GNU bug report logs - #7118
24.0.50; dired-subdir-alist, dired-directory, etc.: necessarily buffer-local

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Mon, 27 Sep 2010 18:46:03 UTC

Severity: wishlist

Found in version 24.0.50

Fixed in version 29.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 7118 in the body.
You can then email your comments to 7118 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 owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7118; Package emacs. (Mon, 27 Sep 2010 18:46:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Drew Adams" <drew.adams <at> oracle.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 27 Sep 2010 18:46:03 GMT) Full text and rfc822 format available.

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

From: "Drew Adams" <drew.adams <at> oracle.com>
To: <bug-gnu-emacs <at> gnu.org>
Subject: 24.0.50;
	dired-subdir-alist, dired-directory, etc.: necessarily buffer-local
Date: Mon, 27 Sep 2010 11:47:39 -0700
We should use `make-variable-buffer-local' with vars such as
`dired-subdir-alist' and `dired-directory', instead of just calling
`make-local-variable'.  Why?  Because these vars MUST be buffer local,
and we might as well make the code clearer by pointing that out.  That
is precisely the use case for `make-variable-buffer-local': a var that
is necessarily buffer-local.
 
Also, the doc strings are otherwise incomplete/vague: for
`dired-subdir-alist', for example, it speaks of "the buffer".  The var's
value is local to each particular Dired buffer, and this needs to be
made more clear.  If we use `make-variable-buffer-local' that will add
the necessary info to `C-h v' so that the doc strings begin to make
sense.  (Still, we should mention in the doc string of
`dired-subdir-alist' that the subdirs are subdirs of `dired-directory'.)
 

In GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600)
 of 2010-09-20 on 3249CTO
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (4.4) --no-opt --cflags
-Ic:/imagesupport/include'
 





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7118; Package emacs. (Mon, 27 Sep 2010 21:03:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 7118 <at> debbugs.gnu.org
Subject: Re: bug#7118: 24.0.50;
	dired-subdir-alist, dired-directory, etc.: necessarily buffer-local
Date: Mon, 27 Sep 2010 23:05:00 +0200
> We should use `make-variable-buffer-local' with vars such as
> `dired-subdir-alist' and `dired-directory', instead of just calling
> `make-local-variable'.

Sounds OK.


        Stefan




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7118; Package emacs. (Mon, 27 Sep 2010 23:34:02 GMT) Full text and rfc822 format available.

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

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 7118 <at> debbugs.gnu.org
Subject: Re: bug#7118: 24.0.50; dired-subdir-alist, dired-directory, etc.:
	necessarily buffer-local
Date: Tue, 28 Sep 2010 01:35:12 +0200
On Mon, Sep 27, 2010 at 20:47, Drew Adams <drew.adams <at> oracle.com> wrote:

> We should use `make-variable-buffer-local' with vars such as
> `dired-subdir-alist' and `dired-directory', instead of just calling
> `make-local-variable'.  Why?  Because these vars MUST be buffer local,
> and we might as well make the code clearer by pointing that out.  That
> is precisely the use case for `make-variable-buffer-local': a var that
> is necessarily buffer-local.

On the same vein, every single use of revert-buffer-function starts with

  (make-local-variable 'revert-buffer-function)
  (setq revert-buffer-function XXXXX)

or

  (set (make-local-variable 'revert-buffer-function) XXXXXX)

except the one in dired-x.el, which relies in dired-mode doing it
before. There have been at least three bugs in the past year caused by
revert-buffer-function not being automatically buffer-local.

    Juanma




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7118; Package emacs. (Thu, 14 Jul 2011 14:33:02 GMT) Full text and rfc822 format available.

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

From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 7118 <at> debbugs.gnu.org, Drew Adams <drew.adams <at> oracle.com>
Subject: Re: bug#7118: 24.0.50;
	dired-subdir-alist, dired-directory, etc.: necessarily buffer-local
Date: Thu, 14 Jul 2011 16:21:32 +0200
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>> We should use `make-variable-buffer-local' with vars such as
>> `dired-subdir-alist' and `dired-directory', instead of just calling
>> `make-local-variable'.
>
> Sounds OK.

What's the best way to make this change?  Just say

(make-variable-buffer-local 'var)

after the `defvar', and then removing all the `make-local-variable'
calls?

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




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7118; Package emacs. (Thu, 14 Jul 2011 14:47:02 GMT) Full text and rfc822 format available.

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

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
Cc: 7118 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#7118: 24.0.50; dired-subdir-alist, dired-directory, etc.:
	necessarily buffer-local
Date: Thu, 14 Jul 2011 16:45:28 +0200
> What's the best way to make this change?  Just say
>
> (make-variable-buffer-local 'var)
>
> after the `defvar', and then removing all the `make-local-variable'
> calls?

Yes.

BTW, it's a mystery to me why `revert-buffer-function' is not
automatically buffer-local, when every single package that sets it
does so locally; having a global non-nil revert-buffer-function does
not make any sense whatsoever.

But IMHO, neither changing `revert-buffer-function' nor
`dired-subdir-alist' and `dired-directory' is really a bug fix. Yes,
as they are now is error prone, but the uses in the sources are
already correct. That should be a wishlist item for 24.2.

    Juanma




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7118; Package emacs. (Thu, 14 Jul 2011 14:51:02 GMT) Full text and rfc822 format available.

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

From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 7118 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#7118: 24.0.50;
	dired-subdir-alist, dired-directory, etc.: necessarily buffer-local
Date: Thu, 14 Jul 2011 16:49:19 +0200
Juanma Barranquero <lekktu <at> gmail.com> writes:

> But IMHO, neither changing `revert-buffer-function' nor
> `dired-subdir-alist' and `dired-directory' is really a bug fix. Yes,
> as they are now is error prone, but the uses in the sources are
> already correct. That should be a wishlist item for 24.2.

Yeah, that's true.

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




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7118; Package emacs. (Sun, 17 Jul 2011 02:25:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
Cc: Juanma Barranquero <lekktu <at> gmail.com>, 7118 <at> debbugs.gnu.org
Subject: Re: bug#7118: 24.0.50;
	dired-subdir-alist, dired-directory, etc.: necessarily buffer-local
Date: Sat, 16 Jul 2011 22:24:37 -0400
>> But IMHO, neither changing `revert-buffer-function' nor
>> `dired-subdir-alist' and `dired-directory' is really a bug fix.  Yes,
>> as they are now is error prone, but the uses in the sources are
>> already correct. That should be a wishlist item for 24.2.

Indeed.  Also always be extra careful that none of the `setq'
(resulting from removal of make-local-variable) can run before the
make-variable-buffer-local.  This is usually trivially the case, but
problems can appear if the setq is within an autoloaded expression or
when several files are involved.


        Stefan




Severity set to 'wishlist' from 'minor' Request was from Lars Magne Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 02 Aug 2011 20:09:01 GMT) Full text and rfc822 format available.

Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7118; Package emacs. (Tue, 02 Aug 2011 21:13:03 GMT) Full text and rfc822 format available.

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

From: Drew Adams <drew.adams <at> oracle.com>
To: "'Stefan Monnier'" <monnier <at> iro.umontreal.ca>, "'Lars Magne Ingebrigtsen'"
	<larsi <at> gnus.org>
Cc: 'Juanma Barranquero' <lekktu <at> gmail.com>, 7118 <at> debbugs.gnu.org
Subject: RE: bug#7118: 24.0.50;dired-subdir-alist, dired-directory, etc.:
	necessarily buffer-local
Date: Tue, 2 Aug 2011 14:11:46 -0700 (PDT)
Please don't forget this part of the bug report, which has been ignored so far:

> Still, we should mention in the doc string of
> `dired-subdir-alist' that the subdirs are subdirs of 
> `dired-directory'.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#7118; Package emacs. (Mon, 07 Feb 2022 00:32:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 7118 <at> debbugs.gnu.org
Subject: Re: bug#7118: 24.0.50; dired-subdir-alist, dired-directory, etc.:
 necessarily buffer-local
Date: Mon, 07 Feb 2022 01:31:35 +0100
"Drew Adams" <drew.adams <at> oracle.com> writes:

> We should use `make-variable-buffer-local' with vars such as
> `dired-subdir-alist' and `dired-directory', instead of just calling
> `make-local-variable'.

I've now fixed this in Emacs 29.

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




bug marked as fixed in version 29.1, send any further explanations to 7118 <at> debbugs.gnu.org and "Drew Adams" <drew.adams <at> oracle.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 07 Feb 2022 00:32:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 07 Mar 2022 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 48 days ago.

Previous Next


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