GNU bug report logs -
#5420
23.1.91; dired-goto-file does not work with a listing of absolute file names
Previous Next
Reported by: "Drew Adams" <drew.adams <at> oracle.com>
Date: Tue, 19 Jan 2010 01:18:01 UTC
Severity: normal
Merged with 7126
Found in version 24.0.50
Done: Chong Yidong <cyd <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
emacs -Q
Let A and B be the absolute file names of some existing files, possibly in
different directories. You can pass an explicit list of files to `dired', and
those file names can be absolute.
M-: (dired '("foo" A B)) ; with A and B as absolute file names
If you do that, you get a functioning Dired buffer that lists only those files.
They are listed as absolute file names, as they must be, since they can be in
different directories. No problem; Dired works fine with such a listing, in
general - you can do pretty much everything normally.
However, `dired-goto-file' does not work in such a listing; `dired-goto-file'
does not work if the displayed file names are absolute.
M-: (dired-goto-file A) ; with A the absolute file name as listed
This is so because `dired-goto-file' searches for a space followed by the
_relative_ file name:
(let ((base (file-name-nondirectory file)) ; <<< RELATIVE NAME
search-string
(boundary (dired-subdir-max)))
(setq search-string (replace-regexp-in-string
"\^m" "\\^m" base nil t))
(setq search-string (replace-regexp-in-string
"\\\\" "\\\\" search-string nil t))
(while (and (not found)
;; filenames are preceded by SPC, this makes
;; the search faster (e.g. for the filename "-"!).
(search-forward (concat " " search-string) boundary 'move))
...
`dired-goto-file' is used in several places in the code, in addition to its
interactive use, so this breaks a certain number of things. In particular, it
breaks `dired-mark-remembered', so you cannot restore a set of recorded
markings.
In GNU Emacs 23.1.91.1 (i386-mingw-nt5.1.2600)
of 2010-01-02 on PRETEST
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4)'
This bug report was last modified 13 years and 72 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.