annotate lisp/blank-mode.el @ 79873:b774fe15b6e4

*** empty log message ***
author Richard M. Stallman <rms@gnu.org>
date Fri, 18 Jan 2008 03:19:07 +0000
parents a8237408c221
children 37b9cc9f1a31
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
79869
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1 ;;; blank-mode.el --- minor mode to visualise TAB, (HARD) SPACE, NEWLINE
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
2
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
3 ;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
4 ;; Free Software Foundation, Inc.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
5
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
6 ;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
7 ;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
8 ;; Keywords: data, wp
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
9 ;; Version: 8.0
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
10 ;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
11
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
12 ;; This file is part of GNU Emacs.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
13
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
14 ;; GNU Emacs is free software; you can redistribute it and/or modify
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
15 ;; it under the terms of the GNU General Public License as published
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
16 ;; by the Free Software Foundation; either version 3, or (at your
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
17 ;; option) any later version.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
18
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
19 ;; GNU Emacs is distributed in the hope that it will be useful, but
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
20 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
22 ;; General Public License for more details.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
23
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
24 ;; You should have received a copy of the GNU General Public License
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
25 ;; along with GNU Emacs; see the file COPYING. If not, write to the
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
26 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
27 ;; Boston, MA 02110-1301, USA.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
28
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
29 ;;; Commentary:
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
30
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
31 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
32 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
33 ;; Introduction
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
34 ;; ------------
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
35 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
36 ;; This package is a minor mode to visualise blanks (TAB, (HARD) SPACE
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
37 ;; and NEWLINE).
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
38 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
39 ;; blank-mode uses two ways to visualise blanks: faces and display
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
40 ;; table.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
41 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
42 ;; * Faces are used to highlight the background with a color.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
43 ;; blank-mode uses font-lock to highlight blank characters.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
44 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
45 ;; * Display table changes the way a character is displayed, that is,
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
46 ;; it provides a visual mark for characters, for example, at the end
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
47 ;; of line (?\xB6), at SPACEs (?\xB7) and at TABs (?\xBB).
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
48 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
49 ;; The `blank-style' and `blank-chars' variables are used to select
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
50 ;; which way should be used to visualise blanks.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
51 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
52 ;; Note that when blank-mode is turned on, blank-mode saves the
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
53 ;; font-lock state, that is, if font-lock is on or off. And
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
54 ;; blank-mode restores the font-lock state when it is turned off. So,
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
55 ;; if blank-mode is turned on and font-lock is off, blank-mode also
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
56 ;; turns on the font-lock to highlight blanks, but the font-lock will
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
57 ;; be turned off when blank-mode is turned off. Thus, turn on
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
58 ;; font-lock before blank-mode is on, if you want that font-lock
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
59 ;; continues on after blank-mode is turned off.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
60 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
61 ;; When blank-mode is on, it takes care of highlighting some special
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
62 ;; characters over the default mechanism of `nobreak-char-display'
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
63 ;; (which see) and `show-trailing-whitespace' (which see).
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
64 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
65 ;; There are two ways of using blank-mode: local and global.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
66 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
67 ;; * Local blank-mode affects only the current buffer.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
68 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
69 ;; * Global blank-mode affects all current and future buffers. That
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
70 ;; is, if you turn on global blank-mode and then create a new
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
71 ;; buffer, the new buffer will also have blank-mode on. The
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
72 ;; `blank-global-modes' variable controls which major-mode will be
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
73 ;; automagically turned on.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
74 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
75 ;; You can mix the local and global usage without any conflict. But
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
76 ;; local blank-mode has priority over global blank-mode. Blank mode
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
77 ;; is active in a buffer if you have enabled it in that buffer or if
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
78 ;; you have enabled it globally.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
79 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
80 ;; When global and local blank-mode are on:
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
81 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
82 ;; * if local blank-mode is turned off, blank-mode is turned off for
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
83 ;; the current buffer only.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
84 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
85 ;; * if global blank-mode is turned off, blank-mode continues on only
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
86 ;; in the buffers in which local blank-mode is on.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
87 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
88 ;; To use blank-mode, insert in your ~/.emacs:
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
89 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
90 ;; (require 'blank-mode)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
91 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
92 ;; Or autoload at least one of the commands`blank-mode',
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
93 ;; `blank-toggle-options', `global-blank-mode' or
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
94 ;; `global-blank-toggle-options'. For example:
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
95 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
96 ;; (autoload 'blank-mode "blank-mode"
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
97 ;; "Toggle blank visualisation." t)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
98 ;; (autoload 'blank-toggle-options "blank-mode"
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
99 ;; "Toggle local `blank-mode' options." t)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
100 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
101 ;; blank-mode was inspired by:
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
102 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
103 ;; show-whitespace-mode.el Aurelien Tisne <aurelien.tisne@free.fr>
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
104 ;; Simple mode to highlight whitespaces
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
105 ;; (inspired the idea to use font-lock)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
106 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
107 ;; whitespace-mode.el Lawrence Mitchell <wence@gmx.li>
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
108 ;; Major mode for editing Whitespace
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
109 ;; (inspired the idea to use display table)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
110 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
111 ;; visws.el Miles Bader <miles@gnu.org>
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
112 ;; Make whitespace visible
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
113 ;; (handle display table, his code was modified, but the main
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
114 ;; idea was kept)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
115 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
116 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
117 ;; Using blank-mode
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
118 ;; ----------------
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
119 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
120 ;; There is no problem if you mix local and global minor mode usage.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
121 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
122 ;; * LOCAL blank-mode:
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
123 ;; + To toggle blank-mode options locally, type:
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
124 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
125 ;; M-x blank-toggle-options RET
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
126 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
127 ;; + To activate blank-mode locally, type:
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
128 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
129 ;; C-u 1 M-x blank-mode RET
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
130 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
131 ;; + To deactivate blank-mode locally, type:
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
132 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
133 ;; C-u 0 M-x blank-mode RET
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
134 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
135 ;; + To toggle blank-mode locally, type:
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
136 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
137 ;; M-x blank-mode RET
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
138 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
139 ;; * GLOBAL blank-mode:
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
140 ;; + To toggle blank-mode options globally, type:
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
141 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
142 ;; M-x global-blank-toggle-options RET
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
143 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
144 ;; + To activate blank-mode globally, type:
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
145 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
146 ;; C-u 1 M-x global-blank-mode RET
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
147 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
148 ;; + To deactivate blank-mode globally, type:
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
149 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
150 ;; C-u 0 M-x global-blank-mode RET
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
151 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
152 ;; + To toggle blank-mode globally, type:
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
153 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
154 ;; M-x global-blank-mode RET
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
155 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
156 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
157 ;; Hooks
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
158 ;; -----
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
159 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
160 ;; blank-mode has the following hook variables:
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
161 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
162 ;; `blank-mode-hook'
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
163 ;; It is evaluated always when blank-mode is turned on locally.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
164 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
165 ;; `global-blank-mode-hook'
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
166 ;; It is evaluated always when blank-mode is turned on globally.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
167 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
168 ;; `blank-load-hook'
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
169 ;; It is evaluated after blank-mode package is loaded.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
170 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
171 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
172 ;; Options
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
173 ;; -------
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
174 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
175 ;; Below it's shown a brief description of blank-mode options, please,
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
176 ;; see the options declaration in the code for a long documentation.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
177 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
178 ;; `blank-style' Specify the visualisation style.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
179 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
180 ;; `blank-chars' Specify which kind of blank is
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
181 ;; visualised.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
182 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
183 ;; `blank-space-face' Face used to visualise SPACE.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
184 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
185 ;; `blank-hspace-face' Face used to visualise HARD SPACE.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
186 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
187 ;; `blank-tab-face' Face used to visualise TAB.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
188 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
189 ;; `blank-newline-face' Face used to visualise NEWLINE char
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
190 ;; mapping.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
191 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
192 ;; `blank-trailing-face' Face used to visualise trailing
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
193 ;; blanks.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
194 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
195 ;; `blank-line-face' Face used to visualise "long" lines.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
196 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
197 ;; `blank-space-before-tab-face' Face used to visualise SPACEs
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
198 ;; before TAB.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
199 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
200 ;; `blank-space-regexp' Specify SPACE characters regexp.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
201 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
202 ;; `blank-hspace-regexp' Specify HARD SPACE characters regexp.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
203 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
204 ;; `blank-tab-regexp' Specify TAB characters regexp.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
205 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
206 ;; `blank-trailing-regexp' Specify trailing characters regexp.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
207 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
208 ;; `blank-space-before-tab-regexp' Specify SPACEs before TAB
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
209 ;; regexp.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
210 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
211 ;; `blank-line-length' Specify length beyond which the line
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
212 ;; is highlighted.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
213 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
214 ;; `blank-display-mappings' Specify an alist of mappings for
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
215 ;; displaying characters.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
216 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
217 ;; `blank-global-modes' Modes for which global `blank-mode' is
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
218 ;; automagically turned on.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
219 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
220 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
221 ;; Acknowledgements
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
222 ;; ----------------
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
223 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
224 ;; Thanks to Juri Linkov <juri@jurta.org> for suggesting:
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
225 ;; * `define-minor-mode'.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
226 ;; * `global-blank-*' name for global commands.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
227 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
228 ;; Thanks to Robert J. Chassell <bob@gnu.org> for doc fix and testing.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
229 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
230 ;; Thanks to Drew Adams <drew.adams@oracle.com> for toggle commands
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
231 ;; suggestion.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
232 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
233 ;; Thanks to Antti Kaihola <antti.kaihola@linux-aktivaattori.org> for
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
234 ;; helping to fix `find-file-hooks' reference.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
235 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
236 ;; Thanks to Andreas Roehler <andreas.roehler@easy-emacs.de> for
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
237 ;; indicating defface byte-compilation warnings.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
238 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
239 ;; Thanks to TimOCallaghan (EmacsWiki) for the idea about highlight
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
240 ;; "long" lines. See EightyColumnRule (EmacsWiki).
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
241 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
242 ;; Thanks to Yanghui Bian <yanghuibian@gmail.com> for indicating a new
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
243 ;; newline character mapping.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
244 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
245 ;; Thanks to Pete Forman <pete.forman@westgeo.com> for indicating
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
246 ;; whitespace-mode on XEmacs.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
247 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
248 ;; Thanks to Miles Bader <miles@gnu.org> for handling display table via
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
249 ;; visws.el (his code was modified, but the main idea was kept).
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
250 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
251 ;; Thanks to:
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
252 ;; Aurelien Tisne <aurelien.tisne@free.fr> show-whitespace-mode.el
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
253 ;; Lawrence Mitchell <wence@gmx.li> whitespace-mode.el
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
254 ;; Miles Bader <miles@gnu.org> visws.el
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
255 ;; And to all people who contributed with them.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
256 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
257 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
258 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
259
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
260 ;;; code:
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
261
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
262
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
263 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
264 ;;;; User Variables:
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
265
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
266
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
267 ;;; Interface to the command system
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
268
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
269
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
270 (defgroup blank nil
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
271 "Visualise blanks (TAB, (HARD) SPACE and NEWLINE)."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
272 :link '(emacs-library-link :tag "Source Lisp File" "blank-mode.el")
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
273 :version "22.2"
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
274 :group 'wp
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
275 :group 'data)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
276
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
277
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
278 (defcustom blank-style '(mark color)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
279 "*Specify the visualisation style.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
280
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
281 It's a list which element value can be:
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
282
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
283 mark display mappings are visualised.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
284
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
285 color faces are visualised.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
286
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
287 Any other value is ignored.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
288
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
289 If it's nil, don't visualise TABs, (HARD) SPACEs and NEWLINEs.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
290
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
291 See also `blank-display-mappings' for documentation."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
292 :type '(repeat :tag "Style of Blank"
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
293 (choice :tag "Style of Blank"
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
294 (const :tag "Display Table" mark)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
295 (const :tag "Faces" color)))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
296 :group 'blank)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
297
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
298
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
299 (defcustom blank-chars
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
300 '(tabs spaces trailing lines space-before-tab newline)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
301 "*Specify which kind of blank is visualised.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
302
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
303 It's a list which element value can be:
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
304
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
305 trailing trailing blanks are visualised.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
306
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
307 tabs TABs are visualised.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
308
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
309 spaces SPACEs and HARD SPACEs are visualised.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
310
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
311 lines lines whose length is greater than
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
312 `blank-line-length' are highlighted.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
313
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
314 space-before-tab SPACEs before TAB are visualised.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
315
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
316 newline NEWLINEs are visualised.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
317
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
318 Any other element value is ignored.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
319
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
320 If it's nil, don't visualise TABs, (HARD) SPACEs and NEWLINEs.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
321
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
322 Used when `blank-style' has `color' as an element.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
323 If `blank-chars' has `newline' as an element, used when `blank-style'
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
324 has `mark' as an element."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
325 :type '(repeat :tag "Kind of Blank"
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
326 (choice :tag "Kind of Blank"
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
327 (const :tag "Trailing TABs, SPACEs and HARD SPACEs"
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
328 trailing)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
329 (const :tag "SPACEs and HARD SPACEs" spaces)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
330 (const :tag "TABs" tabs)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
331 (const :tag "Lines" lines)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
332 (const :tag "SPACEs before TAB"
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
333 space-before-tab)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
334 (const :tag "NEWLINEs" newline)))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
335 :group 'blank)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
336
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
337
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
338 (defcustom blank-space-face 'blank-space-face
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
339 "*Symbol face used to visualise SPACE.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
340
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
341 Used when `blank-style' has `color' as an element."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
342 :type 'face
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
343 :group 'blank)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
344
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
345
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
346 (defface blank-space-face
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
347 '((((class color) (background dark))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
348 (:background "grey20" :foreground "aquamarine3"))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
349 (((class color) (background light))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
350 (:background "LightYellow" :foreground "aquamarine3"))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
351 (t (:inverse-video t)))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
352 "Face used to visualise SPACE."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
353 :group 'blank)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
354
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
355
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
356 (defcustom blank-hspace-face 'blank-hspace-face
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
357 "*Symbol face used to visualise HARD SPACE.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
358
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
359 Used when `blank-style' has `color' as an element."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
360 :type 'face
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
361 :group 'blank)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
362
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
363
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
364 (defface blank-hspace-face ; 'nobreak-space
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
365 '((((class color) (background dark))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
366 (:background "grey24" :foreground "aquamarine3"))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
367 (((class color) (background light))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
368 (:background "LemonChiffon3" :foreground "aquamarine3"))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
369 (t (:inverse-video t)))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
370 "Face used to visualise HARD SPACE."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
371 :group 'blank)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
372
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
373
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
374 (defcustom blank-tab-face 'blank-tab-face
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
375 "*Symbol face used to visualise TAB.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
376
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
377 Used when `blank-style' has `color' as an element."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
378 :type 'face
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
379 :group 'blank)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
380
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
381
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
382 (defface blank-tab-face
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
383 '((((class color) (background dark))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
384 (:background "grey22" :foreground "aquamarine3"))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
385 (((class color) (background light))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
386 (:background "beige" :foreground "aquamarine3"))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
387 (t (:inverse-video t)))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
388 "Face used to visualise TAB."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
389 :group 'blank)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
390
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
391
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
392 (defcustom blank-newline-face 'blank-newline-face
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
393 "*Symbol face used to visualise NEWLINE char mapping.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
394
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
395 See `blank-display-mappings'.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
396
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
397 Used when `blank-style' has `mark' and `color' as elements
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
398 and `blank-chars' has `newline' as an element."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
399 :type 'face
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
400 :group 'blank)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
401
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
402
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
403 (defface blank-newline-face
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
404 '((((class color) (background dark))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
405 (:background "grey26" :foreground "aquamarine3" :bold t))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
406 (((class color) (background light))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
407 (:background "linen" :foreground "aquamarine3" :bold t))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
408 (t (:bold t :underline t)))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
409 "Face used to visualise NEWLINE char mapping.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
410
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
411 See `blank-display-mappings'."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
412 :group 'blank)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
413
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
414
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
415 (defcustom blank-trailing-face 'blank-trailing-face
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
416 "*Symbol face used to visualise traling blanks.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
417
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
418 Used when `blank-style' has `color' as an element."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
419 :type 'face
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
420 :group 'blank)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
421
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
422
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
423 (defface blank-trailing-face ; 'trailing-whitespace
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
424 '((((class mono)) (:inverse-video t :bold t :underline t))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
425 (t (:background "red1" :foreground "yellow" :bold t)))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
426 "Face used to visualise trailing blanks."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
427 :group 'blank)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
428
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
429
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
430 (defcustom blank-line-face 'blank-line-face
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
431 "*Symbol face used to visualise \"long\" lines.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
432
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
433 See `blank-line-legnth'.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
434
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
435 Used when `blank-style' has `color' as an element."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
436 :type 'face
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
437 :group 'blank)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
438
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
439
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
440 (defface blank-line-face
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
441 '((((class mono)) (:inverse-video t :bold t :underline t))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
442 (t (:background "gray20" :foreground "violet")))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
443 "Face used to visualise \"long\" lines.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
444
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
445 See `blank-line-length'."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
446 :group 'blank)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
447
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
448
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
449 (defcustom blank-space-before-tab-face 'blank-space-before-tab-face
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
450 "*Symbol face used to visualise SPACEs before TAB.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
451
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
452 Used when `blank-style' has `color' as an element."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
453 :type 'face
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
454 :group 'blank)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
455
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
456
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
457 (defface blank-space-before-tab-face
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
458 '((((class mono)) (:inverse-video t :bold t :underline t))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
459 (t (:background "DarkOrange" :foreground "firebrick")))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
460 "Face used to visualise SPACEs before TAB."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
461 :group 'blank)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
462
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
463
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
464 (defcustom blank-hspace-regexp
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
465 "\\(\\(\xA0\\|\x8A0\\|\x920\\|\xE20\\|\xF20\\)+\\)"
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
466 "*Specify HARD SPACE characters regexp.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
467
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
468 If you're using `mule' package, it may exist other characters besides:
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
469
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
470 \"\\xA0\" \"\\x8A0\" \"\\x920\" \"\\xE20\" \"\\xF20\"
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
471
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
472 that it should be considered HARD SPACE.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
473
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
474 Here are some examples:
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
475
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
476 \"\\\\(^\\xA0+\\\\)\" \
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
477 visualise only leading HARD SPACEs.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
478 \"\\\\(\\xA0+$\\\\)\" \
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
479 visualise only trailing HARD SPACEs.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
480 \"\\\\(^\\xA0+\\\\|\\xA0+$\\\\)\" \
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
481 visualise leading and/or trailing HARD SPACEs.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
482 \"\\t\\\\(\\xA0+\\\\)\\t\" \
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
483 visualise only HARD SPACEs between TABs.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
484
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
485 NOTE: Enclose always by \\\\( and \\\\) the elements to highlight.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
486 Use exactly one pair of enclosing \\\\( and \\\\).
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
487
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
488 Used when `blank-style' has `color' as an element, and
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
489 `blank-chars' has `spaces' as an element."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
490 :type '(regexp :tag "HARD SPACE Chars")
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
491 :group 'blank)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
492
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
493
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
494 (defcustom blank-space-regexp "\\( +\\)"
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
495 "*Specify SPACE characters regexp.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
496
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
497 If you're using `mule' package, it may exist other characters
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
498 besides \" \" that it should be considered SPACE.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
499
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
500 Here are some examples:
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
501
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
502 \"\\\\(^ +\\\\)\" visualise only leading SPACEs.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
503 \"\\\\( +$\\\\)\" visualise only trailing SPACEs.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
504 \"\\\\(^ +\\\\| +$\\\\)\" \
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
505 visualise leading and/or trailing SPACEs.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
506 \"\\t\\\\( +\\\\)\\t\" visualise only SPACEs between TABs.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
507
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
508 NOTE: Enclose always by \\\\( and \\\\) the elements to highlight.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
509 Use exactly one pair of enclosing \\\\( and \\\\).
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
510
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
511 Used when `blank-style' has `color' as an element, and
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
512 `blank-chars' has `spaces' as an element."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
513 :type '(regexp :tag "SPACE Chars")
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
514 :group 'blank)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
515
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
516
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
517 (defcustom blank-tab-regexp "\\(\t+\\)"
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
518 "*Specify TAB characters regexp.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
519
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
520 If you're using `mule' package, it may exist other characters
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
521 besides \"\\t\" that it should be considered TAB.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
522
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
523 Here are some examples:
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
524
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
525 \"\\\\(^\\t+\\\\)\" visualise only leading TABs.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
526 \"\\\\(\\t+$\\\\)\" visualise only trailing TABs.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
527 \"\\\\(^\\t+\\\\|\\t+$\\\\)\" \
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
528 visualise leading and/or trailing TABs.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
529 \" \\\\(\\t+\\\\) \" visualise only TABs between SPACEs.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
530
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
531 NOTE: Enclose always by \\\\( and \\\\) the elements to highlight.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
532 Use exactly one pair of enclosing \\\\( and \\\\).
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
533
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
534 Used when `blank-style' has `color' as an element, and
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
535 `blank-chars' has `tabs' as an element."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
536 :type '(regexp :tag "TAB Chars")
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
537 :group 'blank)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
538
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
539
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
540 (defcustom blank-trailing-regexp
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
541 "\t\\| \\|\xA0\\|\x8A0\\|\x920\\|\xE20\\|\xF20"
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
542 "*Specify trailing characters regexp.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
543
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
544 If you're using `mule' package, it may exist other characters besides:
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
545
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
546 \" \" \"\\t\" \"\\xA0\" \"\\x8A0\" \"\\x920\" \"\\xE20\" \
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
547 \"\\xF20\"
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
548
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
549 that it should be considered blank.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
550
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
551 NOTE: DOES NOT enclose by \\\\( and \\\\) the elements to highlight.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
552 `blank-mode' surrounds this regexp by \"\\\\(\\\\(\" and
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
553 \"\\\\)+\\\\)$\".
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
554
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
555 Used when `blank-style' has `color' as an element, and
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
556 `blank-chars' has `trailing' as an element."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
557 :type '(regexp :tag "Trailing Chars")
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
558 :group 'blank)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
559
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
560
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
561 (defcustom blank-space-before-tab-regexp "\\( +\\)\t"
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
562 "*Specify SPACEs before TAB regexp.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
563
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
564 If you're using `mule' package, it may exist other characters besides:
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
565
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
566 \" \" \"\\t\" \"\\xA0\" \"\\x8A0\" \"\\x920\" \"\\xE20\" \
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
567 \"\\xF20\"
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
568
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
569 that it should be considered blank.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
570
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
571 Used when `blank-style' has `color' as an element, and
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
572 `blank-chars' has `space-before-tab' as an element."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
573 :type '(regexp :tag "SPACEs Before TAB")
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
574 :group 'blank)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
575
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
576
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
577 (defcustom blank-line-length 80
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
578 "*Specify length beyond which the line is highlighted.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
579
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
580 Used when `blank-style' has `color' as an element, and
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
581 `blank-chars' has `lines' as an element."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
582 :type '(integer :tag "Line Length")
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
583 :group 'blank)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
584
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
585
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
586 ;; Hacked from `visible-whitespace-mappings' in visws.el
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
587 (defcustom blank-display-mappings
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
588 ;; Due to limitations of glyph representation, the char code can not
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
589 ;; be above ?\x1FFFF. Probably, this will be fixed after Emacs
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
590 ;; unicode merging.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
591 '(
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
592 (?\ [?\xB7] [?.]) ; space - centered dot
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
593 (?\xA0 [?\xA4] [?_]) ; hard space - currency
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
594 (?\x8A0 [?\x8A4] [?_]) ; hard space - currency
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
595 (?\x920 [?\x924] [?_]) ; hard space - currency
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
596 (?\xE20 [?\xE24] [?_]) ; hard space - currency
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
597 (?\xF20 [?\xF24] [?_]) ; hard space - currency
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
598 ;; NEWLINE is displayed using the face `blank-newline-face'
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
599 (?\n [?$ ?\n]) ; end-of-line - dollar sign
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
600 ;; (?\n [?\u21B5 ?\n] [?$ ?\n]) ; end-of-line - downwards arrow
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
601 ;; (?\n [?\xB6 ?\n] [?$ ?\n]) ; end-of-line - pilcrow
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
602 ;; (?\n [?\x8AF ?\n] [?$ ?\n]) ; end-of-line - overscore
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
603 ;; (?\n [?\x8AC ?\n] [?$ ?\n]) ; end-of-line - negation
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
604 ;; (?\n [?\x8B0 ?\n] [?$ ?\n]) ; end-of-line - grade
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
605 ;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
606 ;; WARNING: the mapping below has a problem.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
607 ;; When a TAB occupies exactly one column, it will display the
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
608 ;; character ?\xBB at that column followed by a TAB which goes to
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
609 ;; the next TAB column.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
610 ;; If this is a problem for you, please, comment the line below.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
611 (?\t [?\xBB ?\t] [?\\ ?\t]) ; tab - left quote mark
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
612 )
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
613 "*Specify an alist of mappings for displaying characters.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
614
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
615 Each element has the following form:
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
616
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
617 (CHAR VECTOR...)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
618
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
619 Where:
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
620
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
621 CHAR is the character to be mapped.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
622
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
623 VECTOR is a vector of characters to be displayed in place of CHAR.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
624 The first display vector that can be displayed is used;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
625 if no display vector for a mapping can be displayed, then
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
626 that character is displayed unmodified.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
627
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
628 The NEWLINE character is displayed using the face given by
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
629 `blank-newline-face' variable. The characters in the vector to be
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
630 displayed will not have applied this face if the character code is
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
631 above #x1FFFF.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
632
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
633 Used when `blank-style' has `mark' as an element."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
634 :type '(repeat
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
635 (list :tag "Character Mapping"
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
636 (character :tag "Char")
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
637 (repeat :inline t :tag "Vector List"
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
638 (vector :tag ""
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
639 (repeat :inline t
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
640 :tag "Vector Characters"
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
641 (character :tag "Char"))))))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
642 :group 'blank)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
643
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
644
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
645 (defcustom blank-global-modes t
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
646 "*Modes for which global `blank-mode' is automagically turned on.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
647
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
648 Global `blank-mode' is controlled by the command `global-blank-mode'.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
649
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
650 If nil, means no modes have `blank-mode' automatically turned on.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
651 If t, all modes that support `blank-mode' have it automatically
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
652 turned on.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
653 If a list, it should be a list of `major-mode' symbol names for
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
654 which `blank-mode' should be automatically turned on. The sense
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
655 of the list is negated if it begins with `not'. For example:
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
656
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
657 (c-mode c++-mode)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
658
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
659 means that `blank-mode' is turned on for buffers in C and C++
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
660 modes only."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
661 :type '(choice (const :tag "none" nil)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
662 (const :tag "all" t)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
663 (set :menu-tag "mode specific" :tag "modes"
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
664 :value (not)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
665 (const :tag "Except" not)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
666 (repeat :inline t
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
667 (symbol :tag "mode"))))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
668 :group 'blank)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
669
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
670
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
671 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
672 ;;;; User commands - Local mode
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
673
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
674
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
675 ;;;###autoload
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
676 (define-minor-mode blank-mode
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
677 "Toggle blank minor mode visualisation (bl on modeline).
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
678
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
679 If ARG is null, toggle blank visualisation.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
680 If ARG is a number and is greater than zero, turn on
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
681 visualisation; otherwise, turn off visualisation.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
682 Only useful with a windowing system."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
683 :lighter " bl"
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
684 :init-value nil
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
685 :global nil
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
686 :group 'blank
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
687 (cond
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
688 (noninteractive ; running a batch job
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
689 (setq blank-mode nil))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
690 (blank-mode ; blank-mode on
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
691 (blank-turn-on))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
692 (t ; blank-mode off
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
693 (blank-turn-off))))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
694
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
695
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
696 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
697 ;;;; User commands - Global mode
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
698
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
699
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
700 (define-minor-mode global-blank-mode
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
701 "Toggle blank global minor mode visualisation (BL on modeline).
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
702
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
703 If ARG is null, toggle blank visualisation.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
704 If ARG is a number and is greater than zero, turn on
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
705 visualisation; otherwise, turn off visualisation.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
706 Only useful with a windowing system."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
707 :lighter " BL"
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
708 :init-value nil
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
709 :global t
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
710 :group 'blank
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
711 (cond
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
712 (noninteractive ; running a batch job
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
713 (setq global-blank-mode nil))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
714 (global-blank-mode ; global-blank-mode on
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
715 (save-excursion
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
716 (if (boundp 'find-file-hook)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
717 (add-hook 'find-file-hook 'blank-turn-on-if-enabled t)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
718 (add-hook 'find-file-hooks 'blank-turn-on-if-enabled t))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
719 (dolist (buffer (buffer-list)) ; adjust all local mode
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
720 (set-buffer buffer)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
721 (unless blank-mode
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
722 (blank-turn-on-if-enabled)))))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
723 (t ; global-blank-mode off
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
724 (save-excursion
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
725 (if (boundp 'find-file-hook)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
726 (remove-hook 'find-file-hook 'blank-turn-on-if-enabled)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
727 (remove-hook 'find-file-hooks 'blank-turn-on-if-enabled))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
728 (dolist (buffer (buffer-list)) ; adjust all local mode
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
729 (set-buffer buffer)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
730 (unless blank-mode
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
731 (blank-turn-off)))))))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
732
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
733
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
734 (defun blank-turn-on-if-enabled ()
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
735 (when (cond
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
736 ((eq blank-global-modes t))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
737 ((listp blank-global-modes)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
738 (if (eq (car-safe blank-global-modes) 'not)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
739 (not (memq major-mode (cdr blank-global-modes)))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
740 (memq major-mode blank-global-modes)))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
741 (t nil))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
742 (let (inhibit-quit)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
743 ;; Don't turn on blank mode if...
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
744 (or
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
745 ;; ...we don't have a display (we're running a batch job)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
746 noninteractive
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
747 ;; ...or if the buffer is invisible (name starts with a space)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
748 (eq (aref (buffer-name) 0) ?\ )
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
749 ;; ...or if the buffer is temporary (name starts with *)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
750 (and (eq (aref (buffer-name) 0) ?*)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
751 ;; except the scratch buffer.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
752 (not (string= (buffer-name) "*scratch*")))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
753 ;; Otherwise, turn on blank mode.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
754 (blank-turn-on)))))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
755
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
756
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
757 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
758 ;;;; User commands - Toggle
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
759
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
760
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
761 (defconst blank-chars-value-list
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
762 '(tabs
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
763 spaces
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
764 trailing
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
765 space-before-tab
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
766 lines
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
767 newline
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
768 )
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
769 "List of valid `blank-chars' value.")
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
770
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
771
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
772 (defconst blank-style-value-list
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
773 '(color
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
774 mark
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
775 )
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
776 "List of valid `blank-style' value.")
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
777
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
778
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
779 (defconst blank-toggle-option-alist
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
780 '((?t . tabs)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
781 (?s . spaces)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
782 (?r . trailing)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
783 (?b . space-before-tab)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
784 (?l . lines)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
785 (?n . newline)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
786 (?c . color)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
787 (?m . mark)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
788 (?x . blank-chars)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
789 (?z . blank-style)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
790 )
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
791 "Alist of toggle options.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
792
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
793 Each element has the form:
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
794
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
795 (CHAR . SYMBOL)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
796
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
797 Where:
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
798
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
799 CHAR is a char which the user will have to type.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
800
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
801 SYMBOL is a valid symbol associated with CHAR.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
802 See `blank-chars-value-list' and `blank-style-value-list'.")
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
803
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
804
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
805 (defvar blank-active-chars nil
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
806 "Used to save locally `blank-chars' value.")
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
807 (make-variable-buffer-local 'blank-active-chars)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
808
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
809 (defvar blank-active-style nil
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
810 "Used to save locally `blank-style' value.")
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
811 (make-variable-buffer-local 'blank-active-style)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
812
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
813
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
814 ;;;###autoload
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
815 (defun blank-toggle-options (arg)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
816 "Toggle local `blank-mode' options.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
817
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
818 If local blank-mode is off, toggle the option given by ARG and
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
819 turn on local blank-mode.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
820
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
821 If local blank-mode is on, toggle the option given by ARG and
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
822 restart local blank-mode.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
823
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
824 Interactively, it reads one of the following chars:
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
825
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
826 CHAR MEANING
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
827 t toggle TAB visualisation
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
828 s toggle SPACE and HARD SPACE visualisation
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
829 r toggle trailing blanks visualisation
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
830 b toggle SPACEs before TAB visualisation
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
831 l toggle \"long lines\" visualisation
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
832 n toggle NEWLINE visualisation
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
833 c toggle color faces
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
834 m toggle visual mark
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
835 x restore `blank-chars' value
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
836 z restore `blank-style' value
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
837 ? display brief help
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
838
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
839 Non-interactively, ARG should be a symbol or a list of symbol.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
840 The valid symbols are:
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
841
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
842 tabs toggle TAB visualisation
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
843 spaces toggle SPACE and HARD SPACE visualisation
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
844 trailing toggle trailing blanks visualisation
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
845 space-before-tab toggle SPACEs before TAB visualisation
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
846 lines toggle \"long lines\" visualisation
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
847 newline toggle NEWLINE visualisation
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
848 color toggle color faces
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
849 mark toggle visual mark
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
850 blank-chars restore `blank-chars' value
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
851 blank-style restore `blank-style' value
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
852
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
853 Only useful with a windowing system."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
854 (interactive (blank-interactive-char t))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
855 (let ((blank-chars
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
856 (blank-toggle-list t arg blank-active-chars blank-chars
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
857 'blank-chars blank-chars-value-list))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
858 (blank-style
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
859 (blank-toggle-list t arg blank-active-style blank-style
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
860 'blank-style blank-style-value-list)))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
861 (blank-mode 0)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
862 (blank-mode 1)))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
863
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
864
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
865 (defvar blank-toggle-chars nil
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
866 "Used to toggle the global `blank-chars' value.")
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
867 (defvar blank-toggle-style nil
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
868 "Used to toggle the global `blank-style' value.")
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
869
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
870
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
871 ;;;###autoload
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
872 (defun global-blank-toggle-options (arg)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
873 "Toggle global `blank-mode' options.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
874
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
875 If global blank-mode is off, toggle the option given by ARG and
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
876 turn on global blank-mode.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
877
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
878 If global blank-mode is on, toggle the option given by ARG and
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
879 restart global blank-mode.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
880
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
881 Interactively, it reads one of the following chars:
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
882
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
883 CHAR MEANING
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
884 t toggle TAB visualisation
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
885 s toggle SPACE and HARD SPACE visualisation
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
886 r toggle trailing blanks visualisation
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
887 b toggle SPACEs before TAB visualisation
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
888 l toggle \"long lines\" visualisation
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
889 n toggle NEWLINE visualisation
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
890 c toggle color faces
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
891 m toggle visual mark
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
892 x restore `blank-chars' value
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
893 z restore `blank-style' value
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
894 ? display brief help
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
895
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
896 Non-interactively, ARG should be a symbol or a list of symbol.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
897 The valid symbols are:
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
898
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
899 tabs toggle TAB visualisation
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
900 spaces toggle SPACE and HARD SPACE visualisation
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
901 trailing toggle trailing blanks visualisation
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
902 space-before-tab toggle SPACEs before TAB visualisation
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
903 lines toggle \"long lines\" visualisation
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
904 newline toggle NEWLINE visualisation
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
905 color toggle color faces
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
906 mark toggle visual mark
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
907 blank-chars restore `blank-chars' value
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
908 blank-style restore `blank-style' value
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
909
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
910 Only useful with a windowing system."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
911 (interactive (blank-interactive-char nil))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
912 (let ((blank-chars
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
913 (blank-toggle-list nil arg blank-toggle-chars blank-chars
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
914 'blank-chars blank-chars-value-list))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
915 (blank-style
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
916 (blank-toggle-list nil arg blank-toggle-style blank-style
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
917 'blank-style blank-style-value-list)))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
918 (setq blank-toggle-chars blank-chars
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
919 blank-toggle-style blank-style)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
920 (global-blank-mode 0)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
921 (global-blank-mode 1)))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
922
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
923
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
924 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
925 ;;;; Internal functions
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
926
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
927
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
928 (defvar blank-font-lock-mode nil
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
929 "Used to remember whether a buffer had font lock mode on or not.")
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
930 (make-variable-buffer-local 'blank-font-lock-mode)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
931
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
932 (defvar blank-font-lock nil
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
933 "Used to remember whether a buffer initially had font lock on or not.")
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
934 (make-variable-buffer-local 'blank-font-lock)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
935
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
936 (defvar blank-font-lock-keywords nil
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
937 "Used to save locally `font-lock-keywords' value.")
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
938 (make-variable-buffer-local 'blank-font-lock-keywords)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
939
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
940
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
941 (defconst blank-help-text
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
942 "\
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
943 blank-mode toggle options:
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
944
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
945 [] t - toggle TAB visualisation
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
946 [] s - toggle SPACE and HARD SPACE visualisation
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
947 [] r - toggle trailing blanks visualisation
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
948 [] b - toggle SPACEs before TAB visualisation
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
949 [] l - toggle \"long lines\" visualisation
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
950 [] n - toggle NEWLINE visualisation
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
951
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
952 [] c - toggle color faces
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
953 [] m - toggle visual mark
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
954
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
955 x - restore `blank-chars' value
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
956 z - restore `blank-style' value
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
957
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
958 ? - display this text\n\n"
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
959 "Text for blank toggle options.")
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
960
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
961
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
962 (defconst blank-help-buffer-name "*Blank Toggle Options*"
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
963 "The buffer name for blank toggle options.")
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
964
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
965
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
966 (defun blank-insert-option-mark (the-list the-value)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
967 "Insert the option mark ('X' or ' ') in toggle options buffer."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
968 (forward-line 1)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
969 (dolist (sym the-list)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
970 (forward-line 1)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
971 (forward-char 2)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
972 (insert (if (memq sym the-value) "X" " "))))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
973
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
974
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
975 (defun blank-help-on (chars style)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
976 "Display the blank toggle options."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
977 (unless (get-buffer blank-help-buffer-name)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
978 (delete-other-windows)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
979 (let ((buffer (get-buffer-create blank-help-buffer-name)))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
980 (save-excursion
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
981 (set-buffer buffer)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
982 (erase-buffer)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
983 (insert blank-help-text)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
984 (goto-char (point-min))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
985 (blank-insert-option-mark blank-chars-value-list chars)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
986 (blank-insert-option-mark blank-style-value-list style)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
987 (goto-char (point-min))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
988 (set-buffer-modified-p nil)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
989 (let ((size (- (window-height)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
990 (max window-min-height
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
991 (1+ (count-lines (point-min) (point-max)))))))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
992 (when (<= size 0)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
993 (kill-buffer buffer)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
994 (error "Frame height is too small; \
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
995 can't split window to display blank toggle options"))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
996 (set-window-buffer (split-window nil size) buffer))))))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
997
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
998
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
999 (defun blank-help-off ()
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1000 "Remove the buffer and window of the blank toggle options."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1001 (let ((buffer (get-buffer blank-help-buffer-name)))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1002 (when buffer
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1003 (delete-windows-on buffer)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1004 (kill-buffer buffer))))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1005
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1006
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1007 (defun blank-interactive-char (local-p)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1008 "Interactive function to read a char and return a symbol.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1009
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1010 If LOCAL-P is non-nil, it uses a local context; otherwise, it
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1011 uses a global context.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1012
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1013 It reads one of the following chars:
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1014
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1015 CHAR MEANING
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1016 t toggle TAB visualisation
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1017 s toggle SPACE and HARD SPACE visualisation
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1018 r toggle trailing blanks visualisation
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1019 b toggle SPACEs before TAB visualisation
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1020 l toggle \"long lines\" visualisation
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1021 n toggle NEWLINE visualisation
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1022 c toggle color faces
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1023 m toggle visual mark
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1024 x restore `blank-chars' value
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1025 z restore `blank-style' value
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1026 ? display brief help
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1027
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1028 See also `blank-toggle-option-alist'."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1029 (let* ((is-off (not (if local-p blank-mode global-blank-mode)))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1030 (chars (cond (is-off blank-chars) ; use default value
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1031 (local-p blank-active-chars)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1032 (t blank-toggle-chars)))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1033 (style (cond (is-off blank-style) ; use default value
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1034 (local-p blank-active-style)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1035 (t blank-toggle-style)))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1036 (prompt
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1037 (format "Blank Toggle %s (type ? for further options)-"
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1038 (if local-p "Local" "Global")))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1039 ch sym)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1040 ;; read a valid option and get the corresponding symbol
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1041 (save-window-excursion
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1042 (condition-case data
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1043 (progn
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1044 (while
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1045 ;; while condition
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1046 (progn
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1047 (setq ch (read-char prompt))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1048 (not
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1049 (setq sym
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1050 (cdr (assq ch blank-toggle-option-alist)))))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1051 ;; while body
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1052 (if (eq ch ?\?)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1053 (blank-help-on chars style)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1054 (ding)))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1055 (blank-help-off)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1056 (message " ")) ; clean echo area
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1057 ;; handler
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1058 ((quit error)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1059 (blank-help-off)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1060 (error (error-message-string data)))))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1061 (list sym))) ; return the apropriate symbol
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1062
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1063
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1064 (defun blank-toggle-list (local-p arg the-list default-list
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1065 sym-restore sym-list)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1066 "Toggle options in THE-LIST based on list ARG.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1067
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1068 If LOCAL-P is non-nil, it uses a local context; otherwise, it
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1069 uses a global context.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1070
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1071 ARG is a list of options to be toggled.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1072
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1073 THE-LIST is a list of options. This list will be toggled and the
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1074 resultant list will be returned.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1075
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1076 DEFAULT-LIST is the default list of options. It is used to
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1077 restore the options in THE-LIST.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1078
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1079 SYM-RESTORE is the symbol which indicates to restore the options
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1080 in THE-LIST.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1081
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1082 SYM-LIST is a list of valid options, used to check if the ARG's
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1083 options are valid."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1084 (unless (if local-p blank-mode global-blank-mode)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1085 (setq the-list default-list))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1086 (setq the-list (copy-sequence the-list)) ; keep original list
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1087 (dolist (sym (if (listp arg) arg (list arg)))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1088 (cond
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1089 ;; restore default values
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1090 ((eq sym sym-restore)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1091 (setq the-list default-list))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1092 ;; toggle valid values
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1093 ((memq sym sym-list)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1094 (setq the-list (if (memq sym the-list)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1095 (delq sym the-list)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1096 (cons sym the-list))))))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1097 the-list)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1098
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1099
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1100 (defun blank-turn-on ()
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1101 "Turn on blank visualisation."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1102 (setq blank-active-style (if (listp blank-style)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1103 blank-style
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1104 (list blank-style)))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1105 (setq blank-active-chars (if (listp blank-chars)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1106 blank-chars
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1107 (list blank-chars)))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1108 (and (memq 'color blank-active-style)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1109 (blank-color-on))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1110 (and (memq 'mark blank-active-style)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1111 (blank-display-char-on)))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1112
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1113
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1114 (defun blank-turn-off ()
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1115 "Turn off blank visualisation."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1116 (and (memq 'color blank-active-style)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1117 (blank-color-off))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1118 (and (memq 'mark blank-active-style)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1119 (blank-display-char-off)))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1120
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1121
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1122 (defun blank-color-on ()
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1123 "Turn on color visualisation."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1124 (when blank-active-chars
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1125 (unless blank-font-lock
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1126 (setq blank-font-lock t
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1127 blank-font-lock-keywords
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1128 (copy-sequence font-lock-keywords)))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1129 ;; turn off font lock
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1130 (setq blank-font-lock-mode font-lock-mode)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1131 (font-lock-mode 0)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1132 ;; add blank-mode color into font lock
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1133 (when (memq 'spaces blank-active-chars)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1134 (font-lock-add-keywords
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1135 nil
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1136 (list
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1137 ;; Show SPACEs
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1138 (list blank-space-regexp 1 blank-space-face t)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1139 ;; Show HARD SPACEs
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1140 (list blank-hspace-regexp 1 blank-hspace-face t))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1141 t))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1142 (when (memq 'tabs blank-active-chars)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1143 (font-lock-add-keywords
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1144 nil
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1145 (list
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1146 ;; Show TABs
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1147 (list blank-tab-regexp 1 blank-tab-face t))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1148 t))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1149 (when (memq 'trailing blank-active-chars)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1150 (font-lock-add-keywords
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1151 nil
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1152 (list
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1153 ;; Show trailing blanks
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1154 (list (concat "\\(\\(" blank-trailing-regexp "\\)+\\)$")
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1155 1 blank-trailing-face t))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1156 t))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1157 (when (memq 'lines blank-active-chars)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1158 (font-lock-add-keywords
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1159 nil
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1160 (list
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1161 ;; Show "long" lines
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1162 (list (concat "^\\(.\\{" (int-to-string blank-line-length)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1163 ",\\}\\)$")
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1164 1 blank-line-face t))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1165 t))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1166 (when (memq 'space-before-tab blank-active-chars)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1167 (font-lock-add-keywords
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1168 nil
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1169 (list
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1170 ;; Show SPACEs before TAB
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1171 (list blank-space-before-tab-regexp
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1172 1 blank-space-before-tab-face t))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1173 t))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1174 ;; now turn on font lock and highlight blanks
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1175 (font-lock-mode 1)))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1176
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1177
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1178 (defun blank-color-off ()
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1179 "Turn off color visualisation."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1180 (when blank-active-chars
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1181 (when blank-font-lock
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1182 (setq blank-font-lock nil
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1183 font-lock-keywords blank-font-lock-keywords))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1184 ;; turn off font lock
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1185 (font-lock-mode 0)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1186 ;; restore original font lock state
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1187 (font-lock-mode blank-font-lock-mode)))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1188
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1189
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1190 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1191 ;;;; Hacked from visws.el (Miles Bader <miles@gnu.org>)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1192
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1193
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1194 (defvar blank-display-table nil
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1195 "Used to save a local display table.")
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1196 (make-variable-buffer-local 'blank-display-table)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1197
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1198 (defvar blank-display-table-was-local nil
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1199 "Used to remember whether a buffer initially had a local display table or not.")
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1200 (make-variable-buffer-local 'blank-display-table-was-local)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1201
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1202
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1203 (defsubst blank-char-valid-p (char)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1204 ;; This check should be improved!!!
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1205 (or (< char 256)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1206 (char-valid-p char)))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1207
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1208
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1209 (defun blank-legal-display-vector-p (vec)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1210 "Return true if every character in vector VEC can be displayed."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1211 (let ((i (length vec)))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1212 (when (> i 0)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1213 (while (and (>= (setq i (1- i)) 0)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1214 (blank-char-valid-p (aref vec i))))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1215 (< i 0))))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1216
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1217
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1218 (defun blank-display-char-on ()
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1219 "Turn on character display mapping."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1220 (when blank-display-mappings
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1221 (let (vecs vec)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1222 ;; Remember whether a buffer has a local display table.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1223 (unless blank-display-table-was-local
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1224 (setq blank-display-table-was-local t
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1225 blank-display-table
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1226 (copy-sequence buffer-display-table)))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1227 (unless buffer-display-table
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1228 (setq buffer-display-table (make-display-table)))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1229 (dolist (entry blank-display-mappings)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1230 (setq vecs (cdr entry))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1231 ;; Get a displayable mapping.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1232 (while (and vecs
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1233 (not (blank-legal-display-vector-p (car vecs))))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1234 (setq vecs (cdr vecs)))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1235 ;; Display a valid mapping.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1236 (when vecs
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1237 (setq vec (copy-sequence (car vecs)))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1238 (cond
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1239 ;; Any char except newline
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1240 ((not (eq (car entry) ?\n))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1241 (aset buffer-display-table (car entry) vec))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1242 ;; Newline char - display it
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1243 ((memq 'newline blank-active-chars)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1244 ;; Only insert face bits on NEWLINE char mapping to avoid
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1245 ;; obstruction of other faces like TABs and (HARD) SPACEs
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1246 ;; faces, font-lock faces, etc.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1247 (when (memq 'color blank-active-style)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1248 (dotimes (i (length vec))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1249 ;; Due to limitations of glyph representation, the char
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1250 ;; code can not be above ?\x1FFFF. Probably, this will
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1251 ;; be fixed after Emacs unicode merging.
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1252 (or (eq (aref vec i) ?\n)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1253 (> (aref vec i) #x1FFFF)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1254 (aset vec i (make-glyph-code (aref vec i)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1255 blank-newline-face)))))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1256 ;; Display mapping
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1257 (aset buffer-display-table (car entry) vec))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1258 ;; Newline char - don't display it
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1259 (t
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1260 ;; Do nothing
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1261 )))))))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1262
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1263
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1264 (defun blank-display-char-off ()
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1265 "Turn off character display mapping."
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1266 (and blank-display-mappings
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1267 blank-display-table-was-local
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1268 (setq blank-display-table-was-local nil
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1269 buffer-display-table blank-display-table)))
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1270
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1271
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1272 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1273
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1274
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1275 (provide 'blank-mode)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1276
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1277
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1278 (run-hooks 'blank-load-hook)
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1279
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1280
a8237408c221 New file: blank-mode.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1281 ;;; blank-mode.el ends here