Subject: bug#24409: 25.1.1; dired-jump: Interactive call w/ prefix arg move to wrong file line

From: Tino Calancha <[email-masked]>
Date: Sun, 11 Sep 2016 13:50:04 +0900 (JST)

On Sun, 11 Sep 2016, Noam Postavsky wrote:

> On Sun, Sep 11, 2016 at 12:33 AM, Tino Calancha <[email-masked]> wrote:
>>    (interactive
>>     (list nil (and current-prefix-arg
>> -                  (read-file-name "Jump to Dired file: "))))
>> +                  (expand-file-name
>> +                   (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))
>> +    (let* ((file (or (and file-name (expand-file-name file-name))
>> +                     buffer-file-name))
>
> Doesn't the second `expand-file-name` call make the first one redundant?
Absolutely.  Thank you!
Following is the corrected second patch:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>From f4b0e30a79e4d2c959931d9baec7ce72cd67c935 Mon Sep 17 00:00:00 2001
From: Tino Calancha <[email-masked]>
Date: Sun, 11 Sep 2016 13:47:50 +0900
Subject: [PATCH] dired-jump: Make sure file-name is expanded

* lisp/dired-x.el (dired-jump): Use expand-file-name on FILE-NAME
before call dired-goto-file (Bug#24409).
---
  lisp/dired-x.el | 7 ++++---
  1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lisp/dired-x.el b/lisp/dired-x.el
index 088ca81..2ab9562 100644
--- a/lisp/dired-x.el
+++ b/lisp/dired-x.el
@@ -413,14 +413,15 @@ dired-jump
  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, move to FILE-NAME 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))
+    (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
-- 
2.9.3

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

In GNU Emacs 25.1.1 (x86_64-pc-linux-gnu, GTK+ Version 3.21.5)
  of 2016-09-10
Repository revision: 0bbdeed10f37d4ce203e1f5feb0cd7c4b5eeec72