GNU bug report logs - #17205
24.3.50; dired and directory variables

Previous Next

Package: emacs;

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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 17205 in the body.
You can then email your comments to 17205 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#17205; Package emacs. (Sun, 06 Apr 2014 12:56:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Michael Heerdegen <michael_heerdegen <at> web.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 06 Apr 2014 12:56:06 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50; dired and directory variables
Date: Sun, 06 Apr 2014 14:55:19 +0200
Hello,

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.


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.


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.


Many thanks,

Michael.



In GNU Emacs 24.3.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.7)
 of 2014-03-28 on drachen
Windowing system distributor `The X.Org Foundation', version 11.0.11500000
System Description:	Debian GNU/Linux testing (jessie)





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17205; Package emacs. (Sat, 23 Jan 2021 22:13:01 GMT) Full text and rfc822 format available.

Message #8 received at 17205 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: 17205 <at> debbugs.gnu.org
Subject: Re: bug#17205: 24.3.50; dired and directory variables
Date: Sat, 23 Jan 2021 23:12:36 +0100
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




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 23 Jan 2021 22:13:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17205; Package emacs. (Sun, 24 Jan 2021 19:38:01 GMT) Full text and rfc822 format available.

Message #13 received at 17205 <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 17205 <at> debbugs.gnu.org
Subject: Re: bug#17205: 24.3.50; dired and directory variables
Date: Sun, 24 Jan 2021 20:37:15 +0100
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Do all these cases work for you, too, in Emacs 28?

All of my reported issues seem to be fixed indeed, thanks!  But a tiny
thing remains: in the

((nil . ((a .  "hallo")
         (subdirs . nil))))

scenario, the variable `a' is not bound in the dired buffer for the
directory the .dir-locals.el file lives in.  I would expect it to be.


TIA, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17205; Package emacs. (Mon, 25 Jan 2021 12:51:01 GMT) Full text and rfc822 format available.

Message #16 received at 17205 <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 17205 <at> debbugs.gnu.org
Subject: Re: bug#17205: 24.3.50; dired and directory variables
Date: Mon, 25 Jan 2021 13:50:19 +0100
Michael Heerdegen <michael_heerdegen <at> web.de> writes:

> Lars Ingebrigtsen <larsi <at> gnus.org> writes:
>
> > Do all these cases work for you, too, in Emacs 28?
>
> All of my reported issues seem to be fixed indeed, thanks!  But a tiny
> thing remains: in the
>
> ((nil . ((a .  "hallo")
>          (subdirs . nil))))
>
> scenario, the variable `a' is not bound in the dired buffer for the
> directory the .dir-locals.el file lives in.

Seems that in this case this test (unexpectedly) fails:

  (equal root default-directory)

where in my case root --> /home/micha/ and default-directory --> "~/".


Regards,

Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17205; Package emacs. (Tue, 26 Jan 2021 00:15:02 GMT) Full text and rfc822 format available.

Message #19 received at 17205 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: 17205 <at> debbugs.gnu.org
Subject: Re: bug#17205: 24.3.50; dired and directory variables
Date: Tue, 26 Jan 2021 01:14:37 +0100
Michael Heerdegen <michael_heerdegen <at> web.de> writes:

>> Do all these cases work for you, too, in Emacs 28?
>
> All of my reported issues seem to be fixed indeed, thanks!  But a tiny
> thing remains: in the
>
> ((nil . ((a .  "hallo")
>          (subdirs . nil))))
>
> scenario, the variable `a' is not bound in the dired buffer for the
> directory the .dir-locals.el file lives in.  I would expect it to be.

[...]

> Seems that in this case this test (unexpectedly) fails:
>
>   (equal root default-directory)
>
> where in my case root --> /home/micha/ and default-directory --> "~/".

Yup; I was able to reproduce that, too, and slapping an expand-file-name
on default-directory fixed this.  So I think that's all in this bug
report (it doesn't sound like subdirs in .dir-locals.el is used a lot,
does it?), and I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 26 Jan 2021 00:15:03 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 17205 <at> debbugs.gnu.org and Michael Heerdegen <michael_heerdegen <at> web.de> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 26 Jan 2021 00:15:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17205; Package emacs. (Tue, 26 Jan 2021 12:23:01 GMT) Full text and rfc822 format available.

Message #26 received at 17205 <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 17205 <at> debbugs.gnu.org
Subject: Re: bug#17205: 24.3.50; dired and directory variables
Date: Tue, 26 Jan 2021 13:22:32 +0100
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Yup; I was able to reproduce that, too, and slapping an expand-file-name
> on default-directory fixed this.  So I think that's all in this bug
> report (it doesn't sound like subdirs in .dir-locals.el is used a lot,
> does it?),

Yes, I think so, and also dir locals in dired.  More generally,
directory local variables have some more potential that isn't used so
far, in my opinion.

> and I'm closing this bug report.

Thanks for your work, Lars!

Regards,

Michael.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 23 Feb 2021 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 121 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.