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

Previous Next

Package: emacs;

Reported by: Drew Adams <drew.adams <at> oracle.com>

Date: Sun, 7 Sep 2014 16:42:02 UTC

Severity: wishlist

Found in version 24.4.50

Full log


View this message in rfc822 format

From: Drew Adams <drew.adams <at> oracle.com>
To: 18421 <at> debbugs.gnu.org
Subject: bug#18421: 24.4.50; Allow Dired to use unrelated dir trees?
Date: Sun, 7 Sep 2014 10:19:13 -0700 (PDT)
> 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    ())

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))




This bug report was last modified 10 years and 281 days ago.

Previous Next


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