Subject: bug#36837: 26.2; whitespace-mode: whitespace-line-column is not set to local fill-column

From: tastytea <[email-masked]>
Date: Sat, 3 Aug 2019 09:50:56 +0200

On Fri, 02 Aug 2019 16:57:37 +0200 
Štěpán Němec <[email-masked]> wrote:

> On Mon, 29 Jul 2019 11:17:56 +0200
> [email-masked] wrote:
> 
> > whitespace-mode will highlight long lines starting at 70 characters
> > instead of what fill-column is set to, if whitespace-line-column is
> > set to nil.
> > […]
> 
> Yes, unfortunately, file-local variables are only setup (via
> `hack-local-variables') _after_ the mode hooks are run (cf.
> `run-mode-hooks'), so `whitespace-color-on' still sees the original
> `fill-column' the first time.

Maybe whitespace-mode could watch fill-column for changes, at least
until the file-local variables are loaded?
There is also the possibility that fill-column is changed afterwards by
the user, but I guess that's not too common…

> You can work around this by hacking^W having `hack-local-variables'
> also run in your hook function:
> 
>  (add-hook 'conf-mode-hook 
>            (lambda () (hack-local-variables) (whitespace-mode))

Thanks, that's a better workaround than my solution of setting
whitespace-line-column and restarting whitespace-mode in
find-file-hook. :-)

Kind regards, tastytea