GNU bug report logs -
#24409
25.1.1; dired-jump: Interactive call w/ prefix arg move to wrong file line
Previous Next
Reported by: Tino Calancha <tino.calancha <at> gmail.com>
Date: Sun, 11 Sep 2016 04:35:01 UTC
Severity: minor
Found in version 25.1.1
Done: Tino Calancha <tino.calancha <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On Sun, 11 Sep 2016, Eli Zaretskii wrote:
> Thanks. A few nits:
>
> Please be sure to explain the need for the expand-file-name call
> either in a comment or in the log message.
> Also, you fixed the do string (thanks!), but didn't mention that in
> the log message.
*) Please, take a look in the new patch below with more verbose log
message/comments.
*) Where should go the fix: emacs-25 branch or master?
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
From fcb693f38657c2e47e6bb3116a781bebaea1d3ea Mon Sep 17 00:00:00 2001
From: Tino Calancha <tino.calancha <at> gmail.com>
Date: Mon, 12 Sep 2016 01:53:44 +0900
Subject: [PATCH] dired-jump: Expand file-name before dired-goto-file call
* lisp/dired-x.el (dired-jump): Use expand-file-name on FILE-NAME
before dired-goto-file call: this is mandatory in interactive
calls (Bug#24409); in non-interactive calls is also desirable
in order to accept an abbreviated FILE-NAME as ~/dir/file.
Clarify in doc string the meaning of arg FILE-NAME.
---
lisp/dired-x.el | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/lisp/dired-x.el b/lisp/dired-x.el
index 088ca81..2a9bd72 100644
--- a/lisp/dired-x.el
+++ b/lisp/dired-x.el
@@ -413,14 +413,20 @@ 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))
+ ;; Expand file-name before calling `dired-goto-file':
+ ;; This is required in interactive calls because the return value
+ ;; of `read-file-name' is not expanded; it also helps in
+ ;; non-interactive calls, where file-name could be an abbreviated
+ ;; file name as ~/dir/file (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
--
2.9.3
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
In GNU Emacs 25.1.1 (x86_64-pc-linux-gnu, GTK+ Version 3.21.5)
of 2016-09-12
Repository revision: 0bbdeed10f37d4ce203e1f5feb0cd7c4b5eeec72
This bug report was last modified 8 years and 255 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.