From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#27801: 26.0.50; Dired: Use relative file names when DIR-OR-LIST is a cons Date: Sun, 23 Jul 2017 22:05:47 -0700 (PDT) Message-ID: <9bf9cd47-8075-4e66-a9b1-d1aa6518e5a7@default> References: <87o9sacy1f.fsf@calancha-pc> <30959d8c-d19a-457a-93e3-c77f45a3d587@default> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1500872861 25212 195.159.176.226 (24 Jul 2017 05:07:41 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 24 Jul 2017 05:07:41 +0000 (UTC) Cc: 27801@debbugs.gnu.org To: Tino Calancha Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jul 24 07:07:36 2017 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 1dZVac-0005vI-I3 for geb-bug-gnu-emacs@m.gmane.org; Mon, 24 Jul 2017 07:07:30 +0200 Original-Received: from localhost ([::1]:52957 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZVag-0002pX-EU for geb-bug-gnu-emacs@m.gmane.org; Mon, 24 Jul 2017 01:07:34 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58198) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZVZF-0001tI-FS for bug-gnu-emacs@gnu.org; Mon, 24 Jul 2017 01:06:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dZVZC-0006UC-7h for bug-gnu-emacs@gnu.org; Mon, 24 Jul 2017 01:06:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:51065) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dZVZC-0006U8-3B for bug-gnu-emacs@gnu.org; Mon, 24 Jul 2017 01:06:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dZVZB-00082m-Lt for bug-gnu-emacs@gnu.org; Mon, 24 Jul 2017 01:06:01 -0400 X-Loop: help-debbugs@gnu.org 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: Original-Received: via spool by 27801-submit@debbugs.gnu.org id=B27801.150087275830910 (code B ref 27801); Mon, 24 Jul 2017 05:06:01 +0000 Original-Received: (at 27801) by debbugs.gnu.org; 24 Jul 2017 05:05:58 +0000 Original-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 Original-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 Original-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 Original-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 Original-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 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)] X-Source-IP: userv0021.oracle.com [156.151.31.71] 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:134902 Archived-At: > >> ;; 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.