unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#7118: 24.0.50; dired-subdir-alist, dired-directory, etc.: necessarily buffer-local
@ 2010-09-27 18:47 Drew Adams
  2010-09-27 21:05 ` Stefan Monnier
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Drew Adams @ 2010-09-27 18:47 UTC (permalink / raw)
  To: 7118

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'
 






^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#7118: 24.0.50; dired-subdir-alist, dired-directory, etc.: necessarily buffer-local
  2010-09-27 18:47 bug#7118: 24.0.50; dired-subdir-alist, dired-directory, etc.: necessarily buffer-local Drew Adams
@ 2010-09-27 21:05 ` Stefan Monnier
  2011-07-14 14:21   ` Lars Magne Ingebrigtsen
  2010-09-27 23:35 ` Juanma Barranquero
  2022-02-07  0:31 ` Lars Ingebrigtsen
  2 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2010-09-27 21:05 UTC (permalink / raw)
  To: Drew Adams; +Cc: 7118

> 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





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#7118: 24.0.50; dired-subdir-alist, dired-directory, etc.: necessarily buffer-local
  2010-09-27 18:47 bug#7118: 24.0.50; dired-subdir-alist, dired-directory, etc.: necessarily buffer-local Drew Adams
  2010-09-27 21:05 ` Stefan Monnier
@ 2010-09-27 23:35 ` Juanma Barranquero
  2022-02-07  0:31 ` Lars Ingebrigtsen
  2 siblings, 0 replies; 9+ messages in thread
From: Juanma Barranquero @ 2010-09-27 23:35 UTC (permalink / raw)
  To: Drew Adams; +Cc: 7118

On Mon, Sep 27, 2010 at 20:47, Drew Adams <drew.adams@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





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#7118: 24.0.50; dired-subdir-alist, dired-directory, etc.: necessarily buffer-local
  2010-09-27 21:05 ` Stefan Monnier
@ 2011-07-14 14:21   ` Lars Magne Ingebrigtsen
  2011-07-14 14:45     ` Juanma Barranquero
  0 siblings, 1 reply; 9+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-07-14 14:21 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 7118

Stefan Monnier <monnier@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/





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#7118: 24.0.50; dired-subdir-alist, dired-directory, etc.: necessarily buffer-local
  2011-07-14 14:21   ` Lars Magne Ingebrigtsen
@ 2011-07-14 14:45     ` Juanma Barranquero
  2011-07-14 14:49       ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 9+ messages in thread
From: Juanma Barranquero @ 2011-07-14 14:45 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen; +Cc: 7118

> 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





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#7118: 24.0.50; dired-subdir-alist, dired-directory, etc.: necessarily buffer-local
  2011-07-14 14:45     ` Juanma Barranquero
@ 2011-07-14 14:49       ` Lars Magne Ingebrigtsen
  2011-07-17  2:24         ` Stefan Monnier
  0 siblings, 1 reply; 9+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-07-14 14:49 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 7118

Juanma Barranquero <lekktu@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/





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#7118: 24.0.50; dired-subdir-alist, dired-directory, etc.: necessarily buffer-local
  2011-07-14 14:49       ` Lars Magne Ingebrigtsen
@ 2011-07-17  2:24         ` Stefan Monnier
  2011-08-02 21:11           ` Drew Adams
  0 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2011-07-17  2:24 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen; +Cc: Juanma Barranquero, 7118

>> 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





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#7118: 24.0.50; dired-subdir-alist, dired-directory, etc.: necessarily buffer-local
  2011-07-17  2:24         ` Stefan Monnier
@ 2011-08-02 21:11           ` Drew Adams
  0 siblings, 0 replies; 9+ messages in thread
From: Drew Adams @ 2011-08-02 21:11 UTC (permalink / raw)
  To: 'Stefan Monnier', 'Lars Magne Ingebrigtsen'
  Cc: 'Juanma Barranquero', 7118

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'.






^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#7118: 24.0.50; dired-subdir-alist, dired-directory, etc.: necessarily buffer-local
  2010-09-27 18:47 bug#7118: 24.0.50; dired-subdir-alist, dired-directory, etc.: necessarily buffer-local Drew Adams
  2010-09-27 21:05 ` Stefan Monnier
  2010-09-27 23:35 ` Juanma Barranquero
@ 2022-02-07  0:31 ` Lars Ingebrigtsen
  2 siblings, 0 replies; 9+ messages in thread
From: Lars Ingebrigtsen @ 2022-02-07  0:31 UTC (permalink / raw)
  To: Drew Adams; +Cc: 7118

"Drew Adams" <drew.adams@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





^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-02-07  0:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-27 18:47 bug#7118: 24.0.50; dired-subdir-alist, dired-directory, etc.: necessarily buffer-local Drew Adams
2010-09-27 21:05 ` Stefan Monnier
2011-07-14 14:21   ` Lars Magne Ingebrigtsen
2011-07-14 14:45     ` Juanma Barranquero
2011-07-14 14:49       ` Lars Magne Ingebrigtsen
2011-07-17  2:24         ` Stefan Monnier
2011-08-02 21:11           ` Drew Adams
2010-09-27 23:35 ` Juanma Barranquero
2022-02-07  0:31 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).