GNU bug report logs -
#52395
27.2; Expansion of DIR arg of `dired-buffers-for-dir'
Previous Next
Reported by: Drew Adams <drew.adams <at> oracle.com>
Date: Thu, 9 Dec 2021 22:00:02 UTC
Severity: wishlist
Found in version 27.2
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 52395 in the body.
You can then email your comments to 52395 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52395
; Package
emacs
.
(Thu, 09 Dec 2021 22:00:02 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
.
(Thu, 09 Dec 2021 22:00:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
This bug report is in the form of a question. Shouldn't this function
expand the DIR argument using `expand-file-name' (e.g. with
`default-directory')?
I think the answer is "yes", but perhaps there's some good reason the
answer should be "no".
All uses of `dired-buffers-for-dir' I'm aware of call `expand-file-name'
on the directory passed as arg.
If you instead pass, say, "~/some/dir/", then a Dired buffer for that
directory won't be found. To me, that seems like a bug. The "problem"
is that the code just uses `assoc' to look up the given DIR argument in
the value of `dired-subdir-alist', and entries in that alist have
absolute (i.e., expanded) dir names as their cars.
At the very least, the doc should tell you about the gotcha - it should
tell you to expand the DIR arg before calling.
I'd propose changing the first line of the `dired-buffers-for-dir' code
from this:
(setq dir (file-name-as-directory dir))
to this:
(setq dir (expand-file-name (file-name-as-directory dir)))
That way, there's no need for callers to themselves expand the dir name.
(A question is whether `file-truename' should be used instead of
`expand-file-name'. I guess not.)
Such a code change shouldn't change the behavior of any existing code,
since that seems to always use `expand-file-name' before calling
`dired-buffers-for-dir'.
If this code change is made then it would be good to also change the
doc to say that DIR is expanded relative to `default-directoy'. Code
that needs a name expanded properly relative to some other directory will
then be sure to expand the name before calling `dired-buffers-for-dir'.
___
If you don't agree to such a code change, fine. But in that case I
suggest that the doc of `dired-buffers-for-dir' say explicitly that
argument DIR needs to be an expanded absolute file name. The doc needs
to explicitly say "expanded", because `file-absolute-p' doesn't test for
this meaning of "absolute" file name - the name cannot use `~' for a
home directory.
In GNU Emacs 27.2 (build 1, x86_64-w64-mingw32)
of 2021-03-26 built on CIRROCUMULUS
Repository revision: deef5efafb70f4b171265b896505b92b6eef24e6
Repository branch: HEAD
Windowing system distributor 'Microsoft Corp.', version 10.0.19042
System Description: Microsoft Windows 10 Pro (v10.0.2009.19042.1348)
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Configured using:
'configure --without-dbus --host=x86_64-w64-mingw32
--without-compress-install 'CFLAGS=-O2 -static''
Severity set to 'wishlist' from 'normal'
Request was from
Stefan Kangas <stefan <at> marxist.se>
to
control <at> debbugs.gnu.org
.
(Fri, 10 Dec 2021 01:24:01 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52395
; Package
emacs
.
(Fri, 10 Dec 2021 11:34:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 52395 <at> debbugs.gnu.org (full text, mbox):
Drew Adams <drew.adams <at> oracle.com> writes:
> This bug report is in the form of a question. Shouldn't this function
> expand the DIR argument using `expand-file-name' (e.g. with
> `default-directory')?
Makes sense to me. Now done 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
52395 <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
.
(Fri, 10 Dec 2021 11:34: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
.
(Fri, 07 Jan 2022 12:24:08 GMT)
Full text and
rfc822 format available.
This bug report was last modified 3 years and 222 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.