GNU bug report logs -
#17205
24.3.50; dired and directory variables
Previous Next
Reported by: Michael Heerdegen <michael_heerdegen <at> web.de>
Date: Sun, 6 Apr 2014 12:56:05 UTC
Severity: normal
Tags: fixed, moreinfo
Found in version 24.3.50
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Michael Heerdegen <michael_heerdegen <at> web.de> writes:
> dired doesn't play well with directory local variables. The manual
> (info "(emacs) Directory Variables") seems to say that they would work
> with dired, but I found several problems with that (all this in emacs
> -Q):
>
> 1. In dired, they (sometimes?) take effect only in subdirectories, but
> not in the directory where they are specified.
>
> Example: In my ~, I create a .dir-locals.el with the content
>
> ((nil . ((a . "hallo"))))
>
> When I now open a dired buffer of ~, `a' is undefined. When I open any
> file below ~, `a' is bound as expected.
(I'm going through old bug reports that unfortunately got no response at
the time.)
I'm unable to reproduce this in Emacs 28 -- if I put that into
~/.dir-locals.el, then the `a' variable is set (after some prompting
about the safety).
> 2. Being able to use use `dired-listing-switches' as a directory
> variable would obviously be very useful. But it has no effect, even not
> in subdirectories. OTOH, using `dired-actual-switches' has an effect,
> it leads to a sorting as expected, even (contrary to 1.) in the
> directory that contains the dir locals file.
This also seems to work for me in Emacs 28 with a file of
((nil . ((a . "hallo") (dired-listing-switches "-l"))))
> 3. `dir-locals-collect-variables' "destroys" any (subdirs . nil)
> specification:
>
> I change the .dir-locals.el in my ~ to the following content:
>
> ((nil . ((a . "hallo")
> (subdirs . nil))))
>
> and restart Emacs.
>
> Now I dired ~. After that, I visit any file somewhere under ~ (this can
> be a regular file or a directory). `a' will be bound in that buffer.
>
> This doesn't happen if I don't dired ~ before. The cause seems to be
> this line in `dir-locals-collect-variables':
>
> (setq alist (delq subdirs alist))
>
> which modifies the cached alist sturcture destructively (permanently!).
> The `delq' should be a `remq', I guess.
I am able to reproduce this bit, though, and indeed, changing the delq
to remq fixes this problem.
Do all these cases work for you, too, in Emacs 28?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
This bug report was last modified 4 years and 122 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.