GNU bug report logs - #18421
24.4.50; Allow Dired to use unrelated dir trees?

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: wishlist; Reported by: Drew Adams <drew.adams@HIDDEN>; dated Sun, 7 Sep 2014 16:42:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 18421 <at> debbugs.gnu.org:


Received: (at 18421) by debbugs.gnu.org; 7 Sep 2014 17:19:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 07 13:19:23 2014
Received: from localhost ([127.0.0.1]:32958 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1XQg7W-0003sn-Lh
	for submit <at> debbugs.gnu.org; Sun, 07 Sep 2014 13:19:23 -0400
Received: from userp1040.oracle.com ([156.151.31.81]:30652)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <drew.adams@HIDDEN>) id 1XQg7U-0003sZ-Ds
 for 18421 <at> debbugs.gnu.org; Sun, 07 Sep 2014 13:19:20 -0400
Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93])
 by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id
 s87HJDAt014518
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK)
 for <18421 <at> debbugs.gnu.org>; Sun, 7 Sep 2014 17:19:13 GMT
Received: from aserz7022.oracle.com (aserz7022.oracle.com [141.146.126.231])
 by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s87HJBCt017787
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO)
 for <18421 <at> debbugs.gnu.org>; Sun, 7 Sep 2014 17:19:12 GMT
Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9])
 by aserz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s87HJB2X000462
 for <18421 <at> debbugs.gnu.org>; Sun, 7 Sep 2014 17:19:11 GMT
MIME-Version: 1.0
Message-ID: <dda5685b-9d6c-4f65-b7e8-b755a2486628@default>
Date: Sun, 7 Sep 2014 10:19:13 -0700 (PDT)
From: Drew Adams <drew.adams@HIDDEN>
To: 18421 <at> debbugs.gnu.org
Subject: RE: bug#18421: 24.4.50; Allow Dired to use unrelated dir trees?
References: <ccb81b39-1a34-4d0d-9fa7-ce5add28f2e5@default>
In-Reply-To: <ccb81b39-1a34-4d0d-9fa7-ce5add28f2e5@default>
X-Priority: 3
X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.8.2  (807160) [OL
 12.0.6691.5000 (x86)]
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
X-Source-IP: ucsinet21.oracle.com [156.151.31.93]
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: 18421
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.0 (----)

> And we get rid of this `if' condition in `dired-insert-subdir-
> newpos'?
>=20
>  (if (dired-tree-lessp dir new-dir)
>      ;; Insert NEW-DIR after DIR
>      (setq new-pos (dired-get-subdir-max elt)
>            alist nil))
>=20
> So the code does this unconditionally:
>=20
>  (setq new-pos  (dired-get-subdir-max elt)
>        alist    ())

No, that loses the normal insertion order.
This seems to DTRT, however:

(defun dired-insert-subdir-newpos (new-dir)
  ;; Find pos for new subdir, according to tree order.
  ;;(goto-char (point-max))
  (let ((alist  dired-subdir-alist)
        elt dir new-pos)
    (while alist
      (setq elt    (car alist)
            alist  (cdr alist)
            dir    (car elt))
      (if (dired-tree-lessp dir new-dir)
          ;; Insert NEW-DIR after DIR
          (setq new-pos  (dired-get-subdir-max elt)
                alist    ())
        (setq new-pos  (point-max))))
    (goto-char new-pos))
  ;; want a separating newline between subdirs
  (unless (eobp) (forward-line -1))
  (insert "\n")
  (point))




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#18421; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 7 Sep 2014 16:41:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 07 12:41:59 2014
Received: from localhost ([127.0.0.1]:32945 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1XQfXK-0002yd-FJ
	for submit <at> debbugs.gnu.org; Sun, 07 Sep 2014 12:41:58 -0400
Received: from eggs.gnu.org ([208.118.235.92]:43968)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <drew.adams@HIDDEN>) id 1XQfXG-0002yJ-5a
 for submit <at> debbugs.gnu.org; Sun, 07 Sep 2014 12:41:55 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <drew.adams@HIDDEN>) id 1XQfX2-0002jm-Dv
 for submit <at> debbugs.gnu.org; Sun, 07 Sep 2014 12:41:48 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:41102)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <drew.adams@HIDDEN>) id 1XQfX2-0002ji-Ah
 for submit <at> debbugs.gnu.org; Sun, 07 Sep 2014 12:41:40 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:45659)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <drew.adams@HIDDEN>) id 1XQfWu-0000zm-In
 for bug-gnu-emacs@HIDDEN; Sun, 07 Sep 2014 12:41:40 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <drew.adams@HIDDEN>) id 1XQfWm-0002ie-Uu
 for bug-gnu-emacs@HIDDEN; Sun, 07 Sep 2014 12:41:32 -0400
