Subject: bug#22874: 25.0.91; whitespace.el documentation looks incorrect

From: David Caldwell <[email-masked]>
Date: Sat, 15 Aug 2020 11:40:13 -0700

Hi,

On 8/14/20 9:32 PM, Stefan Kangas wrote:
> tags 22874 + moreinfo
> thanks
> 
> Hi David,
> 
> Lars Ingebrigtsen <[email-masked]> writes:
> 
>> David Caldwell <[email-masked]> writes:
>>
>>> Hello,
>>>
>>> M-x describe-variable RET whitespace-style RET
>>>
>>> says:
>>>
>>> [snip]
>>>
>>>    indentation::tab     8 or more SPACEs at beginning of line are
>>>                         visualized via faces.
>>>                         It has effect only if ‘face’ (see above)
>>>                         is present in ‘whitespace-style’.
>>>
>>>    indentation::space   TABs at beginning of line are visualized via
>>>                         faces.
>>>                         It has effect only if ‘face’ (see above)
>>>                         is present in ‘whitespace-style’.
>>
>> I tried to reproduce this bug with the following file:
>>
>> But with either
>>
>> (setq whitespace-style '(face indentation::tab))
>> (setq whitespace-style '(face indentation::space))
>>
>> and then `M-x whitespace-mode'
>>
>> just the lines with leading spaces were fontified.
>>
>> So this either doesn't seem to work at all, or I'm just doing it wrong.
>
> We seem to be needing more info to make any progress here.  Could you
> take a look at the above and explain the issue you are seeing?

I just tested it in Emacs 27.1 and they both seem to work exactly as
documented.

I was initially confused because why would setting `indentation::tab`
show spaces at the beginning of a line and why would
`indentation::space` show tabs? I thought they just got switched around
in the docs, but I guess maybe it's supposed to act like an assertion?
`indentation::space` means "I expect my file to be indented with spaces
so please highlight any stray tab indents", and `indentation::tab` means
"I expect my file to be indented with tabs so highlight any `tab-width`
long runs of spaces".

Bottom line: I'm wrong, my patch is wrong, and the docs *are* correct.
Sorry to waste your time. :-)

-David