[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#36837: 26.2; whitespace-mode: whitespace-line-column is not set to l

From: Noam Postavsky
Subject: bug#36837: 26.2; whitespace-mode: whitespace-line-column is not set to local fill-column
Date: Fri, 02 Aug 2019 17:14:34 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.92 (windows-nt)

Štěpán Němec <address@hidden> writes:

> On Fri, 02 Aug 2019 15:28:01 -0400
> Noam Postavsky wrote:
>> It sounds like you are confusing defcustom settings with file-local [...]
> I'm not sure what you mean.

I think it was me who was confused about what you meant.  See the last
section of this message.

> Whether a library will need to be loaded or not depends on whether the
> feature required by a particular hook or variable value (e.g. in case
> of "eval" file-local variables) is already provided or not.
> In this particular case, if you follow OP's recipe (emacs -Q),
> `whitespace-mode' is autoloaded, so the whitespace library will be
> loaded only at the point the hook is run.

You are right that, strictly speaking, whitespace.el does get loaded
while opening the file (via running conf-mode-hook).  But if I modify
the OP's recipe by adding a require:

    (require 'whitespace)
    (setq whitespace-line-column nil)
    (add-hook 'conf-mode-hook
              (lambda () (whitespace-mode)))

I get the same result.  So I don't think the autoloading is relevant.

> Really, isn't this how we all customize all kinds of variables? In your
> init file you have (setq some-var some-value) (or the equivalent
> customize forms if you're into that) even before the relevant feature is
> provided (by loading the library), and the defvar form in the pertinent
> library will of course not clobber the user-specified value. Unless I'm
> missing something, it works the same way if you `hack-local-variables'
> before loading the whitespace.el library in this particular case.

Oh, the digression into the defvars/defcustom thing was just an analogy?
Ignore my previous message then.

If I've now understood correctly, you are assuming the file-local
setting is a kind of default setting, like (defvar foo DEFAULT) which
you expect to override from your init file.  But the intended usage is
that you do:

(setq some-var some-value) in your init file as a global setting,
(add-hook some-mode-hook (lambda () (setq some-var another-value)) as
a mode-specific seting, and
-*- some-var: yet-another-value -*- as a file-specific setting.

So they go in that order: global may be overridden by mode-specific,
which may be overriden by file-specific.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]