Document use of `tab-width'

* lisp/whitespace.el: When talking about `8 or more spaces', mention
`tab-width' instead of 8.  (Bug#24745)
This commit is contained in:
Reuben Thomas 2016-10-25 23:04:18 +01:00
parent 2350bb9531
commit 50bba7f47e

View file

@ -332,8 +332,8 @@ It's a list containing some or all of the following values:
It has effect only if `face' (see above)
is present in `whitespace-style'.
indentation::tab 8 or more SPACEs at beginning of line are
visualized via faces.
indentation::tab `tab-width' or more SPACEs at beginning of line
are visualized via faces.
It has effect only if `face' (see above)
is present in `whitespace-style'.
@ -342,10 +342,10 @@ It's a list containing some or all of the following values:
It has effect only if `face' (see above)
is present in `whitespace-style'.
indentation 8 or more SPACEs at beginning of line are
visualized, if `indent-tabs-mode' (which see)
is non-nil; otherwise, TABs at beginning of
line are visualized via faces.
indentation `tab-width' or more SPACEs at beginning of line
are visualized, if `indent-tabs-mode' (which
see) is non-nil; otherwise, TABs at beginning
of line are visualized via faces.
It has effect only if `face' (see above)
is present in `whitespace-style'.
@ -353,18 +353,19 @@ It's a list containing some or all of the following values:
It has effect only if `face' (see above)
is present in `whitespace-style'.
space-after-tab::tab 8 or more SPACEs after a TAB are
visualized via faces.
space-after-tab::tab `tab-width' or more SPACEs after a TAB
are visualized via faces.
It has effect only if `face' (see above)
is present in `whitespace-style'.
space-after-tab::space TABs are visualized when 8 or more
SPACEs occur after a TAB, via faces.
space-after-tab::space TABs are visualized when `tab-width' or
more SPACEs occur after a TAB, via
faces.
It has effect only if `face' (see above)
is present in `whitespace-style'.
space-after-tab 8 or more SPACEs after a TAB are
visualized, if `indent-tabs-mode'
space-after-tab `tab-width' or more SPACEs after a TAB
are visualized, if `indent-tabs-mode'
(which see) is non-nil; otherwise,
the TABs are visualized via faces.
It has effect only if `face' (see above)
@ -569,14 +570,14 @@ Used when `whitespace-style' includes the value `space-before-tab'.")
(defvar whitespace-indentation 'whitespace-indentation
"Symbol face used to visualize 8 or more SPACEs at beginning of line.
Used when `whitespace-style' includes the value `indentation'.")
"Symbol face used to visualize `tab-width' or more SPACEs at beginning of
line. Used when `whitespace-style' includes the value `indentation'.")
(make-obsolete-variable 'whitespace-indentation "use the face instead." "24.4")
(defface whitespace-indentation
'((((class mono)) :inverse-video t :weight bold :underline t)
(t :background "yellow" :foreground "firebrick"))
"Face used to visualize 8 or more SPACEs at beginning of line."
"Face used to visualize `tab-width' or more SPACEs at beginning of line."
:group 'whitespace)
(defface whitespace-big-indent
@ -599,7 +600,7 @@ Used when `whitespace-style' includes the value `empty'.")
(defvar whitespace-space-after-tab 'whitespace-space-after-tab
"Symbol face used to visualize 8 or more SPACEs after TAB.
"Symbol face used to visualize `tab-width' or more SPACEs after TAB.
Used when `whitespace-style' includes the value `space-after-tab'.")
(make-obsolete-variable 'whitespace-space-after-tab
"use the face instead." "24.4")
@ -607,7 +608,7 @@ Used when `whitespace-style' includes the value `space-after-tab'.")
(defface whitespace-space-after-tab
'((((class mono)) :inverse-video t :weight bold :underline t)
(t :background "yellow" :foreground "firebrick"))
"Face used to visualize 8 or more SPACEs after TAB."
"Face used to visualize `tab-width' or more SPACEs after TAB."
:group 'whitespace)
@ -708,7 +709,7 @@ Used when `whitespace-style' includes `space-before-tab',
(defcustom whitespace-indentation-regexp
'("^\t*\\(\\( \\{%d\\}\\)+\\)[^\n\t]"
. "^ *\\(\t+\\)[^\n]")
"Specify regexp for 8 or more SPACEs at beginning of line.
"Specify regexp for `tab-width' or more SPACEs at beginning of line.
It is a cons where the cons car is used for SPACEs visualization
and the cons cdr is used for TABs visualization.
@ -739,7 +740,7 @@ Used when `whitespace-style' includes `empty'."
(defcustom whitespace-space-after-tab-regexp
'("\t+\\(\\( \\{%d,\\}\\)+\\)"
. "\\(\t+\\) \\{%d,\\}")
"Specify regexp for 8 or more SPACEs after TAB.
"Specify regexp for `tab-width' or more SPACEs after TAB.
It is a cons where the cons car is used for SPACEs visualization
and the cons cdr is used for TABs visualization.
@ -1345,13 +1346,13 @@ The problems cleaned up are:
If `whitespace-style' includes the value `empty', remove all
empty lines at beginning and/or end of buffer.
3. 8 or more SPACEs at beginning of line.
3. `tab-width' or more SPACEs at beginning of line.
If `whitespace-style' includes the value `indentation':
replace 8 or more SPACEs at beginning of line by TABs, if
`indent-tabs-mode' is non-nil; otherwise, replace TABs by
replace `tab-width' or more SPACEs at beginning of line by
TABs, if `indent-tabs-mode' is non-nil; otherwise, replace TABs by
SPACEs.
If `whitespace-style' includes the value `indentation::tab',
replace 8 or more SPACEs at beginning of line by TABs.
replace `tab-width' or more SPACEs at beginning of line by TABs.
If `whitespace-style' includes the value `indentation::space',
replace TABs by SPACEs.
@ -1368,7 +1369,7 @@ The problems cleaned up are:
If `whitespace-style' includes the value `trailing', remove
all SPACEs or TABs at end of line.
6. 8 or more SPACEs after TAB.
6. `tab-width' or more SPACEs after TAB.
If `whitespace-style' includes the value `space-after-tab':
replace SPACEs by TABs, if `indent-tabs-mode' is non-nil;
otherwise, replace TABs by SPACEs.
@ -1389,10 +1390,10 @@ documentation."
current-prefix-arg)
mark-active)
;; PROBLEMs 1 and 2 are not handled in region
;; PROBLEM 3: 8 or more SPACEs at bol
;; PROBLEM 3: `tab-width' or more SPACEs at bol
;; PROBLEM 4: SPACEs before TAB
;; PROBLEM 5: SPACEs or TABs at eol
;; PROBLEM 6: 8 or more SPACEs after TAB
;; PROBLEM 6: `tab-width' or more SPACEs after TAB
(whitespace-cleanup-region (region-beginning) (region-end)))
;; whole buffer
(t
@ -1409,10 +1410,10 @@ documentation."
(when (re-search-forward
whitespace-empty-at-eob-regexp nil t)
(delete-region (match-beginning 1) (match-end 1)))))))
;; PROBLEM 3: 8 or more SPACEs at bol
;; PROBLEM 3: `tab-width' or more SPACEs at bol
;; PROBLEM 4: SPACEs before TAB
;; PROBLEM 5: SPACEs or TABs at eol
;; PROBLEM 6: 8 or more SPACEs after TAB
;; PROBLEM 6: `tab-width' or more SPACEs after TAB
(whitespace-cleanup-region (point-min) (point-max)))))
(defun whitespace-ensure-local-variables ()
@ -1428,13 +1429,13 @@ documentation."
The problems cleaned up are:
1. 8 or more SPACEs at beginning of line.
1. `tab-width' or more SPACEs at beginning of line.
If `whitespace-style' includes the value `indentation':
replace 8 or more SPACEs at beginning of line by TABs, if
`indent-tabs-mode' is non-nil; otherwise, replace TABs by
replace `tab-width' or more SPACEs at beginning of line by TABs,
if `indent-tabs-mode' is non-nil; otherwise, replace TABs by
SPACEs.
If `whitespace-style' includes the value `indentation::tab',
replace 8 or more SPACEs at beginning of line by TABs.
replace `tab-width' or more SPACEs at beginning of line by TABs.
If `whitespace-style' includes the value `indentation::space',
replace TABs by SPACEs.
@ -1451,7 +1452,7 @@ The problems cleaned up are:
If `whitespace-style' includes the value `trailing', remove
all SPACEs or TABs at end of line.
4. 8 or more SPACEs after TAB.
4. `tab-width' or more SPACEs after TAB.
If `whitespace-style' includes the value `space-after-tab':
replace SPACEs by TABs, if `indent-tabs-mode' is non-nil;
otherwise, replace TABs by SPACEs.
@ -1476,9 +1477,9 @@ documentation."
tmp)
(save-excursion
(save-match-data ;FIXME: Why?
;; PROBLEM 1: 8 or more SPACEs at bol
;; PROBLEM 1: `tab-width' or more SPACEs at bol
(cond
;; ACTION: replace 8 or more SPACEs at bol by TABs, if
;; ACTION: replace `tab-width' or more SPACEs at bol by TABs, if
;; `indent-tabs-mode' is non-nil; otherwise, replace TABs
;; by SPACEs.
((memq 'indentation whitespace-style)
@ -1490,7 +1491,7 @@ documentation."
(delete-horizontal-space)
(unless (eolp)
(indent-to tmp)))))
;; ACTION: replace 8 or more SPACEs at bol by TABs.
;; ACTION: replace `tab-width' or more SPACEs at bol by TABs.
((memq 'indentation::tab whitespace-style)
(whitespace-replace-action
'tabify rstart rend
@ -1506,16 +1507,16 @@ documentation."
(whitespace-replace-action
'delete-region rstart rend
whitespace-trailing-regexp 1))
;; PROBLEM 4: 8 or more SPACEs after TAB
;; PROBLEM 4: `tab-width' or more SPACEs after TAB
(cond
;; ACTION: replace 8 or more SPACEs by TABs, if
;; ACTION: replace `tab-width' or more SPACEs by TABs, if
;; `indent-tabs-mode' is non-nil; otherwise, replace TABs
;; by SPACEs.
((memq 'space-after-tab whitespace-style)
(whitespace-replace-action
(if whitespace-indent-tabs-mode 'tabify 'untabify)
rstart rend (whitespace-space-after-tab-regexp) 1))
;; ACTION: replace 8 or more SPACEs by TABs.
;; ACTION: replace `tab-width' or more SPACEs by TABs.
((memq 'space-after-tab::tab whitespace-style)
(whitespace-replace-action
'tabify rstart rend
@ -1615,15 +1616,15 @@ See also `tab-width'."
empty [] [] empty lines at beginning of buffer
empty [] [] empty lines at end of buffer
trailing [] [] SPACEs or TABs at end of line
indentation [] [] 8 or more SPACEs at beginning of line
indentation::tab [] [] 8 or more SPACEs at beginning of line
indentation [] [] >= `tab-width' SPACEs at beginning of line
indentation::tab [] [] >= `tab-width' SPACEs at beginning of line
indentation::space [] [] TABs at beginning of line
space-before-tab [] [] SPACEs before TAB
space-before-tab::tab [] [] SPACEs before TAB: SPACEs
space-before-tab::space [] [] SPACEs before TAB: TABs
space-after-tab [] [] 8 or more SPACEs after TAB
space-after-tab::tab [] [] 8 or more SPACEs after TAB: SPACEs
space-after-tab::space [] [] 8 or more SPACEs after TAB: TABs
space-after-tab [] [] >= `tab-width' SPACEs after TAB
space-after-tab::tab [] [] >= `tab-width' SPACEs after TAB: SPACEs
space-after-tab::space [] [] >= `tab-width' SPACEs after TAB: TABs
indent-tabs-mode =
tab-width = \n\n"
@ -1637,14 +1638,14 @@ See also `tab-width'."
empty [] [] empty lines at end of buffer
trailing [] [] SPACEs or TABs at end of line
indentation [] [] TABs at beginning of line
indentation::tab [] [] 8 or more SPACEs at beginning of line
indentation::tab [] [] >= `tab-width' SPACEs at beginning of line
indentation::space [] [] TABs at beginning of line
space-before-tab [] [] SPACEs before TAB
space-before-tab::tab [] [] SPACEs before TAB: SPACEs
space-before-tab::space [] [] SPACEs before TAB: TABs
space-after-tab [] [] 8 or more SPACEs after TAB
space-after-tab::tab [] [] 8 or more SPACEs after TAB: SPACEs
space-after-tab::space [] [] 8 or more SPACEs after TAB: TABs
space-after-tab [] [] >= `tab-width' SPACEs after TAB
space-after-tab::tab [] [] >= `tab-width' SPACEs after TAB: SPACEs
space-after-tab::space [] [] >= `tab-width' SPACEs after TAB: TABs
indent-tabs-mode =
tab-width = \n\n")
@ -1696,9 +1697,9 @@ Report if some of the following whitespace problems exist:
empty 1. empty lines at beginning of buffer.
empty 2. empty lines at end of buffer.
trailing 3. SPACEs or TABs at end of line.
indentation 4. 8 or more SPACEs at beginning of line.
indentation 4. line starts with `tab-width' or more SPACEs.
space-before-tab 5. SPACEs before TAB.
space-after-tab 6. 8 or more SPACEs after TAB.
space-after-tab 6. `tab-width' or more SPACEs after TAB.
* If `indent-tabs-mode' is nil:
empty 1. empty lines at beginning of buffer.
@ -1706,7 +1707,7 @@ Report if some of the following whitespace problems exist:
trailing 3. SPACEs or TABs at end of line.
indentation 4. TABS at beginning of line.
space-before-tab 5. SPACEs before TAB.
space-after-tab 6. 8 or more SPACEs after TAB.
space-after-tab 6. `tab-width' or more SPACEs after TAB.
See `whitespace-style' for documentation.
See also `whitespace-cleanup' and `whitespace-cleanup-region' for