From unknown Tue Jun 24 10:32:17 2025 X-Loop: help-debbugs@gnu.org Subject: bug#27801: 26.0.50; Dired: Use relative file names when DIR-OR-LIST is a cons Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 24 Jul 2017 03:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 27801 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 27801@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.150086701022709 (code B ref -1); Mon, 24 Jul 2017 03:31:01 +0000 Received: (at submit) by debbugs.gnu.org; 24 Jul 2017 03:30:10 +0000 Received: from localhost ([127.0.0.1]:53723 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dZU4P-0005uD-JQ for submit@debbugs.gnu.org; Sun, 23 Jul 2017 23:30:09 -0400 Received: from eggs.gnu.org ([208.118.235.92]:58139) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dZU4M-0005sh-Nn for submit@debbugs.gnu.org; Sun, 23 Jul 2017 23:30:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dZU4G-0004Ru-9q for submit@debbugs.gnu.org; Sun, 23 Jul 2017 23:30:01 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:44138) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dZU4G-0004Ro-6R for submit@debbugs.gnu.org; Sun, 23 Jul 2017 23:30:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49095) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZU4E-0004RU-Rc for bug-gnu-emacs@gnu.org; Sun, 23 Jul 2017 23:29:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dZU4B-0004Q3-Oe for bug-gnu-emacs@gnu.org; Sun, 23 Jul 2017 23:29:58 -0400 Received: from mail-pg0-x231.google.com ([2607:f8b0:400e:c05::231]:33545) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dZU4B-0004Pc-I3 for bug-gnu-emacs@gnu.org; Sun, 23 Jul 2017 23:29:55 -0400 Received: by mail-pg0-x231.google.com with SMTP id g14so2379540pgu.0 for ; Sun, 23 Jul 2017 20:29:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=jfauy/WcJL+pDGVRdNeZXX1Dm2oHlyHoQUAo566TooM=; b=ufTEKrVjGc4dhMSiJRh2MbH6VpoX9NSibk8QF8P94RmZEgfRX0YVyXaeQrAczkPJSD Yyi9P38/aKG/J6n8gBUAE7K0Zfrz1BUGeGR/VklycT+w0cyQTqH+BQYnY5gx2fQtStdw nFYSnTFr0P8kd96HmDu/gEPRWlYj8z+f3uJt/MrIBsc0sKjKMVylxsa6N2CbinwhbqtS sHNfBeCIjW1BxPYWxVA7hCVhY6vjduaKlWI1QckeP2VtNhat6ZWsNU8/m8CIZ5z/7kHA LBWLKUIwkdamR3X94r8fBcYPW9AR2Sp6nhjP2z9o+N0iXPrHynANLp18fu0xMMkBbmM8 /TcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=jfauy/WcJL+pDGVRdNeZXX1Dm2oHlyHoQUAo566TooM=; b=N7PzUxuYVjYFAouUBHRiAUdy8Ul4obxODEKwca+WqHgHoSH11OyKW6KTbX36EI5vdG 5/6WX+uOxopmB/EC0zfFRLTc7CmsLhBe7Hsbaj3lYNnvBjJS4AGeCUM4KxadMlVpxTyw ZM9+/xdld+afWSQbpu07ovaxnbCiUwQ0Sxx8BI6ubtTlowF+4cDknrR+LomoN/VhJnBp NVl4EHOjRRwA9Kb3NZ93XrfMGwrOaG04oU87c8Ssb5Grj4nVQDv5tbCstXmaaXQ5VXBG eKdVMTAtXFSNUACZpjKBM/AgpbwpA9Iqm/NZ6wkh+wzKXW/FFvRmTW6wz5VGFYXeDSCR rtWA== X-Gm-Message-State: AIVw113qJv4VOYk6wdxOnaOVI1ovuSs9+SDm0cCJCBH8+ez+9vYT9vYs Fu2vK9xvBLIPiXjK X-Received: by 10.99.173.6 with SMTP id g6mr14881055pgf.1.1500866992844; Sun, 23 Jul 2017 20:29:52 -0700 (PDT) Received: from calancha-pc (170.224.128.101.dy.bbexcite.jp. [101.128.224.170]) by smtp.gmail.com with ESMTPSA id 10sm20402123pfj.61.2017.07.23.20.29.51 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 23 Jul 2017 20:29:52 -0700 (PDT) From: Tino Calancha Date: Mon, 24 Jul 2017 12:29:48 +0900 Message-ID: <87o9sacy1f.fsf@calancha-pc> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -6.8 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.8 (------) Severity: wishlist emacs -Q /tmp ;; Following form shows the full file name in the Dired buffer. (let* ((dir source-directory) (file1 (expand-file-name "lisp/subr.el" dir)) (file2 (expand-file-name "src/data.c" dir))) (dired (list dir file1 file2))) ;; Usually, Dired just shows the relative file name to ;; 'default-directory'. That is more clear, specially for ;; long file names. --8<-----------------------------cut here---------------start------------->8--- commit 192c9b0179adbe4ae65d956f064eb9c2197a0a01 Author: Tino Calancha Date: Mon Jul 24 12:25:24 2017 +0900 Dired: Use relative file names when DIR-OR-LIST is a cons * lisp/dired.el (dired-internal-noselect): Use relative file names when DIR-OR-LIST is a cons. * test/lisp/dired-tests.el (dired-test-bug27801): Add test. diff --git a/lisp/dired.el b/lisp/dired.el index 9d500a9f52..718c2b8cf9 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -926,6 +926,11 @@ dired-internal-noselect ;; if it was the name of a directory at all. (file-name-directory dirname)) (or switches (setq switches dired-listing-switches)) + ;; If `dir-or-list' is a cons, use file names relative + ;; to default-directory. + (when (and (consp dir-or-list) (file-name-absolute-p (cadr dir-or-list))) + (setf (cdr dir-or-list) + (mapcar #'file-relative-name (cdr dir-or-list)))) (if mode (funcall mode) (dired-mode dir-or-list switches)) ;; default-directory and dired-actual-switches are set now diff --git a/test/lisp/dired-tests.el b/test/lisp/dired-tests.el index 69331457c0..4241609ec6 100644 --- a/test/lisp/dired-tests.el +++ b/test/lisp/dired-tests.el @@ -175,5 +175,25 @@ (should (looking-at "src"))) (when (buffer-live-p buf) (kill-buffer buf))))) +(ert-deftest dired-test-bug27801 () + "Test for http://debbugs.gnu.org/27801 ." + (let* ((dir (make-temp-file "bug27801" 'dir)) + (foo (expand-file-name "foo" dir)) + (bar (expand-file-name "bar" dir)) + (f1 (expand-file-name "file" foo)) + (f2 (expand-file-name "file" bar)) + buf) + (unwind-protect + (progn + (make-directory foo) + (make-directory bar) + (with-temp-file f1 nil) + (with-temp-file f2 nil) + (setq buf (dired (list dir f1 f2))) + (dired-goto-file f1) + (should (looking-at "foo/file$"))) + (when (buffer-live-p buf) (kill-buffer buf)) + (delete-directory dir t)))) + (provide 'dired-tests) ;; dired-tests.el ends here --8<-----------------------------cut here---------------end--------------->8--- In GNU Emacs 26.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.11) of 2017-07-23 Repository revision: 1f450f1d3531cb53ebe50744c85c90141fce7ad0 From unknown Tue Jun 24 10:32:17 2025 X-Loop: help-debbugs@gnu.org Subject: bug#27801: 26.0.50; Dired: Use relative file names when DIR-OR-LIST is a cons Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 24 Jul 2017 03:49:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27801 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Tino Calancha , 27801@debbugs.gnu.org Received: via spool by 27801-submit@debbugs.gnu.org id=B27801.150086808624246 (code B ref 27801); Mon, 24 Jul 2017 03:49:01 +0000 Received: (at 27801) by debbugs.gnu.org; 24 Jul 2017 03:48:06 +0000 Received: from localhost ([127.0.0.1]:53729 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dZULm-0006J0-9r for submit@debbugs.gnu.org; Sun, 23 Jul 2017 23:48:06 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:38745) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dZULk-0006IV-6r for 27801@debbugs.gnu.org; Sun, 23 Jul 2017 23:48:04 -0400 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v6O3lsOv023779 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Jul 2017 03:47:55 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id v6O3lraw004576 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Jul 2017 03:47:54 GMT Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id v6O3lqRf016355; Mon, 24 Jul 2017 03:47:52 GMT MIME-Version: 1.0 Message-ID: <30959d8c-d19a-457a-93e3-c77f45a3d587@default> Date: Sun, 23 Jul 2017 20:47:51 -0700 (PDT) From: Drew Adams References: <87o9sacy1f.fsf@calancha-pc> In-Reply-To: <87o9sacy1f.fsf@calancha-pc> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 12.0.6770.5000 (x86)] Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Source-IP: userv0021.oracle.com [156.151.31.71] X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) > ;; Following form shows the full file name in the Dired buffer. > (let* ((dir source-directory) > (file1 (expand-file-name "lisp/subr.el" dir)) > (file2 (expand-file-name "src/data.c" dir))) > (dired (list dir file1 file2))) >=20 > ;; Usually, Dired just shows the relative file name to > ;; 'default-directory'. That is more clear, specially for > ;; long file names. Sorry, but I've only read this bug report quickly - no time now. If you are suggesting that when DIR-OR-LIST is a cons the file names shown should be relative then I think I disagree strongly. The typical use case for a cons DIR-OR-LIST is a list of files from anywhere, in which case absolute file names are appropriate. Again, sorry if I've read too quickly and misunderstood. From unknown Tue Jun 24 10:32:17 2025 X-Loop: help-debbugs@gnu.org Subject: bug#27801: 26.0.50; Dired: Use relative file names when DIR-OR-LIST is a cons Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 24 Jul 2017 04:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27801 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Drew Adams Cc: 27801@debbugs.gnu.org, Tino Calancha Received: via spool by 27801-submit@debbugs.gnu.org id=B27801.150086981026694 (code B ref 27801); Mon, 24 Jul 2017 04:17:01 +0000 Received: (at 27801) by debbugs.gnu.org; 24 Jul 2017 04:16:50 +0000 Received: from localhost ([127.0.0.1]:53735 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dZUna-0006wU-KJ for submit@debbugs.gnu.org; Mon, 24 Jul 2017 00:16:50 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:37750) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dZUnZ-0006wI-HT for 27801@debbugs.gnu.org; Mon, 24 Jul 2017 00:16:49 -0400 Received: by mail-pf0-f194.google.com with SMTP id y25so2132656pfk.4 for <27801@debbugs.gnu.org>; Sun, 23 Jul 2017 21:16:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=DAdYRbD/v6iIgZcwYgiPwO0ft8XDgn2jSCgU8iB4Dj8=; b=A66V1eUxU8uci80MaK8+xiaJxdybhIRtou//iwpWJexMj57lVrkmbNFJrYKjpfBTYB QEvsZ6dys+w7OnvjiC4xQAe+NVnh8CSs60s7/RZ7LOGgo6kpzEoiNCl0Vqm0DotlWKCs 2ySDMzdH1bNWKq8qfuEBZFKBMmVBesNdSSJi+gbo3jnaB0oLsLovGMuAJQxekIVT6OTv 3R17NjeGRg5ALJNa8qXSf8ST/5j54mMGcTnfREeCXkIVQnunAxsGGpa3WsFfdwS56Tqn nVizlU5CNRbhNIWaukBoPzgAwjl53qREyqbV2O+zF2a1VRB/e1bi7czNXr6+QwMVZWVO z7AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=DAdYRbD/v6iIgZcwYgiPwO0ft8XDgn2jSCgU8iB4Dj8=; b=jTH8oM29QWJpSSR2I7CxK3ZYUUTUkcBII1LP81YkjZpfSYr8CGjz92565pmDWHPdOX t4YLHSz2z1zx66Aap86KJxvdyjF67qvO1ULieEA/0YBYsYIkEYG7+HwaLB4T9LLhzi1o T1ctwyvAnOOpJMaqfzQJW+0lkhnws41BCaaEzlphMHCG1QH55S8/EDgTfJISHHEIhzlT tTBwUIvsUYl+1Wb+NbNwRnsmStTFxw8yzmdNV9pu5clHojiPSmMcR6cn9Wqp5h+xhjXt eeHUXiJkvouiZXt2EKNg361TsK9g+XQicsjwFRuZKcprIwngDofbWxaR+FC8BjySyP+C bmoQ== X-Gm-Message-State: AIVw112KACdI/Q/U0LxjWXnDlXPHrAmTY4KAYoQ4j6XxKQKaNsJm05MQ cZKpfUF8/SKXNg== X-Received: by 10.99.100.132 with SMTP id y126mr14726587pgb.8.1500869803785; Sun, 23 Jul 2017 21:16:43 -0700 (PDT) Received: from calancha-pc (170.224.128.101.dy.bbexcite.jp. [101.128.224.170]) by smtp.gmail.com with ESMTPSA id t70sm19562963pfk.111.2017.07.23.21.16.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 23 Jul 2017 21:16:43 -0700 (PDT) From: Tino Calancha X-Google-Original-From: Tino Calancha Date: Mon, 24 Jul 2017 13:16:40 +0900 (JST) X-X-Sender: calancha@calancha-pc In-Reply-To: <30959d8c-d19a-457a-93e3-c77f45a3d587@default> Message-ID: References: <87o9sacy1f.fsf@calancha-pc> <30959d8c-d19a-457a-93e3-c77f45a3d587@default> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Spam-Score: -2.8 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.8 (--) On Sun, 23 Jul 2017, Drew Adams wrote: >> ;; Following form shows the full file name in the Dired buffer. >> (let* ((dir source-directory) >> (file1 (expand-file-name "lisp/subr.el" dir)) >> (file2 (expand-file-name "src/data.c" dir))) >> (dired (list dir file1 file2))) >> >> ;; Usually, Dired just shows the relative file name to >> ;; 'default-directory'. That is more clear, specially for >> ;; long file names. > > Sorry, but I've only read this bug report quickly - no time now. > > If you are suggesting that when DIR-OR-LIST is a cons the > file names shown should be relative then I think I disagree > strongly. > > The typical use case for a cons DIR-OR-LIST is a list > of files from anywhere, in which case absolute file > names are appropriate. I am OK with adding a new variable `foo' so that i can get this behavior if i locally bind `foo' to a non-nil value. This idea comes while i am trying to implement Bug#27631; to have this feature working with 'ls-lisp' my implementation do something like: 1) Collect all matches with `find-lisp' in a variable FILES. (This is just a first approach to the problem; for large number of matches would be better to not store the matches in a list). 2) [Suppose DIR is the default-directory i the Dired buffer] Then call: (dired (list DIR FILES)) ;; My implementation works as with GNU ls; the only difference is ;; that 2) shows full file names in the Dired buffer. I rather ;; prefer is the output has same format regarless on if the user ;; use `ls-lisp' or not. With the var `foo' mentioned above, we could change 2) with: 3) (let ((foo t)) (dired (list DIR FILES))) From unknown Tue Jun 24 10:32:17 2025 X-Loop: help-debbugs@gnu.org Subject: bug#27801: 26.0.50; Dired: Use relative file names when DIR-OR-LIST is a cons Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 24 Jul 2017 05:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27801 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Tino Calancha Cc: 27801@debbugs.gnu.org Received: via spool by 27801-submit@debbugs.gnu.org id=B27801.150087275830910 (code B ref 27801); Mon, 24 Jul 2017 05:06:01 +0000 Received: (at 27801) by debbugs.gnu.org; 24 Jul 2017 05:05:58 +0000 Received: from localhost ([127.0.0.1]:53742 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dZVZ8-00082U-IM for submit@debbugs.gnu.org; Mon, 24 Jul 2017 01:05:58 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:23695) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dZVZ6-00082G-S0 for 27801@debbugs.gnu.org; Mon, 24 Jul 2017 01:05:57 -0400 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v6O55oBl020417 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Jul 2017 05:05:50 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id v6O55nfc009560 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Jul 2017 05:05:49 GMT Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v6O55mLa024505; Mon, 24 Jul 2017 05:05:48 GMT MIME-Version: 1.0 Message-ID: <9bf9cd47-8075-4e66-a9b1-d1aa6518e5a7@default> Date: Sun, 23 Jul 2017 22:05:47 -0700 (PDT) From: Drew Adams References: <87o9sacy1f.fsf@calancha-pc> <30959d8c-d19a-457a-93e3-c77f45a3d587@default> In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 12.0.6770.5000 (x86)] Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Source-IP: userv0021.oracle.com [156.151.31.71] X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) > >> ;; Following form shows the full file name in the Dired buffer. > >> (let* ((dir source-directory) > >> (file1 (expand-file-name "lisp/subr.el" dir)) > >> (file2 (expand-file-name "src/data.c" dir))) > >> (dired (list dir file1 file2))) > >> > >> ;; Usually, Dired just shows the relative file name to > >> ;; 'default-directory'. That is more clear, specially for > >> ;; long file names. > > > > Sorry, but I've only read this bug report quickly - no time > > now. If you are suggesting that when DIR-OR-LIST is a cons > > the file names shown should be relative then I think I > > disagree strongly. > > > > The typical use case for a cons DIR-OR-LIST is a list > > of files from anywhere, in which case absolute file > > names are appropriate. > > I am OK with adding a new variable `foo' so that i can get > this behavior if i locally bind `foo' to a non-nil value. I don't see why you need that. > This idea comes while i am trying to implement Bug#27631; to > have this feature working with 'ls-lisp' my implementation > do something like: >=20 > 1) Collect all matches with `find-lisp' in a variable FILES. (What is `find-lisp'? I don't see it in Emacs 25.2 or earlier. But I see 4 functions whose names start with `find-lisp-'.) > (This is just a first approach to the problem; for large > number of matches would be better to not store the matches > in a list). >=20 > 2) [Suppose DIR is the default-directory i the Dired buffer] > Then call: (dired (list DIR FILES)) >=20 > My implementation works as with GNU ls; the only difference is > that 2) shows full file names in the Dired buffer. I rather > prefer is the output has same format regarless on if the user > use `ls-lisp' or not. >=20 > With the var `foo' mentioned above, we could change 2) with: > 3) (let ((foo t)) (dired (list DIR FILES))) Again, sorry, but I don't really have time to look into this now. Two quick comments though, which might be misguided: 1. IIUC, bug #27631 is not a bug. It is an enhancement request, for a new feature. That's not a reason to change a longstanding, essentially unrelated, behavior that is very general and very useful. 2. If you call (dired (list DIR FILES)) and you want FILES to be relative rather than absolute, why can't you just (for your particular use case) use something like (dired (list DIR (mapcar #'dired-make-relative FILES)))? What am I missing? Possibly you would want to pass DIR or some other directory to `dired-make-relative' ; dunno. Or maybe `file-relative-name' would be more appropriate for your use case; dunno. I don't understand why you would propose changing `dired' so that a cons argument is interpreted in some new, more restrictive way. I say "more restrictive" because currently you can get absolute or relative file names, just by passing the forms of names that you want. You can even get a mix of absolute and relative names - that's sometimes handy. Dired should be able to list file names in either or both forms. I see no reason that it shouldn't. I don't see why you would need to add a variable, as you describe, instead of just passing the file names you want in the form(s) that you want. But I'm probably missing something in what you're suggesting. From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 24 01:36:35 2017 Received: (at control) by debbugs.gnu.org; 24 Jul 2017 05:36:35 +0000 Received: from localhost ([127.0.0.1]:53758 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dZW2l-0000Tt-IE for submit@debbugs.gnu.org; Mon, 24 Jul 2017 01:36:35 -0400 Received: from mail-pg0-f43.google.com ([74.125.83.43]:35611) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dZW2j-0000Tf-Dv for control@debbugs.gnu.org; Mon, 24 Jul 2017 01:36:33 -0400 Received: by mail-pg0-f43.google.com with SMTP id v190so52413342pgv.2 for ; Sun, 23 Jul 2017 22:36:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:to:from:subject; bh=mwiZ7JB6OJEsbZX+LWQ7UMcFbR32dRyeH1dFowe/lZk=; b=cj6GFwHVAJ46nmjZPiSNcBOWID63YXZzeblIRy8bGGya2W6ExXjKzYVRSpeiKse617 XI2Tg0/A+zeRkkj07r86FsC7kKULcbpxSL96npAk8bpZMoD0LzH4JDuwnJToSu4aTc3T oxm9mmpOxq4bWp8wHdX5Br3+G75SQKVjtdqN/Lv13ktIsK388731RI9qiKY8WkTZR+Pi bmdy1cC/AaWtce/hgqp4l884fo+P2n6luglfZeSVfZTePQzsTgSUHVGMaCXRiJ7KLUET +ddQ00pqUbNL1d6hafG8qBhQ8dwMog1M6D9uBrhubX89U2bs2gnqQhyc5KmnqeIuGR3B bK7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:to:from:subject; bh=mwiZ7JB6OJEsbZX+LWQ7UMcFbR32dRyeH1dFowe/lZk=; b=o6Rd6EabFR/u9rj3SmWy7ApAJE5zyAkCv7EaoZcg8EDby+HqbpadJLXoNc3DYOexDY hIBN9rx/P0pl4HoOK8e5GNAahO1Dp6zN850biV/jtd3N4HmqYt5bPdU70jecLPjXr15w jsyYx9xt2sQLD56rp9betY4J8EQ7nXcs3sYGvauOhXf+4S3jw4d6NofEaw9uK3x1vLoD hdl3VcPyTJCRlJE3s4RQQRIu6YaOoPTif212ahbsarvucmdsRtRb6LcGWQkOqtTd7001 Ya329Y8oU1WCoZacTfNTAtej7OTtbarfSxqqnJcqt7ZGT/4N6KPx5cGKLZ83VjrXGSni EYNA== X-Gm-Message-State: AIVw111EjxTC7mnYhonMc9aIs1NbP7E1DfZpyRxYUO2RRSVQ4c9JEPEZ k72YtlA91c6fx1S4 X-Received: by 10.98.83.130 with SMTP id h124mr14718401pfb.13.1500874586912; Sun, 23 Jul 2017 22:36:26 -0700 (PDT) Received: from calancha-pc (170.224.128.101.dy.bbexcite.jp. [101.128.224.170]) by smtp.gmail.com with ESMTPSA id p9sm19235729pgn.87.2017.07.23.22.36.25 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 23 Jul 2017 22:36:26 -0700 (PDT) Date: Mon, 24 Jul 2017 14:36:10 +0900 Message-Id: <8760eibdmd.fsf@calancha-pc> To: control@debbugs.gnu.org From: Tino Calancha Subject: control message for bug #27801 X-Spam-Score: -2.8 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.8 (--) tags 27801 wontfix From unknown Tue Jun 24 10:32:17 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Tino Calancha Subject: bug#27801: closed (Re: bug#27801: 26.0.50; Dired: Use relative file names when DIR-OR-LIST is a cons) Message-ID: References: <87379mbdjz.fsf@calancha-pc> <87o9sacy1f.fsf@calancha-pc> X-Gnu-PR-Message: they-closed 27801 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: wontfix Reply-To: 27801@debbugs.gnu.org Date: Mon, 24 Jul 2017 05:38:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1500874682-2008-1" This is a multi-part message in MIME format... ------------=_1500874682-2008-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #27801: 26.0.50; Dired: Use relative file names when DIR-OR-LIST is a cons which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 27801@debbugs.gnu.org. --=20 27801: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D27801 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1500874682-2008-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 27801-done) by debbugs.gnu.org; 24 Jul 2017 05:37:49 +0000 Received: from localhost ([127.0.0.1]:53763 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dZW3w-0000Vy-Sx for submit@debbugs.gnu.org; Mon, 24 Jul 2017 01:37:49 -0400 Received: from mail-pg0-f42.google.com ([74.125.83.42]:37026) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dZW3v-0000Vj-EN for 27801-done@debbugs.gnu.org; Mon, 24 Jul 2017 01:37:47 -0400 Received: by mail-pg0-f42.google.com with SMTP id y129so52371882pgy.4 for <27801-done@debbugs.gnu.org>; Sun, 23 Jul 2017 22:37:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=tKmSdGz+Wi14fcfYwYPOGHjHDD56lQ72f6t8hgOuh1Q=; b=aCec3XRfvZBA1zNRoSCZiTI1eRczmg780l0gmKLPBw04OSop/ls/0iImEvWVbpvb/y RLXlRjdZccwLIU1XTF8aqQb9sPTx/69QxCaHvxAxst2NeqJc1TTYvGMEaCzF+ot3pTQK afuxf4hUYT7qsLYTHgoQqXo99IUOaQNBBwd4idLaK7mhCgJyaIOdGNVWXmRYIywKVAEH CgjHPnz5HkKXN8RayCUdfiwBURtYVWhaynMpzCNi9TerdpPgHzXNcbbGXdyVs+JDXgtG p192Nbe1XldYetJVeqplBID1L901gpuEx0VbsslX0+aM/bdFXWR/j25UTIBfcJieS7xu hkOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=tKmSdGz+Wi14fcfYwYPOGHjHDD56lQ72f6t8hgOuh1Q=; b=unQcHRSJXhOdr8tFFMwCAMB/nTseSsBxnAaPRpsWP13lHgs+14EpQLVBrMQiM39yjP /e0k4lt718VNwc+u0S2UZNBGIW01fkTBD6o4a4/3/t1uTnx3m8yCm8ax3MSTNFT3yJJ2 XztWeIqMIaSWfbnylyl/KpYX9KO1rVFy+NH4yrRWItpLGuVryv/gxjvJXffdZn2um0si PkhxpNL7YKz8KG4qV3TChMx0Gy9UwXGHnboyWd0OaKniBgeI/9RNQEoXwpJe80MOB4sd 0Wmxi4MxBM8Bcw8cnRjo+FojQx6WN04eGnvXSiSmU4v9jUCCXWlIeWjbGoQ/Zeq6CuaB OORA== X-Gm-Message-State: AIVw111qP+eoQLH9DgHEEdqoBQ9nDHX0HGpH34uLs5luMtpElQ7y23Gx yMNI49oMDSd1oA== X-Received: by 10.84.131.78 with SMTP id 72mr16416037pld.43.1500874661733; Sun, 23 Jul 2017 22:37:41 -0700 (PDT) Received: from calancha-pc (170.224.128.101.dy.bbexcite.jp. [101.128.224.170]) by smtp.gmail.com with ESMTPSA id p8sm3073762pfj.101.2017.07.23.22.37.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 23 Jul 2017 22:37:41 -0700 (PDT) From: Tino Calancha To: 27801-done@debbugs.gnu.org Subject: Re: bug#27801: 26.0.50; Dired: Use relative file names when DIR-OR-LIST is a cons References: <87o9sacy1f.fsf@calancha-pc> <30959d8c-d19a-457a-93e3-c77f45a3d587@default> <9bf9cd47-8075-4e66-a9b1-d1aa6518e5a7@default> Date: Mon, 24 Jul 2017 14:37:36 +0900 In-Reply-To: <9bf9cd47-8075-4e66-a9b1-d1aa6518e5a7@default> (Drew Adams's message of "Sun, 23 Jul 2017 22:05:47 -0700 (PDT)") Message-ID: <87379mbdjz.fsf@calancha-pc> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 27801-done Cc: Drew Adams X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.5 (/) Drew Adams writes: > 2. If you call (dired (list DIR FILES)) and you want FILES > to be relative rather than absolute, why can't you just > (for your particular use case) use something like > (dired (list DIR (mapcar #'dired-make-relative FILES)))? > What am I missing? Your right. Thank you! This is the proper way to do it: pass a list with the relative names. ------------=_1500874682-2008-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 24 Jul 2017 03:30:10 +0000 Received: from localhost ([127.0.0.1]:53723 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dZU4P-0005uD-JQ for submit@debbugs.gnu.org; Sun, 23 Jul 2017 23:30:09 -0400 Received: from eggs.gnu.org ([208.118.235.92]:58139) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dZU4M-0005sh-Nn for submit@debbugs.gnu.org; Sun, 23 Jul 2017 23:30:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dZU4G-0004Ru-9q for submit@debbugs.gnu.org; Sun, 23 Jul 2017 23:30:01 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:44138) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dZU4G-0004Ro-6R for submit@debbugs.gnu.org; Sun, 23 Jul 2017 23:30:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49095) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZU4E-0004RU-Rc for bug-gnu-emacs@gnu.org; Sun, 23 Jul 2017 23:29:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dZU4B-0004Q3-Oe for bug-gnu-emacs@gnu.org; Sun, 23 Jul 2017 23:29:58 -0400 Received: from mail-pg0-x231.google.com ([2607:f8b0:400e:c05::231]:33545) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dZU4B-0004Pc-I3 for bug-gnu-emacs@gnu.org; Sun, 23 Jul 2017 23:29:55 -0400 Received: by mail-pg0-x231.google.com with SMTP id g14so2379540pgu.0 for ; Sun, 23 Jul 2017 20:29:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=jfauy/WcJL+pDGVRdNeZXX1Dm2oHlyHoQUAo566TooM=; b=ufTEKrVjGc4dhMSiJRh2MbH6VpoX9NSibk8QF8P94RmZEgfRX0YVyXaeQrAczkPJSD Yyi9P38/aKG/J6n8gBUAE7K0Zfrz1BUGeGR/VklycT+w0cyQTqH+BQYnY5gx2fQtStdw nFYSnTFr0P8kd96HmDu/gEPRWlYj8z+f3uJt/MrIBsc0sKjKMVylxsa6N2CbinwhbqtS sHNfBeCIjW1BxPYWxVA7hCVhY6vjduaKlWI1QckeP2VtNhat6ZWsNU8/m8CIZ5z/7kHA LBWLKUIwkdamR3X94r8fBcYPW9AR2Sp6nhjP2z9o+N0iXPrHynANLp18fu0xMMkBbmM8 /TcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=jfauy/WcJL+pDGVRdNeZXX1Dm2oHlyHoQUAo566TooM=; b=N7PzUxuYVjYFAouUBHRiAUdy8Ul4obxODEKwca+WqHgHoSH11OyKW6KTbX36EI5vdG 5/6WX+uOxopmB/EC0zfFRLTc7CmsLhBe7Hsbaj3lYNnvBjJS4AGeCUM4KxadMlVpxTyw ZM9+/xdld+afWSQbpu07ovaxnbCiUwQ0Sxx8BI6ubtTlowF+4cDknrR+LomoN/VhJnBp NVl4EHOjRRwA9Kb3NZ93XrfMGwrOaG04oU87c8Ssb5Grj4nVQDv5tbCstXmaaXQ5VXBG eKdVMTAtXFSNUACZpjKBM/AgpbwpA9Iqm/NZ6wkh+wzKXW/FFvRmTW6wz5VGFYXeDSCR rtWA== X-Gm-Message-State: AIVw113qJv4VOYk6wdxOnaOVI1ovuSs9+SDm0cCJCBH8+ez+9vYT9vYs Fu2vK9xvBLIPiXjK X-Received: by 10.99.173.6 with SMTP id g6mr14881055pgf.1.1500866992844; Sun, 23 Jul 2017 20:29:52 -0700 (PDT) Received: from calancha-pc (170.224.128.101.dy.bbexcite.jp. [101.128.224.170]) by smtp.gmail.com with ESMTPSA id 10sm20402123pfj.61.2017.07.23.20.29.51 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 23 Jul 2017 20:29:52 -0700 (PDT) From: Tino Calancha To: bug-gnu-emacs@gnu.org Subject: 26.0.50; Dired: Use relative file names when DIR-OR-LIST is a cons Date: Mon, 24 Jul 2017 12:29:48 +0900 Message-ID: <87o9sacy1f.fsf@calancha-pc> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -6.8 (------) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.8 (------) Severity: wishlist emacs -Q /tmp ;; Following form shows the full file name in the Dired buffer. (let* ((dir source-directory) (file1 (expand-file-name "lisp/subr.el" dir)) (file2 (expand-file-name "src/data.c" dir))) (dired (list dir file1 file2))) ;; Usually, Dired just shows the relative file name to ;; 'default-directory'. That is more clear, specially for ;; long file names. --8<-----------------------------cut here---------------start------------->8--- commit 192c9b0179adbe4ae65d956f064eb9c2197a0a01 Author: Tino Calancha Date: Mon Jul 24 12:25:24 2017 +0900 Dired: Use relative file names when DIR-OR-LIST is a cons * lisp/dired.el (dired-internal-noselect): Use relative file names when DIR-OR-LIST is a cons. * test/lisp/dired-tests.el (dired-test-bug27801): Add test. diff --git a/lisp/dired.el b/lisp/dired.el index 9d500a9f52..718c2b8cf9 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -926,6 +926,11 @@ dired-internal-noselect ;; if it was the name of a directory at all. (file-name-directory dirname)) (or switches (setq switches dired-listing-switches)) + ;; If `dir-or-list' is a cons, use file names relative + ;; to default-directory. + (when (and (consp dir-or-list) (file-name-absolute-p (cadr dir-or-list))) + (setf (cdr dir-or-list) + (mapcar #'file-relative-name (cdr dir-or-list)))) (if mode (funcall mode) (dired-mode dir-or-list switches)) ;; default-directory and dired-actual-switches are set now diff --git a/test/lisp/dired-tests.el b/test/lisp/dired-tests.el index 69331457c0..4241609ec6 100644 --- a/test/lisp/dired-tests.el +++ b/test/lisp/dired-tests.el @@ -175,5 +175,25 @@ (should (looking-at "src"))) (when (buffer-live-p buf) (kill-buffer buf))))) +(ert-deftest dired-test-bug27801 () + "Test for http://debbugs.gnu.org/27801 ." + (let* ((dir (make-temp-file "bug27801" 'dir)) + (foo (expand-file-name "foo" dir)) + (bar (expand-file-name "bar" dir)) + (f1 (expand-file-name "file" foo)) + (f2 (expand-file-name "file" bar)) + buf) + (unwind-protect + (progn + (make-directory foo) + (make-directory bar) + (with-temp-file f1 nil) + (with-temp-file f2 nil) + (setq buf (dired (list dir f1 f2))) + (dired-goto-file f1) + (should (looking-at "foo/file$"))) + (when (buffer-live-p buf) (kill-buffer buf)) + (delete-directory dir t)))) + (provide 'dired-tests) ;; dired-tests.el ends here --8<-----------------------------cut here---------------end--------------->8--- In GNU Emacs 26.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.11) of 2017-07-23 Repository revision: 1f450f1d3531cb53ebe50744c85c90141fce7ad0 ------------=_1500874682-2008-1--