unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Tino Calancha <tino.calancha@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 24409@debbugs.gnu.org, Tino Calancha <tino.calancha@gmail.com>
Subject: bug#24409: 25.1.1; dired-jump: Interactive call w/ prefix arg move to wrong file line
Date: Mon, 12 Sep 2016 13:37:14 +0900 (JST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1609121336330.3868@calancha-pc> (raw)
In-Reply-To: <83zine9x18.fsf@gnu.org>


On Sun, 11 Sep 2016, Eli Zaretskii wrote:

> I think a better comment would be to say that dired-goto-file requires
> its argument to be an absolute file name, and the result of
> read-file-name could be an abbreviated file name.
Thank you.  I rewrote the comment/log message with your suggestion.
I included the word canonical: an abbreviated file name could be
an absolute file name, for instance ~/foo, but dired-goto-file,
in addition to absolute file name, requires the substitution of '~/'.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
From 3e58d4987590dbdb54d08fd6be201bd0cad4b804 Mon Sep 17 00:00:00 2001
From: Tino Calancha <tino.calancha@gmail.com>
Date: Mon, 12 Sep 2016 13:16:32 +0900
Subject: [PATCH] dired-jump: Expand file-name before dired-goto-file call

Command dired-goto-file requires its argument to be an absolute
canonical file name.  Interactively FILE-NAME is read with
read-file-name, which could return an abbreviated file name, i.e.,
non-canonical (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 | 11 ++++++++---
  1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lisp/dired-x.el b/lisp/dired-x.el
index be762e6..90420ad 100644
--- a/lisp/dired-x.el
+++ b/lisp/dired-x.el
@@ -413,14 +413,19 @@ 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 `dired-goto-file' call:
+    ;; `dired-goto-file' requires its argument to be an absolute
+    ;; canonical file name; the result of `read-file-name' could
+    ;; be an abbreviated file name, i.e., non-canonical (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.50.2 (x86_64-pc-linux-gnu, GTK+ Version 3.21.5)
  of 2016-09-12 built on calancha-pc
Repository revision: 367f8568bc9e759ebdfb423648891efa0346456b







  reply	other threads:[~2016-09-12  4:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-11  4:33 bug#24409: 25.1.1; dired-jump: Interactive call w/ prefix arg move to wrong file line Tino Calancha
2016-09-11  4:42 ` Noam Postavsky
2016-09-11  4:50   ` Tino Calancha
2016-09-11 15:36 ` Eli Zaretskii
2016-09-11 17:03   ` Tino Calancha
2016-09-11 17:16     ` Eli Zaretskii
2016-09-12  4:37       ` Tino Calancha [this message]
2016-09-12 16:53         ` Eli Zaretskii
2016-09-13  7:04           ` Tino Calancha
2016-09-13 14:37             ` Eli Zaretskii
2016-09-13 15:09               ` Tino Calancha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.20.1609121336330.3868@calancha-pc \
    --to=tino.calancha@gmail.com \
    --cc=24409@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).