]> code.delx.au - gnu-emacs/commitdiff
Fix 'dired-goto-file' in Dired buffers produced by find-dired
authorEli Zaretskii <eliz@gnu.org>
Fri, 25 Mar 2016 14:18:21 +0000 (17:18 +0300)
committerEli Zaretskii <eliz@gnu.org>
Fri, 25 Mar 2016 14:18:21 +0000 (17:18 +0300)
* lisp/dired.el (dired-goto-file): Try looking for the file as a
relative name with leading sub-directories, before looking for the
basename alone.  (Bug#23089)

lisp/dired.el

index ef22d457bca29e9b5b035029f88e5be268d2bead..5741872cfc875fd79ecd64ae9e3c744fd19c1cc0 100644 (file)
@@ -2736,9 +2736,18 @@ instead of `dired-actual-switches'."
                 (save-excursion
                   (goto-char (point-min))
                   (dired-goto-file-1 file file (point-max)))
-                ;; Otherwise, look for it as a relative name.  The
-                ;; hair is to get the result of `dired-goto-subdir'
-                ;; without calling it if we don't have any subdirs.
+                 ;; Next, look for it as a relative name with leading
+                 ;; subdirectories.  (This happens in Dired buffers
+                 ;; created by find-dired, for example.)
+                 (save-excursion
+                   (goto-char (point-min))
+                   (dired-goto-file-1 (file-relative-name file
+                                                          default-directory)
+                                      file (point-max)))
+                ;; Otherwise, look for it as a relative name, a base
+                ;; name only.  The hair is to get the result of
+                ;; `dired-goto-subdir' without calling it if we don't
+                ;; have any subdirs.
                 (save-excursion
                   (when (if (string= dir (expand-file-name default-directory))
                             (goto-char (point-min))