comparison lisp/whitespace.el @ 110234:28ca316fcaea

Merge whitespace.el from trunk
author Chong Yidong <cyd@stupidchicken.com>
date Mon, 06 Sep 2010 12:24:32 -0400
parents fe84742c509a
children 376148b31b5e
comparison
equal deleted inserted replaced
110233:9b0c446f8952 110234:28ca316fcaea
4 ;; Free Software Foundation, Inc. 4 ;; Free Software Foundation, Inc.
5 5
6 ;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br> 6 ;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
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.
13 13
14 ;; GNU Emacs is free software: you can redistribute it and/or modify 14 ;; GNU Emacs is free software: you can redistribute it and/or modify
376 376
377 (defgroup whitespace nil 377 (defgroup whitespace nil
378 "Visualize blanks (TAB, (HARD) SPACE and NEWLINE)." 378 "Visualize blanks (TAB, (HARD) SPACE and NEWLINE)."
379 :link '(emacs-library-link :tag "Source Lisp File" "whitespace.el") 379 :link '(emacs-library-link :tag "Source Lisp File" "whitespace.el")
380 :version "23.1" 380 :version "23.1"
381 :group 'wp 381 :group 'convenience)
382 :group 'data)
383 382
384 383
385 (defcustom whitespace-style 384 (defcustom whitespace-style
386 '(tabs spaces trailing lines space-before-tab newline 385 '(face
387 indentation empty space-after-tab 386 tabs spaces trailing lines space-before-tab newline
388 space-mark tab-mark newline-mark) 387 indentation empty space-after-tab
388 space-mark tab-mark newline-mark)
389 "Specify which kind of blank is visualized. 389 "Specify which kind of blank is visualized.
390 390
391 It's a list containing some or all of the following values: 391 It's a list containing some or all of the following values:
392 392
393 face enable all visualization via faces (see below).
394
393 trailing trailing blanks are visualized via faces. 395 trailing trailing blanks are visualized via faces.
396 It has effect only if `face' (see above)
397 is present in `whitespace-style'.
394 398
395 tabs TABs are visualized via faces. 399 tabs TABs are visualized via faces.
400 It has effect only if `face' (see above)
401 is present in `whitespace-style'.
396 402
397 spaces SPACEs and HARD SPACEs are visualized via 403 spaces SPACEs and HARD SPACEs are visualized via
398 faces. 404 faces.
405 It has effect only if `face' (see above)
406 is present in `whitespace-style'.
399 407
400 lines lines which have columns beyond 408 lines lines which have columns beyond
401 `whitespace-line-column' are highlighted via 409 `whitespace-line-column' are highlighted via
402 faces. 410 faces.
403 Whole line is highlighted. 411 Whole line is highlighted.
404 It has precedence over `lines-tail' (see 412 It has precedence over `lines-tail' (see
405 below). 413 below).
414 It has effect only if `face' (see above)
415 is present in `whitespace-style'.
406 416
407 lines-tail lines which have columns beyond 417 lines-tail lines which have columns beyond
408 `whitespace-line-column' are highlighted via 418 `whitespace-line-column' are highlighted via
409 faces. 419 faces.
410 But only the part of line which goes 420 But only the part of line which goes
411 beyond `whitespace-line-column' column. 421 beyond `whitespace-line-column' column.
412 It has effect only if `lines' (see above) 422 It has effect only if `lines' (see above)
413 is not present in `whitespace-style'. 423 is not present in `whitespace-style'
424 and if `face' (see above) is present in
425 `whitespace-style'.
414 426
415 newline NEWLINEs are visualized via faces. 427 newline NEWLINEs are visualized via faces.
428 It has effect only if `face' (see above)
429 is present in `whitespace-style'.
416 430
417 empty empty lines at beginning and/or end of buffer 431 empty empty lines at beginning and/or end of buffer
418 are visualized via faces. 432 are visualized via faces.
433 It has effect only if `face' (see above)
434 is present in `whitespace-style'.
419 435
420 indentation::tab 8 or more SPACEs at beginning of line are 436 indentation::tab 8 or more SPACEs at beginning of line are
421 visualized via faces. 437 visualized via faces.
438 It has effect only if `face' (see above)
439 is present in `whitespace-style'.
422 440
423 indentation::space TABs at beginning of line are visualized via 441 indentation::space TABs at beginning of line are visualized via
424 faces. 442 faces.
443 It has effect only if `face' (see above)
444 is present in `whitespace-style'.
425 445
426 indentation 8 or more SPACEs at beginning of line are 446 indentation 8 or more SPACEs at beginning of line are
427 visualized, if `indent-tabs-mode' (which see) 447 visualized, if `indent-tabs-mode' (which see)
428 is non-nil; otherwise, TABs at beginning of 448 is non-nil; otherwise, TABs at beginning of
429 line are visualized via faces. 449 line are visualized via faces.
450 It has effect only if `face' (see above)
451 is present in `whitespace-style'.
430 452
431 space-after-tab::tab 8 or more SPACEs after a TAB are 453 space-after-tab::tab 8 or more SPACEs after a TAB are
432 visualized via faces. 454 visualized via faces.
455 It has effect only if `face' (see above)
456 is present in `whitespace-style'.
433 457
434 space-after-tab::space TABs are visualized when 8 or more 458 space-after-tab::space TABs are visualized when 8 or more
435 SPACEs occur after a TAB, via faces. 459 SPACEs occur after a TAB, via faces.
460 It has effect only if `face' (see above)
461 is present in `whitespace-style'.
436 462
437 space-after-tab 8 or more SPACEs after a TAB are 463 space-after-tab 8 or more SPACEs after a TAB are
438 visualized, if `indent-tabs-mode' 464 visualized, if `indent-tabs-mode'
439 (which see) is non-nil; otherwise, 465 (which see) is non-nil; otherwise,
440 the TABs are visualized via faces. 466 the TABs are visualized via faces.
467 It has effect only if `face' (see above)
468 is present in `whitespace-style'.
441 469
442 space-before-tab::tab SPACEs before TAB are visualized via 470 space-before-tab::tab SPACEs before TAB are visualized via
443 faces. 471 faces.
472 It has effect only if `face' (see above)
473 is present in `whitespace-style'.
444 474
445 space-before-tab::space TABs are visualized when SPACEs occur 475 space-before-tab::space TABs are visualized when SPACEs occur
446 before TAB, via faces. 476 before TAB, via faces.
477 It has effect only if `face' (see above)
478 is present in `whitespace-style'.
447 479
448 space-before-tab SPACEs before TAB are visualized, if 480 space-before-tab SPACEs before TAB are visualized, if
449 `indent-tabs-mode' (which see) is 481 `indent-tabs-mode' (which see) is
450 non-nil; otherwise, the TABs are 482 non-nil; otherwise, the TABs are
451 visualized via faces. 483 visualized via faces.
484 It has effect only if `face' (see above)
485 is present in `whitespace-style'.
452 486
453 space-mark SPACEs and HARD SPACEs are visualized via 487 space-mark SPACEs and HARD SPACEs are visualized via
454 display table. 488 display table.
455 489
456 tab-mark TABs are visualized via display table. 490 tab-mark TABs are visualized via display table.
485 519
486 So, for example, if indentation and indentation::space are 520 So, for example, if indentation and indentation::space are
487 included in `whitespace-style' list, the indentation value is 521 included in `whitespace-style' list, the indentation value is
488 evaluated instead of indentation::space value. 522 evaluated instead of indentation::space value.
489 523
524 One reason for not visualize spaces via faces (if `face' is not
525 included in `whitespace-style') is to use exclusively for
526 cleanning up a buffer. See `whitespace-cleanup' and
527 `whitespace-cleanup-region' for documentation.
528
490 See also `whitespace-display-mappings' for documentation." 529 See also `whitespace-display-mappings' for documentation."
491 :type '(repeat :tag "Kind of Blank" 530 :type '(repeat :tag "Kind of Blank"
492 (choice :tag "Kind of Blank Face" 531 (choice :tag "Kind of Blank Face"
532 (const :tag "(Face) Face visualization"
533 face)
493 (const :tag "(Face) Trailing TABs, SPACEs and HARD SPACEs" 534 (const :tag "(Face) Trailing TABs, SPACEs and HARD SPACEs"
494 trailing) 535 trailing)
495 (const :tag "(Face) SPACEs and HARD SPACEs" 536 (const :tag "(Face) SPACEs and HARD SPACEs"
496 spaces) 537 spaces)
497 (const :tag "(Face) TABs" tabs) 538 (const :tag "(Face) TABs" tabs)
520 :group 'whitespace) 561 :group 'whitespace)
521 562
522 563
523 (defface whitespace-space 564 (defface whitespace-space
524 '((((class color) (background dark)) 565 '((((class color) (background dark))
525 (:background "grey20" :foreground "aquamarine3")) 566 (:background "grey20" :foreground "darkgray"))
526 (((class color) (background light)) 567 (((class color) (background light))
527 (:background "LightYellow" :foreground "aquamarine3")) 568 (:background "LightYellow" :foreground "lightgray"))
528 (t (:inverse-video t))) 569 (t (:inverse-video t)))
529 "Face used to visualize SPACE." 570 "Face used to visualize SPACE."
530 :group 'whitespace) 571 :group 'whitespace)
531 572
532 573
538 :group 'whitespace) 579 :group 'whitespace)
539 580
540 581
541 (defface whitespace-hspace ; 'nobreak-space 582 (defface whitespace-hspace ; 'nobreak-space
542 '((((class color) (background dark)) 583 '((((class color) (background dark))
543 (:background "grey24" :foreground "aquamarine3")) 584 (:background "grey24" :foreground "darkgray"))
544 (((class color) (background light)) 585 (((class color) (background light))
545 (:background "LemonChiffon3" :foreground "aquamarine3")) 586 (:background "LemonChiffon3" :foreground "lightgray"))
546 (t (:inverse-video t))) 587 (t (:inverse-video t)))
547 "Face used to visualize HARD SPACE." 588 "Face used to visualize HARD SPACE."
548 :group 'whitespace) 589 :group 'whitespace)
549 590
550 591
556 :group 'whitespace) 597 :group 'whitespace)
557 598
558 599
559 (defface whitespace-tab 600 (defface whitespace-tab
560 '((((class color) (background dark)) 601 '((((class color) (background dark))
561 (:background "grey22" :foreground "aquamarine3")) 602 (:background "grey22" :foreground "darkgray"))
562 (((class color) (background light)) 603 (((class color) (background light))
563 (:background "beige" :foreground "aquamarine3")) 604 (:background "beige" :foreground "lightgray"))
564 (t (:inverse-video t))) 605 (t (:inverse-video t)))
565 "Face used to visualize TAB." 606 "Face used to visualize TAB."
566 :group 'whitespace) 607 :group 'whitespace)
567 608
568 609
865 906
866 907
867 (defcustom whitespace-line-column 80 908 (defcustom whitespace-line-column 80
868 "Specify column beyond which the line is highlighted. 909 "Specify column beyond which the line is highlighted.
869 910
911 It must be an integer or nil. If nil, the `fill-column' variable value is
912 used.
913
870 Used when `whitespace-style' includes `lines' or `lines-tail'." 914 Used when `whitespace-style' includes `lines' or `lines-tail'."
871 :type '(integer :tag "Line Length") 915 :type '(choice :tag "Line Length Limit"
916 (integer :tag "Line Length")
917 (const :tag "Use fill-column" nil))
872 :group 'whitespace) 918 :group 'whitespace)
873 919
874 920
875 ;; Hacked from `visible-whitespace-mappings' in visws.el 921 ;; Hacked from `visible-whitespace-mappings' in visws.el
876 (defcustom whitespace-display-mappings 922 (defcustom whitespace-display-mappings
1150 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 1196 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1151 ;;;; User commands - Toggle 1197 ;;;; User commands - Toggle
1152 1198
1153 1199
1154 (defconst whitespace-style-value-list 1200 (defconst whitespace-style-value-list
1155 '(tabs 1201 '(face
1202 tabs
1156 spaces 1203 spaces
1157 trailing 1204 trailing
1158 lines 1205 lines
1159 lines-tail 1206 lines-tail
1160 newline 1207 newline
1175 ) 1222 )
1176 "List of valid `whitespace-style' values.") 1223 "List of valid `whitespace-style' values.")
1177 1224
1178 1225
1179 (defconst whitespace-toggle-option-alist 1226 (defconst whitespace-toggle-option-alist
1180 '((?t . tabs) 1227 '((?f . face)
1228 (?t . tabs)
1181 (?s . spaces) 1229 (?s . spaces)
1182 (?r . trailing) 1230 (?r . trailing)
1183 (?l . lines) 1231 (?l . lines)
1184 (?L . lines-tail) 1232 (?L . lines-tail)
1185 (?n . newline) 1233 (?n . newline)
1255 1303
1256 Interactively, it reads one of the following chars: 1304 Interactively, it reads one of the following chars:
1257 1305
1258 CHAR MEANING 1306 CHAR MEANING
1259 (VIA FACES) 1307 (VIA FACES)
1308 f toggle face visualization
1260 t toggle TAB visualization 1309 t toggle TAB visualization
1261 s toggle SPACE and HARD SPACE visualization 1310 s toggle SPACE and HARD SPACE visualization
1262 r toggle trailing blanks visualization 1311 r toggle trailing blanks visualization
1263 l toggle \"long lines\" visualization 1312 l toggle \"long lines\" visualization
1264 L toggle \"long lines\" tail visualization 1313 L toggle \"long lines\" tail visualization
1283 ? display brief help 1332 ? display brief help
1284 1333
1285 Non-interactively, ARG should be a symbol or a list of symbols. 1334 Non-interactively, ARG should be a symbol or a list of symbols.
1286 The valid symbols are: 1335 The valid symbols are:
1287 1336
1337 face toggle face visualization
1288 tabs toggle TAB visualization 1338 tabs toggle TAB visualization
1289 spaces toggle SPACE and HARD SPACE visualization 1339 spaces toggle SPACE and HARD SPACE visualization
1290 trailing toggle trailing blanks visualization 1340 trailing toggle trailing blanks visualization
1291 lines toggle \"long lines\" visualization 1341 lines toggle \"long lines\" visualization
1292 lines-tail toggle \"long lines\" tail visualization 1342 lines-tail toggle \"long lines\" tail visualization
1332 1382
1333 Interactively, it accepts one of the following chars: 1383 Interactively, it accepts one of the following chars:
1334 1384
1335 CHAR MEANING 1385 CHAR MEANING
1336 (VIA FACES) 1386 (VIA FACES)
1387 f toggle face visualization
1337 t toggle TAB visualization 1388 t toggle TAB visualization
1338 s toggle SPACE and HARD SPACE visualization 1389 s toggle SPACE and HARD SPACE visualization
1339 r toggle trailing blanks visualization 1390 r toggle trailing blanks visualization
1340 l toggle \"long lines\" visualization 1391 l toggle \"long lines\" visualization
1341 L toggle \"long lines\" tail visualization 1392 L toggle \"long lines\" tail visualization
1360 ? display brief help 1411 ? display brief help
1361 1412
1362 Non-interactively, ARG should be a symbol or a list of symbols. 1413 Non-interactively, ARG should be a symbol or a list of symbols.
1363 The valid symbols are: 1414 The valid symbols are:
1364 1415
1416 face toggle face visualization
1365 tabs toggle TAB visualization 1417 tabs toggle TAB visualization
1366 spaces toggle SPACE and HARD SPACE visualization 1418 spaces toggle SPACE and HARD SPACE visualization
1367 trailing toggle trailing blanks visualization 1419 trailing toggle trailing blanks visualization
1368 lines toggle \"long lines\" visualization 1420 lines toggle \"long lines\" visualization
1369 lines-tail toggle \"long lines\" tail visualization 1421 lines-tail toggle \"long lines\" tail visualization
1889 "Used to save locally `font-lock-keywords' value.") 1941 "Used to save locally `font-lock-keywords' value.")
1890 1942
1891 1943
1892 (defconst whitespace-help-text 1944 (defconst whitespace-help-text
1893 "\ 1945 "\
1894 Whitespace Toggle Options 1946 Whitespace Toggle Options | scroll up : SPC or > |
1895 1947 | scroll down: M-SPC or < |
1896 FACES 1948 FACES \\__________________________/
1949 [] f - toggle face visualization
1897 [] t - toggle TAB visualization 1950 [] t - toggle TAB visualization
1898 [] s - toggle SPACE and HARD SPACE visualization 1951 [] s - toggle SPACE and HARD SPACE visualization
1899 [] r - toggle trailing blanks visualization 1952 [] r - toggle trailing blanks visualization
1900 [] l - toggle \"long lines\" visualization 1953 [] l - toggle \"long lines\" visualization
1901 [] L - toggle \"long lines\" tail visualization 1954 [] L - toggle \"long lines\" tail visualization
1965 2018
1966 (defun whitespace-display-window (buffer) 2019 (defun whitespace-display-window (buffer)
1967 "Display BUFFER in a new window." 2020 "Display BUFFER in a new window."
1968 (goto-char (point-min)) 2021 (goto-char (point-min))
1969 (set-buffer-modified-p nil) 2022 (set-buffer-modified-p nil)
1970 (let ((size (- (window-height) 2023 (when (< (window-height) (* 2 window-min-height))
1971 (max window-min-height 2024 (kill-buffer buffer)
1972 (1+ (count-lines (point-min) 2025 (error "Window height is too small; \
1973 (point-max)))))))
1974 (when (<= size 0)
1975 (kill-buffer buffer)
1976 (error "Frame height is too small; \
1977 can't split window to display whitespace toggle options")) 2026 can't split window to display whitespace toggle options"))
1978 (set-window-buffer (split-window nil size) buffer))) 2027 (let ((win (split-window)))
2028 (set-window-buffer win buffer)
2029 (shrink-window-if-larger-than-buffer win)))
1979 2030
1980 2031
1981 (defun whitespace-kill-buffer (buffer-name) 2032 (defun whitespace-kill-buffer (buffer-name)
1982 "Kill buffer BUFFER-NAME and windows related with it." 2033 "Kill buffer BUFFER-NAME and windows related with it."
1983 (let ((buffer (get-buffer buffer-name))) 2034 (let ((buffer (get-buffer buffer-name)))
1989 (defun whitespace-help-off () 2040 (defun whitespace-help-off ()
1990 "Remove the buffer and window of the whitespace toggle options." 2041 "Remove the buffer and window of the whitespace toggle options."
1991 (whitespace-kill-buffer whitespace-help-buffer-name)) 2042 (whitespace-kill-buffer whitespace-help-buffer-name))
1992 2043
1993 2044
2045 (defun whitespace-help-scroll (&optional up)
2046 "Scroll help window, if it exists.
2047
2048 If UP is non-nil, scroll up; otherwise, scroll down."
2049 (condition-case data-help
2050 (let ((buffer (get-buffer whitespace-help-buffer-name)))
2051 (if buffer
2052 (with-selected-window (get-buffer-window buffer)
2053 (if up
2054 (scroll-up 3)
2055 (scroll-down 3)))
2056 (ding)))
2057 ;; handler
2058 ((error)
2059 ;; just ignore error
2060 )))
2061
2062
1994 (defun whitespace-interactive-char (local-p) 2063 (defun whitespace-interactive-char (local-p)
1995 "Interactive function to read a char and return a symbol. 2064 "Interactive function to read a char and return a symbol.
1996 2065
1997 If LOCAL-P is non-nil, it uses a local context; otherwise, it 2066 If LOCAL-P is non-nil, it uses a local context; otherwise, it
1998 uses a global context. 2067 uses a global context.
1999 2068
2000 It accepts one of the following chars: 2069 It accepts one of the following chars:
2001 2070
2002 CHAR MEANING 2071 CHAR MEANING
2003 (VIA FACES) 2072 (VIA FACES)
2073 f toggle face visualization
2004 t toggle TAB visualization 2074 t toggle TAB visualization
2005 s toggle SPACE and HARD SPACE visualization 2075 s toggle SPACE and HARD SPACE visualization
2006 r toggle trailing blanks visualization 2076 r toggle trailing blanks visualization
2007 l toggle \"long lines\" visualization 2077 l toggle \"long lines\" visualization
2008 L toggle \"long lines\" tail visualization 2078 L toggle \"long lines\" tail visualization
2048 (not 2118 (not
2049 (setq sym 2119 (setq sym
2050 (cdr 2120 (cdr
2051 (assq ch whitespace-toggle-option-alist))))) 2121 (assq ch whitespace-toggle-option-alist)))))
2052 ;; while body 2122 ;; while body
2053 (if (eq ch ?\?) 2123 (cond
2054 (whitespace-help-on style) 2124 ((eq ch ?\?) (whitespace-help-on style))
2055 (ding))) 2125 ((eq ch ?\ ) (whitespace-help-scroll t))
2126 ((eq ch ?\M- ) (whitespace-help-scroll))
2127 ((eq ch ?>) (whitespace-help-scroll t))
2128 ((eq ch ?<) (whitespace-help-scroll))
2129 (t (ding))))
2056 (whitespace-help-off) 2130 (whitespace-help-off)
2057 (message " ")) ; clean echo area 2131 (message " ")) ; clean echo area
2058 ;; handler 2132 ;; handler
2059 ((quit error) 2133 ((quit error)
2060 (whitespace-help-off) 2134 (whitespace-help-off)
2129 (whitespace-display-char-off))) 2203 (whitespace-display-char-off)))
2130 2204
2131 2205
2132 (defun whitespace-style-face-p () 2206 (defun whitespace-style-face-p ()
2133 "Return t if there is some visualization via face." 2207 "Return t if there is some visualization via face."
2134 (or (memq 'tabs whitespace-active-style) 2208 (and (memq 'face whitespace-active-style)
2135 (memq 'spaces whitespace-active-style) 2209 (or (memq 'tabs whitespace-active-style)
2136 (memq 'trailing whitespace-active-style) 2210 (memq 'spaces whitespace-active-style)
2137 (memq 'lines whitespace-active-style) 2211 (memq 'trailing whitespace-active-style)
2138 (memq 'lines-tail whitespace-active-style) 2212 (memq 'lines whitespace-active-style)
2139 (memq 'newline whitespace-active-style) 2213 (memq 'lines-tail whitespace-active-style)
2140 (memq 'empty whitespace-active-style) 2214 (memq 'newline whitespace-active-style)
2141 (memq 'indentation whitespace-active-style) 2215 (memq 'empty whitespace-active-style)
2142 (memq 'indentation::tab whitespace-active-style) 2216 (memq 'indentation whitespace-active-style)
2143 (memq 'indentation::space whitespace-active-style) 2217 (memq 'indentation::tab whitespace-active-style)
2144 (memq 'space-after-tab whitespace-active-style) 2218 (memq 'indentation::space whitespace-active-style)
2145 (memq 'space-after-tab::tab whitespace-active-style) 2219 (memq 'space-after-tab whitespace-active-style)
2146 (memq 'space-after-tab::space whitespace-active-style) 2220 (memq 'space-after-tab::tab whitespace-active-style)
2147 (memq 'space-before-tab whitespace-active-style) 2221 (memq 'space-after-tab::space whitespace-active-style)
2148 (memq 'space-before-tab::tab whitespace-active-style) 2222 (memq 'space-before-tab whitespace-active-style)
2149 (memq 'space-before-tab::space whitespace-active-style))) 2223 (memq 'space-before-tab::tab whitespace-active-style)
2224 (memq 'space-before-tab::space whitespace-active-style))))
2150 2225
2151 2226
2152 (defun whitespace-color-on () 2227 (defun whitespace-color-on ()
2153 "Turn on color visualization." 2228 "Turn on color visualization."
2154 (when (whitespace-style-face-p) 2229 (when (whitespace-style-face-p)
2202 (font-lock-add-keywords 2277 (font-lock-add-keywords
2203 nil 2278 nil
2204 (list 2279 (list
2205 ;; Show "long" lines 2280 ;; Show "long" lines
2206 (list 2281 (list
2207 (format 2282 (let ((line-column (or whitespace-line-column fill-column)))
2208 "^\\([^\t\n]\\{%s\\}\\|[^\t\n]\\{0,%s\\}\t\\)\\{%d\\}%s\\(.+\\)$" 2283 (format
2209 whitespace-tab-width (1- whitespace-tab-width) 2284 "^\\([^\t\n]\\{%s\\}\\|[^\t\n]\\{0,%s\\}\t\\)\\{%d\\}%s\\(.+\\)$"
2210 (/ whitespace-line-column whitespace-tab-width) 2285 whitespace-tab-width
2211 (let ((rem (% whitespace-line-column whitespace-tab-width))) 2286 (1- whitespace-tab-width)
2212 (if (zerop rem) 2287 (/ line-column whitespace-tab-width)
2213 "" 2288 (let ((rem (% line-column whitespace-tab-width)))
2214 (format ".\\{%d\\}" rem)))) 2289 (if (zerop rem)
2290 ""
2291 (format ".\\{%d\\}" rem)))))
2215 (if (memq 'lines whitespace-active-style) 2292 (if (memq 'lines whitespace-active-style)
2216 0 ; whole line 2293 0 ; whole line
2217 2) ; line tail 2294 2) ; line tail
2218 whitespace-line t)) 2295 whitespace-line t))
2219 t)) 2296 t))