bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#5420: 23.1.91; dired-goto-file does not work with a listing of absol


From: Drew Adams
Subject: bug#5420: 23.1.91; dired-goto-file does not work with a listing of absolute file names
Date: Mon, 18 Jan 2010 17:17:24 -0800

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







reply via email to

[Prev in Thread] Current Thread [Next in Thread]