Subject: Re: bug#76912: 31.0.50; hack-local-variables docstring inaccurate about directory-local variables

From: Eli Zaretskii <[email-masked]>
Date: Mon, 10 Mar 2025 18:51:53 +0200

> From: Sean Whitton <[email-masked]>
> Date: Mon, 10 Mar 2025 16:58:28 +0800
> 
> We have:
> 
>     (defun hack-local-variables (&optional handle-mode inhibit-locals)
>       "Parse and put into effect this buffer's local variables spec.
>     For buffers visiting files, also puts into effect directory-local
>     variables.
> 
> but this second sentence is wrong -- buffers not visiting files get
> them, too.  For example
> 
> - emacs -Q
> - C-x v d ~/src/emacs/trunk/ RET
> - C-h v fill-column RET
> => local value of 72, from our .dir-locals.el, but VC-Dir is not a
>    file-visiting buffer.
> 
> I think this is not a bug in the implementation and the docstring just
> needs changing.  Would someone kindly confirm?

The code clearly calls hack-dir-local-variables, and has been doing so
since 2008, AFAICT.  As usual, we changed the code, but failed pt
update the doc string.

Note that the ELisp manual keeps silence about this aspect of
hack-local-variables.

It would be good to document which directory is used for non-file
buffers, btw.