aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVinicius Jose Latorre2008-04-26 11:38:50 +0000
committerVinicius Jose Latorre2008-04-26 11:38:50 +0000
commitae68f2d88c49dc668e9cbeaf141b45c0c9753347 (patch)
treedee131b24f1fb42c820e34341e10aff84bc251dd
parent01388a3dd2bb36ab8deeb59f62b35a47688ea22a (diff)
downloademacs-ae68f2d88c49dc668e9cbeaf141b45c0c9753347.tar.gz
emacs-ae68f2d88c49dc668e9cbeaf141b45c0c9753347.zip
New version 11.0.
-rw-r--r--lisp/ChangeLog33
-rw-r--r--lisp/whitespace.el554
2 files changed, 293 insertions, 294 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 5fac8b80a67..190d51d4621 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,36 @@
12008-04-26 Vinicius Jose Latorre <viniciusjl@ig.com.br>
2
3 * whitespace.el: There is now only one variable (whitespace-style) to
4 specify which kind of blank is visualized. Doc and docstring fix. New
5 version 11.0.
6 (whitespace-style): New option, replace whitespace-style-mark and
7 whitespace-style-color.
8 (whitespace-style-mark, whitespace-style-color): Options removed.
9 (whitespace-hspace, whitespace-tab, whitespace-newline)
10 (whitespace-trailing, whitespace-line, whitespace-space-before-tab)
11 (whitespace-indentation, whitespace-empty, whitespace-space-after-tab)
12 (whitespace-hspace-regexp, whitespace-space-regexp)
13 (whitespace-tab-regexp, whitespace-trailing-regexp)
14 (whitespace-space-before-tab-regexp, whitespace-indentation-regexp)
15 (whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp)
16 (whitespace-space-after-tab-regexp, whitespace-line-column)
17 (whitespace-display-mappings, whitespace-report): Docstring fix.
18 (whitespace-color-value-list, whitespace-mark-value-list)
19 (whitespace-active-color, whitespace-active-mark)
20 (whitespace-toggle-color, whitespace-toggle-mark): Vars removed.
21 (whitespace-style-value-list, whitespace-active-style)
22 (whitespace-toggle-style): New vars.
23 (whitespace-toggle-option-alist, whitespace-help-text): Var
24 initialization and docstring fix.
25 (whitespace-toggle-options, global-whitespace-toggle-options)
26 (whitespace-cleanup, whitespace-cleanup-region)
27 (whitespace-report-region, whitespace-interactive-char)
28 (whitespace-toggle-list): Docstring and code fix.
29 (whitespace-insert-option-mark, whitespace-help-on, whitespace-turn-on)
30 (whitespace-turn-off, whitespace-color-on, whitespace-color-off)
31 (whitespace-display-char-on, whitespace-display-char-off): Code fix.
32 (whitespace-style-face-p, whitespace-style-mark-p): New fun.
33
12008-04-26 Stefan Monnier <monnier@iro.umontreal.ca> 342008-04-26 Stefan Monnier <monnier@iro.umontreal.ca>
2 35
3 * diff-mode.el (diff-hunk-header-re-unified): Allow elided line counts. 36 * diff-mode.el (diff-hunk-header-re-unified): Allow elided line counts.
diff --git a/lisp/whitespace.el b/lisp/whitespace.el
index 326621e9c4c..25b2f9fc4e5 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: 10.0 9;; Version: 11.0
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.
@@ -46,8 +46,8 @@
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 `whitespace-style-mark' and `whitespace-style-color' variables 49;; The `whitespace-style' variable is used to select which way should
50;; are used to select which way should be used to visualize blanks. 50;; be used to visualize blanks.
51;; 51;;
52;; Note that when whitespace is turned on, whitespace saves the 52;; Note that when whitespace is turned on, whitespace 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
@@ -178,41 +178,39 @@
178;; 178;;
179;; 1. empty lines at beginning of buffer. 179;; 1. empty lines at beginning of buffer.
180;; 2. empty lines at end of buffer. 180;; 2. empty lines at end of buffer.
181;; If `whitespace-style-color' includes the value `empty', remove 181;; If `whitespace-style' includes the value `empty', remove all
182;; all empty lines at beginning and/or end of buffer. 182;; empty lines at beginning and/or end of buffer.
183;; 183;;
184;; 3. 8 or more SPACEs at beginning of line. 184;; 3. 8 or more SPACEs at beginning of line.
185;; If `whitespace-style-color' includes the value `indentation': 185;; If `whitespace-style' includes the value `indentation':
186;; replace 8 or more SPACEs at beginning of line by TABs, if 186;; replace 8 or more SPACEs at beginning of line by TABs, if
187;; `indent-tabs-mode' is non-nil; otherwise, replace TABs by 187;; `indent-tabs-mode' is non-nil; otherwise, replace TABs by
188;; SPACEs. 188;; SPACEs.
189;; If `whitespace-style-color' includes the value 189;; If `whitespace-style' includes the value `indentation::tab',
190;; `indentation::tab', replace 8 or more SPACEs at beginning of line 190;; replace 8 or more SPACEs at beginning of line by TABs.
191;; by TABs. 191;; If `whitespace-style' includes the value `indentation::space',
192;; If `whitespace-style-color' includes the value 192;; replace TABs by SPACEs.
193;; `indentation::space', replace TABs by SPACEs.
194;; 193;;
195;; 4. SPACEs before TAB. 194;; 4. SPACEs before TAB.
196;; If `whitespace-style-color' includes the value 195;; If `whitespace-style' includes the value `space-before-tab':
197;; `space-before-tab': replace SPACEs by TABs, if 196;; replace SPACEs by TABs, if `indent-tabs-mode' is non-nil;
198;; `indent-tabs-mode' is non-nil; otherwise, replace TABs by 197;; otherwise, replace TABs by SPACEs.
199;; SPACEs. 198;; If `whitespace-style' includes the value
200;; If `whitespace-style-color' includes the value
201;; `space-before-tab::tab', replace SPACEs by TABs. 199;; `space-before-tab::tab', replace SPACEs by TABs.
202;; If `whitespace-style-color' includes the value 200;; If `whitespace-style' includes the value
203;; `space-before-tab::space', replace TABs by SPACEs. 201;; `space-before-tab::space', replace TABs by SPACEs.
204;; 202;;
205;; 5. SPACEs or TABs at end of line. 203;; 5. SPACEs or TABs at end of line.
206;; If `whitespace-style-color' includes the value `trailing', 204;; If `whitespace-style' includes the value `trailing', remove all
207;; remove all SPACEs or TABs at end of line. 205;; SPACEs or TABs at end of line.
208;; 206;;
209;; 6. 8 or more SPACEs after TAB. 207;; 6. 8 or more SPACEs after TAB.
210;; If `whitespace-style-color' includes the value 208;; If `whitespace-style' includes the value `space-after-tab':
211;; `space-after-tab': replace SPACEs by TABs, if `indent-tabs-mode' 209;; replace SPACEs by TABs, if `indent-tabs-mode' is non-nil;
212;; is non-nil; otherwise, replace TABs by SPACEs. 210;; otherwise, replace TABs by SPACEs.
213;; If `whitespace-style-color' includes the value 211;; If `whitespace-style' includes the value `space-after-tab::tab',
214;; `space-after-tab::tab', replace SPACEs by TABs. 212;; replace SPACEs by TABs.
215;; If `whitespace-style-color' includes the value 213;; If `whitespace-style' includes the value
216;; `space-after-tab::space', replace TABs by SPACEs. 214;; `space-after-tab::space', replace TABs by SPACEs.
217;; 215;;
218;; 216;;
@@ -237,11 +235,8 @@
237;; Below it's shown a brief description of whitespace options, please, 235;; Below it's shown a brief description of whitespace options, please,
238;; see the options declaration in the code for a long documentation. 236;; see the options declaration in the code for a long documentation.
239;; 237;;
240;; `whitespace-style-mark' Specify which kind of blank is 238;; `whitespace-style' Specify which kind of blank is
241;; visualized via display table. 239;; visualized.
242;;
243;; `whitespace-style-color' Specify which kind of blank is
244;; visualized via faces.
245;; 240;;
246;; `whitespace-space' Face used to visualize SPACE. 241;; `whitespace-space' Face used to visualize SPACE.
247;; 242;;
@@ -374,103 +369,91 @@
374 :group 'data) 369 :group 'data)
375 370
376 371
377(defcustom whitespace-style-mark '(space-mark tab-mark newline-mark) 372(defcustom whitespace-style
378 "*Specify which kind of blank is visualized via display table.
379
380It's a list containing some or all of the following values:
381
382 space-mark SPACEs and HARD SPACEs are visualized.
383
384 tab-mark TABs are visualized.
385
386 newline-mark NEWLINEs are visualized.
387
388Any other value is ignored.
389
390If nil, don't visualize TABs, (HARD) SPACEs and NEWLINEs via display
391table.
392
393See also `whitespace-display-mappings' for documentation."
394 :type '(repeat :tag "Kind of Blank Mark"
395 (choice :tag "Kind of Blank Mark"
396 (const :tag "SPACEs and HARD SPACEs"
397 space-mark)
398 (const :tag "TABs" tab-mark)
399 (const :tag "NEWLINEs" newline-mark)))
400 :group 'whitespace)
401
402
403(defcustom whitespace-style-color
404 '(tabs spaces trailing lines space-before-tab newline 373 '(tabs spaces trailing lines space-before-tab newline
405 indentation empty space-after-tab) 374 indentation empty space-after-tab
406 "*Specify which kind of blank is visualized via faces. 375 space-mark tab-mark newline-mark)
376 "*Specify which kind of blank is visualized.
407 377
408It's a list containing some or all of the following values: 378It's a list containing some or all of the following values:
409 379
410 trailing trailing blanks are visualized. 380 trailing trailing blanks are visualized via faces.
411 381
412 tabs TABs are visualized. 382 tabs TABs are visualized via faces.
413 383
414 spaces SPACEs and HARD SPACEs are visualized. 384 spaces SPACEs and HARD SPACEs are visualized via
385 faces.
415 386
416 lines lines whose have columns beyond 387 lines lines whose have columns beyond
417 `whitespace-line-column' are highlighted. 388 `whitespace-line-column' are highlighted via
389 faces .
418 Whole line is highlighted. 390 Whole line is highlighted.
419 It has precedence over 391 It has precedence over `lines-tail' (see
420 `lines-tail' (see below). 392 below).
421 393
422 lines-tail lines whose have columns beyond 394 lines-tail lines whose have columns beyond
423 `whitespace-line-column' are highlighted. 395 `whitespace-line-column' are highlighted via
396 faces.
424 But only the part of line which goes 397 But only the part of line which goes
425 beyond `whitespace-line-column' column. 398 beyond `whitespace-line-column' column.
426 It has effect only if `lines' (see above) 399 It has effect only if `lines' (see above)
427 is not present in `whitespace-style-color'. 400 is not present in `whitespace-style'.
428 401
429 newline NEWLINEs are visualized. 402 newline NEWLINEs are visualized via faces.
430 403
431 empty empty lines at beginning and/or end of buffer 404 empty empty lines at beginning and/or end of buffer
432 are visualized. 405 are visualized via faces.
433 406
434 indentation::tab 8 or more SPACEs at beginning of line are 407 indentation::tab 8 or more SPACEs at beginning of line are
435 visualized. 408 visualized via faces.
436 409
437 indentation::space TABs at beginning of line are visualized. 410 indentation::space TABs at beginning of line are visualized via
411 faces.
438 412
439 indentation 8 or more SPACEs at beginning of line are 413 indentation 8 or more SPACEs at beginning of line are
440 visualized, if `indent-tabs-mode' (which see) 414 visualized, if `indent-tabs-mode' (which see)
441 is non-nil; otherwise, TABs at beginning of 415 is non-nil; otherwise, TABs at beginning of
442 line are visualized. 416 line are visualized via faces.
443 417
444 space-after-tab::tab 8 or more SPACEs after a TAB are 418 space-after-tab::tab 8 or more SPACEs after a TAB are
445 visualized. 419 visualized via faces.
446 420
447 space-after-tab::space TABs are visualized when occurs 8 or 421 space-after-tab::space TABs are visualized when occurs 8 or
448 more SPACEs after a TAB. 422 more SPACEs after a TAB via faces.
449 423
450 space-after-tab 8 or more SPACEs after a TAB are 424 space-after-tab 8 or more SPACEs after a TAB are
451 visualized, if `indent-tabs-mode' 425 visualized, if `indent-tabs-mode'
452 (which see) is non-nil; otherwise, 426 (which see) is non-nil; otherwise,
453 the TABs are visualized. 427 the TABs are visualized via faces.
454 428
455 space-before-tab::tab SPACEs before TAB are visualized. 429 space-before-tab::tab SPACEs before TAB are visualized via
430 faces.
456 431
457 space-before-tab::space TABs are visualized when occurs SPACEs 432 space-before-tab::space TABs are visualized when occurs SPACEs
458 before TAB. 433 before TAB via faces.
459 434
460 space-before-tab SPACEs before TAB are visualized, if 435 space-before-tab SPACEs before TAB are visualized, if
461 `indent-tabs-mode' (which see) is 436 `indent-tabs-mode' (which see) is
462 non-nil; otherwise, the TABs are 437 non-nil; otherwise, the TABs are
463 visualized. 438 visualized via faces.
439
440 space-mark SPACEs and HARD SPACEs are visualized via
441 display table.
442
443 tab-mark TABs are visualized via display table.
444
445 newline-mark NEWLINEs are visualized via display table.
464 446
465Any other value is ignored. 447Any other value is ignored.
466 448
467If nil, don't visualize TABs, (HARD) SPACEs and NEWLINEs via faces. 449If nil, don't visualize TABs, (HARD) SPACEs and NEWLINEs via faces and
450via display table.
468 451
469There is an evaluation order for some values, if some values are 452There is an evaluation order for some values, if some values are
470included in `whitespace-style-color' list. For example, if 453included in `whitespace-style' list. For example, if
471indentation, indentation::tab and/or indentation::space are 454indentation, indentation::tab and/or indentation::space are
472included in `whitespace-style-color' list. The evaluation order 455included in `whitespace-style' list. The evaluation order for
473for these values is: 456these values is:
474 457
475 * For indentation: 458 * For indentation:
476 1. indentation 459 1. indentation
@@ -488,30 +471,38 @@ for these values is:
488 3. space-before-tab::space 471 3. space-before-tab::space
489 472
490So, for example, if indentation and indentation::space are 473So, for example, if indentation and indentation::space are
491included in `whitespace-style-color' list, the indentation value 474included in `whitespace-style' list, the indentation value is
492is evaluated instead of indentation::space value." 475evaluated instead of indentation::space value.
493 :type '(repeat :tag "Kind of Blank Face" 476
477See also `whitespace-display-mappings' for documentation."
478 :type '(repeat :tag "Kind of Blank"
494 (choice :tag "Kind of Blank Face" 479 (choice :tag "Kind of Blank Face"
495 (const :tag "Trailing TABs, SPACEs and HARD SPACEs" 480 (const :tag "(Face) Trailing TABs, SPACEs and HARD SPACEs"
496 trailing) 481 trailing)
497 (const :tag "SPACEs and HARD SPACEs" spaces) 482 (const :tag "(Face) SPACEs and HARD SPACEs"
498 (const :tag "TABs" tabs) 483 spaces)
499 (const :tag "Lines" lines) 484 (const :tag "(Face) TABs" tabs)
500 (const :tag "SPACEs before TAB" 485 (const :tag "(Face) Lines" lines)
486 (const :tag "(Face) SPACEs before TAB"
501 space-before-tab) 487 space-before-tab)
502 (const :tag "NEWLINEs" newline) 488 (const :tag "(Face) NEWLINEs" newline)
503 (const :tag "Indentation SPACEs" indentation) 489 (const :tag "(Face) Indentation SPACEs"
504 (const :tag "Empty Lines At BOB And/Or EOB" 490 indentation)
491 (const :tag "(Face) Empty Lines At BOB And/Or EOB"
505 empty) 492 empty)
506 (const :tag "SPACEs after TAB" 493 (const :tag "(Face) SPACEs after TAB"
507 space-after-tab))) 494 space-after-tab)
495 (const :tag "(Mark) SPACEs and HARD SPACEs"
496 space-mark)
497 (const :tag "(Mark) TABs" tab-mark)
498 (const :tag "(Mark) NEWLINEs" newline-mark)))
508 :group 'whitespace) 499 :group 'whitespace)
509 500
510 501
511(defcustom whitespace-space 'whitespace-space 502(defcustom whitespace-space 'whitespace-space
512 "*Symbol face used to visualize SPACE. 503 "*Symbol face used to visualize SPACE.
513 504
514Used when `whitespace-style-color' includes the value `spaces'." 505Used when `whitespace-style' includes the value `spaces'."
515 :type 'face 506 :type 'face
516 :group 'whitespace) 507 :group 'whitespace)
517 508
@@ -529,7 +520,7 @@ Used when `whitespace-style-color' includes the value `spaces'."
529(defcustom whitespace-hspace 'whitespace-hspace 520(defcustom whitespace-hspace 'whitespace-hspace
530 "*Symbol face used to visualize HARD SPACE. 521 "*Symbol face used to visualize HARD SPACE.
531 522
532Used when `whitespace-style-color' includes the value `spaces'." 523Used when `whitespace-style' includes the value `spaces'."
533 :type 'face 524 :type 'face
534 :group 'whitespace) 525 :group 'whitespace)
535 526
@@ -547,7 +538,7 @@ Used when `whitespace-style-color' includes the value `spaces'."
547(defcustom whitespace-tab 'whitespace-tab 538(defcustom whitespace-tab 'whitespace-tab
548 "*Symbol face used to visualize TAB. 539 "*Symbol face used to visualize TAB.
549 540
550Used when `whitespace-style-color' includes the value `tabs'." 541Used when `whitespace-style' includes the value `tabs'."
551 :type 'face 542 :type 'face
552 :group 'whitespace) 543 :group 'whitespace)
553 544
@@ -567,8 +558,8 @@ Used when `whitespace-style-color' includes the value `tabs'."
567 558
568See `whitespace-display-mappings'. 559See `whitespace-display-mappings'.
569 560
570Used when `whitespace-style-mark' includes the values `newline-mark' 561Used when `whitespace-style' includes the values `newline-mark'
571and `whitespace-style-color' includes `newline'." 562and `newline'."
572 :type 'face 563 :type 'face
573 :group 'whitespace) 564 :group 'whitespace)
574 565
@@ -588,7 +579,7 @@ See `whitespace-display-mappings'."
588(defcustom whitespace-trailing 'whitespace-trailing 579(defcustom whitespace-trailing 'whitespace-trailing
589 "*Symbol face used to visualize traling blanks. 580 "*Symbol face used to visualize traling blanks.
590 581
591Used when `whitespace-style-color' includes the value `trailing'." 582Used when `whitespace-style' includes the value `trailing'."
592 :type 'face 583 :type 'face
593 :group 'whitespace) 584 :group 'whitespace)
594 585
@@ -605,7 +596,7 @@ Used when `whitespace-style-color' includes the value `trailing'."
605 596
606See `whitespace-line-column'. 597See `whitespace-line-column'.
607 598
608Used when `whitespace-style-color' includes the value `line'." 599Used when `whitespace-style' includes the value `line'."
609 :type 'face 600 :type 'face
610 :group 'whitespace) 601 :group 'whitespace)
611 602
@@ -622,7 +613,7 @@ See `whitespace-line-column'."
622(defcustom whitespace-space-before-tab 'whitespace-space-before-tab 613(defcustom whitespace-space-before-tab 'whitespace-space-before-tab
623 "*Symbol face used to visualize SPACEs before TAB. 614 "*Symbol face used to visualize SPACEs before TAB.
624 615
625Used when `whitespace-style-color' includes the value `space-before-tab'." 616Used when `whitespace-style' includes the value `space-before-tab'."
626 :type 'face 617 :type 'face
627 :group 'whitespace) 618 :group 'whitespace)
628 619
@@ -637,7 +628,7 @@ Used when `whitespace-style-color' includes the value `space-before-tab'."
637(defcustom whitespace-indentation 'whitespace-indentation 628(defcustom whitespace-indentation 'whitespace-indentation
638 "*Symbol face used to visualize 8 or more SPACEs at beginning of line. 629 "*Symbol face used to visualize 8 or more SPACEs at beginning of line.
639 630
640Used when `whitespace-style-color' includes the value `indentation'." 631Used when `whitespace-style' includes the value `indentation'."
641 :type 'face 632 :type 'face
642 :group 'whitespace) 633 :group 'whitespace)
643 634
@@ -652,7 +643,7 @@ Used when `whitespace-style-color' includes the value `indentation'."
652(defcustom whitespace-empty 'whitespace-empty 643(defcustom whitespace-empty 'whitespace-empty
653 "*Symbol face used to visualize empty lines at beginning and/or end of buffer. 644 "*Symbol face used to visualize empty lines at beginning and/or end of buffer.
654 645
655Used when `whitespace-style-color' includes the value `empty'." 646Used when `whitespace-style' includes the value `empty'."
656 :type 'face 647 :type 'face
657 :group 'whitespace) 648 :group 'whitespace)
658 649
@@ -667,7 +658,7 @@ Used when `whitespace-style-color' includes the value `empty'."
667(defcustom whitespace-space-after-tab 'whitespace-space-after-tab 658(defcustom whitespace-space-after-tab 'whitespace-space-after-tab
668 "*Symbol face used to visualize 8 or more SPACEs after TAB. 659 "*Symbol face used to visualize 8 or more SPACEs after TAB.
669 660
670Used when `whitespace-style-color' includes the value `space-after-tab'." 661Used when `whitespace-style' includes the value `space-after-tab'."
671 :type 'face 662 :type 'face
672 :group 'whitespace) 663 :group 'whitespace)
673 664
@@ -703,7 +694,7 @@ visualize only HARD SPACEs between TABs.
703NOTE: Enclose always by \\\\( and \\\\) the elements to highlight. 694NOTE: Enclose always by \\\\( and \\\\) the elements to highlight.
704 Use exactly one pair of enclosing \\\\( and \\\\). 695 Use exactly one pair of enclosing \\\\( and \\\\).
705 696
706Used when `whitespace-style-color' includes `spaces'." 697Used when `whitespace-style' includes `spaces'."
707 :type '(regexp :tag "HARD SPACE Chars") 698 :type '(regexp :tag "HARD SPACE Chars")
708 :group 'whitespace) 699 :group 'whitespace)
709 700
@@ -725,7 +716,7 @@ visualize leading and/or trailing SPACEs.
725NOTE: Enclose always by \\\\( and \\\\) the elements to highlight. 716NOTE: Enclose always by \\\\( and \\\\) the elements to highlight.
726 Use exactly one pair of enclosing \\\\( and \\\\). 717 Use exactly one pair of enclosing \\\\( and \\\\).
727 718
728Used when `whitespace-style-color' includes `spaces'." 719Used when `whitespace-style' includes `spaces'."
729 :type '(regexp :tag "SPACE Chars") 720 :type '(regexp :tag "SPACE Chars")
730 :group 'whitespace) 721 :group 'whitespace)
731 722
@@ -747,7 +738,7 @@ visualize leading and/or trailing TABs.
747NOTE: Enclose always by \\\\( and \\\\) the elements to highlight. 738NOTE: Enclose always by \\\\( and \\\\) the elements to highlight.
748 Use exactly one pair of enclosing \\\\( and \\\\). 739 Use exactly one pair of enclosing \\\\( and \\\\).
749 740
750Used when `whitespace-style-color' includes `tabs'." 741Used when `whitespace-style' includes `tabs'."
751 :type '(regexp :tag "TAB Chars") 742 :type '(regexp :tag "TAB Chars")
752 :group 'whitespace) 743 :group 'whitespace)
753 744
@@ -767,7 +758,7 @@ NOTE: DO NOT enclose by \\\\( and \\\\) the elements to highlight.
767 `whitespace-mode' surrounds this regexp by \"\\\\(\\\\(\" and 758 `whitespace-mode' surrounds this regexp by \"\\\\(\\\\(\" and
768 \"\\\\)+\\\\)$\". 759 \"\\\\)+\\\\)$\".
769 760
770Used when `whitespace-style-color' includes `trailing'." 761Used when `whitespace-style' includes `trailing'."
771 :type '(regexp :tag "Trailing Chars") 762 :type '(regexp :tag "Trailing Chars")
772 :group 'whitespace) 763 :group 'whitespace)
773 764
@@ -782,7 +773,7 @@ If you're using `mule' package, there may be other characters besides:
782 773
783that should be considered blank. 774that should be considered blank.
784 775
785Used when `whitespace-style-color' includes `space-before-tab', 776Used when `whitespace-style' includes `space-before-tab',
786`space-before-tab::tab' or `space-before-tab::space'." 777`space-before-tab::tab' or `space-before-tab::space'."
787 :type '(regexp :tag "SPACEs Before TAB") 778 :type '(regexp :tag "SPACEs Before TAB")
788 :group 'whitespace) 779 :group 'whitespace)
@@ -803,7 +794,7 @@ If you're using `mule' package, there may be other characters besides:
803 794
804that should be considered blank. 795that should be considered blank.
805 796
806Used when `whitespace-style-color' includes `indentation', 797Used when `whitespace-style' includes `indentation',
807`indentation::tab' or `indentation::space'." 798`indentation::tab' or `indentation::space'."
808 :type '(cons (regexp :tag "Indentation SPACEs") 799 :type '(cons (regexp :tag "Indentation SPACEs")
809 (regexp :tag "Indentation TABs")) 800 (regexp :tag "Indentation TABs"))
@@ -820,7 +811,7 @@ If you're using `mule' package, there may be other characters besides:
820 811
821that should be considered blank. 812that should be considered blank.
822 813
823Used when `whitespace-style-color' includes `empty'." 814Used when `whitespace-style' includes `empty'."
824 :type '(regexp :tag "Empty Lines At Beginning Of Buffer") 815 :type '(regexp :tag "Empty Lines At Beginning Of Buffer")
825 :group 'whitespace) 816 :group 'whitespace)
826 817
@@ -835,7 +826,7 @@ If you're using `mule' package, there may be other characters besides:
835 826
836that should be considered blank. 827that should be considered blank.
837 828
838Used when `whitespace-style-color' includes `empty'." 829Used when `whitespace-style' includes `empty'."
839 :type '(regexp :tag "Empty Lines At End Of Buffer") 830 :type '(regexp :tag "Empty Lines At End Of Buffer")
840 :group 'whitespace) 831 :group 'whitespace)
841 832
@@ -855,7 +846,7 @@ If you're using `mule' package, there may be other characters besides:
855 846
856that should be considered blank. 847that should be considered blank.
857 848
858Used when `whitespace-style-color' includes `space-after-tab', 849Used when `whitespace-style' includes `space-after-tab',
859`space-after-tab::tab' or `space-after-tab::space'." 850`space-after-tab::tab' or `space-after-tab::space'."
860 :type '(regexp :tag "SPACEs After TAB") 851 :type '(regexp :tag "SPACEs After TAB")
861 :group 'whitespace) 852 :group 'whitespace)
@@ -864,7 +855,7 @@ Used when `whitespace-style-color' includes `space-after-tab',
864(defcustom whitespace-line-column 80 855(defcustom whitespace-line-column 80
865 "*Specify column beyond which the line is highlighted. 856 "*Specify column beyond which the line is highlighted.
866 857
867Used when `whitespace-style-color' includes `lines' or `lines-tail'." 858Used when `whitespace-style' includes `lines' or `lines-tail'."
868 :type '(integer :tag "Line Length") 859 :type '(integer :tag "Line Length")
869 :group 'whitespace) 860 :group 'whitespace)
870 861
@@ -920,7 +911,8 @@ VECTOR is a vector of characters to be displayed in place of CHAR.
920The NEWLINE character is displayed using the face given by 911The NEWLINE character is displayed using the face given by
921`whitespace-newline' variable. 912`whitespace-newline' variable.
922 913
923Used when `whitespace-style-mark' is non-nil." 914Used when `whitespace-style' includes `tab-mark', `space-mark' or
915`newline-mark'."
924 :type '(repeat 916 :type '(repeat
925 (list :tag "Character Mapping" 917 (list :tag "Character Mapping"
926 (choice :tag "Char Kind" 918 (choice :tag "Char Kind"
@@ -983,7 +975,7 @@ It's a list containing some or all of the following values:
983 when local whitespace is turned on. 975 when local whitespace is turned on.
984 976
985 auto-cleanup cleanup any bogus whitespace when buffer is 977 auto-cleanup cleanup any bogus whitespace when buffer is
986 written or killed. 978 written or killed.
987 See `whitespace-cleanup' and 979 See `whitespace-cleanup' and
988 `whitespace-cleanup-region'. 980 `whitespace-cleanup-region'.
989 981
@@ -1090,7 +1082,7 @@ Only useful with a windowing system."
1090;;;; User commands - Toggle 1082;;;; User commands - Toggle
1091 1083
1092 1084
1093(defconst whitespace-color-value-list 1085(defconst whitespace-style-value-list
1094 '(tabs 1086 '(tabs
1095 spaces 1087 spaces
1096 trailing 1088 trailing
@@ -1107,21 +1099,16 @@ Only useful with a windowing system."
1107 space-before-tab 1099 space-before-tab
1108 space-before-tab::tab 1100 space-before-tab::tab
1109 space-before-tab::space 1101 space-before-tab::space
1110 ) 1102 help-newline ; value used by `whitespace-insert-option-mark'
1111 "List of valid `whitespace-style-color' values.") 1103 tab-mark
1112
1113
1114(defconst whitespace-mark-value-list
1115 '(tab-mark
1116 space-mark 1104 space-mark
1117 newline-mark 1105 newline-mark
1118 ) 1106 )
1119 "List of valid `whitespace-style-mark' values.") 1107 "List of valid `whitespace-style' values.")
1120 1108
1121 1109
1122(defconst whitespace-toggle-option-alist 1110(defconst whitespace-toggle-option-alist
1123 '( ;; `whitespace-color-value-list' values 1111 '((?t . tabs)
1124 (?t . tabs)
1125 (?s . spaces) 1112 (?s . spaces)
1126 (?r . trailing) 1113 (?r . trailing)
1127 (?l . lines) 1114 (?l . lines)
@@ -1137,13 +1124,10 @@ Only useful with a windowing system."
1137 (?\C-b . space-before-tab) 1124 (?\C-b . space-before-tab)
1138 (?B . space-before-tab::tab) 1125 (?B . space-before-tab::tab)
1139 (?b . space-before-tab::space) 1126 (?b . space-before-tab::space)
1140 ;; `whitespace-mark-value-list' values
1141 (?T . tab-mark) 1127 (?T . tab-mark)
1142 (?S . space-mark) 1128 (?S . space-mark)
1143 (?N . newline-mark) 1129 (?N . newline-mark)
1144 ;; restore values 1130 (?x . whitespace-style)
1145 (?x . whitespace-style-color)
1146 (?z . whitespace-style-mark)
1147 ) 1131 )
1148 "Alist of toggle options. 1132 "Alist of toggle options.
1149 1133
@@ -1156,15 +1140,11 @@ Where:
1156CHAR is a char which the user will have to type. 1140CHAR is a char which the user will have to type.
1157 1141
1158SYMBOL is a valid symbol associated with CHAR. 1142SYMBOL is a valid symbol associated with CHAR.
1159 See `whitespace-color-value-list' and 1143 See `whitespace-style-value-list'.")
1160 `whitespace-mark-value-list'.")
1161
1162 1144
1163(defvar whitespace-active-color nil
1164 "Used to save locally `whitespace-style-color' value.")
1165 1145
1166(defvar whitespace-active-mark nil 1146(defvar whitespace-active-style nil
1167 "Used to save locally `whitespace-style-mark' value.") 1147 "Used to save locally `whitespace-style' value.")
1168 1148
1169(defvar whitespace-indent-tabs-mode indent-tabs-mode 1149(defvar whitespace-indent-tabs-mode indent-tabs-mode
1170 "Used to save locally `indent-tabs-mode' value.") 1150 "Used to save locally `indent-tabs-mode' value.")
@@ -1209,8 +1189,7 @@ Interactively, it reads one of the following chars:
1209 S toggle SPACEs before TAB visualization 1189 S toggle SPACEs before TAB visualization
1210 N toggle NEWLINE visualization 1190 N toggle NEWLINE visualization
1211 1191
1212 x restore `whitespace-style-color' value 1192 x restore `whitespace-style' value
1213 z restore `whitespace-style-mark' value
1214 ? display brief help 1193 ? display brief help
1215 1194
1216Non-interactively, ARG should be a symbol or a list of symbols. 1195Non-interactively, ARG should be a symbol or a list of symbols.
@@ -1237,30 +1216,20 @@ The valid symbols are:
1237 space-mark toggle SPACEs before TAB visualization 1216 space-mark toggle SPACEs before TAB visualization
1238 newline-mark toggle NEWLINE visualization 1217 newline-mark toggle NEWLINE visualization
1239 1218
1240 whitespace-style-color restore `whitespace-style-color' value 1219 whitespace-style restore `whitespace-style' value
1241 whitespace-style-mark restore `whitespace-style-mark' value
1242 1220
1243Only useful with a windowing system. 1221Only useful with a windowing system.
1244 1222
1245See `whitespace-style-color', `whitespace-style-mark' and 1223See `whitespace-style' and `indent-tabs-mode' for documentation."
1246`indent-tabs-mode' for documentation."
1247 (interactive (whitespace-interactive-char t)) 1224 (interactive (whitespace-interactive-char t))
1248 (let ((whitespace-style-color 1225 (let ((whitespace-style
1249 (whitespace-toggle-list 1226 (whitespace-toggle-list t arg whitespace-active-style)))
1250 t arg whitespace-active-color whitespace-style-color
1251 'whitespace-style-color whitespace-color-value-list))
1252 (whitespace-style-mark
1253 (whitespace-toggle-list
1254 t arg whitespace-active-mark whitespace-style-mark
1255 'whitespace-style-mark whitespace-mark-value-list)))
1256 (whitespace-mode 0) 1227 (whitespace-mode 0)
1257 (whitespace-mode 1))) 1228 (whitespace-mode 1)))
1258 1229
1259 1230
1260(defvar whitespace-toggle-color nil 1231(defvar whitespace-toggle-style nil
1261 "Used to toggle the global `whitespace-style-color' value.") 1232 "Used to toggle the global `whitespace-style' value.")
1262(defvar whitespace-toggle-mark nil
1263 "Used to toggle the global `whitespace-style-mark' value.")
1264 1233
1265 1234
1266;;;###autoload 1235;;;###autoload
@@ -1299,8 +1268,7 @@ Interactively, it accepts one of the following chars:
1299 S toggle SPACEs before TAB visualization 1268 S toggle SPACEs before TAB visualization
1300 N toggle NEWLINE visualization 1269 N toggle NEWLINE visualization
1301 1270
1302 x restore `whitespace-style-color' value 1271 x restore `whitespace-style' value
1303 z restore `whitespace-style-mark' value
1304 ? display brief help 1272 ? display brief help
1305 1273
1306Non-interactively, ARG should be a symbol or a list of symbols. 1274Non-interactively, ARG should be a symbol or a list of symbols.
@@ -1327,24 +1295,15 @@ The valid symbols are:
1327 space-mark toggle SPACEs before TAB visualization 1295 space-mark toggle SPACEs before TAB visualization
1328 newline-mark toggle NEWLINE visualization 1296 newline-mark toggle NEWLINE visualization
1329 1297
1330 whitespace-style-color restore `whitespace-style-color' value 1298 whitespace-style restore `whitespace-style' value
1331 whitespace-style-mark restore `whitespace-style-mark' value
1332 1299
1333Only useful with a windowing system. 1300Only useful with a windowing system.
1334 1301
1335See `whitespace-style-color', `whitespace-style-mark' and 1302See `whitespace-style' and `indent-tabs-mode' for documentation."
1336`indent-tabs-mode' for documentation."
1337 (interactive (whitespace-interactive-char nil)) 1303 (interactive (whitespace-interactive-char nil))
1338 (let ((whitespace-style-color 1304 (let ((whitespace-style
1339 (whitespace-toggle-list 1305 (whitespace-toggle-list nil arg whitespace-toggle-style)))
1340 nil arg whitespace-toggle-color whitespace-style-color 1306 (setq whitespace-toggle-style whitespace-style)
1341 'whitespace-style-color whitespace-color-value-list))
1342 (whitespace-style-mark
1343 (whitespace-toggle-list
1344 nil arg whitespace-toggle-mark whitespace-style-mark
1345 'whitespace-style-mark whitespace-mark-value-list)))
1346 (setq whitespace-toggle-color whitespace-style-color
1347 whitespace-toggle-mark whitespace-style-mark)
1348 (global-whitespace-mode 0) 1307 (global-whitespace-mode 0)
1349 (global-whitespace-mode 1))) 1308 (global-whitespace-mode 1)))
1350 1309
@@ -1369,44 +1328,43 @@ The problems cleaned up are:
1369 1328
13701. empty lines at beginning of buffer. 13291. empty lines at beginning of buffer.
13712. empty lines at end of buffer. 13302. empty lines at end of buffer.
1372 If `whitespace-style-color' includes the value `empty', remove all 1331 If `whitespace-style' includes the value `empty', remove all
1373 empty lines at beginning and/or end of buffer. 1332 empty lines at beginning and/or end of buffer.
1374 1333
13753. 8 or more SPACEs at beginning of line. 13343. 8 or more SPACEs at beginning of line.
1376 If `whitespace-style-color' includes the value `indentation': 1335 If `whitespace-style' includes the value `indentation':
1377 replace 8 or more SPACEs at beginning of line by TABs, if 1336 replace 8 or more SPACEs at beginning of line by TABs, if
1378 `indent-tabs-mode' is non-nil; otherwise, replace TABs by 1337 `indent-tabs-mode' is non-nil; otherwise, replace TABs by
1379 SPACEs. 1338 SPACEs.
1380 If `whitespace-style-color' includes the value 1339 If `whitespace-style' includes the value `indentation::tab',
1381 `indentation::tab', replace 8 or more SPACEs at beginning of 1340 replace 8 or more SPACEs at beginning of line by TABs.
1382 line by TABs. 1341 If `whitespace-style' includes the value `indentation::space',
1383 If `whitespace-style-color' includes the value 1342 replace TABs by SPACEs.
1384 `indentation::space', replace TABs by SPACEs.
1385 1343
13864. SPACEs before TAB. 13444. SPACEs before TAB.
1387 If `whitespace-style-color' includes the value `space-before-tab': 1345 If `whitespace-style' includes the value `space-before-tab':
1388 replace SPACEs by TABs, if `indent-tabs-mode' is non-nil; 1346 replace SPACEs by TABs, if `indent-tabs-mode' is non-nil;
1389 otherwise, replace TABs by SPACEs. 1347 otherwise, replace TABs by SPACEs.
1390 If `whitespace-style-color' includes the value 1348 If `whitespace-style' includes the value
1391 `space-before-tab::tab', replace SPACEs by TABs. 1349 `space-before-tab::tab', replace SPACEs by TABs.
1392 If `whitespace-style-color' includes the value 1350 If `whitespace-style' includes the value
1393 `space-before-tab::space', replace TABs by SPACEs. 1351 `space-before-tab::space', replace TABs by SPACEs.
1394 1352
13955. SPACEs or TABs at end of line. 13535. SPACEs or TABs at end of line.
1396 If `whitespace-style-color' includes the value `trailing', remove 1354 If `whitespace-style' includes the value `trailing', remove
1397 all SPACEs or TABs at end of line. 1355 all SPACEs or TABs at end of line.
1398 1356
13996. 8 or more SPACEs after TAB. 13576. 8 or more SPACEs after TAB.
1400 If `whitespace-style-color' includes the value `space-after-tab': 1358 If `whitespace-style' includes the value `space-after-tab':
1401 replace SPACEs by TABs, if `indent-tabs-mode' is non-nil; 1359 replace SPACEs by TABs, if `indent-tabs-mode' is non-nil;
1402 otherwise, replace TABs by SPACEs. 1360 otherwise, replace TABs by SPACEs.
1403 If `whitespace-style-color' includes the value 1361 If `whitespace-style' includes the value
1404 `space-after-tab::tab', replace SPACEs by TABs. 1362 `space-after-tab::tab', replace SPACEs by TABs.
1405 If `whitespace-style-color' includes the value 1363 If `whitespace-style' includes the value
1406 `space-after-tab::space', replace TABs by SPACEs. 1364 `space-after-tab::space', replace TABs by SPACEs.
1407 1365
1408See `whitespace-style-color', `indent-tabs-mode' and `tab-width' 1366See `whitespace-style', `indent-tabs-mode' and `tab-width' for
1409for documentation." 1367documentation."
1410 (interactive "@*") 1368 (interactive "@*")
1411 (if (and (or transient-mark-mode 1369 (if (and (or transient-mark-mode
1412 current-prefix-arg) 1370 current-prefix-arg)
@@ -1424,7 +1382,7 @@ for documentation."
1424 ;; PROBLEM 1: empty lines at bob 1382 ;; PROBLEM 1: empty lines at bob
1425 ;; PROBLEM 2: empty lines at eob 1383 ;; PROBLEM 2: empty lines at eob
1426 ;; ACTION: remove all empty lines at bob and/or eob 1384 ;; ACTION: remove all empty lines at bob and/or eob
1427 (when (memq 'empty whitespace-style-color) 1385 (when (memq 'empty whitespace-style)
1428 (let (overwrite-mode) ; enforce no overwrite 1386 (let (overwrite-mode) ; enforce no overwrite
1429 (goto-char (point-min)) 1387 (goto-char (point-min))
1430 (when (re-search-forward 1388 (when (re-search-forward
@@ -1447,40 +1405,39 @@ for documentation."
1447The problems cleaned up are: 1405The problems cleaned up are:
1448 1406
14491. 8 or more SPACEs at beginning of line. 14071. 8 or more SPACEs at beginning of line.
1450 If `whitespace-style-color' includes the value `indentation': 1408 If `whitespace-style' includes the value `indentation':
1451 replace 8 or more SPACEs at beginning of line by TABs, if 1409 replace 8 or more SPACEs at beginning of line by TABs, if
1452 `indent-tabs-mode' is non-nil; otherwise, replace TABs by 1410 `indent-tabs-mode' is non-nil; otherwise, replace TABs by
1453 SPACEs. 1411 SPACEs.
1454 If `whitespace-style-color' includes the value 1412 If `whitespace-style' includes the value `indentation::tab',
1455 `indentation::tab', replace 8 or more SPACEs at beginning of 1413 replace 8 or more SPACEs at beginning of line by TABs.
1456 line by TABs. 1414 If `whitespace-style' includes the value `indentation::space',
1457 If `whitespace-style-color' includes the value 1415 replace TABs by SPACEs.
1458 `indentation::space', replace TABs by SPACEs.
1459 1416
14602. SPACEs before TAB. 14172. SPACEs before TAB.
1461 If `whitespace-style-color' includes the value `space-before-tab': 1418 If `whitespace-style' includes the value `space-before-tab':
1462 replace SPACEs by TABs, if `indent-tabs-mode' is non-nil; 1419 replace SPACEs by TABs, if `indent-tabs-mode' is non-nil;
1463 otherwise, replace TABs by SPACEs. 1420 otherwise, replace TABs by SPACEs.
1464 If `whitespace-style-color' includes the value 1421 If `whitespace-style' includes the value
1465 `space-before-tab::tab', replace SPACEs by TABs. 1422 `space-before-tab::tab', replace SPACEs by TABs.
1466 If `whitespace-style-color' includes the value 1423 If `whitespace-style' includes the value
1467 `space-before-tab::space', replace TABs by SPACEs. 1424 `space-before-tab::space', replace TABs by SPACEs.
1468 1425
14693. SPACEs or TABs at end of line. 14263. SPACEs or TABs at end of line.
1470 If `whitespace-style-color' includes the value `trailing', remove 1427 If `whitespace-style' includes the value `trailing', remove
1471 all SPACEs or TABs at end of line. 1428 all SPACEs or TABs at end of line.
1472 1429
14734. 8 or more SPACEs after TAB. 14304. 8 or more SPACEs after TAB.
1474 If `whitespace-style-color' includes the value `space-after-tab': 1431 If `whitespace-style' includes the value `space-after-tab':
1475 replace SPACEs by TABs, if `indent-tabs-mode' is non-nil; 1432 replace SPACEs by TABs, if `indent-tabs-mode' is non-nil;
1476 otherwise, replace TABs by SPACEs. 1433 otherwise, replace TABs by SPACEs.
1477 If `whitespace-style-color' includes the value 1434 If `whitespace-style' includes the value
1478 `space-after-tab::tab', replace SPACEs by TABs. 1435 `space-after-tab::tab', replace SPACEs by TABs.
1479 If `whitespace-style-color' includes the value 1436 If `whitespace-style' includes the value
1480 `space-after-tab::space', replace TABs by SPACEs. 1437 `space-after-tab::space', replace TABs by SPACEs.
1481 1438
1482See `whitespace-style-color', `indent-tabs-mode' and `tab-width' 1439See `whitespace-style', `indent-tabs-mode' and `tab-width' for
1483for documentation." 1440documentation."
1484 (interactive "@*r") 1441 (interactive "@*r")
1485 (let ((rstart (min start end)) 1442 (let ((rstart (min start end))
1486 (rend (copy-marker (max start end))) 1443 (rend (copy-marker (max start end)))
@@ -1495,7 +1452,7 @@ for documentation."
1495 ;; ACTION: replace 8 or more SPACEs at bol by TABs, if 1452 ;; ACTION: replace 8 or more SPACEs at bol by TABs, if
1496 ;; `indent-tabs-mode' is non-nil; otherwise, replace TABs by 1453 ;; `indent-tabs-mode' is non-nil; otherwise, replace TABs by
1497 ;; SPACEs. 1454 ;; SPACEs.
1498 ((memq 'indentation whitespace-style-color) 1455 ((memq 'indentation whitespace-style)
1499 (let ((regexp (whitespace-indentation-regexp))) 1456 (let ((regexp (whitespace-indentation-regexp)))
1500 (goto-char rstart) 1457 (goto-char rstart)
1501 (while (re-search-forward regexp rend t) 1458 (while (re-search-forward regexp rend t)
@@ -1505,18 +1462,18 @@ for documentation."
1505 (unless (eolp) 1462 (unless (eolp)
1506 (indent-to tmp))))) 1463 (indent-to tmp)))))
1507 ;; ACTION: replace 8 or more SPACEs at bol by TABs. 1464 ;; ACTION: replace 8 or more SPACEs at bol by TABs.
1508 ((memq 'indentation::tab whitespace-style-color) 1465 ((memq 'indentation::tab whitespace-style)
1509 (whitespace-replace-action 1466 (whitespace-replace-action
1510 'tabify rstart rend 1467 'tabify rstart rend
1511 (whitespace-indentation-regexp 'tab) 0)) 1468 (whitespace-indentation-regexp 'tab) 0))
1512 ;; ACTION: replace TABs by SPACEs. 1469 ;; ACTION: replace TABs by SPACEs.
1513 ((memq 'indentation::space whitespace-style-color) 1470 ((memq 'indentation::space whitespace-style)
1514 (whitespace-replace-action 1471 (whitespace-replace-action
1515 'untabify rstart rend 1472 'untabify rstart rend
1516 (whitespace-indentation-regexp 'space) 0))) 1473 (whitespace-indentation-regexp 'space) 0)))
1517 ;; PROBLEM 3: SPACEs or TABs at eol 1474 ;; PROBLEM 3: SPACEs or TABs at eol
1518 ;; ACTION: remove all SPACEs or TABs at eol 1475 ;; ACTION: remove all SPACEs or TABs at eol
1519 (when (memq 'trailing whitespace-style-color) 1476 (when (memq 'trailing whitespace-style)
1520 (whitespace-replace-action 1477 (whitespace-replace-action
1521 'delete-region rstart rend 1478 'delete-region rstart rend
1522 (whitespace-trailing-regexp) 1)) 1479 (whitespace-trailing-regexp) 1))
@@ -1525,17 +1482,17 @@ for documentation."
1525 ;; ACTION: replace 8 or more SPACEs by TABs, if 1482 ;; ACTION: replace 8 or more SPACEs by TABs, if
1526 ;; `indent-tabs-mode' is non-nil; otherwise, replace TABs by 1483 ;; `indent-tabs-mode' is non-nil; otherwise, replace TABs by
1527 ;; SPACEs. 1484 ;; SPACEs.
1528 ((memq 'space-after-tab whitespace-style-color) 1485 ((memq 'space-after-tab whitespace-style)
1529 (whitespace-replace-action 1486 (whitespace-replace-action
1530 (if whitespace-indent-tabs-mode 'tabify 'untabify) 1487 (if whitespace-indent-tabs-mode 'tabify 'untabify)
1531 rstart rend (whitespace-space-after-tab-regexp) 1)) 1488 rstart rend (whitespace-space-after-tab-regexp) 1))
1532 ;; ACTION: replace 8 or more SPACEs by TABs. 1489 ;; ACTION: replace 8 or more SPACEs by TABs.
1533 ((memq 'space-after-tab::tab whitespace-style-color) 1490 ((memq 'space-after-tab::tab whitespace-style)
1534 (whitespace-replace-action 1491 (whitespace-replace-action
1535 'tabify rstart rend 1492 'tabify rstart rend
1536 (whitespace-space-after-tab-regexp 'tab) 1)) 1493 (whitespace-space-after-tab-regexp 'tab) 1))
1537 ;; ACTION: replace TABs by SPACEs. 1494 ;; ACTION: replace TABs by SPACEs.
1538 ((memq 'space-after-tab::space whitespace-style-color) 1495 ((memq 'space-after-tab::space whitespace-style)
1539 (whitespace-replace-action 1496 (whitespace-replace-action
1540 'untabify rstart rend 1497 'untabify rstart rend
1541 (whitespace-space-after-tab-regexp 'space) 1))) 1498 (whitespace-space-after-tab-regexp 'space) 1)))
@@ -1544,18 +1501,18 @@ for documentation."
1544 ;; ACTION: replace SPACEs before TAB by TABs, if 1501 ;; ACTION: replace SPACEs before TAB by TABs, if
1545 ;; `indent-tabs-mode' is non-nil; otherwise, replace TABs by 1502 ;; `indent-tabs-mode' is non-nil; otherwise, replace TABs by
1546 ;; SPACEs. 1503 ;; SPACEs.
1547 ((memq 'space-before-tab whitespace-style-color) 1504 ((memq 'space-before-tab whitespace-style)
1548 (whitespace-replace-action 1505 (whitespace-replace-action
1549 (if whitespace-indent-tabs-mode 'tabify 'untabify) 1506 (if whitespace-indent-tabs-mode 'tabify 'untabify)
1550 rstart rend whitespace-space-before-tab-regexp 1507 rstart rend whitespace-space-before-tab-regexp
1551 (if whitespace-indent-tabs-mode 1 2))) 1508 (if whitespace-indent-tabs-mode 1 2)))
1552 ;; ACTION: replace SPACEs before TAB by TABs. 1509 ;; ACTION: replace SPACEs before TAB by TABs.
1553 ((memq 'space-before-tab::tab whitespace-style-color) 1510 ((memq 'space-before-tab::tab whitespace-style)
1554 (whitespace-replace-action 1511 (whitespace-replace-action
1555 'tabify rstart rend 1512 'tabify rstart rend
1556 whitespace-space-before-tab-regexp 1)) 1513 whitespace-space-before-tab-regexp 1))
1557 ;; ACTION: replace TABs by SPACEs. 1514 ;; ACTION: replace TABs by SPACEs.
1558 ((memq 'space-before-tab::space whitespace-style-color) 1515 ((memq 'space-before-tab::space whitespace-style)
1559 (whitespace-replace-action 1516 (whitespace-replace-action
1560 'untabify rstart rend 1517 'untabify rstart rend
1561 whitespace-space-before-tab-regexp 2))))) 1518 whitespace-space-before-tab-regexp 2)))))
@@ -1685,7 +1642,7 @@ non-nil.
1685 1642
1686If FORCE is non-nil or \\[universal-argument] was pressed just 1643If FORCE is non-nil or \\[universal-argument] was pressed just
1687before calling `whitespace-report' interactively, it forces 1644before calling `whitespace-report' interactively, it forces
1688`whitespace-style-color' to have: 1645`whitespace-style' to have:
1689 1646
1690 empty 1647 empty
1691 trailing 1648 trailing
@@ -1714,8 +1671,7 @@ Report if some of the following whitespace problems exist:
1714 space-before-tab 5. SPACEs before TAB. 1671 space-before-tab 5. SPACEs before TAB.
1715 space-after-tab 6. 8 or more SPACEs after TAB. 1672 space-after-tab 6. 8 or more SPACEs after TAB.
1716 1673
1717See `whitespace-style-color' and `whitespace-style-mark' for 1674See `whitespace-style' for documentation.
1718documentation.
1719See also `whitespace-cleanup' and `whitespace-cleanup-region' for 1675See also `whitespace-cleanup' and `whitespace-cleanup-region' for
1720cleaning up these problems." 1676cleaning up these problems."
1721 (interactive (list current-prefix-arg)) 1677 (interactive (list current-prefix-arg))
@@ -1732,7 +1688,7 @@ non-nil.
1732 1688
1733If FORCE is non-nil or \\[universal-argument] was pressed just 1689If FORCE is non-nil or \\[universal-argument] was pressed just
1734before calling `whitespace-report-region' interactively, it 1690before calling `whitespace-report-region' interactively, it
1735forces `whitespace-style-color' to have: 1691forces `whitespace-style' to have:
1736 1692
1737 empty 1693 empty
1738 indentation 1694 indentation
@@ -1761,8 +1717,7 @@ Report if some of the following whitespace problems exist:
1761 space-before-tab 5. SPACEs before TAB. 1717 space-before-tab 5. SPACEs before TAB.
1762 space-after-tab 6. 8 or more SPACEs after TAB. 1718 space-after-tab 6. 8 or more SPACEs after TAB.
1763 1719
1764See `whitespace-style-color' and `whitespace-style-mark' for 1720See `whitespace-style' for documentation.
1765documentation.
1766See also `whitespace-cleanup' and `whitespace-cleanup-region' for 1721See also `whitespace-cleanup' and `whitespace-cleanup-region' for
1767cleaning up these problems." 1722cleaning up these problems."
1768 (interactive "r") 1723 (interactive "r")
@@ -1776,8 +1731,7 @@ cleaning up these problems."
1776 (mapcar 1731 (mapcar
1777 #'(lambda (option) 1732 #'(lambda (option)
1778 (when force 1733 (when force
1779 (add-to-list 'whitespace-style-color 1734 (add-to-list 'whitespace-style (car option)))
1780 (car option)))
1781 (goto-char rstart) 1735 (goto-char rstart)
1782 (let ((regexp 1736 (let ((regexp
1783 (cond 1737 (cond
@@ -1815,7 +1769,7 @@ cleaning up these problems."
1815 (dolist (option whitespace-report-list) 1769 (dolist (option whitespace-report-list)
1816 (forward-line 1) 1770 (forward-line 1)
1817 (whitespace-mark-x 1771 (whitespace-mark-x
1818 27 (memq (car option) whitespace-style-color)) 1772 27 (memq (car option) whitespace-style))
1819 (whitespace-mark-x 7 (car bogus-list)) 1773 (whitespace-mark-x 7 (car bogus-list))
1820 (setq bogus-list (cdr bogus-list))) 1774 (setq bogus-list (cdr bogus-list)))
1821 (forward-line 1) 1775 (forward-line 1)
@@ -1872,8 +1826,7 @@ cleaning up these problems."
1872 [] S - toggle SPACE and HARD SPACE visualization 1826 [] S - toggle SPACE and HARD SPACE visualization
1873 [] N - toggle NEWLINE visualization 1827 [] N - toggle NEWLINE visualization
1874 1828
1875 x - restore `whitespace-style-color' value 1829 x - restore `whitespace-style' value
1876 z - restore `whitespace-style-mark' value
1877 1830
1878 ? - display this text\n\n" 1831 ? - display this text\n\n"
1879 "Text for whitespace toggle options.") 1832 "Text for whitespace toggle options.")
@@ -1898,13 +1851,16 @@ cleaning up these problems."
1898 1851
1899(defun whitespace-insert-option-mark (the-list the-value) 1852(defun whitespace-insert-option-mark (the-list the-value)
1900 "Insert the option mark ('X' or ' ') in toggle options buffer." 1853 "Insert the option mark ('X' or ' ') in toggle options buffer."
1854 (goto-char (point-min))
1901 (forward-line 2) 1855 (forward-line 2)
1902 (dolist (sym the-list) 1856 (dolist (sym the-list)
1903 (forward-line 1) 1857 (if (eq sym 'help-newline)
1904 (whitespace-mark-x 2 (memq sym the-value)))) 1858 (forward-line 2)
1859 (forward-line 1)
1860 (whitespace-mark-x 2 (memq sym the-value)))))
1905 1861
1906 1862
1907(defun whitespace-help-on (chars style) 1863(defun whitespace-help-on (style)
1908 "Display the whitespace toggle options." 1864 "Display the whitespace toggle options."
1909 (unless (get-buffer whitespace-help-buffer-name) 1865 (unless (get-buffer whitespace-help-buffer-name)
1910 (delete-other-windows) 1866 (delete-other-windows)
@@ -1913,11 +1869,8 @@ cleaning up these problems."
1913 (set-buffer buffer) 1869 (set-buffer buffer)
1914 (erase-buffer) 1870 (erase-buffer)
1915 (insert whitespace-help-text) 1871 (insert whitespace-help-text)
1916 (goto-char (point-min))
1917 (whitespace-insert-option-mark 1872 (whitespace-insert-option-mark
1918 whitespace-color-value-list chars) 1873 whitespace-style-value-list style)
1919 (whitespace-insert-option-mark
1920 whitespace-mark-value-list style)
1921 (whitespace-display-window buffer))))) 1874 (whitespace-display-window buffer)))))
1922 1875
1923 1876
@@ -1981,20 +1934,16 @@ It accepts one of the following chars:
1981 S toggle SPACE and HARD SPACE visualization 1934 S toggle SPACE and HARD SPACE visualization
1982 N toggle NEWLINE visualization 1935 N toggle NEWLINE visualization
1983 1936
1984 x restore `whitespace-style-color' value 1937 x restore `whitespace-style' value
1985 z restore `whitespace-style-mark' value
1986 ? display brief help 1938 ? display brief help
1987 1939
1988See also `whitespace-toggle-option-alist'." 1940See also `whitespace-toggle-option-alist'."
1989 (let* ((is-off (not (if local-p 1941 (let* ((is-off (not (if local-p
1990 whitespace-mode 1942 whitespace-mode
1991 global-whitespace-mode))) 1943 global-whitespace-mode)))
1992 (chars (cond (is-off whitespace-style-color) ; use default value 1944 (style (cond (is-off whitespace-style) ; use default value
1993 (local-p whitespace-active-color) 1945 (local-p whitespace-active-style)
1994 (t whitespace-toggle-color))) 1946 (t whitespace-toggle-style)))
1995 (style (cond (is-off whitespace-style-mark) ; use default value
1996 (local-p whitespace-active-mark)
1997 (t whitespace-toggle-mark)))
1998 (prompt 1947 (prompt
1999 (format "Whitespace Toggle %s (type ? for further options)-" 1948 (format "Whitespace Toggle %s (type ? for further options)-"
2000 (if local-p "Local" "Global"))) 1949 (if local-p "Local" "Global")))
@@ -2013,7 +1962,7 @@ See also `whitespace-toggle-option-alist'."
2013 (assq ch whitespace-toggle-option-alist))))) 1962 (assq ch whitespace-toggle-option-alist)))))
2014 ;; while body 1963 ;; while body
2015 (if (eq ch ?\?) 1964 (if (eq ch ?\?)
2016 (whitespace-help-on chars style) 1965 (whitespace-help-on style)
2017 (ding))) 1966 (ding)))
2018 (whitespace-help-off) 1967 (whitespace-help-off)
2019 (message " ")) ; clean echo area 1968 (message " ")) ; clean echo area
@@ -2024,8 +1973,7 @@ See also `whitespace-toggle-option-alist'."
2024 (list sym))) ; return the apropriate symbol 1973 (list sym))) ; return the apropriate symbol
2025 1974
2026 1975
2027(defun whitespace-toggle-list (local-p arg the-list default-list 1976(defun whitespace-toggle-list (local-p arg the-list)
2028 sym-restore sym-list)
2029 "Toggle options in THE-LIST based on list ARG. 1977 "Toggle options in THE-LIST based on list ARG.
2030 1978
2031If LOCAL-P is non-nil, it uses a local context; otherwise, it 1979If LOCAL-P is non-nil, it uses a local context; otherwise, it
@@ -2034,37 +1982,32 @@ uses a global context.
2034ARG is a list of options to be toggled. 1982ARG is a list of options to be toggled.
2035 1983
2036THE-LIST is a list of options. This list will be toggled and the 1984THE-LIST is a list of options. This list will be toggled and the
2037resultant list will be returned. 1985resultant list will be returned."
2038
2039DEFAULT-LIST is the default list of options. It is used to
2040restore the options in THE-LIST.
2041
2042SYM-RESTORE is the symbol which indicates to restore the options
2043in THE-LIST.
2044
2045SYM-LIST is a list of valid options, used to check if the ARG's
2046options are valid."
2047 (unless (if local-p whitespace-mode global-whitespace-mode) 1986 (unless (if local-p whitespace-mode global-whitespace-mode)
2048 (setq the-list default-list)) 1987 (setq the-list whitespace-style))
2049 (setq the-list (copy-sequence the-list)) ; keep original list 1988 (setq the-list (copy-sequence the-list)) ; keep original list
2050 (dolist (sym (if (listp arg) arg (list arg))) 1989 (dolist (sym (if (listp arg) arg (list arg)))
2051 (cond 1990 (cond
1991 ;; ignore help value
1992 ((eq sym 'help-newline))
2052 ;; restore default values 1993 ;; restore default values
2053 ((eq sym sym-restore) 1994 ((eq sym 'whitespace-style)
2054 (setq the-list default-list)) 1995 (setq the-list whitespace-style))
2055 ;; toggle valid values 1996 ;; toggle valid values
2056 ((memq sym sym-list) 1997 ((memq sym whitespace-style-value-list)
2057 (setq the-list (if (memq sym the-list) 1998 (setq the-list (if (memq sym the-list)
2058 (delq sym the-list) 1999 (delq sym the-list)
2059 (cons sym the-list)))))) 2000 (cons sym the-list))))))
2060 the-list) 2001 the-list)
2061 2002
2003
2062(defvar whitespace-display-table nil 2004(defvar whitespace-display-table nil
2063 "Used to save a local display table.") 2005 "Used to save a local display table.")
2064 2006
2065(defvar whitespace-display-table-was-local nil 2007(defvar whitespace-display-table-was-local nil
2066 "Used to remember whether a buffer initially had a local display table.") 2008 "Used to remember whether a buffer initially had a local display table.")
2067 2009
2010
2068(defun whitespace-turn-on () 2011(defun whitespace-turn-on ()
2069 "Turn on whitespace visualization." 2012 "Turn on whitespace visualization."
2070 ;; prepare local hooks 2013 ;; prepare local hooks
@@ -2075,37 +2018,51 @@ options are valid."
2075 (set (make-local-variable 'whitespace-font-lock-keywords) nil) 2018 (set (make-local-variable 'whitespace-font-lock-keywords) nil)
2076 (set (make-local-variable 'whitespace-display-table) nil) 2019 (set (make-local-variable 'whitespace-display-table) nil)
2077 (set (make-local-variable 'whitespace-display-table-was-local) nil) 2020 (set (make-local-variable 'whitespace-display-table-was-local) nil)
2078 (set (make-local-variable 'whitespace-active-mark) 2021 (set (make-local-variable 'whitespace-active-style)
2079 (if (listp whitespace-style-mark) 2022 (if (listp whitespace-style)
2080 whitespace-style-mark 2023 whitespace-style
2081 (list whitespace-style-mark))) 2024 (list whitespace-style)))
2082 (set (make-local-variable 'whitespace-active-color)
2083 (if (listp whitespace-style-color)
2084 whitespace-style-color
2085 (list whitespace-style-color)))
2086 (set (make-local-variable 'whitespace-indent-tabs-mode) 2025 (set (make-local-variable 'whitespace-indent-tabs-mode)
2087 indent-tabs-mode) 2026 indent-tabs-mode)
2088 (set (make-local-variable 'whitespace-tab-width) 2027 (set (make-local-variable 'whitespace-tab-width)
2089 tab-width) 2028 tab-width)
2090 ;; turn on whitespace 2029 ;; turn on whitespace
2091 (when whitespace-active-color 2030 (when whitespace-active-style
2092 (whitespace-color-on)) 2031 (whitespace-color-on)
2093 (when whitespace-active-mark
2094 (whitespace-display-char-on))) 2032 (whitespace-display-char-on)))
2095 2033
2096 2034
2097(defun whitespace-turn-off () 2035(defun whitespace-turn-off ()
2098 "Turn off whitespace visualization." 2036 "Turn off whitespace visualization."
2099 (whitespace-remove-local-hook) 2037 (whitespace-remove-local-hook)
2100 (when whitespace-active-color 2038 (when whitespace-active-style
2101 (whitespace-color-off)) 2039 (whitespace-color-off)
2102 (when whitespace-active-mark
2103 (whitespace-display-char-off))) 2040 (whitespace-display-char-off)))
2104 2041
2105 2042
2043(defun whitespace-style-face-p ()
2044 "Return t if there is some visualization via face."
2045 (or (memq 'tabs whitespace-active-style)
2046 (memq 'spaces whitespace-active-style)
2047 (memq 'trailing whitespace-active-style)
2048 (memq 'lines whitespace-active-style)
2049 (memq 'lines-tail whitespace-active-style)
2050 (memq 'newline whitespace-active-style)
2051 (memq 'empty whitespace-active-style)
2052 (memq 'indentation whitespace-active-style)
2053 (memq 'indentation::tab whitespace-active-style)
2054 (memq 'indentation::space whitespace-active-style)
2055 (memq 'space-after-tab whitespace-active-style)
2056 (memq 'space-after-tab::tab whitespace-active-style)
2057 (memq 'space-after-tab::space whitespace-active-style)
2058 (memq 'space-before-tab whitespace-active-style)
2059 (memq 'space-before-tab::tab whitespace-active-style)
2060 (memq 'space-before-tab::space whitespace-active-style)))
2061
2062
2106(defun whitespace-color-on () 2063(defun whitespace-color-on ()
2107 "Turn on color visualization." 2064 "Turn on color visualization."
2108 (when whitespace-active-color 2065 (when (whitespace-style-face-p)
2109 (unless whitespace-font-lock 2066 (unless whitespace-font-lock
2110 (setq whitespace-font-lock t 2067 (setq whitespace-font-lock t
2111 whitespace-font-lock-keywords 2068 whitespace-font-lock-keywords
@@ -2115,7 +2072,7 @@ options are valid."
2115 font-lock-mode) 2072 font-lock-mode)
2116 (font-lock-mode 0) 2073 (font-lock-mode 0)
2117 ;; add whitespace-mode color into font lock 2074 ;; add whitespace-mode color into font lock
2118 (when (memq 'spaces whitespace-active-color) 2075 (when (memq 'spaces whitespace-active-style)
2119 (font-lock-add-keywords 2076 (font-lock-add-keywords
2120 nil 2077 nil
2121 (list 2078 (list
@@ -2124,22 +2081,22 @@ options are valid."
2124 ;; Show HARD SPACEs 2081 ;; Show HARD SPACEs
2125 (list whitespace-hspace-regexp 1 whitespace-hspace t)) 2082 (list whitespace-hspace-regexp 1 whitespace-hspace t))
2126 t)) 2083 t))
2127 (when (memq 'tabs whitespace-active-color) 2084 (when (memq 'tabs whitespace-active-style)
2128 (font-lock-add-keywords 2085 (font-lock-add-keywords
2129 nil 2086 nil
2130 (list 2087 (list
2131 ;; Show TABs 2088 ;; Show TABs
2132 (list whitespace-tab-regexp 1 whitespace-tab t)) 2089 (list whitespace-tab-regexp 1 whitespace-tab t))
2133 t)) 2090 t))
2134 (when (memq 'trailing whitespace-active-color) 2091 (when (memq 'trailing whitespace-active-style)
2135 (font-lock-add-keywords 2092 (font-lock-add-keywords
2136 nil 2093 nil
2137 (list 2094 (list
2138 ;; Show trailing blanks 2095 ;; Show trailing blanks
2139 (list (whitespace-trailing-regexp) 1 whitespace-trailing t)) 2096 (list (whitespace-trailing-regexp) 1 whitespace-trailing t))
2140 t)) 2097 t))
2141 (when (or (memq 'lines whitespace-active-color) 2098 (when (or (memq 'lines whitespace-active-style)
2142 (memq 'lines-tail whitespace-active-color)) 2099 (memq 'lines-tail whitespace-active-style))
2143 (font-lock-add-keywords 2100 (font-lock-add-keywords
2144 nil 2101 nil
2145 (list 2102 (list
@@ -2153,13 +2110,13 @@ options are valid."
2153 (if (zerop rem) 2110 (if (zerop rem)
2154 "" 2111 ""
2155 (format ".\\{%d\\}" rem)))) 2112 (format ".\\{%d\\}" rem))))
2156 (if (memq 'lines whitespace-active-color) 2113 (if (memq 'lines whitespace-active-style)
2157 0 ; whole line 2114 0 ; whole line
2158 2) ; line tail 2115 2) ; line tail
2159 whitespace-line t)) 2116 whitespace-line t))
2160 t)) 2117 t))
2161 (cond 2118 (cond
2162 ((memq 'space-before-tab whitespace-active-color) 2119 ((memq 'space-before-tab whitespace-active-style)
2163 (font-lock-add-keywords 2120 (font-lock-add-keywords
2164 nil 2121 nil
2165 (list 2122 (list
@@ -2168,7 +2125,7 @@ options are valid."
2168 (if whitespace-indent-tabs-mode 1 2) 2125 (if whitespace-indent-tabs-mode 1 2)
2169 whitespace-space-before-tab t)) 2126 whitespace-space-before-tab t))
2170 t)) 2127 t))
2171 ((memq 'space-before-tab::tab whitespace-active-color) 2128 ((memq 'space-before-tab::tab whitespace-active-style)
2172 (font-lock-add-keywords 2129 (font-lock-add-keywords
2173 nil 2130 nil
2174 (list 2131 (list
@@ -2176,7 +2133,7 @@ options are valid."
2176 (list whitespace-space-before-tab-regexp 2133 (list whitespace-space-before-tab-regexp
2177 1 whitespace-space-before-tab t)) 2134 1 whitespace-space-before-tab t))
2178 t)) 2135 t))
2179 ((memq 'space-before-tab::space whitespace-active-color) 2136 ((memq 'space-before-tab::space whitespace-active-style)
2180 (font-lock-add-keywords 2137 (font-lock-add-keywords
2181 nil 2138 nil
2182 (list 2139 (list
@@ -2185,7 +2142,7 @@ options are valid."
2185 2 whitespace-space-before-tab t)) 2142 2 whitespace-space-before-tab t))
2186 t))) 2143 t)))
2187 (cond 2144 (cond
2188 ((memq 'indentation whitespace-active-color) 2145 ((memq 'indentation whitespace-active-style)
2189 (font-lock-add-keywords 2146 (font-lock-add-keywords
2190 nil 2147 nil
2191 (list 2148 (list
@@ -2193,7 +2150,7 @@ options are valid."
2193 (list (whitespace-indentation-regexp) 2150 (list (whitespace-indentation-regexp)
2194 1 whitespace-indentation t)) 2151 1 whitespace-indentation t))
2195 t)) 2152 t))
2196 ((memq 'indentation::tab whitespace-active-color) 2153 ((memq 'indentation::tab whitespace-active-style)
2197 (font-lock-add-keywords 2154 (font-lock-add-keywords
2198 nil 2155 nil
2199 (list 2156 (list
@@ -2201,7 +2158,7 @@ options are valid."
2201 (list (whitespace-indentation-regexp 'tab) 2158 (list (whitespace-indentation-regexp 'tab)
2202 1 whitespace-indentation t)) 2159 1 whitespace-indentation t))
2203 t)) 2160 t))
2204 ((memq 'indentation::space whitespace-active-color) 2161 ((memq 'indentation::space whitespace-active-style)
2205 (font-lock-add-keywords 2162 (font-lock-add-keywords
2206 nil 2163 nil
2207 (list 2164 (list
@@ -2209,7 +2166,7 @@ options are valid."
2209 (list (whitespace-indentation-regexp 'space) 2166 (list (whitespace-indentation-regexp 'space)
2210 1 whitespace-indentation t)) 2167 1 whitespace-indentation t))
2211 t))) 2168 t)))
2212 (when (memq 'empty whitespace-active-color) 2169 (when (memq 'empty whitespace-active-style)
2213 (font-lock-add-keywords 2170 (font-lock-add-keywords
2214 nil 2171 nil
2215 (list 2172 (list
@@ -2225,7 +2182,7 @@ options are valid."
2225 1 whitespace-empty t)) 2182 1 whitespace-empty t))
2226 t)) 2183 t))
2227 (cond 2184 (cond
2228 ((memq 'space-after-tab whitespace-active-color) 2185 ((memq 'space-after-tab whitespace-active-style)
2229 (font-lock-add-keywords 2186 (font-lock-add-keywords
2230 nil 2187 nil
2231 (list 2188 (list
@@ -2233,7 +2190,7 @@ options are valid."
2233 (list (whitespace-space-after-tab-regexp) 2190 (list (whitespace-space-after-tab-regexp)
2234 1 whitespace-space-after-tab t)) 2191 1 whitespace-space-after-tab t))
2235 t)) 2192 t))
2236 ((memq 'space-after-tab::tab whitespace-active-color) 2193 ((memq 'space-after-tab::tab whitespace-active-style)
2237 (font-lock-add-keywords 2194 (font-lock-add-keywords
2238 nil 2195 nil
2239 (list 2196 (list
@@ -2241,7 +2198,7 @@ options are valid."
2241 (list (whitespace-space-after-tab-regexp 'tab) 2198 (list (whitespace-space-after-tab-regexp 'tab)
2242 1 whitespace-space-after-tab t)) 2199 1 whitespace-space-after-tab t))
2243 t)) 2200 t))
2244 ((memq 'space-after-tab::space whitespace-active-color) 2201 ((memq 'space-after-tab::space whitespace-active-style)
2245 (font-lock-add-keywords 2202 (font-lock-add-keywords
2246 nil 2203 nil
2247 (list 2204 (list
@@ -2255,8 +2212,8 @@ options are valid."
2255 2212
2256(defun whitespace-color-off () 2213(defun whitespace-color-off ()
2257 "Turn off color visualization." 2214 "Turn off color visualization."
2258 (when whitespace-active-color 2215 ;; turn off font lock
2259 ;; turn off font lock 2216 (when (whitespace-style-face-p)
2260 (font-lock-mode 0) 2217 (font-lock-mode 0)
2261 (when whitespace-font-lock 2218 (when whitespace-font-lock
2262 (setq whitespace-font-lock nil 2219 (setq whitespace-font-lock nil
@@ -2269,6 +2226,13 @@ options are valid."
2269;;;; Hacked from visws.el (Miles Bader <miles@gnu.org>) 2226;;;; Hacked from visws.el (Miles Bader <miles@gnu.org>)
2270 2227
2271 2228
2229(defun whitespace-style-mark-p ()
2230 "Return t if there is some visualization via display table."
2231 (or (memq 'tab-mark whitespace-active-style)
2232 (memq 'space-mark whitespace-active-style)
2233 (memq 'newline-mark whitespace-active-style)))
2234
2235
2272(defsubst whitespace-char-valid-p (char) 2236(defsubst whitespace-char-valid-p (char)
2273 ;; This check should be improved!!! 2237 ;; This check should be improved!!!
2274 (or (< char 256) 2238 (or (< char 256)
@@ -2286,7 +2250,8 @@ options are valid."
2286 2250
2287(defun whitespace-display-char-on () 2251(defun whitespace-display-char-on ()
2288 "Turn on character display mapping." 2252 "Turn on character display mapping."
2289 (when whitespace-display-mappings 2253 (when (and whitespace-display-mappings
2254 (whitespace-style-mark-p))
2290 (let (vecs vec) 2255 (let (vecs vec)
2291 ;; Remember whether a buffer has a local display table. 2256 ;; Remember whether a buffer has a local display table.
2292 (unless whitespace-display-table-was-local 2257 (unless whitespace-display-table-was-local
@@ -2297,7 +2262,7 @@ options are valid."
2297 (setq buffer-display-table (make-display-table))) 2262 (setq buffer-display-table (make-display-table)))
2298 (dolist (entry whitespace-display-mappings) 2263 (dolist (entry whitespace-display-mappings)
2299 ;; check if it is to display this mark 2264 ;; check if it is to display this mark
2300 (when (memq (car entry) whitespace-style-mark) 2265 (when (memq (car entry) whitespace-style)
2301 ;; Get a displayable mapping. 2266 ;; Get a displayable mapping.
2302 (setq vecs (cddr entry)) 2267 (setq vecs (cddr entry))
2303 (while (and vecs 2268 (while (and vecs
@@ -2308,7 +2273,7 @@ options are valid."
2308 (setq vec (copy-sequence (car vecs))) 2273 (setq vec (copy-sequence (car vecs)))
2309 ;; NEWLINE char 2274 ;; NEWLINE char
2310 (when (and (eq (cadr entry) ?\n) 2275 (when (and (eq (cadr entry) ?\n)
2311 (memq 'newline whitespace-active-color)) 2276 (memq 'newline whitespace-active-style))
2312 ;; Only insert face bits on NEWLINE char mapping to avoid 2277 ;; Only insert face bits on NEWLINE char mapping to avoid
2313 ;; obstruction of other faces like TABs and (HARD) SPACEs 2278 ;; obstruction of other faces like TABs and (HARD) SPACEs
2314 ;; faces, font-lock faces, etc. 2279 ;; faces, font-lock faces, etc.
@@ -2324,6 +2289,7 @@ options are valid."
2324(defun whitespace-display-char-off () 2289(defun whitespace-display-char-off ()
2325 "Turn off character display mapping." 2290 "Turn off character display mapping."
2326 (and whitespace-display-mappings 2291 (and whitespace-display-mappings
2292 (whitespace-style-mark-p)
2327 whitespace-display-table-was-local 2293 whitespace-display-table-was-local
2328 (setq whitespace-display-table-was-local nil 2294 (setq whitespace-display-table-was-local nil
2329 buffer-display-table whitespace-display-table))) 2295 buffer-display-table whitespace-display-table)))