From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.bugs Subject: bug#24409: 25.1.1; dired-jump: Interactive call w/ prefix arg move to wrong file line Date: Tue, 13 Sep 2016 16:04:05 +0900 (JST) Message-ID: References: <83a8febg8c.fsf@gnu.org> <83zine9x18.fsf@gnu.org> <83fup59i0w.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Trace: blaine.gmane.org 1473750331 18115 195.159.176.226 (13 Sep 2016 07:05:31 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 13 Sep 2016 07:05:31 +0000 (UTC) User-Agent: Alpine 2.20 (DEB 67 2015-01-07) Cc: 24409@debbugs.gnu.org, Tino Calancha To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Sep 13 09:05:26 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bjhmR-0003W8-D3 for geb-bug-gnu-emacs@m.gmane.org; Tue, 13 Sep 2016 09:05:19 +0200 Original-Received: from localhost ([::1]:46887 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjhmP-0001Ho-DG for geb-bug-gnu-emacs@m.gmane.org; Tue, 13 Sep 2016 03:05:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43727) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjhmH-0001D4-7I for bug-gnu-emacs@gnu.org; Tue, 13 Sep 2016 03:05:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjhmB-00035T-6z for bug-gnu-emacs@gnu.org; Tue, 13 Sep 2016 03:05:08 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:60439) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjhmB-00035O-3c for bug-gnu-emacs@gnu.org; Tue, 13 Sep 2016 03:05:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bjhmA-0005ND-P1 for bug-gnu-emacs@gnu.org; Tue, 13 Sep 2016 03:05:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 13 Sep 2016 07:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24409 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 24409-submit@debbugs.gnu.org id=B24409.147375025620454 (code B ref 24409); Tue, 13 Sep 2016 07:05:02 +0000 Original-Received: (at 24409) by debbugs.gnu.org; 13 Sep 2016 07:04:16 +0000 Original-Received: from localhost ([127.0.0.1]:58149 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bjhlQ-0005Jq-4d for submit@debbugs.gnu.org; Tue, 13 Sep 2016 03:04:16 -0400 Original-Received: from mail-pa0-f42.google.com ([209.85.220.42]:36661) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bjhlO-0005Jd-Mp for 24409@debbugs.gnu.org; Tue, 13 Sep 2016 03:04:15 -0400 Original-Received: by mail-pa0-f42.google.com with SMTP id id6so58885218pad.3 for <24409@debbugs.gnu.org>; Tue, 13 Sep 2016 00:04:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:date:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=ZfJZcFvuOk+8kfNC6HZojzUPUfB6M6yUGWT7nu77fFg=; b=qVowIQXTIurxzUNfxFRJxETZHUa/iLO4iddkPJBv4dojP/P02CRQKUAUtHHL+2UGl7 KQbHEK+ELq8QqTep6HXBhjrtvdAlP/MpXwsC/2JDp4XhjqBxR4cm3jxU7vVmtdThh4MK O0L3ngyjHhCqp/sQf/mC4MG7SqXpFNZ6Lv6/VuyCEl7NN8hmfUAZu0xTfr6oO59MSOp7 5S3pvOvTVrNj+aYs6AfNS1VcRAEHzKjGEFgrCthdHlMeWkk3OUkeUUL81TLr+S16PFtc 9n03G129r+f7zUHlIgZvAIoxggeJ7/qk5zkE1U9yfGhyGqyySV1Cg3THDP2DbrH9/nVj JnyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=ZfJZcFvuOk+8kfNC6HZojzUPUfB6M6yUGWT7nu77fFg=; b=ZW26jjbWVsPspWD2pBCAGfxxPmcbKxfNCwqUFm8zbcqSgM0TYcJ05KV91Lcis6hnIT ftgwxrCKZgexMKH9LrepDM9Sn52jVnLFWVJ73o6Tkf5F0IlH0Bnr1pXNBO5TlsAzP7I5 hc3gDXUcOQjsHZNBsB7bI2zmJPSxRjc+zjI/kocvWnN3929XKan/gcCu7ysErGBTAeva CbckaWYJfWXr0Z5MR55aJFOIzXhA0wNI5aOQJuz5HyzSlO7MvHCx6Map85zPqucNMshB NdowPngMsg7S+xWda99M+4Jt1gH3Wr6Cb9puo9VWc7L2YoIq2LDtFfWI/P+vqCTP2RjJ urXg== X-Gm-Message-State: AE9vXwOudo9EAEvfTbdlaHUAs7YSeilXKKb4CIqNM1Ay+++3y5hXfkDvqlGbfHUZve7sJg== X-Received: by 10.66.25.228 with SMTP id f4mr41399762pag.157.1473750248921; Tue, 13 Sep 2016 00:04:08 -0700 (PDT) Original-Received: from calancha-pc (57.92.100.220.dy.bbexcite.jp. [220.100.92.57]) by smtp.gmail.com with ESMTPSA id 3sm28800932pai.48.2016.09.13.00.04.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Sep 2016 00:04:08 -0700 (PDT) X-Google-Original-From: Tino Calancha X-X-Sender: calancha@calancha-pc In-Reply-To: <83fup59i0w.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:123242 Archived-At: On Mon, 12 Sep 2016, Eli Zaretskii wrote: >> From: Tino Calancha >> Date: Mon, 12 Sep 2016 13:37:14 +0900 (JST) >> cc: Tino Calancha , 24409@debbugs.gnu.org >> >>> 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 '~/'. > > We don't have a notion of a "canonical" file name in Emacs, so I'm not > sure this helps. OTOH, "absolute file name" is quite clear, and I > don't think people will be confused by the fact that ~/foo returns > non-nil from file-name-absolute-p. Ok, i will not use the word canonical. >> +When FILE-NAME is non-nil, move to FILE-NAME line in Dired. > > "When FILE-NAME is non-nil, jump to its line in Dired." > (Try to avoid saying the same thing twice too close to one another.) Added. Thank you very much. Once you give me the LGTM i will apply the following corrected patch: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >From e1541dd78cb5bf81247bd4025a603cef81f3a3cb Mon Sep 17 00:00:00 2001 From: Tino Calancha Date: Tue, 13 Sep 2016 15:59:45 +0900 Subject: [PATCH] dired-jump: Expand file-name before dired-goto-file call 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 | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lisp/dired-x.el b/lisp/dired-x.el index be762e6..41c2256 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, 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 -- 2.9.3 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; In GNU Emacs 25.1.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.21.5) of 2016-09-13 Repository revision: 367f8568bc9e759ebdfb423648891efa0346456b