aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReuben Thomas2016-10-25 23:04:18 +0100
committerReuben Thomas2016-11-03 12:16:56 +0000
commit50bba7f47ee52dd07f72f326377d6436ee1a4cdc (patch)
tree80efc0bd4fd7d26a2bb71b4fb40b4ea5363392ae
parent2350bb95316f51d42e3abebd199126482c519744 (diff)
downloademacs-50bba7f47ee52dd07f72f326377d6436ee1a4cdc.tar.gz
emacs-50bba7f47ee52dd07f72f326377d6436ee1a4cdc.zip
Document use of `tab-width'
* lisp/whitespace.el: When talking about `8 or more spaces', mention `tab-width' instead of 8. (Bug#24745)
-rw-r--r--lisp/whitespace.el103
1 files changed, 52 insertions, 51 deletions
diff --git a/lisp/whitespace.el b/lisp/whitespace.el
index a270a19183e..b7cc5f91cd3 100644
--- a/lisp/whitespace.el
+++ b/lisp/whitespace.el
@@ -332,8 +332,8 @@ It's a list containing some or all of the following values:
332 It has effect only if `face' (see above) 332 It has effect only if `face' (see above)
333 is present in `whitespace-style'. 333 is present in `whitespace-style'.
334 334
335 indentation::tab 8 or more SPACEs at beginning of line are 335 indentation::tab `tab-width' or more SPACEs at beginning of line
336 visualized via faces. 336 are visualized via faces.
337 It has effect only if `face' (see above) 337 It has effect only if `face' (see above)
338 is present in `whitespace-style'. 338 is present in `whitespace-style'.
339 339
@@ -342,10 +342,10 @@ It's a list containing some or all of the following values:
342 It has effect only if `face' (see above) 342 It has effect only if `face' (see above)
343 is present in `whitespace-style'. 343 is present in `whitespace-style'.
344 344
345 indentation 8 or more SPACEs at beginning of line are 345 indentation `tab-width' or more SPACEs at beginning of line
346 visualized, if `indent-tabs-mode' (which see) 346 are visualized, if `indent-tabs-mode' (which
347 is non-nil; otherwise, TABs at beginning of 347 see) is non-nil; otherwise, TABs at beginning
348 line are visualized via faces. 348 of line are visualized via faces.
349 It has effect only if `face' (see above) 349 It has effect only if `face' (see above)
350 is present in `whitespace-style'. 350 is present in `whitespace-style'.
351 351
@@ -353,18 +353,19 @@ It's a list containing some or all of the following values:
353 It has effect only if `face' (see above) 353 It has effect only if `face' (see above)
354 is present in `whitespace-style'. 354 is present in `whitespace-style'.
355 355
356 space-after-tab::tab 8 or more SPACEs after a TAB are 356 space-after-tab::tab `tab-width' or more SPACEs after a TAB
357 visualized via faces. 357 are visualized via faces.
358 It has effect only if `face' (see above) 358 It has effect only if `face' (see above)
359 is present in `whitespace-style'. 359 is present in `whitespace-style'.
360 360
361 space-after-tab::space TABs are visualized when 8 or more 361 space-after-tab::space TABs are visualized when `tab-width' or
362 SPACEs occur after a TAB, via faces. 362 more SPACEs occur after a TAB, via
363 faces.
363 It has effect only if `face' (see above) 364 It has effect only if `face' (see above)
364 is present in `whitespace-style'. 365 is present in `whitespace-style'.
365 366
366 space-after-tab 8 or more SPACEs after a TAB are 367 space-after-tab `tab-width' or more SPACEs after a TAB
367 visualized, if `indent-tabs-mode' 368 are visualized, if `indent-tabs-mode'
368 (which see) is non-nil; otherwise, 369 (which see) is non-nil; otherwise,
369 the TABs are visualized via faces. 370 the TABs are visualized via faces.
370 It has effect only if `face' (see above) 371 It has effect only if `face' (see above)
@@ -569,14 +570,14 @@ Used when `whitespace-style' includes the value `space-before-tab'.")
569 570
570 571
571(defvar whitespace-indentation 'whitespace-indentation 572(defvar whitespace-indentation 'whitespace-indentation
572 "Symbol face used to visualize 8 or more SPACEs at beginning of line. 573 "Symbol face used to visualize `tab-width' or more SPACEs at beginning of
573Used when `whitespace-style' includes the value `indentation'.") 574line. Used when `whitespace-style' includes the value `indentation'.")
574(make-obsolete-variable 'whitespace-indentation "use the face instead." "24.4") 575(make-obsolete-variable 'whitespace-indentation "use the face instead." "24.4")
575 576
576(defface whitespace-indentation 577(defface whitespace-indentation
577 '((((class mono)) :inverse-video t :weight bold :underline t) 578 '((((class mono)) :inverse-video t :weight bold :underline t)
578 (t :background "yellow" :foreground "firebrick")) 579 (t :background "yellow" :foreground "firebrick"))
579 "Face used to visualize 8 or more SPACEs at beginning of line." 580 "Face used to visualize `tab-width' or more SPACEs at beginning of line."
580 :group 'whitespace) 581 :group 'whitespace)
581 582
582(defface whitespace-big-indent 583(defface whitespace-big-indent
@@ -599,7 +600,7 @@ Used when `whitespace-style' includes the value `empty'.")
599 600
600 601
601(defvar whitespace-space-after-tab 'whitespace-space-after-tab 602(defvar whitespace-space-after-tab 'whitespace-space-after-tab
602 "Symbol face used to visualize 8 or more SPACEs after TAB. 603 "Symbol face used to visualize `tab-width' or more SPACEs after TAB.
603Used when `whitespace-style' includes the value `space-after-tab'.") 604Used when `whitespace-style' includes the value `space-after-tab'.")
604(make-obsolete-variable 'whitespace-space-after-tab 605(make-obsolete-variable 'whitespace-space-after-tab
605 "use the face instead." "24.4") 606 "use the face instead." "24.4")
@@ -607,7 +608,7 @@ Used when `whitespace-style' includes the value `space-after-tab'.")
607(defface whitespace-space-after-tab 608(defface whitespace-space-after-tab
608 '((((class mono)) :inverse-video t :weight bold :underline t) 609 '((((class mono)) :inverse-video t :weight bold :underline t)
609 (t :background "yellow" :foreground "firebrick")) 610 (t :background "yellow" :foreground "firebrick"))
610 "Face used to visualize 8 or more SPACEs after TAB." 611 "Face used to visualize `tab-width' or more SPACEs after TAB."
611 :group 'whitespace) 612 :group 'whitespace)
612 613
613 614
@@ -708,7 +709,7 @@ Used when `whitespace-style' includes `space-before-tab',
708(defcustom whitespace-indentation-regexp 709(defcustom whitespace-indentation-regexp
709 '("^\t*\\(\\( \\{%d\\}\\)+\\)[^\n\t]" 710 '("^\t*\\(\\( \\{%d\\}\\)+\\)[^\n\t]"
710 . "^ *\\(\t+\\)[^\n]") 711 . "^ *\\(\t+\\)[^\n]")
711 "Specify regexp for 8 or more SPACEs at beginning of line. 712 "Specify regexp for `tab-width' or more SPACEs at beginning of line.
712 713
713It is a cons where the cons car is used for SPACEs visualization 714It is a cons where the cons car is used for SPACEs visualization
714and the cons cdr is used for TABs visualization. 715and the cons cdr is used for TABs visualization.
@@ -739,7 +740,7 @@ Used when `whitespace-style' includes `empty'."
739(defcustom whitespace-space-after-tab-regexp 740(defcustom whitespace-space-after-tab-regexp
740 '("\t+\\(\\( \\{%d,\\}\\)+\\)" 741 '("\t+\\(\\( \\{%d,\\}\\)+\\)"
741 . "\\(\t+\\) \\{%d,\\}") 742 . "\\(\t+\\) \\{%d,\\}")
742 "Specify regexp for 8 or more SPACEs after TAB. 743 "Specify regexp for `tab-width' or more SPACEs after TAB.
743 744
744It is a cons where the cons car is used for SPACEs visualization 745It is a cons where the cons car is used for SPACEs visualization
745and the cons cdr is used for TABs visualization. 746and the cons cdr is used for TABs visualization.
@@ -1345,13 +1346,13 @@ The problems cleaned up are:
1345 If `whitespace-style' includes the value `empty', remove all 1346 If `whitespace-style' includes the value `empty', remove all
1346 empty lines at beginning and/or end of buffer. 1347 empty lines at beginning and/or end of buffer.
1347 1348
13483. 8 or more SPACEs at beginning of line. 13493. `tab-width' or more SPACEs at beginning of line.
1349 If `whitespace-style' includes the value `indentation': 1350 If `whitespace-style' includes the value `indentation':
1350 replace 8 or more SPACEs at beginning of line by TABs, if 1351 replace `tab-width' or more SPACEs at beginning of line by
1351 `indent-tabs-mode' is non-nil; otherwise, replace TABs by 1352 TABs, if `indent-tabs-mode' is non-nil; otherwise, replace TABs by
1352 SPACEs. 1353 SPACEs.
1353 If `whitespace-style' includes the value `indentation::tab', 1354 If `whitespace-style' includes the value `indentation::tab',
1354 replace 8 or more SPACEs at beginning of line by TABs. 1355 replace `tab-width' or more SPACEs at beginning of line by TABs.
1355 If `whitespace-style' includes the value `indentation::space', 1356 If `whitespace-style' includes the value `indentation::space',
1356 replace TABs by SPACEs. 1357 replace TABs by SPACEs.
1357 1358
@@ -1368,7 +1369,7 @@ The problems cleaned up are:
1368 If `whitespace-style' includes the value `trailing', remove 1369 If `whitespace-style' includes the value `trailing', remove
1369 all SPACEs or TABs at end of line. 1370 all SPACEs or TABs at end of line.
1370 1371
13716. 8 or more SPACEs after TAB. 13726. `tab-width' or more SPACEs after TAB.
1372 If `whitespace-style' includes the value `space-after-tab': 1373 If `whitespace-style' includes the value `space-after-tab':
1373 replace SPACEs by TABs, if `indent-tabs-mode' is non-nil; 1374 replace SPACEs by TABs, if `indent-tabs-mode' is non-nil;
1374 otherwise, replace TABs by SPACEs. 1375 otherwise, replace TABs by SPACEs.
@@ -1389,10 +1390,10 @@ documentation."
1389 current-prefix-arg) 1390 current-prefix-arg)
1390 mark-active) 1391 mark-active)
1391 ;; PROBLEMs 1 and 2 are not handled in region 1392 ;; PROBLEMs 1 and 2 are not handled in region
1392 ;; PROBLEM 3: 8 or more SPACEs at bol 1393 ;; PROBLEM 3: `tab-width' or more SPACEs at bol
1393 ;; PROBLEM 4: SPACEs before TAB 1394 ;; PROBLEM 4: SPACEs before TAB
1394 ;; PROBLEM 5: SPACEs or TABs at eol 1395 ;; PROBLEM 5: SPACEs or TABs at eol
1395 ;; PROBLEM 6: 8 or more SPACEs after TAB 1396 ;; PROBLEM 6: `tab-width' or more SPACEs after TAB
1396 (whitespace-cleanup-region (region-beginning) (region-end))) 1397 (whitespace-cleanup-region (region-beginning) (region-end)))
1397 ;; whole buffer 1398 ;; whole buffer
1398 (t 1399 (t
@@ -1409,10 +1410,10 @@ documentation."
1409 (when (re-search-forward 1410 (when (re-search-forward
1410 whitespace-empty-at-eob-regexp nil t) 1411 whitespace-empty-at-eob-regexp nil t)
1411 (delete-region (match-beginning 1) (match-end 1))))))) 1412 (delete-region (match-beginning 1) (match-end 1)))))))
1412 ;; PROBLEM 3: 8 or more SPACEs at bol 1413 ;; PROBLEM 3: `tab-width' or more SPACEs at bol
1413 ;; PROBLEM 4: SPACEs before TAB 1414 ;; PROBLEM 4: SPACEs before TAB
1414 ;; PROBLEM 5: SPACEs or TABs at eol 1415 ;; PROBLEM 5: SPACEs or TABs at eol
1415 ;; PROBLEM 6: 8 or more SPACEs after TAB 1416 ;; PROBLEM 6: `tab-width' or more SPACEs after TAB
1416 (whitespace-cleanup-region (point-min) (point-max))))) 1417 (whitespace-cleanup-region (point-min) (point-max)))))
1417 1418
1418(defun whitespace-ensure-local-variables () 1419(defun whitespace-ensure-local-variables ()
@@ -1428,13 +1429,13 @@ documentation."
1428 1429
1429The problems cleaned up are: 1430The problems cleaned up are:
1430 1431
14311. 8 or more SPACEs at beginning of line. 14321. `tab-width' or more SPACEs at beginning of line.
1432 If `whitespace-style' includes the value `indentation': 1433 If `whitespace-style' includes the value `indentation':
1433 replace 8 or more SPACEs at beginning of line by TABs, if 1434 replace `tab-width' or more SPACEs at beginning of line by TABs,
1434 `indent-tabs-mode' is non-nil; otherwise, replace TABs by 1435 if `indent-tabs-mode' is non-nil; otherwise, replace TABs by
1435 SPACEs. 1436 SPACEs.
1436 If `whitespace-style' includes the value `indentation::tab', 1437 If `whitespace-style' includes the value `indentation::tab',
1437 replace 8 or more SPACEs at beginning of line by TABs. 1438 replace `tab-width' or more SPACEs at beginning of line by TABs.
1438 If `whitespace-style' includes the value `indentation::space', 1439 If `whitespace-style' includes the value `indentation::space',
1439 replace TABs by SPACEs. 1440 replace TABs by SPACEs.
1440 1441
@@ -1451,7 +1452,7 @@ The problems cleaned up are:
1451 If `whitespace-style' includes the value `trailing', remove 1452 If `whitespace-style' includes the value `trailing', remove
1452 all SPACEs or TABs at end of line. 1453 all SPACEs or TABs at end of line.
1453 1454
14544. 8 or more SPACEs after TAB. 14554. `tab-width' or more SPACEs after TAB.
1455 If `whitespace-style' includes the value `space-after-tab': 1456 If `whitespace-style' includes the value `space-after-tab':
1456 replace SPACEs by TABs, if `indent-tabs-mode' is non-nil; 1457 replace SPACEs by TABs, if `indent-tabs-mode' is non-nil;
1457 otherwise, replace TABs by SPACEs. 1458 otherwise, replace TABs by SPACEs.
@@ -1476,9 +1477,9 @@ documentation."
1476 tmp) 1477 tmp)
1477 (save-excursion 1478 (save-excursion
1478 (save-match-data ;FIXME: Why? 1479 (save-match-data ;FIXME: Why?
1479 ;; PROBLEM 1: 8 or more SPACEs at bol 1480 ;; PROBLEM 1: `tab-width' or more SPACEs at bol
1480 (cond 1481 (cond
1481 ;; ACTION: replace 8 or more SPACEs at bol by TABs, if 1482 ;; ACTION: replace `tab-width' or more SPACEs at bol by TABs, if
1482 ;; `indent-tabs-mode' is non-nil; otherwise, replace TABs 1483 ;; `indent-tabs-mode' is non-nil; otherwise, replace TABs
1483 ;; by SPACEs. 1484 ;; by SPACEs.
1484 ((memq 'indentation whitespace-style) 1485 ((memq 'indentation whitespace-style)
@@ -1490,7 +1491,7 @@ documentation."
1490 (delete-horizontal-space) 1491 (delete-horizontal-space)
1491 (unless (eolp) 1492 (unless (eolp)
1492 (indent-to tmp))))) 1493 (indent-to tmp)))))
1493 ;; ACTION: replace 8 or more SPACEs at bol by TABs. 1494 ;; ACTION: replace `tab-width' or more SPACEs at bol by TABs.
1494 ((memq 'indentation::tab whitespace-style) 1495 ((memq 'indentation::tab whitespace-style)
1495 (whitespace-replace-action 1496 (whitespace-replace-action
1496 'tabify rstart rend 1497 'tabify rstart rend
@@ -1506,16 +1507,16 @@ documentation."
1506 (whitespace-replace-action 1507 (whitespace-replace-action
1507 'delete-region rstart rend 1508 'delete-region rstart rend
1508 whitespace-trailing-regexp 1)) 1509 whitespace-trailing-regexp 1))
1509 ;; PROBLEM 4: 8 or more SPACEs after TAB 1510 ;; PROBLEM 4: `tab-width' or more SPACEs after TAB
1510 (cond 1511 (cond
1511 ;; ACTION: replace 8 or more SPACEs by TABs, if 1512 ;; ACTION: replace `tab-width' or more SPACEs by TABs, if
1512 ;; `indent-tabs-mode' is non-nil; otherwise, replace TABs 1513 ;; `indent-tabs-mode' is non-nil; otherwise, replace TABs
1513 ;; by SPACEs. 1514 ;; by SPACEs.
1514 ((memq 'space-after-tab whitespace-style) 1515 ((memq 'space-after-tab whitespace-style)
1515 (whitespace-replace-action 1516 (whitespace-replace-action
1516 (if whitespace-indent-tabs-mode 'tabify 'untabify) 1517 (if whitespace-indent-tabs-mode 'tabify 'untabify)
1517 rstart rend (whitespace-space-after-tab-regexp) 1)) 1518 rstart rend (whitespace-space-after-tab-regexp) 1))
1518 ;; ACTION: replace 8 or more SPACEs by TABs. 1519 ;; ACTION: replace `tab-width' or more SPACEs by TABs.
1519 ((memq 'space-after-tab::tab whitespace-style) 1520 ((memq 'space-after-tab::tab whitespace-style)
1520 (whitespace-replace-action 1521 (whitespace-replace-action
1521 'tabify rstart rend 1522 'tabify rstart rend
@@ -1615,15 +1616,15 @@ See also `tab-width'."
1615 empty [] [] empty lines at beginning of buffer 1616 empty [] [] empty lines at beginning of buffer
1616 empty [] [] empty lines at end of buffer 1617 empty [] [] empty lines at end of buffer
1617 trailing [] [] SPACEs or TABs at end of line 1618 trailing [] [] SPACEs or TABs at end of line
1618 indentation [] [] 8 or more SPACEs at beginning of line 1619 indentation [] [] >= `tab-width' SPACEs at beginning of line
1619 indentation::tab [] [] 8 or more SPACEs at beginning of line 1620 indentation::tab [] [] >= `tab-width' SPACEs at beginning of line
1620 indentation::space [] [] TABs at beginning of line 1621 indentation::space [] [] TABs at beginning of line
1621 space-before-tab [] [] SPACEs before TAB 1622 space-before-tab [] [] SPACEs before TAB
1622 space-before-tab::tab [] [] SPACEs before TAB: SPACEs 1623 space-before-tab::tab [] [] SPACEs before TAB: SPACEs
1623 space-before-tab::space [] [] SPACEs before TAB: TABs 1624 space-before-tab::space [] [] SPACEs before TAB: TABs
1624 space-after-tab [] [] 8 or more SPACEs after TAB 1625 space-after-tab [] [] >= `tab-width' SPACEs after TAB
1625 space-after-tab::tab [] [] 8 or more SPACEs after TAB: SPACEs 1626 space-after-tab::tab [] [] >= `tab-width' SPACEs after TAB: SPACEs
1626 space-after-tab::space [] [] 8 or more SPACEs after TAB: TABs 1627 space-after-tab::space [] [] >= `tab-width' SPACEs after TAB: TABs
1627 1628
1628 indent-tabs-mode = 1629 indent-tabs-mode =
1629 tab-width = \n\n" 1630 tab-width = \n\n"
@@ -1637,14 +1638,14 @@ See also `tab-width'."
1637 empty [] [] empty lines at end of buffer 1638 empty [] [] empty lines at end of buffer
1638 trailing [] [] SPACEs or TABs at end of line 1639 trailing [] [] SPACEs or TABs at end of line
1639 indentation [] [] TABs at beginning of line 1640 indentation [] [] TABs at beginning of line
1640 indentation::tab [] [] 8 or more SPACEs at beginning of line 1641 indentation::tab [] [] >= `tab-width' SPACEs at beginning of line
1641 indentation::space [] [] TABs at beginning of line 1642 indentation::space [] [] TABs at beginning of line
1642 space-before-tab [] [] SPACEs before TAB 1643 space-before-tab [] [] SPACEs before TAB
1643 space-before-tab::tab [] [] SPACEs before TAB: SPACEs 1644 space-before-tab::tab [] [] SPACEs before TAB: SPACEs
1644 space-before-tab::space [] [] SPACEs before TAB: TABs 1645 space-before-tab::space [] [] SPACEs before TAB: TABs
1645 space-after-tab [] [] 8 or more SPACEs after TAB 1646 space-after-tab [] [] >= `tab-width' SPACEs after TAB
1646 space-after-tab::tab [] [] 8 or more SPACEs after TAB: SPACEs 1647 space-after-tab::tab [] [] >= `tab-width' SPACEs after TAB: SPACEs
1647 space-after-tab::space [] [] 8 or more SPACEs after TAB: TABs 1648 space-after-tab::space [] [] >= `tab-width' SPACEs after TAB: TABs
1648 1649
1649 indent-tabs-mode = 1650 indent-tabs-mode =
1650 tab-width = \n\n") 1651 tab-width = \n\n")
@@ -1696,9 +1697,9 @@ Report if some of the following whitespace problems exist:
1696 empty 1. empty lines at beginning of buffer. 1697 empty 1. empty lines at beginning of buffer.
1697 empty 2. empty lines at end of buffer. 1698 empty 2. empty lines at end of buffer.
1698 trailing 3. SPACEs or TABs at end of line. 1699 trailing 3. SPACEs or TABs at end of line.
1699 indentation 4. 8 or more SPACEs at beginning of line. 1700 indentation 4. line starts with `tab-width' or more SPACEs.
1700 space-before-tab 5. SPACEs before TAB. 1701 space-before-tab 5. SPACEs before TAB.
1701 space-after-tab 6. 8 or more SPACEs after TAB. 1702 space-after-tab 6. `tab-width' or more SPACEs after TAB.
1702 1703
1703* If `indent-tabs-mode' is nil: 1704* If `indent-tabs-mode' is nil:
1704 empty 1. empty lines at beginning of buffer. 1705 empty 1. empty lines at beginning of buffer.
@@ -1706,7 +1707,7 @@ Report if some of the following whitespace problems exist:
1706 trailing 3. SPACEs or TABs at end of line. 1707 trailing 3. SPACEs or TABs at end of line.
1707 indentation 4. TABS at beginning of line. 1708 indentation 4. TABS at beginning of line.
1708 space-before-tab 5. SPACEs before TAB. 1709 space-before-tab 5. SPACEs before TAB.
1709 space-after-tab 6. 8 or more SPACEs after TAB. 1710 space-after-tab 6. `tab-width' or more SPACEs after TAB.
1710 1711
1711See `whitespace-style' for documentation. 1712See `whitespace-style' for documentation.
1712See also `whitespace-cleanup' and `whitespace-cleanup-region' for 1713See also `whitespace-cleanup' and `whitespace-cleanup-region' for