diff options
| author | Chong Yidong | 2010-09-06 12:24:32 -0400 |
|---|---|---|
| committer | Chong Yidong | 2010-09-06 12:24:32 -0400 |
| commit | 9c405a86c6d6ee1034252d653c246ef509145000 (patch) | |
| tree | 9d7fab75294e6a33f54057fd3a81fe7df4c94080 | |
| parent | 3fa0dc8f4dcf7142f23668cceb39435eea8de6e5 (diff) | |
| download | emacs-9c405a86c6d6ee1034252d653c246ef509145000.tar.gz emacs-9c405a86c6d6ee1034252d653c246ef509145000.zip | |
Merge whitespace.el from trunk
| -rw-r--r-- | lisp/ChangeLog | 19 | ||||
| -rw-r--r-- | lisp/whitespace.el | 185 |
2 files changed, 150 insertions, 54 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2d4ef5611bb..b8fd151f001 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,22 @@ | |||
| 1 | 2010-09-06 Vinicius Jose Latorre <viniciusjl@ig.com.br> | ||
| 2 | |||
| 3 | * whitespace.el: Allow cleaning up blanks without blank | ||
| 4 | visualization (Bug#6651). Adjust help window for | ||
| 5 | whitespace-toggle-options (Bug#6479). Allow to use fill-column | ||
| 6 | instead of whitespace-line-column (from EmacsWiki). New version | ||
| 7 | 13.1. | ||
| 8 | (whitespace-style): Added new value 'face. Adjust docstring. | ||
| 9 | (whitespace-space, whitespace-hspace, whitespace-tab): Adjust | ||
| 10 | foreground property face. | ||
| 11 | (whitespace-line-column): Adjust docstring and type declaration. | ||
| 12 | (whitespace-style-value-list, whitespace-toggle-option-alist) | ||
| 13 | (whitespace-help-text): Adjust const initialization. | ||
| 14 | (whitespace-toggle-options, global-whitespace-toggle-options): | ||
| 15 | Adjust docstring. | ||
| 16 | (whitespace-display-window, whitespace-interactive-char) | ||
| 17 | (whitespace-style-face-p, whitespace-color-on): Adjust code. | ||
| 18 | (whitespace-help-scroll): New fun. | ||
| 19 | |||
| 1 | 2010-09-05 Alexander Klimov <alserkli@inbox.ru> (tiny change) | 20 | 2010-09-05 Alexander Klimov <alserkli@inbox.ru> (tiny change) |
| 2 | 21 | ||
| 3 | * files.el (directory-abbrev-alist): Use \` as default regexp. | 22 | * files.el (directory-abbrev-alist): Use \` as default regexp. |
diff --git a/lisp/whitespace.el b/lisp/whitespace.el index 9f4b033e75f..4b8b9a61173 100644 --- a/lisp/whitespace.el +++ b/lisp/whitespace.el | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | ;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br> | 6 | ;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br> |
| 7 | ;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br> | 7 | ;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br> |
| 8 | ;; Keywords: data, wp | 8 | ;; Keywords: data, wp |
| 9 | ;; Version: 13.0 | 9 | ;; Version: 13.1 |
| 10 | ;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre | 10 | ;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre |
| 11 | 11 | ||
| 12 | ;; This file is part of GNU Emacs. | 12 | ;; This file is part of GNU Emacs. |
| @@ -378,24 +378,32 @@ | |||
| 378 | "Visualize blanks (TAB, (HARD) SPACE and NEWLINE)." | 378 | "Visualize blanks (TAB, (HARD) SPACE and NEWLINE)." |
| 379 | :link '(emacs-library-link :tag "Source Lisp File" "whitespace.el") | 379 | :link '(emacs-library-link :tag "Source Lisp File" "whitespace.el") |
| 380 | :version "23.1" | 380 | :version "23.1" |
| 381 | :group 'wp | 381 | :group 'convenience) |
| 382 | :group 'data) | ||
| 383 | 382 | ||
| 384 | 383 | ||
| 385 | (defcustom whitespace-style | 384 | (defcustom whitespace-style |
| 386 | '(tabs spaces trailing lines space-before-tab newline | 385 | '(face |
| 387 | indentation empty space-after-tab | 386 | tabs spaces trailing lines space-before-tab newline |
| 388 | space-mark tab-mark newline-mark) | 387 | indentation empty space-after-tab |
| 388 | space-mark tab-mark newline-mark) | ||
| 389 | "Specify which kind of blank is visualized. | 389 | "Specify which kind of blank is visualized. |
| 390 | 390 | ||
| 391 | It's a list containing some or all of the following values: | 391 | It's a list containing some or all of the following values: |
| 392 | 392 | ||
| 393 | face enable all visualization via faces (see below). | ||
| 394 | |||
| 393 | trailing trailing blanks are visualized via faces. | 395 | trailing trailing blanks are visualized via faces. |
| 396 | It has effect only if `face' (see above) | ||
| 397 | is present in `whitespace-style'. | ||
| 394 | 398 | ||
| 395 | tabs TABs are visualized via faces. | 399 | tabs TABs are visualized via faces. |
| 400 | It has effect only if `face' (see above) | ||
| 401 | is present in `whitespace-style'. | ||
| 396 | 402 | ||
| 397 | spaces SPACEs and HARD SPACEs are visualized via | 403 | spaces SPACEs and HARD SPACEs are visualized via |
| 398 | faces. | 404 | faces. |
| 405 | It has effect only if `face' (see above) | ||
| 406 | is present in `whitespace-style'. | ||
| 399 | 407 | ||
| 400 | lines lines which have columns beyond | 408 | lines lines which have columns beyond |
| 401 | `whitespace-line-column' are highlighted via | 409 | `whitespace-line-column' are highlighted via |
| @@ -403,6 +411,8 @@ It's a list containing some or all of the following values: | |||
| 403 | Whole line is highlighted. | 411 | Whole line is highlighted. |
| 404 | It has precedence over `lines-tail' (see | 412 | It has precedence over `lines-tail' (see |
| 405 | below). | 413 | below). |
| 414 | It has effect only if `face' (see above) | ||
| 415 | is present in `whitespace-style'. | ||
| 406 | 416 | ||
| 407 | lines-tail lines which have columns beyond | 417 | lines-tail lines which have columns beyond |
| 408 | `whitespace-line-column' are highlighted via | 418 | `whitespace-line-column' are highlighted via |
| @@ -410,45 +420,69 @@ It's a list containing some or all of the following values: | |||
| 410 | But only the part of line which goes | 420 | But only the part of line which goes |
| 411 | beyond `whitespace-line-column' column. | 421 | beyond `whitespace-line-column' column. |
| 412 | It has effect only if `lines' (see above) | 422 | It has effect only if `lines' (see above) |
| 413 | is not present in `whitespace-style'. | 423 | is not present in `whitespace-style' |
| 424 | and if `face' (see above) is present in | ||
| 425 | `whitespace-style'. | ||
| 414 | 426 | ||
| 415 | newline NEWLINEs are visualized via faces. | 427 | newline NEWLINEs are visualized via faces. |
| 428 | It has effect only if `face' (see above) | ||
| 429 | is present in `whitespace-style'. | ||
| 416 | 430 | ||
| 417 | empty empty lines at beginning and/or end of buffer | 431 | empty empty lines at beginning and/or end of buffer |
| 418 | are visualized via faces. | 432 | are visualized via faces. |
| 433 | It has effect only if `face' (see above) | ||
| 434 | is present in `whitespace-style'. | ||
| 419 | 435 | ||
| 420 | indentation::tab 8 or more SPACEs at beginning of line are | 436 | indentation::tab 8 or more SPACEs at beginning of line are |
| 421 | visualized via faces. | 437 | visualized via faces. |
| 438 | It has effect only if `face' (see above) | ||
| 439 | is present in `whitespace-style'. | ||
| 422 | 440 | ||
| 423 | indentation::space TABs at beginning of line are visualized via | 441 | indentation::space TABs at beginning of line are visualized via |
| 424 | faces. | 442 | faces. |
| 443 | It has effect only if `face' (see above) | ||
| 444 | is present in `whitespace-style'. | ||
| 425 | 445 | ||
| 426 | indentation 8 or more SPACEs at beginning of line are | 446 | indentation 8 or more SPACEs at beginning of line are |
| 427 | visualized, if `indent-tabs-mode' (which see) | 447 | visualized, if `indent-tabs-mode' (which see) |
| 428 | is non-nil; otherwise, TABs at beginning of | 448 | is non-nil; otherwise, TABs at beginning of |
| 429 | line are visualized via faces. | 449 | line are visualized via faces. |
| 450 | It has effect only if `face' (see above) | ||
| 451 | is present in `whitespace-style'. | ||
| 430 | 452 | ||
| 431 | space-after-tab::tab 8 or more SPACEs after a TAB are | 453 | space-after-tab::tab 8 or more SPACEs after a TAB are |
| 432 | visualized via faces. | 454 | visualized via faces. |
| 455 | It has effect only if `face' (see above) | ||
| 456 | is present in `whitespace-style'. | ||
| 433 | 457 | ||
| 434 | space-after-tab::space TABs are visualized when 8 or more | 458 | space-after-tab::space TABs are visualized when 8 or more |
| 435 | SPACEs occur after a TAB, via faces. | 459 | SPACEs occur after a TAB, via faces. |
| 460 | It has effect only if `face' (see above) | ||
| 461 | is present in `whitespace-style'. | ||
| 436 | 462 | ||
| 437 | space-after-tab 8 or more SPACEs after a TAB are | 463 | space-after-tab 8 or more SPACEs after a TAB are |
| 438 | visualized, if `indent-tabs-mode' | 464 | visualized, if `indent-tabs-mode' |
| 439 | (which see) is non-nil; otherwise, | 465 | (which see) is non-nil; otherwise, |
| 440 | the TABs are visualized via faces. | 466 | the TABs are visualized via faces. |
| 467 | It has effect only if `face' (see above) | ||
| 468 | is present in `whitespace-style'. | ||
| 441 | 469 | ||
| 442 | space-before-tab::tab SPACEs before TAB are visualized via | 470 | space-before-tab::tab SPACEs before TAB are visualized via |
| 443 | faces. | 471 | faces. |
| 472 | It has effect only if `face' (see above) | ||
| 473 | is present in `whitespace-style'. | ||
| 444 | 474 | ||
| 445 | space-before-tab::space TABs are visualized when SPACEs occur | 475 | space-before-tab::space TABs are visualized when SPACEs occur |
| 446 | before TAB, via faces. | 476 | before TAB, via faces. |
| 477 | It has effect only if `face' (see above) | ||
| 478 | is present in `whitespace-style'. | ||
| 447 | 479 | ||
| 448 | space-before-tab SPACEs before TAB are visualized, if | 480 | space-before-tab SPACEs before TAB are visualized, if |
| 449 | `indent-tabs-mode' (which see) is | 481 | `indent-tabs-mode' (which see) is |
| 450 | non-nil; otherwise, the TABs are | 482 | non-nil; otherwise, the TABs are |
| 451 | visualized via faces. | 483 | visualized via faces. |
| 484 | It has effect only if `face' (see above) | ||
| 485 | is present in `whitespace-style'. | ||
| 452 | 486 | ||
| 453 | space-mark SPACEs and HARD SPACEs are visualized via | 487 | space-mark SPACEs and HARD SPACEs are visualized via |
| 454 | display table. | 488 | display table. |
| @@ -487,9 +521,16 @@ So, for example, if indentation and indentation::space are | |||
| 487 | included in `whitespace-style' list, the indentation value is | 521 | included in `whitespace-style' list, the indentation value is |
| 488 | evaluated instead of indentation::space value. | 522 | evaluated instead of indentation::space value. |
| 489 | 523 | ||
| 524 | One reason for not visualize spaces via faces (if `face' is not | ||
| 525 | included in `whitespace-style') is to use exclusively for | ||
| 526 | cleanning up a buffer. See `whitespace-cleanup' and | ||
| 527 | `whitespace-cleanup-region' for documentation. | ||
| 528 | |||
| 490 | See also `whitespace-display-mappings' for documentation." | 529 | See also `whitespace-display-mappings' for documentation." |
| 491 | :type '(repeat :tag "Kind of Blank" | 530 | :type '(repeat :tag "Kind of Blank" |
| 492 | (choice :tag "Kind of Blank Face" | 531 | (choice :tag "Kind of Blank Face" |
| 532 | (const :tag "(Face) Face visualization" | ||
| 533 | face) | ||
| 493 | (const :tag "(Face) Trailing TABs, SPACEs and HARD SPACEs" | 534 | (const :tag "(Face) Trailing TABs, SPACEs and HARD SPACEs" |
| 494 | trailing) | 535 | trailing) |
| 495 | (const :tag "(Face) SPACEs and HARD SPACEs" | 536 | (const :tag "(Face) SPACEs and HARD SPACEs" |
| @@ -522,9 +563,9 @@ Used when `whitespace-style' includes the value `spaces'." | |||
| 522 | 563 | ||
| 523 | (defface whitespace-space | 564 | (defface whitespace-space |
| 524 | '((((class color) (background dark)) | 565 | '((((class color) (background dark)) |
| 525 | (:background "grey20" :foreground "aquamarine3")) | 566 | (:background "grey20" :foreground "darkgray")) |
| 526 | (((class color) (background light)) | 567 | (((class color) (background light)) |
| 527 | (:background "LightYellow" :foreground "aquamarine3")) | 568 | (:background "LightYellow" :foreground "lightgray")) |
| 528 | (t (:inverse-video t))) | 569 | (t (:inverse-video t))) |
| 529 | "Face used to visualize SPACE." | 570 | "Face used to visualize SPACE." |
| 530 | :group 'whitespace) | 571 | :group 'whitespace) |
| @@ -540,9 +581,9 @@ Used when `whitespace-style' includes the value `spaces'." | |||
| 540 | 581 | ||
| 541 | (defface whitespace-hspace ; 'nobreak-space | 582 | (defface whitespace-hspace ; 'nobreak-space |
| 542 | '((((class color) (background dark)) | 583 | '((((class color) (background dark)) |
| 543 | (:background "grey24" :foreground "aquamarine3")) | 584 | (:background "grey24" :foreground "darkgray")) |
| 544 | (((class color) (background light)) | 585 | (((class color) (background light)) |
| 545 | (:background "LemonChiffon3" :foreground "aquamarine3")) | 586 | (:background "LemonChiffon3" :foreground "lightgray")) |
| 546 | (t (:inverse-video t))) | 587 | (t (:inverse-video t))) |
| 547 | "Face used to visualize HARD SPACE." | 588 | "Face used to visualize HARD SPACE." |
| 548 | :group 'whitespace) | 589 | :group 'whitespace) |
| @@ -558,9 +599,9 @@ Used when `whitespace-style' includes the value `tabs'." | |||
| 558 | 599 | ||
| 559 | (defface whitespace-tab | 600 | (defface whitespace-tab |
| 560 | '((((class color) (background dark)) | 601 | '((((class color) (background dark)) |
| 561 | (:background "grey22" :foreground "aquamarine3")) | 602 | (:background "grey22" :foreground "darkgray")) |
| 562 | (((class color) (background light)) | 603 | (((class color) (background light)) |
| 563 | (:background "beige" :foreground "aquamarine3")) | 604 | (:background "beige" :foreground "lightgray")) |
| 564 | (t (:inverse-video t))) | 605 | (t (:inverse-video t))) |
| 565 | "Face used to visualize TAB." | 606 | "Face used to visualize TAB." |
| 566 | :group 'whitespace) | 607 | :group 'whitespace) |
| @@ -867,8 +908,13 @@ Used when `whitespace-style' includes `space-after-tab', | |||
| 867 | (defcustom whitespace-line-column 80 | 908 | (defcustom whitespace-line-column 80 |
| 868 | "Specify column beyond which the line is highlighted. | 909 | "Specify column beyond which the line is highlighted. |
| 869 | 910 | ||
| 911 | It must be an integer or nil. If nil, the `fill-column' variable value is | ||
| 912 | used. | ||
| 913 | |||
| 870 | Used when `whitespace-style' includes `lines' or `lines-tail'." | 914 | Used when `whitespace-style' includes `lines' or `lines-tail'." |
| 871 | :type '(integer :tag "Line Length") | 915 | :type '(choice :tag "Line Length Limit" |
| 916 | (integer :tag "Line Length") | ||
| 917 | (const :tag "Use fill-column" nil)) | ||
| 872 | :group 'whitespace) | 918 | :group 'whitespace) |
| 873 | 919 | ||
| 874 | 920 | ||
| @@ -1152,7 +1198,8 @@ See also `whitespace-newline' and `whitespace-display-mappings'." | |||
| 1152 | 1198 | ||
| 1153 | 1199 | ||
| 1154 | (defconst whitespace-style-value-list | 1200 | (defconst whitespace-style-value-list |
| 1155 | '(tabs | 1201 | '(face |
| 1202 | tabs | ||
| 1156 | spaces | 1203 | spaces |
| 1157 | trailing | 1204 | trailing |
| 1158 | lines | 1205 | lines |
| @@ -1177,7 +1224,8 @@ See also `whitespace-newline' and `whitespace-display-mappings'." | |||
| 1177 | 1224 | ||
| 1178 | 1225 | ||
| 1179 | (defconst whitespace-toggle-option-alist | 1226 | (defconst whitespace-toggle-option-alist |
| 1180 | '((?t . tabs) | 1227 | '((?f . face) |
| 1228 | (?t . tabs) | ||
| 1181 | (?s . spaces) | 1229 | (?s . spaces) |
| 1182 | (?r . trailing) | 1230 | (?r . trailing) |
| 1183 | (?l . lines) | 1231 | (?l . lines) |
| @@ -1257,6 +1305,7 @@ Interactively, it reads one of the following chars: | |||
| 1257 | 1305 | ||
| 1258 | CHAR MEANING | 1306 | CHAR MEANING |
| 1259 | (VIA FACES) | 1307 | (VIA FACES) |
| 1308 | f toggle face visualization | ||
| 1260 | t toggle TAB visualization | 1309 | t toggle TAB visualization |
| 1261 | s toggle SPACE and HARD SPACE visualization | 1310 | s toggle SPACE and HARD SPACE visualization |
| 1262 | r toggle trailing blanks visualization | 1311 | r toggle trailing blanks visualization |
| @@ -1285,6 +1334,7 @@ Interactively, it reads one of the following chars: | |||
| 1285 | Non-interactively, ARG should be a symbol or a list of symbols. | 1334 | Non-interactively, ARG should be a symbol or a list of symbols. |
| 1286 | The valid symbols are: | 1335 | The valid symbols are: |
| 1287 | 1336 | ||
| 1337 | face toggle face visualization | ||
| 1288 | tabs toggle TAB visualization | 1338 | tabs toggle TAB visualization |
| 1289 | spaces toggle SPACE and HARD SPACE visualization | 1339 | spaces toggle SPACE and HARD SPACE visualization |
| 1290 | trailing toggle trailing blanks visualization | 1340 | trailing toggle trailing blanks visualization |
| @@ -1334,6 +1384,7 @@ Interactively, it accepts one of the following chars: | |||
| 1334 | 1384 | ||
| 1335 | CHAR MEANING | 1385 | CHAR MEANING |
| 1336 | (VIA FACES) | 1386 | (VIA FACES) |
| 1387 | f toggle face visualization | ||
| 1337 | t toggle TAB visualization | 1388 | t toggle TAB visualization |
| 1338 | s toggle SPACE and HARD SPACE visualization | 1389 | s toggle SPACE and HARD SPACE visualization |
| 1339 | r toggle trailing blanks visualization | 1390 | r toggle trailing blanks visualization |
| @@ -1362,6 +1413,7 @@ Interactively, it accepts one of the following chars: | |||
| 1362 | Non-interactively, ARG should be a symbol or a list of symbols. | 1413 | Non-interactively, ARG should be a symbol or a list of symbols. |
| 1363 | The valid symbols are: | 1414 | The valid symbols are: |
| 1364 | 1415 | ||
| 1416 | face toggle face visualization | ||
| 1365 | tabs toggle TAB visualization | 1417 | tabs toggle TAB visualization |
| 1366 | spaces toggle SPACE and HARD SPACE visualization | 1418 | spaces toggle SPACE and HARD SPACE visualization |
| 1367 | trailing toggle trailing blanks visualization | 1419 | trailing toggle trailing blanks visualization |
| @@ -1891,9 +1943,10 @@ cleaning up these problems." | |||
| 1891 | 1943 | ||
| 1892 | (defconst whitespace-help-text | 1944 | (defconst whitespace-help-text |
| 1893 | "\ | 1945 | "\ |
| 1894 | Whitespace Toggle Options | 1946 | Whitespace Toggle Options | scroll up : SPC or > | |
| 1895 | 1947 | | scroll down: M-SPC or < | | |
| 1896 | FACES | 1948 | FACES \\__________________________/ |
| 1949 | [] f - toggle face visualization | ||
| 1897 | [] t - toggle TAB visualization | 1950 | [] t - toggle TAB visualization |
| 1898 | [] s - toggle SPACE and HARD SPACE visualization | 1951 | [] s - toggle SPACE and HARD SPACE visualization |
| 1899 | [] r - toggle trailing blanks visualization | 1952 | [] r - toggle trailing blanks visualization |
| @@ -1967,15 +2020,13 @@ cleaning up these problems." | |||
| 1967 | "Display BUFFER in a new window." | 2020 | "Display BUFFER in a new window." |
| 1968 | (goto-char (point-min)) | 2021 | (goto-char (point-min)) |
| 1969 | (set-buffer-modified-p nil) | 2022 | (set-buffer-modified-p nil) |
| 1970 | (let ((size (- (window-height) | 2023 | (when (< (window-height) (* 2 window-min-height)) |
| 1971 | (max window-min-height | 2024 | (kill-buffer buffer) |
| 1972 | (1+ (count-lines (point-min) | 2025 | (error "Window height is too small; \ |
| 1973 | (point-max))))))) | ||
| 1974 | (when (<= size 0) | ||
| 1975 | (kill-buffer buffer) | ||
| 1976 | (error "Frame height is too small; \ | ||
| 1977 | can't split window to display whitespace toggle options")) | 2026 | can't split window to display whitespace toggle options")) |
| 1978 | (set-window-buffer (split-window nil size) buffer))) | 2027 | (let ((win (split-window))) |
| 2028 | (set-window-buffer win buffer) | ||
| 2029 | (shrink-window-if-larger-than-buffer win))) | ||
| 1979 | 2030 | ||
| 1980 | 2031 | ||
| 1981 | (defun whitespace-kill-buffer (buffer-name) | 2032 | (defun whitespace-kill-buffer (buffer-name) |
| @@ -1991,6 +2042,24 @@ can't split window to display whitespace toggle options")) | |||
| 1991 | (whitespace-kill-buffer whitespace-help-buffer-name)) | 2042 | (whitespace-kill-buffer whitespace-help-buffer-name)) |
| 1992 | 2043 | ||
| 1993 | 2044 | ||
| 2045 | (defun whitespace-help-scroll (&optional up) | ||
| 2046 | "Scroll help window, if it exists. | ||
| 2047 | |||
| 2048 | If UP is non-nil, scroll up; otherwise, scroll down." | ||
| 2049 | (condition-case data-help | ||
| 2050 | (let ((buffer (get-buffer whitespace-help-buffer-name))) | ||
| 2051 | (if buffer | ||
| 2052 | (with-selected-window (get-buffer-window buffer) | ||
| 2053 | (if up | ||
| 2054 | (scroll-up 3) | ||
| 2055 | (scroll-down 3))) | ||
| 2056 | (ding))) | ||
| 2057 | ;; handler | ||
| 2058 | ((error) | ||
| 2059 | ;; just ignore error | ||
| 2060 | ))) | ||
| 2061 | |||
| 2062 | |||
| 1994 | (defun whitespace-interactive-char (local-p) | 2063 | (defun whitespace-interactive-char (local-p) |
| 1995 | "Interactive function to read a char and return a symbol. | 2064 | "Interactive function to read a char and return a symbol. |
| 1996 | 2065 | ||
| @@ -2001,6 +2070,7 @@ It accepts one of the following chars: | |||
| 2001 | 2070 | ||
| 2002 | CHAR MEANING | 2071 | CHAR MEANING |
| 2003 | (VIA FACES) | 2072 | (VIA FACES) |
| 2073 | f toggle face visualization | ||
| 2004 | t toggle TAB visualization | 2074 | t toggle TAB visualization |
| 2005 | s toggle SPACE and HARD SPACE visualization | 2075 | s toggle SPACE and HARD SPACE visualization |
| 2006 | r toggle trailing blanks visualization | 2076 | r toggle trailing blanks visualization |
| @@ -2050,9 +2120,13 @@ See also `whitespace-toggle-option-alist'." | |||
| 2050 | (cdr | 2120 | (cdr |
| 2051 | (assq ch whitespace-toggle-option-alist))))) | 2121 | (assq ch whitespace-toggle-option-alist))))) |
| 2052 | ;; while body | 2122 | ;; while body |
| 2053 | (if (eq ch ?\?) | 2123 | (cond |
| 2054 | (whitespace-help-on style) | 2124 | ((eq ch ?\?) (whitespace-help-on style)) |
| 2055 | (ding))) | 2125 | ((eq ch ?\ ) (whitespace-help-scroll t)) |
| 2126 | ((eq ch ?\M- ) (whitespace-help-scroll)) | ||
| 2127 | ((eq ch ?>) (whitespace-help-scroll t)) | ||
| 2128 | ((eq ch ?<) (whitespace-help-scroll)) | ||
| 2129 | (t (ding)))) | ||
| 2056 | (whitespace-help-off) | 2130 | (whitespace-help-off) |
| 2057 | (message " ")) ; clean echo area | 2131 | (message " ")) ; clean echo area |
| 2058 | ;; handler | 2132 | ;; handler |
| @@ -2131,22 +2205,23 @@ resultant list will be returned." | |||
| 2131 | 2205 | ||
| 2132 | (defun whitespace-style-face-p () | 2206 | (defun whitespace-style-face-p () |
| 2133 | "Return t if there is some visualization via face." | 2207 | "Return t if there is some visualization via face." |
| 2134 | (or (memq 'tabs whitespace-active-style) | 2208 | (and (memq 'face whitespace-active-style) |
| 2135 | (memq 'spaces whitespace-active-style) | 2209 | (or (memq 'tabs whitespace-active-style) |
| 2136 | (memq 'trailing whitespace-active-style) | 2210 | (memq 'spaces whitespace-active-style) |
| 2137 | (memq 'lines whitespace-active-style) | 2211 | (memq 'trailing whitespace-active-style) |
| 2138 | (memq 'lines-tail whitespace-active-style) | 2212 | (memq 'lines whitespace-active-style) |
| 2139 | (memq 'newline whitespace-active-style) | 2213 | (memq 'lines-tail whitespace-active-style) |
| 2140 | (memq 'empty whitespace-active-style) | 2214 | (memq 'newline whitespace-active-style) |
| 2141 | (memq 'indentation whitespace-active-style) | 2215 | (memq 'empty whitespace-active-style) |
| 2142 | (memq 'indentation::tab whitespace-active-style) | 2216 | (memq 'indentation whitespace-active-style) |
| 2143 | (memq 'indentation::space whitespace-active-style) | 2217 | (memq 'indentation::tab whitespace-active-style) |
| 2144 | (memq 'space-after-tab whitespace-active-style) | 2218 | (memq 'indentation::space whitespace-active-style) |
| 2145 | (memq 'space-after-tab::tab whitespace-active-style) | 2219 | (memq 'space-after-tab whitespace-active-style) |
| 2146 | (memq 'space-after-tab::space whitespace-active-style) | 2220 | (memq 'space-after-tab::tab whitespace-active-style) |
| 2147 | (memq 'space-before-tab whitespace-active-style) | 2221 | (memq 'space-after-tab::space whitespace-active-style) |
| 2148 | (memq 'space-before-tab::tab whitespace-active-style) | 2222 | (memq 'space-before-tab whitespace-active-style) |
| 2149 | (memq 'space-before-tab::space whitespace-active-style))) | 2223 | (memq 'space-before-tab::tab whitespace-active-style) |
| 2224 | (memq 'space-before-tab::space whitespace-active-style)))) | ||
| 2150 | 2225 | ||
| 2151 | 2226 | ||
| 2152 | (defun whitespace-color-on () | 2227 | (defun whitespace-color-on () |
| @@ -2204,14 +2279,16 @@ resultant list will be returned." | |||
| 2204 | (list | 2279 | (list |
| 2205 | ;; Show "long" lines | 2280 | ;; Show "long" lines |
| 2206 | (list | 2281 | (list |
| 2207 | (format | 2282 | (let ((line-column (or whitespace-line-column fill-column))) |
| 2208 | "^\\([^\t\n]\\{%s\\}\\|[^\t\n]\\{0,%s\\}\t\\)\\{%d\\}%s\\(.+\\)$" | 2283 | (format |
| 2209 | whitespace-tab-width (1- whitespace-tab-width) | 2284 | "^\\([^\t\n]\\{%s\\}\\|[^\t\n]\\{0,%s\\}\t\\)\\{%d\\}%s\\(.+\\)$" |
| 2210 | (/ whitespace-line-column whitespace-tab-width) | 2285 | whitespace-tab-width |
| 2211 | (let ((rem (% whitespace-line-column whitespace-tab-width))) | 2286 | (1- whitespace-tab-width) |
| 2212 | (if (zerop rem) | 2287 | (/ line-column whitespace-tab-width) |
| 2213 | "" | 2288 | (let ((rem (% line-column whitespace-tab-width))) |
| 2214 | (format ".\\{%d\\}" rem)))) | 2289 | (if (zerop rem) |
| 2290 | "" | ||
| 2291 | (format ".\\{%d\\}" rem))))) | ||
| 2215 | (if (memq 'lines whitespace-active-style) | 2292 | (if (memq 'lines whitespace-active-style) |
| 2216 | 0 ; whole line | 2293 | 0 ; whole line |
| 2217 | 2) ; line tail | 2294 | 2) ; line tail |