[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#18421: 24.4.50; Allow Dired to use unrelated dir trees?
From: |
Drew Adams |
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))