]> git.eshelyaron.com Git - emacs.git/commitdiff
dired-jump: Expand file-name before dired-goto-file call
authorTino Calancha <tino.calancha@gmail.com>
Tue, 13 Sep 2016 15:04:32 +0000 (00:04 +0900)
committerTino Calancha <tino.calancha@gmail.com>
Tue, 13 Sep 2016 15:04:32 +0000 (00:04 +0900)
Command dired-goto-file requires its argument to be an absolute
file name.  Interactively FILE-NAME is read with read-file-name,
which could return an abbreviated file name (Bug#24409).
* lisp/dired-x.el (dired-jump): Use expand-file-name on FILE-NAME.
Clarify in doc string the meaning of arg FILE-NAME.

lisp/dired-x.el

index be762e6e306976f7a8e1de3a998d9e53c4cb1748..41c2256ec6f91253a99ac9efb64f5bb8023b9443 100644 (file)
@@ -413,14 +413,19 @@ If in Dired already, pop up a level and goto old directory's line.
 In case the proper Dired file line cannot be found, refresh the dired
 buffer and try again.
 When OTHER-WINDOW is non-nil, jump to Dired buffer in other window.
-Interactively with prefix argument, read FILE-NAME and
-move to its line in dired."
+When FILE-NAME is non-nil, jump to its line in Dired.
+Interactively with prefix argument, read FILE-NAME."
   (interactive
    (list nil (and current-prefix-arg
                   (read-file-name "Jump to Dired file: "))))
   (if (bound-and-true-p tar-subfile-mode)
       (switch-to-buffer tar-superior-buffer)
-    (let* ((file (or file-name buffer-file-name))
+    ;; Expand file-name before `dired-goto-file' call:
+    ;; `dired-goto-file' requires its argument to be an absolute
+    ;; file name; the result of `read-file-name' could be
+    ;; an abbreviated file name (Bug#24409).
+    (let* ((file (or (and file-name (expand-file-name file-name))
+                     buffer-file-name))
            (dir (if file (file-name-directory file) default-directory)))
       (if (and (eq major-mode 'dired-mode) (null file-name))
           (progn