Received: from userp1040.oracle.com ([156.151.31.81]:31111)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <drew.adams@HIDDEN>) id 1XQfWm-0002ia-Ot
 for bug-gnu-emacs@HIDDEN; Sun, 07 Sep 2014 12:41:24 -0400
Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93])
 by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id
 s87GfMpQ024936
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK)
 for <bug-gnu-emacs@HIDDEN>; Sun, 7 Sep 2014 16:41:23 GMT
Received: from aserz7022.oracle.com (aserz7022.oracle.com [141.146.126.231])
 by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s87GfLb3014469
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO)
 for <bug-gnu-emacs@HIDDEN>; Sun, 7 Sep 2014 16:41:22 GMT
Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9])
 by aserz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s87GfLRx025258
 for <bug-gnu-emacs@HIDDEN>; Sun, 7 Sep 2014 16:41:21 GMT
MIME-Version: 1.0
Message-ID: <ccb81b39-1a34-4d0d-9fa7-ce5add28f2e5@default>
Date: Sun, 7 Sep 2014 09:41:23 -0700 (PDT)
From: Drew Adams <drew.adams@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 24.4.50; Allow Dired to use unrelated dir trees?
X-Priority: 3
X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.8.2  (807160) [OL
 12.0.6691.5000 (x86)]
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
X-Source-IP: ucsinet21.oracle.com [156.151.31.93]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.0 (----)

I think this is a bug report or enhancment request, but if I'm mistaken
then I would like to know specifically why this is not a good idea, i.e,
what specific problems would ensue.

Currently, and for a long time now (forever?), `dired-insert-subdir' has
called `dired-insert-subdir-validate', which raises an error if the
subdir to be inserted is not in the same directory tree.

Can we remove this limitation that inserted dirs must be in the same
directory tree?

This is important in the context of a call to `dired' that passes a cons
DIRNAME argument, such as this:

(dired '("my dired buffer" "d:/Emacs-23.1" "c:/Emacs-23.2" "~/foo/bar"))

That gives you a workable Dired listing, except for this: you cannot
use `i' to insert the directories.

Normally, one way to work around the not-same-dir-tree problem is to
first `cd' to a directory that is a common ancestor of the directories
that you want to include.  That is just that: a workaround.  And it does
not work for MS Windows when different drive letters are involved: there
is no common ancestor directory.

So what happens if we comment out this line in `dired-insert-subdir':

 (dired-insert-subdir-validate dirname switches)

And we get rid of this `if' condition in `dired-insert-subdir-newpos'?

 (if (dired-tree-lessp dir new-dir)
     ;; Insert NEW-DIR after DIR
     (setq new-pos (dired-get-subdir-max elt)
           alist nil))

So the code does this unconditionally:

 (setq new-pos  (dired-get-subdir-max elt)
       alist    ())

That seems to fix the problem.  And I haven't noticed any drawbacks
so far.  Dired has a lot of code, however, and I no doubt have not
tested everything to see that nothing breaks with this fix.  And I
have not tried it with a platform other than Windows.

I'm looking for information about whether this fix is ill-advised and,
if so, just what problems it presents.  (I would then perhaps look at
those problems, to see whether they too can be easily fixed.)

If it does not seem ill-advised, then please consider this an
enhancement request.

Note: There are actually two parts to function
`dired-insert-subdir-validate':

1. Check whether `dired-in-this-tree'.  This is the part that this
   fix tries to deal with.

2. Check whether switches that make a difference to `dired-get-filename'
   are used for the subdir to insert (and are not used for the overall
   listing).

The code comments say that #2 is important for `dired-get-filename'.
I have not (yet) seen where/how removing `dired-insert-subdir-validate'
creates a problem, but if that comment is correct then removing it
should be problematic for `dired-get-filename' when a mix of switches
(e.g., no `F' + `F', no `b' + `b') is used.  (Does that problem
perhaps depend on whether `ls-lisp' is used?)

So if #2 is still needed, then instead of just removing
`dired-insert-subdir-validate' altogether perhaps we could remove
only its part #1.

FYI, this report was inspired by a Stack Overflow user question:
http://superuser.com/q/807939/250462, which seems like a reasonable
feature request.

In GNU Emacs 24.4.50.1 (i686-pc-mingw32)
 of 2014-08-15 on LEG570
Bzr revision: 117706 rgm@HIDDEN
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --enable-checking 'CFLAGS=3D-O0 -g3' CPPFLAGS=3D-DGLYPH_DEBUG=
=3D1'




Acknowledgement sent to Drew Adams <drew.adams@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#18421; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.