Mercurial > emacs
comparison lisp/blank-mode.el @ 79881:9e4a405ed866
(blank-style, blank-chars, blank-hspace-regexp, blank-space-regexp,
blank-tab-regexp, blank-trailing-regexp, blank-space-before-tab-regexp,
blank-global-modes, blank-mode, global-blank-mode): Doc fixes.
(blank, blank-space-face, blank-hspace-face, blank-tab-face, blank-newline-face,
blank-trailing-face, blank-line-face, blank-space-before-tab-face,
blank-display-mappings, blank-chars-value-list, blank-style-value-list,
blank-toggle-options, global-blank-toggle-options, blank-help-text,
blank-interactive-char, blank-turn-on, blank-turn-off, blank-color-on,
blank-color-off): Fix typos in docstrings.
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Sat, 19 Jan 2008 15:08:22 +0000 |
parents | 37b9cc9f1a31 |
children | f549244775de |
comparison
equal
deleted
inserted
replaced
79880:2be6cb49457d | 79881:9e4a405ed866 |
---|---|
1 ;;; blank-mode.el --- minor mode to visualise TAB, (HARD) SPACE, NEWLINE | 1 ;;; blank-mode.el --- minor mode to visualize TAB, (HARD) SPACE, NEWLINE |
2 | 2 |
3 ;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 | 3 ;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 |
4 ;; Free Software Foundation, Inc. | 4 ;; Free Software Foundation, Inc. |
5 | 5 |
6 ;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br> | 6 ;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br> |
31 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 31 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
32 ;; | 32 ;; |
33 ;; Introduction | 33 ;; Introduction |
34 ;; ------------ | 34 ;; ------------ |
35 ;; | 35 ;; |
36 ;; This package is a minor mode to visualise blanks (TAB, (HARD) SPACE | 36 ;; This package is a minor mode to visualize blanks (TAB, (HARD) SPACE |
37 ;; and NEWLINE). | 37 ;; and NEWLINE). |
38 ;; | 38 ;; |
39 ;; blank-mode uses two ways to visualise blanks: faces and display | 39 ;; blank-mode uses two ways to visualize blanks: faces and display |
40 ;; table. | 40 ;; table. |
41 ;; | 41 ;; |
42 ;; * Faces are used to highlight the background with a color. | 42 ;; * Faces are used to highlight the background with a color. |
43 ;; blank-mode uses font-lock to highlight blank characters. | 43 ;; blank-mode uses font-lock to highlight blank characters. |
44 ;; | 44 ;; |
45 ;; * Display table changes the way a character is displayed, that is, | 45 ;; * Display table changes the way a character is displayed, that is, |
46 ;; it provides a visual mark for characters, for example, at the end | 46 ;; it provides a visual mark for characters, for example, at the end |
47 ;; of line (?\xB6), at SPACEs (?\xB7) and at TABs (?\xBB). | 47 ;; of line (?\xB6), at SPACEs (?\xB7) and at TABs (?\xBB). |
48 ;; | 48 ;; |
49 ;; The `blank-style' and `blank-chars' variables are used to select | 49 ;; The `blank-style' and `blank-chars' variables are used to select |
50 ;; which way should be used to visualise blanks. | 50 ;; which way should be used to visualize blanks. |
51 ;; | 51 ;; |
52 ;; Note that when blank-mode is turned on, blank-mode saves the | 52 ;; Note that when blank-mode is turned on, blank-mode saves the |
53 ;; font-lock state, that is, if font-lock is on or off. And | 53 ;; font-lock state, that is, if font-lock is on or off. And |
54 ;; blank-mode restores the font-lock state when it is turned off. So, | 54 ;; blank-mode restores the font-lock state when it is turned off. So, |
55 ;; if blank-mode is turned on and font-lock is off, blank-mode also | 55 ;; if blank-mode is turned on and font-lock is off, blank-mode also |
92 ;; Or autoload at least one of the commands`blank-mode', | 92 ;; Or autoload at least one of the commands`blank-mode', |
93 ;; `blank-toggle-options', `global-blank-mode' or | 93 ;; `blank-toggle-options', `global-blank-mode' or |
94 ;; `global-blank-toggle-options'. For example: | 94 ;; `global-blank-toggle-options'. For example: |
95 ;; | 95 ;; |
96 ;; (autoload 'blank-mode "blank-mode" | 96 ;; (autoload 'blank-mode "blank-mode" |
97 ;; "Toggle blank visualisation." t) | 97 ;; "Toggle blank visualization." t) |
98 ;; (autoload 'blank-toggle-options "blank-mode" | 98 ;; (autoload 'blank-toggle-options "blank-mode" |
99 ;; "Toggle local `blank-mode' options." t) | 99 ;; "Toggle local `blank-mode' options." t) |
100 ;; | 100 ;; |
101 ;; blank-mode was inspired by: | 101 ;; blank-mode was inspired by: |
102 ;; | 102 ;; |
173 ;; ------- | 173 ;; ------- |
174 ;; | 174 ;; |
175 ;; Below it's shown a brief description of blank-mode options, please, | 175 ;; Below it's shown a brief description of blank-mode options, please, |
176 ;; see the options declaration in the code for a long documentation. | 176 ;; see the options declaration in the code for a long documentation. |
177 ;; | 177 ;; |
178 ;; `blank-style' Specify the visualisation style. | 178 ;; `blank-style' Specify the visualization style. |
179 ;; | 179 ;; |
180 ;; `blank-chars' Specify which kind of blank is | 180 ;; `blank-chars' Specify which kind of blank is |
181 ;; visualised. | 181 ;; visualized. |
182 ;; | 182 ;; |
183 ;; `blank-space-face' Face used to visualise SPACE. | 183 ;; `blank-space-face' Face used to visualize SPACE. |
184 ;; | 184 ;; |
185 ;; `blank-hspace-face' Face used to visualise HARD SPACE. | 185 ;; `blank-hspace-face' Face used to visualize HARD SPACE. |
186 ;; | 186 ;; |
187 ;; `blank-tab-face' Face used to visualise TAB. | 187 ;; `blank-tab-face' Face used to visualize TAB. |
188 ;; | 188 ;; |
189 ;; `blank-newline-face' Face used to visualise NEWLINE char | 189 ;; `blank-newline-face' Face used to visualize NEWLINE char |
190 ;; mapping. | 190 ;; mapping. |
191 ;; | 191 ;; |
192 ;; `blank-trailing-face' Face used to visualise trailing | 192 ;; `blank-trailing-face' Face used to visualize trailing |
193 ;; blanks. | 193 ;; blanks. |
194 ;; | 194 ;; |
195 ;; `blank-line-face' Face used to visualise "long" lines. | 195 ;; `blank-line-face' Face used to visualize "long" lines. |
196 ;; | 196 ;; |
197 ;; `blank-space-before-tab-face' Face used to visualise SPACEs | 197 ;; `blank-space-before-tab-face' Face used to visualize SPACEs |
198 ;; before TAB. | 198 ;; before TAB. |
199 ;; | 199 ;; |
200 ;; `blank-space-regexp' Specify SPACE characters regexp. | 200 ;; `blank-space-regexp' Specify SPACE characters regexp. |
201 ;; | 201 ;; |
202 ;; `blank-hspace-regexp' Specify HARD SPACE characters regexp. | 202 ;; `blank-hspace-regexp' Specify HARD SPACE characters regexp. |
266 | 266 |
267 ;;; Interface to the command system | 267 ;;; Interface to the command system |
268 | 268 |
269 | 269 |
270 (defgroup blank nil | 270 (defgroup blank nil |
271 "Visualise blanks (TAB, (HARD) SPACE and NEWLINE)." | 271 "Visualize blanks (TAB, (HARD) SPACE and NEWLINE)." |
272 :link '(emacs-library-link :tag "Source Lisp File" "blank-mode.el") | 272 :link '(emacs-library-link :tag "Source Lisp File" "blank-mode.el") |
273 :version "22.2" | 273 :version "22.2" |
274 :group 'wp | 274 :group 'wp |
275 :group 'data) | 275 :group 'data) |
276 | 276 |
277 | 277 |
278 (defcustom blank-style '(mark color) | 278 (defcustom blank-style '(mark color) |
279 "*Specify the visualisation style. | 279 "*Specify the visualization style. |
280 | 280 |
281 It's a list which element value can be: | 281 It's a list which element value can be: |
282 | 282 |
283 mark display mappings are visualised. | 283 mark display mappings are visualized. |
284 | 284 |
285 color faces are visualised. | 285 color faces are visualized. |
286 | 286 |
287 Any other value is ignored. | 287 Any other value is ignored. |
288 | 288 |
289 If it's nil, don't visualise TABs, (HARD) SPACEs and NEWLINEs. | 289 If nil, don't visualize TABs, (HARD) SPACEs and NEWLINEs. |
290 | 290 |
291 See also `blank-display-mappings' for documentation." | 291 See also `blank-display-mappings' for documentation." |
292 :type '(repeat :tag "Style of Blank" | 292 :type '(repeat :tag "Style of Blank" |
293 (choice :tag "Style of Blank" | 293 (choice :tag "Style of Blank" |
294 (const :tag "Display Table" mark) | 294 (const :tag "Display Table" mark) |
296 :group 'blank) | 296 :group 'blank) |
297 | 297 |
298 | 298 |
299 (defcustom blank-chars | 299 (defcustom blank-chars |
300 '(tabs spaces trailing lines space-before-tab newline) | 300 '(tabs spaces trailing lines space-before-tab newline) |
301 "*Specify which kind of blank is visualised. | 301 "*Specify which kind of blank is visualized. |
302 | 302 |
303 It's a list which element value can be: | 303 It's a list which element value can be: |
304 | 304 |
305 trailing trailing blanks are visualised. | 305 trailing trailing blanks are visualized. |
306 | 306 |
307 tabs TABs are visualised. | 307 tabs TABs are visualized. |
308 | 308 |
309 spaces SPACEs and HARD SPACEs are visualised. | 309 spaces SPACEs and HARD SPACEs are visualized. |
310 | 310 |
311 lines lines whose length is greater than | 311 lines lines whose length is greater than |
312 `blank-line-length' are highlighted. | 312 `blank-line-length' are highlighted. |
313 | 313 |
314 space-before-tab SPACEs before TAB are visualised. | 314 space-before-tab SPACEs before TAB are visualized. |
315 | 315 |
316 newline NEWLINEs are visualised. | 316 newline NEWLINEs are visualized. |
317 | 317 |
318 Any other element value is ignored. | 318 Any other value is ignored. |
319 | 319 |
320 If it's nil, don't visualise TABs, (HARD) SPACEs and NEWLINEs. | 320 If nil, don't visualize TABs, (HARD) SPACEs and NEWLINEs. |
321 | 321 |
322 Used when `blank-style' has `color' as an element. | 322 Used when `blank-style' has `color' as an element. |
323 If `blank-chars' has `newline' as an element, used when `blank-style' | 323 If `blank-chars' has `newline' as an element, used when `blank-style' |
324 has `mark' as an element." | 324 has `mark' as an element." |
325 :type '(repeat :tag "Kind of Blank" | 325 :type '(repeat :tag "Kind of Blank" |
334 (const :tag "NEWLINEs" newline))) | 334 (const :tag "NEWLINEs" newline))) |
335 :group 'blank) | 335 :group 'blank) |
336 | 336 |
337 | 337 |
338 (defcustom blank-space-face 'blank-space-face | 338 (defcustom blank-space-face 'blank-space-face |
339 "*Symbol face used to visualise SPACE. | 339 "*Symbol face used to visualize SPACE. |
340 | 340 |
341 Used when `blank-style' has `color' as an element." | 341 Used when `blank-style' has `color' as an element." |
342 :type 'face | 342 :type 'face |
343 :group 'blank) | 343 :group 'blank) |
344 | 344 |
347 '((((class color) (background dark)) | 347 '((((class color) (background dark)) |
348 (:background "grey20" :foreground "aquamarine3")) | 348 (:background "grey20" :foreground "aquamarine3")) |
349 (((class color) (background light)) | 349 (((class color) (background light)) |
350 (:background "LightYellow" :foreground "aquamarine3")) | 350 (:background "LightYellow" :foreground "aquamarine3")) |
351 (t (:inverse-video t))) | 351 (t (:inverse-video t))) |
352 "Face used to visualise SPACE." | 352 "Face used to visualize SPACE." |
353 :group 'blank) | 353 :group 'blank) |
354 | 354 |
355 | 355 |
356 (defcustom blank-hspace-face 'blank-hspace-face | 356 (defcustom blank-hspace-face 'blank-hspace-face |
357 "*Symbol face used to visualise HARD SPACE. | 357 "*Symbol face used to visualize HARD SPACE. |
358 | 358 |
359 Used when `blank-style' has `color' as an element." | 359 Used when `blank-style' has `color' as an element." |
360 :type 'face | 360 :type 'face |
361 :group 'blank) | 361 :group 'blank) |
362 | 362 |
365 '((((class color) (background dark)) | 365 '((((class color) (background dark)) |
366 (:background "grey24" :foreground "aquamarine3")) | 366 (:background "grey24" :foreground "aquamarine3")) |
367 (((class color) (background light)) | 367 (((class color) (background light)) |
368 (:background "LemonChiffon3" :foreground "aquamarine3")) | 368 (:background "LemonChiffon3" :foreground "aquamarine3")) |
369 (t (:inverse-video t))) | 369 (t (:inverse-video t))) |
370 "Face used to visualise HARD SPACE." | 370 "Face used to visualize HARD SPACE." |
371 :group 'blank) | 371 :group 'blank) |
372 | 372 |
373 | 373 |
374 (defcustom blank-tab-face 'blank-tab-face | 374 (defcustom blank-tab-face 'blank-tab-face |
375 "*Symbol face used to visualise TAB. | 375 "*Symbol face used to visualize TAB. |
376 | 376 |
377 Used when `blank-style' has `color' as an element." | 377 Used when `blank-style' has `color' as an element." |
378 :type 'face | 378 :type 'face |
379 :group 'blank) | 379 :group 'blank) |
380 | 380 |
383 '((((class color) (background dark)) | 383 '((((class color) (background dark)) |
384 (:background "grey22" :foreground "aquamarine3")) | 384 (:background "grey22" :foreground "aquamarine3")) |
385 (((class color) (background light)) | 385 (((class color) (background light)) |
386 (:background "beige" :foreground "aquamarine3")) | 386 (:background "beige" :foreground "aquamarine3")) |
387 (t (:inverse-video t))) | 387 (t (:inverse-video t))) |
388 "Face used to visualise TAB." | 388 "Face used to visualize TAB." |
389 :group 'blank) | 389 :group 'blank) |
390 | 390 |
391 | 391 |
392 (defcustom blank-newline-face 'blank-newline-face | 392 (defcustom blank-newline-face 'blank-newline-face |
393 "*Symbol face used to visualise NEWLINE char mapping. | 393 "*Symbol face used to visualize NEWLINE char mapping. |
394 | 394 |
395 See `blank-display-mappings'. | 395 See `blank-display-mappings'. |
396 | 396 |
397 Used when `blank-style' has `mark' and `color' as elements | 397 Used when `blank-style' has `mark' and `color' as elements |
398 and `blank-chars' has `newline' as an element." | 398 and `blank-chars' has `newline' as an element." |
404 '((((class color) (background dark)) | 404 '((((class color) (background dark)) |
405 (:background "grey26" :foreground "aquamarine3" :bold t)) | 405 (:background "grey26" :foreground "aquamarine3" :bold t)) |
406 (((class color) (background light)) | 406 (((class color) (background light)) |
407 (:background "linen" :foreground "aquamarine3" :bold t)) | 407 (:background "linen" :foreground "aquamarine3" :bold t)) |
408 (t (:bold t :underline t))) | 408 (t (:bold t :underline t))) |
409 "Face used to visualise NEWLINE char mapping. | 409 "Face used to visualize NEWLINE char mapping. |
410 | 410 |
411 See `blank-display-mappings'." | 411 See `blank-display-mappings'." |
412 :group 'blank) | 412 :group 'blank) |
413 | 413 |
414 | 414 |
415 (defcustom blank-trailing-face 'blank-trailing-face | 415 (defcustom blank-trailing-face 'blank-trailing-face |
416 "*Symbol face used to visualise traling blanks. | 416 "*Symbol face used to visualize traling blanks. |
417 | 417 |
418 Used when `blank-style' has `color' as an element." | 418 Used when `blank-style' has `color' as an element." |
419 :type 'face | 419 :type 'face |
420 :group 'blank) | 420 :group 'blank) |
421 | 421 |
422 | 422 |
423 (defface blank-trailing-face ; 'trailing-whitespace | 423 (defface blank-trailing-face ; 'trailing-whitespace |
424 '((((class mono)) (:inverse-video t :bold t :underline t)) | 424 '((((class mono)) (:inverse-video t :bold t :underline t)) |
425 (t (:background "red1" :foreground "yellow" :bold t))) | 425 (t (:background "red1" :foreground "yellow" :bold t))) |
426 "Face used to visualise trailing blanks." | 426 "Face used to visualize trailing blanks." |
427 :group 'blank) | 427 :group 'blank) |
428 | 428 |
429 | 429 |
430 (defcustom blank-line-face 'blank-line-face | 430 (defcustom blank-line-face 'blank-line-face |
431 "*Symbol face used to visualise \"long\" lines. | 431 "*Symbol face used to visualize \"long\" lines. |
432 | 432 |
433 See `blank-line-legnth'. | 433 See `blank-line-length'. |
434 | 434 |
435 Used when `blank-style' has `color' as an element." | 435 Used when `blank-style' has `color' as an element." |
436 :type 'face | 436 :type 'face |
437 :group 'blank) | 437 :group 'blank) |
438 | 438 |
439 | 439 |
440 (defface blank-line-face | 440 (defface blank-line-face |
441 '((((class mono)) (:inverse-video t :bold t :underline t)) | 441 '((((class mono)) (:inverse-video t :bold t :underline t)) |
442 (t (:background "gray20" :foreground "violet"))) | 442 (t (:background "gray20" :foreground "violet"))) |
443 "Face used to visualise \"long\" lines. | 443 "Face used to visualize \"long\" lines. |
444 | 444 |
445 See `blank-line-length'." | 445 See `blank-line-length'." |
446 :group 'blank) | 446 :group 'blank) |
447 | 447 |
448 | 448 |
449 (defcustom blank-space-before-tab-face 'blank-space-before-tab-face | 449 (defcustom blank-space-before-tab-face 'blank-space-before-tab-face |
450 "*Symbol face used to visualise SPACEs before TAB. | 450 "*Symbol face used to visualize SPACEs before TAB. |
451 | 451 |
452 Used when `blank-style' has `color' as an element." | 452 Used when `blank-style' has `color' as an element." |
453 :type 'face | 453 :type 'face |
454 :group 'blank) | 454 :group 'blank) |
455 | 455 |
456 | 456 |
457 (defface blank-space-before-tab-face | 457 (defface blank-space-before-tab-face |
458 '((((class mono)) (:inverse-video t :bold t :underline t)) | 458 '((((class mono)) (:inverse-video t :bold t :underline t)) |
459 (t (:background "DarkOrange" :foreground "firebrick"))) | 459 (t (:background "DarkOrange" :foreground "firebrick"))) |
460 "Face used to visualise SPACEs before TAB." | 460 "Face used to visualize SPACEs before TAB." |
461 :group 'blank) | 461 :group 'blank) |
462 | 462 |
463 | 463 |
464 (defcustom blank-hspace-regexp | 464 (defcustom blank-hspace-regexp |
465 "\\(\\(\xA0\\|\x8A0\\|\x920\\|\xE20\\|\xF20\\)+\\)" | 465 "\\(\\(\xA0\\|\x8A0\\|\x920\\|\xE20\\|\xF20\\)+\\)" |
467 | 467 |
468 If you're using `mule' package, it may exist other characters besides: | 468 If you're using `mule' package, it may exist other characters besides: |
469 | 469 |
470 \"\\xA0\" \"\\x8A0\" \"\\x920\" \"\\xE20\" \"\\xF20\" | 470 \"\\xA0\" \"\\x8A0\" \"\\x920\" \"\\xE20\" \"\\xF20\" |
471 | 471 |
472 that it should be considered HARD SPACE. | 472 that should be considered HARD SPACE. |
473 | 473 |
474 Here are some examples: | 474 Here are some examples: |
475 | 475 |
476 \"\\\\(^\\xA0+\\\\)\" \ | 476 \"\\\\(^\\xA0+\\\\)\" \ |
477 visualise only leading HARD SPACEs. | 477 visualize only leading HARD SPACEs. |
478 \"\\\\(\\xA0+$\\\\)\" \ | 478 \"\\\\(\\xA0+$\\\\)\" \ |
479 visualise only trailing HARD SPACEs. | 479 visualize only trailing HARD SPACEs. |
480 \"\\\\(^\\xA0+\\\\|\\xA0+$\\\\)\" \ | 480 \"\\\\(^\\xA0+\\\\|\\xA0+$\\\\)\" \ |
481 visualise leading and/or trailing HARD SPACEs. | 481 visualize leading and/or trailing HARD SPACEs. |
482 \"\\t\\\\(\\xA0+\\\\)\\t\" \ | 482 \"\\t\\\\(\\xA0+\\\\)\\t\" \ |
483 visualise only HARD SPACEs between TABs. | 483 visualize only HARD SPACEs between TABs. |
484 | 484 |
485 NOTE: Enclose always by \\\\( and \\\\) the elements to highlight. | 485 NOTE: Enclose always by \\\\( and \\\\) the elements to highlight. |
486 Use exactly one pair of enclosing \\\\( and \\\\). | 486 Use exactly one pair of enclosing \\\\( and \\\\). |
487 | 487 |
488 Used when `blank-style' has `color' as an element, and | 488 Used when `blank-style' has `color' as an element, and |
493 | 493 |
494 (defcustom blank-space-regexp "\\( +\\)" | 494 (defcustom blank-space-regexp "\\( +\\)" |
495 "*Specify SPACE characters regexp. | 495 "*Specify SPACE characters regexp. |
496 | 496 |
497 If you're using `mule' package, it may exist other characters | 497 If you're using `mule' package, it may exist other characters |
498 besides \" \" that it should be considered SPACE. | 498 besides \" \" that should be considered SPACE. |
499 | 499 |
500 Here are some examples: | 500 Here are some examples: |
501 | 501 |
502 \"\\\\(^ +\\\\)\" visualise only leading SPACEs. | 502 \"\\\\(^ +\\\\)\" visualize only leading SPACEs. |
503 \"\\\\( +$\\\\)\" visualise only trailing SPACEs. | 503 \"\\\\( +$\\\\)\" visualize only trailing SPACEs. |
504 \"\\\\(^ +\\\\| +$\\\\)\" \ | 504 \"\\\\(^ +\\\\| +$\\\\)\" \ |
505 visualise leading and/or trailing SPACEs. | 505 visualize leading and/or trailing SPACEs. |
506 \"\\t\\\\( +\\\\)\\t\" visualise only SPACEs between TABs. | 506 \"\\t\\\\( +\\\\)\\t\" visualize only SPACEs between TABs. |
507 | 507 |
508 NOTE: Enclose always by \\\\( and \\\\) the elements to highlight. | 508 NOTE: Enclose always by \\\\( and \\\\) the elements to highlight. |
509 Use exactly one pair of enclosing \\\\( and \\\\). | 509 Use exactly one pair of enclosing \\\\( and \\\\). |
510 | 510 |
511 Used when `blank-style' has `color' as an element, and | 511 Used when `blank-style' has `color' as an element, and |
516 | 516 |
517 (defcustom blank-tab-regexp "\\(\t+\\)" | 517 (defcustom blank-tab-regexp "\\(\t+\\)" |
518 "*Specify TAB characters regexp. | 518 "*Specify TAB characters regexp. |
519 | 519 |
520 If you're using `mule' package, it may exist other characters | 520 If you're using `mule' package, it may exist other characters |
521 besides \"\\t\" that it should be considered TAB. | 521 besides \"\\t\" that should be considered TAB. |
522 | 522 |
523 Here are some examples: | 523 Here are some examples: |
524 | 524 |
525 \"\\\\(^\\t+\\\\)\" visualise only leading TABs. | 525 \"\\\\(^\\t+\\\\)\" visualize only leading TABs. |
526 \"\\\\(\\t+$\\\\)\" visualise only trailing TABs. | 526 \"\\\\(\\t+$\\\\)\" visualize only trailing TABs. |
527 \"\\\\(^\\t+\\\\|\\t+$\\\\)\" \ | 527 \"\\\\(^\\t+\\\\|\\t+$\\\\)\" \ |
528 visualise leading and/or trailing TABs. | 528 visualize leading and/or trailing TABs. |
529 \" \\\\(\\t+\\\\) \" visualise only TABs between SPACEs. | 529 \" \\\\(\\t+\\\\) \" visualize only TABs between SPACEs. |
530 | 530 |
531 NOTE: Enclose always by \\\\( and \\\\) the elements to highlight. | 531 NOTE: Enclose always by \\\\( and \\\\) the elements to highlight. |
532 Use exactly one pair of enclosing \\\\( and \\\\). | 532 Use exactly one pair of enclosing \\\\( and \\\\). |
533 | 533 |
534 Used when `blank-style' has `color' as an element, and | 534 Used when `blank-style' has `color' as an element, and |
544 If you're using `mule' package, it may exist other characters besides: | 544 If you're using `mule' package, it may exist other characters besides: |
545 | 545 |
546 \" \" \"\\t\" \"\\xA0\" \"\\x8A0\" \"\\x920\" \"\\xE20\" \ | 546 \" \" \"\\t\" \"\\xA0\" \"\\x8A0\" \"\\x920\" \"\\xE20\" \ |
547 \"\\xF20\" | 547 \"\\xF20\" |
548 | 548 |
549 that it should be considered blank. | 549 that should be considered blank. |
550 | 550 |
551 NOTE: DOES NOT enclose by \\\\( and \\\\) the elements to highlight. | 551 NOTE: DO NOT enclose by \\\\( and \\\\) the elements to highlight. |
552 `blank-mode' surrounds this regexp by \"\\\\(\\\\(\" and | 552 `blank-mode' surrounds this regexp by \"\\\\(\\\\(\" and |
553 \"\\\\)+\\\\)$\". | 553 \"\\\\)+\\\\)$\". |
554 | 554 |
555 Used when `blank-style' has `color' as an element, and | 555 Used when `blank-style' has `color' as an element, and |
556 `blank-chars' has `trailing' as an element." | 556 `blank-chars' has `trailing' as an element." |
564 If you're using `mule' package, it may exist other characters besides: | 564 If you're using `mule' package, it may exist other characters besides: |
565 | 565 |
566 \" \" \"\\t\" \"\\xA0\" \"\\x8A0\" \"\\x920\" \"\\xE20\" \ | 566 \" \" \"\\t\" \"\\xA0\" \"\\x8A0\" \"\\x920\" \"\\xE20\" \ |
567 \"\\xF20\" | 567 \"\\xF20\" |
568 | 568 |
569 that it should be considered blank. | 569 that should be considered blank. |
570 | 570 |
571 Used when `blank-style' has `color' as an element, and | 571 Used when `blank-style' has `color' as an element, and |
572 `blank-chars' has `space-before-tab' as an element." | 572 `blank-chars' has `space-before-tab' as an element." |
573 :type '(regexp :tag "SPACEs Before TAB") | 573 :type '(regexp :tag "SPACEs Before TAB") |
574 :group 'blank) | 574 :group 'blank) |
625 if no display vector for a mapping can be displayed, then | 625 if no display vector for a mapping can be displayed, then |
626 that character is displayed unmodified. | 626 that character is displayed unmodified. |
627 | 627 |
628 The NEWLINE character is displayed using the face given by | 628 The NEWLINE character is displayed using the face given by |
629 `blank-newline-face' variable. The characters in the vector to be | 629 `blank-newline-face' variable. The characters in the vector to be |
630 displayed will not have applied this face if the character code is | 630 displayed will not have this face applied if the character code is |
631 above #x1FFFF. | 631 above #x1FFFF. |
632 | 632 |
633 Used when `blank-style' has `mark' as an element." | 633 Used when `blank-style' has `mark' as an element." |
634 :type '(repeat | 634 :type '(repeat |
635 (list :tag "Character Mapping" | 635 (list :tag "Character Mapping" |
648 Global `blank-mode' is controlled by the command `global-blank-mode'. | 648 Global `blank-mode' is controlled by the command `global-blank-mode'. |
649 | 649 |
650 If nil, means no modes have `blank-mode' automatically turned on. | 650 If nil, means no modes have `blank-mode' automatically turned on. |
651 If t, all modes that support `blank-mode' have it automatically | 651 If t, all modes that support `blank-mode' have it automatically |
652 turned on. | 652 turned on. |
653 If a list, it should be a list of `major-mode' symbol names for | 653 Else it should be a list of `major-mode' symbol names for |
654 which `blank-mode' should be automatically turned on. The sense | 654 which `blank-mode' should be automatically turned on. The sense |
655 of the list is negated if it begins with `not'. For example: | 655 of the list is negated if it begins with `not'. For example: |
656 | 656 |
657 (c-mode c++-mode) | 657 (c-mode c++-mode) |
658 | 658 |
672 ;;;; User commands - Local mode | 672 ;;;; User commands - Local mode |
673 | 673 |
674 | 674 |
675 ;;;###autoload | 675 ;;;###autoload |
676 (define-minor-mode blank-mode | 676 (define-minor-mode blank-mode |
677 "Toggle blank minor mode visualisation (bl on modeline). | 677 "Toggle blank minor mode visualization (\"bl\" on modeline). |
678 | 678 |
679 If ARG is null, toggle blank visualisation. | 679 If ARG is null, toggle blank visualization. |
680 If ARG is a number and is greater than zero, turn on | 680 If ARG is a number greater than zero, turn on visualization; |
681 visualisation; otherwise, turn off visualisation. | 681 otherwise, turn off visualization. |
682 Only useful with a windowing system." | 682 Only useful with a windowing system." |
683 :lighter " bl" | 683 :lighter " bl" |
684 :init-value nil | 684 :init-value nil |
685 :global nil | 685 :global nil |
686 :group 'blank | 686 :group 'blank |
696 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 696 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
697 ;;;; User commands - Global mode | 697 ;;;; User commands - Global mode |
698 | 698 |
699 | 699 |
700 (define-minor-mode global-blank-mode | 700 (define-minor-mode global-blank-mode |
701 "Toggle blank global minor mode visualisation (BL on modeline). | 701 "Toggle blank global minor mode visualization (\"BL\" on modeline). |
702 | 702 |
703 If ARG is null, toggle blank visualisation. | 703 If ARG is null, toggle blank visualization. |
704 If ARG is a number and is greater than zero, turn on | 704 If ARG is a number greater than zero, turn on visualization; |
705 visualisation; otherwise, turn off visualisation. | 705 otherwise, turn off visualization. |
706 Only useful with a windowing system." | 706 Only useful with a windowing system." |
707 :lighter " BL" | 707 :lighter " BL" |
708 :init-value nil | 708 :init-value nil |
709 :global t | 709 :global t |
710 :group 'blank | 710 :group 'blank |
764 trailing | 764 trailing |
765 space-before-tab | 765 space-before-tab |
766 lines | 766 lines |
767 newline | 767 newline |
768 ) | 768 ) |
769 "List of valid `blank-chars' value.") | 769 "List of valid `blank-chars' values.") |
770 | 770 |
771 | 771 |
772 (defconst blank-style-value-list | 772 (defconst blank-style-value-list |
773 '(color | 773 '(color |
774 mark | 774 mark |
775 ) | 775 ) |
776 "List of valid `blank-style' value.") | 776 "List of valid `blank-style' values.") |
777 | 777 |
778 | 778 |
779 (defconst blank-toggle-option-alist | 779 (defconst blank-toggle-option-alist |
780 '((?t . tabs) | 780 '((?t . tabs) |
781 (?s . spaces) | 781 (?s . spaces) |
822 restart local blank-mode. | 822 restart local blank-mode. |
823 | 823 |
824 Interactively, it reads one of the following chars: | 824 Interactively, it reads one of the following chars: |
825 | 825 |
826 CHAR MEANING | 826 CHAR MEANING |
827 t toggle TAB visualisation | 827 t toggle TAB visualization |
828 s toggle SPACE and HARD SPACE visualisation | 828 s toggle SPACE and HARD SPACE visualization |
829 r toggle trailing blanks visualisation | 829 r toggle trailing blanks visualization |
830 b toggle SPACEs before TAB visualisation | 830 b toggle SPACEs before TAB visualization |
831 l toggle \"long lines\" visualisation | 831 l toggle \"long lines\" visualization |
832 n toggle NEWLINE visualisation | 832 n toggle NEWLINE visualization |
833 c toggle color faces | 833 c toggle color faces |
834 m toggle visual mark | 834 m toggle visual mark |
835 x restore `blank-chars' value | 835 x restore `blank-chars' value |
836 z restore `blank-style' value | 836 z restore `blank-style' value |
837 ? display brief help | 837 ? display brief help |
838 | 838 |
839 Non-interactively, ARG should be a symbol or a list of symbol. | 839 Non-interactively, ARG should be a symbol or a list of symbols. |
840 The valid symbols are: | 840 The valid symbols are: |
841 | 841 |
842 tabs toggle TAB visualisation | 842 tabs toggle TAB visualization |
843 spaces toggle SPACE and HARD SPACE visualisation | 843 spaces toggle SPACE and HARD SPACE visualization |
844 trailing toggle trailing blanks visualisation | 844 trailing toggle trailing blanks visualization |
845 space-before-tab toggle SPACEs before TAB visualisation | 845 space-before-tab toggle SPACEs before TAB visualization |
846 lines toggle \"long lines\" visualisation | 846 lines toggle \"long lines\" visualization |
847 newline toggle NEWLINE visualisation | 847 newline toggle NEWLINE visualization |
848 color toggle color faces | 848 color toggle color faces |
849 mark toggle visual mark | 849 mark toggle visual mark |
850 blank-chars restore `blank-chars' value | 850 blank-chars restore `blank-chars' value |
851 blank-style restore `blank-style' value | 851 blank-style restore `blank-style' value |
852 | 852 |
879 restart global blank-mode. | 879 restart global blank-mode. |
880 | 880 |
881 Interactively, it reads one of the following chars: | 881 Interactively, it reads one of the following chars: |
882 | 882 |
883 CHAR MEANING | 883 CHAR MEANING |
884 t toggle TAB visualisation | 884 t toggle TAB visualization |
885 s toggle SPACE and HARD SPACE visualisation | 885 s toggle SPACE and HARD SPACE visualization |
886 r toggle trailing blanks visualisation | 886 r toggle trailing blanks visualization |
887 b toggle SPACEs before TAB visualisation | 887 b toggle SPACEs before TAB visualization |
888 l toggle \"long lines\" visualisation | 888 l toggle \"long lines\" visualization |
889 n toggle NEWLINE visualisation | 889 n toggle NEWLINE visualization |
890 c toggle color faces | 890 c toggle color faces |
891 m toggle visual mark | 891 m toggle visual mark |
892 x restore `blank-chars' value | 892 x restore `blank-chars' value |
893 z restore `blank-style' value | 893 z restore `blank-style' value |
894 ? display brief help | 894 ? display brief help |
895 | 895 |
896 Non-interactively, ARG should be a symbol or a list of symbol. | 896 Non-interactively, ARG should be a symbol or a list of symbols. |
897 The valid symbols are: | 897 The valid symbols are: |
898 | 898 |
899 tabs toggle TAB visualisation | 899 tabs toggle TAB visualization |
900 spaces toggle SPACE and HARD SPACE visualisation | 900 spaces toggle SPACE and HARD SPACE visualization |
901 trailing toggle trailing blanks visualisation | 901 trailing toggle trailing blanks visualization |
902 space-before-tab toggle SPACEs before TAB visualisation | 902 space-before-tab toggle SPACEs before TAB visualization |
903 lines toggle \"long lines\" visualisation | 903 lines toggle \"long lines\" visualization |
904 newline toggle NEWLINE visualisation | 904 newline toggle NEWLINE visualization |
905 color toggle color faces | 905 color toggle color faces |
906 mark toggle visual mark | 906 mark toggle visual mark |
907 blank-chars restore `blank-chars' value | 907 blank-chars restore `blank-chars' value |
908 blank-style restore `blank-style' value | 908 blank-style restore `blank-style' value |
909 | 909 |
940 | 940 |
941 (defconst blank-help-text | 941 (defconst blank-help-text |
942 "\ | 942 "\ |
943 blank-mode toggle options: | 943 blank-mode toggle options: |
944 | 944 |
945 [] t - toggle TAB visualisation | 945 [] t - toggle TAB visualization |
946 [] s - toggle SPACE and HARD SPACE visualisation | 946 [] s - toggle SPACE and HARD SPACE visualization |
947 [] r - toggle trailing blanks visualisation | 947 [] r - toggle trailing blanks visualization |
948 [] b - toggle SPACEs before TAB visualisation | 948 [] b - toggle SPACEs before TAB visualization |
949 [] l - toggle \"long lines\" visualisation | 949 [] l - toggle \"long lines\" visualization |
950 [] n - toggle NEWLINE visualisation | 950 [] n - toggle NEWLINE visualization |
951 | 951 |
952 [] c - toggle color faces | 952 [] c - toggle color faces |
953 [] m - toggle visual mark | 953 [] m - toggle visual mark |
954 | 954 |
955 x - restore `blank-chars' value | 955 x - restore `blank-chars' value |
1011 uses a global context. | 1011 uses a global context. |
1012 | 1012 |
1013 It reads one of the following chars: | 1013 It reads one of the following chars: |
1014 | 1014 |
1015 CHAR MEANING | 1015 CHAR MEANING |
1016 t toggle TAB visualisation | 1016 t toggle TAB visualization |
1017 s toggle SPACE and HARD SPACE visualisation | 1017 s toggle SPACE and HARD SPACE visualization |
1018 r toggle trailing blanks visualisation | 1018 r toggle trailing blanks visualization |
1019 b toggle SPACEs before TAB visualisation | 1019 b toggle SPACEs before TAB visualization |
1020 l toggle \"long lines\" visualisation | 1020 l toggle \"long lines\" visualization |
1021 n toggle NEWLINE visualisation | 1021 n toggle NEWLINE visualization |
1022 c toggle color faces | 1022 c toggle color faces |
1023 m toggle visual mark | 1023 m toggle visual mark |
1024 x restore `blank-chars' value | 1024 x restore `blank-chars' value |
1025 z restore `blank-style' value | 1025 z restore `blank-style' value |
1026 ? display brief help | 1026 ? display brief help |
1096 (cons sym the-list)))))) | 1096 (cons sym the-list)))))) |
1097 the-list) | 1097 the-list) |
1098 | 1098 |
1099 | 1099 |
1100 (defun blank-turn-on () | 1100 (defun blank-turn-on () |
1101 "Turn on blank visualisation." | 1101 "Turn on blank visualization." |
1102 (setq blank-active-style (if (listp blank-style) | 1102 (setq blank-active-style (if (listp blank-style) |
1103 blank-style | 1103 blank-style |
1104 (list blank-style))) | 1104 (list blank-style))) |
1105 (setq blank-active-chars (if (listp blank-chars) | 1105 (setq blank-active-chars (if (listp blank-chars) |
1106 blank-chars | 1106 blank-chars |
1110 (and (memq 'mark blank-active-style) | 1110 (and (memq 'mark blank-active-style) |
1111 (blank-display-char-on))) | 1111 (blank-display-char-on))) |
1112 | 1112 |
1113 | 1113 |
1114 (defun blank-turn-off () | 1114 (defun blank-turn-off () |
1115 "Turn off blank visualisation." | 1115 "Turn off blank visualization." |
1116 (and (memq 'color blank-active-style) | 1116 (and (memq 'color blank-active-style) |
1117 (blank-color-off)) | 1117 (blank-color-off)) |
1118 (and (memq 'mark blank-active-style) | 1118 (and (memq 'mark blank-active-style) |
1119 (blank-display-char-off))) | 1119 (blank-display-char-off))) |
1120 | 1120 |
1121 | 1121 |
1122 (defun blank-color-on () | 1122 (defun blank-color-on () |
1123 "Turn on color visualisation." | 1123 "Turn on color visualization." |
1124 (when blank-active-chars | 1124 (when blank-active-chars |
1125 (unless blank-font-lock | 1125 (unless blank-font-lock |
1126 (setq blank-font-lock t | 1126 (setq blank-font-lock t |
1127 blank-font-lock-keywords | 1127 blank-font-lock-keywords |
1128 (copy-sequence font-lock-keywords))) | 1128 (copy-sequence font-lock-keywords))) |
1174 ;; now turn on font lock and highlight blanks | 1174 ;; now turn on font lock and highlight blanks |
1175 (font-lock-mode 1))) | 1175 (font-lock-mode 1))) |
1176 | 1176 |
1177 | 1177 |
1178 (defun blank-color-off () | 1178 (defun blank-color-off () |
1179 "Turn off color visualisation." | 1179 "Turn off color visualization." |
1180 (when blank-active-chars | 1180 (when blank-active-chars |
1181 (when blank-font-lock | 1181 (when blank-font-lock |
1182 (setq blank-font-lock nil | 1182 (setq blank-font-lock nil |
1183 font-lock-keywords blank-font-lock-keywords)) | 1183 font-lock-keywords blank-font-lock-keywords)) |
1184 ;; turn off font lock | 1184 ;; turn off font lock |