diff options
| author | Kenichi Handa | 2010-08-25 13:06:15 +0900 |
|---|---|---|
| committer | Kenichi Handa | 2010-08-25 13:06:15 +0900 |
| commit | e87480069cbb711f5ebd2a9d2592dabd8147f57a (patch) | |
| tree | 5326af592fc0066a9d0939178c33db7cf91b20fa | |
| parent | 8809a9f99783685e43e9d2215961388b20298f8b (diff) | |
| parent | 85cc3d4fd8b2642211a83baf9b59cff2f0601c0b (diff) | |
| download | emacs-e87480069cbb711f5ebd2a9d2592dabd8147f57a.tar.gz emacs-e87480069cbb711f5ebd2a9d2592dabd8147f57a.zip | |
merge trunk
| -rw-r--r-- | lisp/ChangeLog | 21 | ||||
| -rw-r--r-- | lisp/whitespace.el | 180 |
2 files changed, 148 insertions, 53 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index fcf27a8da92..ffbd38561f9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,22 @@ | |||
| 1 | 2010-08-24 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-08-24 Chong Yidong <cyd@stupidchicken.com> | 20 | 2010-08-24 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 21 | ||
| 3 | * emacs-lisp/package.el (list-packages): Alias for | 22 | * emacs-lisp/package.el (list-packages): Alias for |
| @@ -164,7 +183,7 @@ | |||
| 164 | (whitespace-post-command-hook, whitespace-display-char-on): | 183 | (whitespace-post-command-hook, whitespace-display-char-on): |
| 165 | Adjust code. | 184 | Adjust code. |
| 166 | (whitespace-looking-back, whitespace-buffer-changed): New funs. | 185 | (whitespace-looking-back, whitespace-buffer-changed): New funs. |
| 167 | (whitespace-space-regexp, whitespace-tab-regexp): Eliminate funs. | 186 | (whitespace-space-regexp, whitespace-tab-regexp): Fun eliminated. |
| 168 | 187 | ||
| 169 | 2010-08-19 Stefan Monnier <monnier@iro.umontreal.ca> | 188 | 2010-08-19 Stefan Monnier <monnier@iro.umontreal.ca> |
| 170 | 189 | ||
diff --git a/lisp/whitespace.el b/lisp/whitespace.el index 9655593893f..0ef41b5a002 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. |
| @@ -382,19 +382,28 @@ | |||
| 382 | 382 | ||
| 383 | 383 | ||
| 384 | (defcustom whitespace-style | 384 | (defcustom whitespace-style |
| 385 | '(tabs spaces trailing lines space-before-tab newline | 385 | '(face |
| 386 | indentation empty space-after-tab | 386 | tabs spaces trailing lines space-before-tab newline |
| 387 | space-mark tab-mark newline-mark) | 387 | indentation empty space-after-tab |
| 388 | space-mark tab-mark newline-mark) | ||
| 388 | "Specify which kind of blank is visualized. | 389 | "Specify which kind of blank is visualized. |
| 389 | 390 | ||
| 390 | 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: |
| 391 | 392 | ||
| 393 | face enable all visualization via faces (see below). | ||
| 394 | |||
| 392 | 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'. | ||
| 393 | 398 | ||
| 394 | 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'. | ||
| 395 | 402 | ||
| 396 | spaces SPACEs and HARD SPACEs are visualized via | 403 | spaces SPACEs and HARD SPACEs are visualized via |
| 397 | faces. | 404 | faces. |
| 405 | It has effect only if `face' (see above) | ||
| 406 | is present in `whitespace-style'. | ||
| 398 | 407 | ||
| 399 | lines lines which have columns beyond | 408 | lines lines which have columns beyond |
| 400 | `whitespace-line-column' are highlighted via | 409 | `whitespace-line-column' are highlighted via |
| @@ -402,6 +411,8 @@ It's a list containing some or all of the following values: | |||
| 402 | Whole line is highlighted. | 411 | Whole line is highlighted. |
| 403 | It has precedence over `lines-tail' (see | 412 | It has precedence over `lines-tail' (see |
| 404 | below). | 413 | below). |
| 414 | It has effect only if `face' (see above) | ||
| 415 | is present in `whitespace-style'. | ||
| 405 | 416 | ||
| 406 | lines-tail lines which have columns beyond | 417 | lines-tail lines which have columns beyond |
| 407 | `whitespace-line-column' are highlighted via | 418 | `whitespace-line-column' are highlighted via |
| @@ -409,45 +420,69 @@ It's a list containing some or all of the following values: | |||
| 409 | But only the part of line which goes | 420 | But only the part of line which goes |
| 410 | beyond `whitespace-line-column' column. | 421 | beyond `whitespace-line-column' column. |
| 411 | It has effect only if `lines' (see above) | 422 | It has effect only if `lines' (see above) |
| 412 | 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'. | ||
| 413 | 426 | ||
| 414 | 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'. | ||
| 415 | 430 | ||
| 416 | empty empty lines at beginning and/or end of buffer | 431 | empty empty lines at beginning and/or end of buffer |
| 417 | are visualized via faces. | 432 | are visualized via faces. |
| 433 | It has effect only if `face' (see above) | ||
| 434 | is present in `whitespace-style'. | ||
| 418 | 435 | ||
| 419 | indentation::tab 8 or more SPACEs at beginning of line are | 436 | indentation::tab 8 or more SPACEs at beginning of line are |
| 420 | visualized via faces. | 437 | visualized via faces. |
| 438 | It has effect only if `face' (see above) | ||
| 439 | is present in `whitespace-style'. | ||
| 421 | 440 | ||
| 422 | indentation::space TABs at beginning of line are visualized via | 441 | indentation::space TABs at beginning of line are visualized via |
| 423 | faces. | 442 | faces. |
| 443 | It has effect only if `face' (see above) | ||
| 444 | is present in `whitespace-style'. | ||
| 424 | 445 | ||
| 425 | indentation 8 or more SPACEs at beginning of line are | 446 | indentation 8 or more SPACEs at beginning of line are |
| 426 | visualized, if `indent-tabs-mode' (which see) | 447 | visualized, if `indent-tabs-mode' (which see) |
| 427 | is non-nil; otherwise, TABs at beginning of | 448 | is non-nil; otherwise, TABs at beginning of |
| 428 | 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'. | ||
| 429 | 452 | ||
| 430 | 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 |
| 431 | visualized via faces. | 454 | visualized via faces. |
| 455 | It has effect only if `face' (see above) | ||
| 456 | is present in `whitespace-style'. | ||
| 432 | 457 | ||
| 433 | space-after-tab::space TABs are visualized when 8 or more | 458 | space-after-tab::space TABs are visualized when 8 or more |
| 434 | 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'. | ||
| 435 | 462 | ||
| 436 | space-after-tab 8 or more SPACEs after a TAB are | 463 | space-after-tab 8 or more SPACEs after a TAB are |
| 437 | visualized, if `indent-tabs-mode' | 464 | visualized, if `indent-tabs-mode' |
| 438 | (which see) is non-nil; otherwise, | 465 | (which see) is non-nil; otherwise, |
| 439 | 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'. | ||
| 440 | 469 | ||
| 441 | space-before-tab::tab SPACEs before TAB are visualized via | 470 | space-before-tab::tab SPACEs before TAB are visualized via |
| 442 | faces. | 471 | faces. |
| 472 | It has effect only if `face' (see above) | ||
| 473 | is present in `whitespace-style'. | ||
| 443 | 474 | ||
| 444 | space-before-tab::space TABs are visualized when SPACEs occur | 475 | space-before-tab::space TABs are visualized when SPACEs occur |
| 445 | before TAB, via faces. | 476 | before TAB, via faces. |
| 477 | It has effect only if `face' (see above) | ||
| 478 | is present in `whitespace-style'. | ||
| 446 | 479 | ||
| 447 | space-before-tab SPACEs before TAB are visualized, if | 480 | space-before-tab SPACEs before TAB are visualized, if |
| 448 | `indent-tabs-mode' (which see) is | 481 | `indent-tabs-mode' (which see) is |
| 449 | non-nil; otherwise, the TABs are | 482 | non-nil; otherwise, the TABs are |
| 450 | visualized via faces. | 483 | visualized via faces. |
| 484 | It has effect only if `face' (see above) | ||
| 485 | is present in `whitespace-style'. | ||
| 451 | 486 | ||
| 452 | space-mark SPACEs and HARD SPACEs are visualized via | 487 | space-mark SPACEs and HARD SPACEs are visualized via |
| 453 | display table. | 488 | display table. |
| @@ -486,6 +521,11 @@ So, for example, if indentation and indentation::space are | |||
| 486 | included in `whitespace-style' list, the indentation value is | 521 | included in `whitespace-style' list, the indentation value is |
| 487 | evaluated instead of indentation::space value. | 522 | evaluated instead of indentation::space value. |
| 488 | 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 | |||
| 489 | See also `whitespace-display-mappings' for documentation." | 529 | See also `whitespace-display-mappings' for documentation." |
| 490 | :type '(repeat :tag "Kind of Blank" | 530 | :type '(repeat :tag "Kind of Blank" |
| 491 | (choice :tag "Kind of Blank Face" | 531 | (choice :tag "Kind of Blank Face" |
| @@ -521,9 +561,9 @@ Used when `whitespace-style' includes the value `spaces'." | |||
| 521 | 561 | ||
| 522 | (defface whitespace-space | 562 | (defface whitespace-space |
| 523 | '((((class color) (background dark)) | 563 | '((((class color) (background dark)) |
| 524 | (:background "grey20" :foreground "aquamarine3")) | 564 | (:background "grey20" :foreground "darkgray")) |
| 525 | (((class color) (background light)) | 565 | (((class color) (background light)) |
| 526 | (:background "LightYellow" :foreground "aquamarine3")) | 566 | (:background "LightYellow" :foreground "lightgray")) |
| 527 | (t (:inverse-video t))) | 567 | (t (:inverse-video t))) |
| 528 | "Face used to visualize SPACE." | 568 | "Face used to visualize SPACE." |
| 529 | :group 'whitespace) | 569 | :group 'whitespace) |
| @@ -539,9 +579,9 @@ Used when `whitespace-style' includes the value `spaces'." | |||
| 539 | 579 | ||
| 540 | (defface whitespace-hspace ; 'nobreak-space | 580 | (defface whitespace-hspace ; 'nobreak-space |
| 541 | '((((class color) (background dark)) | 581 | '((((class color) (background dark)) |
| 542 | (:background "grey24" :foreground "aquamarine3")) | 582 | (:background "grey24" :foreground "darkgray")) |
| 543 | (((class color) (background light)) | 583 | (((class color) (background light)) |
| 544 | (:background "LemonChiffon3" :foreground "aquamarine3")) | 584 | (:background "LemonChiffon3" :foreground "lightgray")) |
| 545 | (t (:inverse-video t))) | 585 | (t (:inverse-video t))) |
| 546 | "Face used to visualize HARD SPACE." | 586 | "Face used to visualize HARD SPACE." |
| 547 | :group 'whitespace) | 587 | :group 'whitespace) |
| @@ -557,9 +597,9 @@ Used when `whitespace-style' includes the value `tabs'." | |||
| 557 | 597 | ||
| 558 | (defface whitespace-tab | 598 | (defface whitespace-tab |
| 559 | '((((class color) (background dark)) | 599 | '((((class color) (background dark)) |
| 560 | (:background "grey22" :foreground "aquamarine3")) | 600 | (:background "grey22" :foreground "darkgray")) |
| 561 | (((class color) (background light)) | 601 | (((class color) (background light)) |
| 562 | (:background "beige" :foreground "aquamarine3")) | 602 | (:background "beige" :foreground "lightgray")) |
| 563 | (t (:inverse-video t))) | 603 | (t (:inverse-video t))) |
| 564 | "Face used to visualize TAB." | 604 | "Face used to visualize TAB." |
| 565 | :group 'whitespace) | 605 | :group 'whitespace) |
| @@ -866,8 +906,13 @@ Used when `whitespace-style' includes `space-after-tab', | |||
| 866 | (defcustom whitespace-line-column 80 | 906 | (defcustom whitespace-line-column 80 |
| 867 | "Specify column beyond which the line is highlighted. | 907 | "Specify column beyond which the line is highlighted. |
| 868 | 908 | ||
| 909 | It must be an integer or nil. If nil, the `fill-column' variable value is | ||
| 910 | used. | ||
| 911 | |||
| 869 | Used when `whitespace-style' includes `lines' or `lines-tail'." | 912 | Used when `whitespace-style' includes `lines' or `lines-tail'." |
| 870 | :type '(integer :tag "Line Length") | 913 | :type '(choice :tag "Line Length Limit" |
| 914 | (integer :tag "Line Length") | ||
| 915 | (const :tag "Use fill-column" nil)) | ||
| 871 | :group 'whitespace) | 916 | :group 'whitespace) |
| 872 | 917 | ||
| 873 | 918 | ||
| @@ -1151,7 +1196,8 @@ See also `whitespace-newline' and `whitespace-display-mappings'." | |||
| 1151 | 1196 | ||
| 1152 | 1197 | ||
| 1153 | (defconst whitespace-style-value-list | 1198 | (defconst whitespace-style-value-list |
| 1154 | '(tabs | 1199 | '(face |
| 1200 | tabs | ||
| 1155 | spaces | 1201 | spaces |
| 1156 | trailing | 1202 | trailing |
| 1157 | lines | 1203 | lines |
| @@ -1176,7 +1222,8 @@ See also `whitespace-newline' and `whitespace-display-mappings'." | |||
| 1176 | 1222 | ||
| 1177 | 1223 | ||
| 1178 | (defconst whitespace-toggle-option-alist | 1224 | (defconst whitespace-toggle-option-alist |
| 1179 | '((?t . tabs) | 1225 | '((?f . face) |
| 1226 | (?t . tabs) | ||
| 1180 | (?s . spaces) | 1227 | (?s . spaces) |
| 1181 | (?r . trailing) | 1228 | (?r . trailing) |
| 1182 | (?l . lines) | 1229 | (?l . lines) |
| @@ -1256,6 +1303,7 @@ Interactively, it reads one of the following chars: | |||
| 1256 | 1303 | ||
| 1257 | CHAR MEANING | 1304 | CHAR MEANING |
| 1258 | (VIA FACES) | 1305 | (VIA FACES) |
| 1306 | f toggle face visualization | ||
| 1259 | t toggle TAB visualization | 1307 | t toggle TAB visualization |
| 1260 | s toggle SPACE and HARD SPACE visualization | 1308 | s toggle SPACE and HARD SPACE visualization |
| 1261 | r toggle trailing blanks visualization | 1309 | r toggle trailing blanks visualization |
| @@ -1284,6 +1332,7 @@ Interactively, it reads one of the following chars: | |||
| 1284 | Non-interactively, ARG should be a symbol or a list of symbols. | 1332 | Non-interactively, ARG should be a symbol or a list of symbols. |
| 1285 | The valid symbols are: | 1333 | The valid symbols are: |
| 1286 | 1334 | ||
| 1335 | face toggle face visualization | ||
| 1287 | tabs toggle TAB visualization | 1336 | tabs toggle TAB visualization |
| 1288 | spaces toggle SPACE and HARD SPACE visualization | 1337 | spaces toggle SPACE and HARD SPACE visualization |
| 1289 | trailing toggle trailing blanks visualization | 1338 | trailing toggle trailing blanks visualization |
| @@ -1333,6 +1382,7 @@ Interactively, it accepts one of the following chars: | |||
| 1333 | 1382 | ||
| 1334 | CHAR MEANING | 1383 | CHAR MEANING |
| 1335 | (VIA FACES) | 1384 | (VIA FACES) |
| 1385 | f toggle face visualization | ||
| 1336 | t toggle TAB visualization | 1386 | t toggle TAB visualization |
| 1337 | s toggle SPACE and HARD SPACE visualization | 1387 | s toggle SPACE and HARD SPACE visualization |
| 1338 | r toggle trailing blanks visualization | 1388 | r toggle trailing blanks visualization |
| @@ -1361,6 +1411,7 @@ Interactively, it accepts one of the following chars: | |||
| 1361 | Non-interactively, ARG should be a symbol or a list of symbols. | 1411 | Non-interactively, ARG should be a symbol or a list of symbols. |
| 1362 | The valid symbols are: | 1412 | The valid symbols are: |
| 1363 | 1413 | ||
| 1414 | face toggle face visualization | ||
| 1364 | tabs toggle TAB visualization | 1415 | tabs toggle TAB visualization |
| 1365 | spaces toggle SPACE and HARD SPACE visualization | 1416 | spaces toggle SPACE and HARD SPACE visualization |
| 1366 | trailing toggle trailing blanks visualization | 1417 | trailing toggle trailing blanks visualization |
| @@ -1890,9 +1941,10 @@ cleaning up these problems." | |||
| 1890 | 1941 | ||
| 1891 | (defconst whitespace-help-text | 1942 | (defconst whitespace-help-text |
| 1892 | "\ | 1943 | "\ |
| 1893 | Whitespace Toggle Options | 1944 | Whitespace Toggle Options | scroll up : SPC or > | |
| 1894 | 1945 | | scroll down: M-SPC or < | | |
| 1895 | FACES | 1946 | FACES \\__________________________/ |
| 1947 | [] f - toggle face visualization | ||
| 1896 | [] t - toggle TAB visualization | 1948 | [] t - toggle TAB visualization |
| 1897 | [] s - toggle SPACE and HARD SPACE visualization | 1949 | [] s - toggle SPACE and HARD SPACE visualization |
| 1898 | [] r - toggle trailing blanks visualization | 1950 | [] r - toggle trailing blanks visualization |
| @@ -1966,15 +2018,13 @@ cleaning up these problems." | |||
| 1966 | "Display BUFFER in a new window." | 2018 | "Display BUFFER in a new window." |
| 1967 | (goto-char (point-min)) | 2019 | (goto-char (point-min)) |
| 1968 | (set-buffer-modified-p nil) | 2020 | (set-buffer-modified-p nil) |
| 1969 | (let ((size (- (window-height) | 2021 | (when (< (window-height) (* 2 window-min-height)) |
| 1970 | (max window-min-height | 2022 | (kill-buffer buffer) |
| 1971 | (1+ (count-lines (point-min) | 2023 | (error "Window height is too small; \ |
| 1972 | (point-max))))))) | ||
| 1973 | (when (<= size 0) | ||
| 1974 | (kill-buffer buffer) | ||
| 1975 | (error "Frame height is too small; \ | ||
| 1976 | can't split window to display whitespace toggle options")) | 2024 | can't split window to display whitespace toggle options")) |
| 1977 | (set-window-buffer (split-window nil size) buffer))) | 2025 | (let ((win (split-window))) |
| 2026 | (set-window-buffer win buffer) | ||
| 2027 | (shrink-window-if-larger-than-buffer win))) | ||
| 1978 | 2028 | ||
| 1979 | 2029 | ||
| 1980 | (defun whitespace-kill-buffer (buffer-name) | 2030 | (defun whitespace-kill-buffer (buffer-name) |
| @@ -1990,6 +2040,24 @@ can't split window to display whitespace toggle options")) | |||
| 1990 | (whitespace-kill-buffer whitespace-help-buffer-name)) | 2040 | (whitespace-kill-buffer whitespace-help-buffer-name)) |
| 1991 | 2041 | ||
| 1992 | 2042 | ||
| 2043 | (defun whitespace-help-scroll (&optional up) | ||
| 2044 | "Scroll help window, if it exists. | ||
| 2045 | |||
| 2046 | If UP is non-nil, scroll up; otherwise, scroll down." | ||
| 2047 | (condition-case data-help | ||
| 2048 | (let ((buffer (get-buffer whitespace-help-buffer-name))) | ||
| 2049 | (if buffer | ||
| 2050 | (with-selected-window (get-buffer-window buffer) | ||
| 2051 | (if up | ||
| 2052 | (scroll-up 3) | ||
| 2053 | (scroll-down 3))) | ||
| 2054 | (ding))) | ||
| 2055 | ;; handler | ||
| 2056 | ((error) | ||
| 2057 | ;; just ignore error | ||
| 2058 | ))) | ||
| 2059 | |||
| 2060 | |||
| 1993 | (defun whitespace-interactive-char (local-p) | 2061 | (defun whitespace-interactive-char (local-p) |
| 1994 | "Interactive function to read a char and return a symbol. | 2062 | "Interactive function to read a char and return a symbol. |
| 1995 | 2063 | ||
| @@ -2000,6 +2068,7 @@ It accepts one of the following chars: | |||
| 2000 | 2068 | ||
| 2001 | CHAR MEANING | 2069 | CHAR MEANING |
| 2002 | (VIA FACES) | 2070 | (VIA FACES) |
| 2071 | f toggle face visualization | ||
| 2003 | t toggle TAB visualization | 2072 | t toggle TAB visualization |
| 2004 | s toggle SPACE and HARD SPACE visualization | 2073 | s toggle SPACE and HARD SPACE visualization |
| 2005 | r toggle trailing blanks visualization | 2074 | r toggle trailing blanks visualization |
| @@ -2049,9 +2118,13 @@ See also `whitespace-toggle-option-alist'." | |||
| 2049 | (cdr | 2118 | (cdr |
| 2050 | (assq ch whitespace-toggle-option-alist))))) | 2119 | (assq ch whitespace-toggle-option-alist))))) |
| 2051 | ;; while body | 2120 | ;; while body |
| 2052 | (if (eq ch ?\?) | 2121 | (cond |
| 2053 | (whitespace-help-on style) | 2122 | ((eq ch ?\?) (whitespace-help-on style)) |
| 2054 | (ding))) | 2123 | ((eq ch ?\ ) (whitespace-help-scroll t)) |
| 2124 | ((eq ch ?\M- ) (whitespace-help-scroll)) | ||
| 2125 | ((eq ch ?>) (whitespace-help-scroll t)) | ||
| 2126 | ((eq ch ?<) (whitespace-help-scroll)) | ||
| 2127 | (t (ding)))) | ||
| 2055 | (whitespace-help-off) | 2128 | (whitespace-help-off) |
| 2056 | (message " ")) ; clean echo area | 2129 | (message " ")) ; clean echo area |
| 2057 | ;; handler | 2130 | ;; handler |
| @@ -2130,22 +2203,23 @@ resultant list will be returned." | |||
| 2130 | 2203 | ||
| 2131 | (defun whitespace-style-face-p () | 2204 | (defun whitespace-style-face-p () |
| 2132 | "Return t if there is some visualization via face." | 2205 | "Return t if there is some visualization via face." |
| 2133 | (or (memq 'tabs whitespace-active-style) | 2206 | (and (memq 'face whitespace-active-style) |
| 2134 | (memq 'spaces whitespace-active-style) | 2207 | (or (memq 'tabs whitespace-active-style) |
| 2135 | (memq 'trailing whitespace-active-style) | 2208 | (memq 'spaces whitespace-active-style) |
| 2136 | (memq 'lines whitespace-active-style) | 2209 | (memq 'trailing whitespace-active-style) |
| 2137 | (memq 'lines-tail whitespace-active-style) | 2210 | (memq 'lines whitespace-active-style) |
| 2138 | (memq 'newline whitespace-active-style) | 2211 | (memq 'lines-tail whitespace-active-style) |
| 2139 | (memq 'empty whitespace-active-style) | 2212 | (memq 'newline whitespace-active-style) |
| 2140 | (memq 'indentation whitespace-active-style) | 2213 | (memq 'empty whitespace-active-style) |
| 2141 | (memq 'indentation::tab whitespace-active-style) | 2214 | (memq 'indentation whitespace-active-style) |
| 2142 | (memq 'indentation::space whitespace-active-style) | 2215 | (memq 'indentation::tab whitespace-active-style) |
| 2143 | (memq 'space-after-tab whitespace-active-style) | 2216 | (memq 'indentation::space whitespace-active-style) |
| 2144 | (memq 'space-after-tab::tab whitespace-active-style) | 2217 | (memq 'space-after-tab whitespace-active-style) |
| 2145 | (memq 'space-after-tab::space whitespace-active-style) | 2218 | (memq 'space-after-tab::tab whitespace-active-style) |
| 2146 | (memq 'space-before-tab whitespace-active-style) | 2219 | (memq 'space-after-tab::space whitespace-active-style) |
| 2147 | (memq 'space-before-tab::tab whitespace-active-style) | 2220 | (memq 'space-before-tab whitespace-active-style) |
| 2148 | (memq 'space-before-tab::space whitespace-active-style))) | 2221 | (memq 'space-before-tab::tab whitespace-active-style) |
| 2222 | (memq 'space-before-tab::space whitespace-active-style)))) | ||
| 2149 | 2223 | ||
| 2150 | 2224 | ||
| 2151 | (defun whitespace-color-on () | 2225 | (defun whitespace-color-on () |
| @@ -2203,14 +2277,16 @@ resultant list will be returned." | |||
| 2203 | (list | 2277 | (list |
| 2204 | ;; Show "long" lines | 2278 | ;; Show "long" lines |
| 2205 | (list | 2279 | (list |
| 2206 | (format | 2280 | (let ((line-column (or whitespace-line-column fill-column))) |
| 2207 | "^\\([^\t\n]\\{%s\\}\\|[^\t\n]\\{0,%s\\}\t\\)\\{%d\\}%s\\(.+\\)$" | 2281 | (format |
| 2208 | whitespace-tab-width (1- whitespace-tab-width) | 2282 | "^\\([^\t\n]\\{%s\\}\\|[^\t\n]\\{0,%s\\}\t\\)\\{%d\\}%s\\(.+\\)$" |
| 2209 | (/ whitespace-line-column whitespace-tab-width) | 2283 | whitespace-tab-width |
| 2210 | (let ((rem (% whitespace-line-column whitespace-tab-width))) | 2284 | (1- whitespace-tab-width) |
| 2211 | (if (zerop rem) | 2285 | (/ line-column whitespace-tab-width) |
| 2212 | "" | 2286 | (let ((rem (% line-column whitespace-tab-width))) |
| 2213 | (format ".\\{%d\\}" rem)))) | 2287 | (if (zerop rem) |
| 2288 | "" | ||
| 2289 | (format ".\\{%d\\}" rem))))) | ||
| 2214 | (if (memq 'lines whitespace-active-style) | 2290 | (if (memq 'lines whitespace-active-style) |
| 2215 | 0 ; whole line | 2291 | 0 ; whole line |
| 2216 | 2) ; line tail | 2292 | 2) ; line tail |