(let ((regexp (regexp-quote (directory-file-name dir)))
(newtext (directory-file-name to))
buffer-read-only)
- (goto-char (dired-get-subdir-min elt))
+ (goto-char (cdr elt))
;; Update subdir headerline in buffer
(if (not (looking-at dired-subdir-regexp))
(error "%s not found where expected - dired-subdir-alist broken?"
(setq dired-subdir-alist
(sort dired-subdir-alist
(lambda (elt1 elt2)
- (> (dired-get-subdir-min elt1)
- (dired-get-subdir-min elt2))))))
+ (> (cdr elt1)
+ (cdr elt2))))))
(defun dired-kill-tree (dirname &optional remember-marks kill-root)
"Kill all proper subdirs of DIRNAME, excluding DIRNAME itself.
(defun dired-insert-subdir-del (element)
;; Erase an already present subdir (given by ELEMENT) from buffer.
;; Move to that buffer position. Return a mark-alist.
- (let ((begin-marker (dired-get-subdir-min element)))
+ (let ((begin-marker (cdr element)))
(goto-char begin-marker)
;; Are at beginning of subdir (and inside it!). Now determine its end:
(goto-char (dired-subdir-max))
;; BEG-END is the subdir-region (as list of begin and end).
(if elt ; subdir was already present
;; update its position (should actually be unchanged)
- (set-marker (dired-get-subdir-min elt) (point-marker))
+ (set-marker (cdr elt) (point-marker))
(dired-alist-add dirname (point-marker)))
;; The hook may depend on the subdir-alist containing the just
;; inserted subdir, so run it after dired-alist-add:
(setq dir (file-name-as-directory dir))
(let ((elt (assoc dir dired-subdir-alist)))
(and elt
- (goto-char (dired-get-subdir-min elt))
+ (goto-char (cdr elt))
;; dired-subdir-hidden-p and dired-add-entry depend on point being
;; at \n after this function succeeds.
(progn (end-of-line)
(end-pos (1- (dired-get-subdir-max elt)))
buffer-read-only)
;; keep header line visible, hide rest
- (goto-char (dired-get-subdir-min elt))
+ (goto-char (cdr elt))
(end-of-line)
(if hidden-p
(dired--unhide (point) end-pos)
;; hide
(let ((pos (point-max))) ; pos of end of last directory
(dolist (subdir dired-subdir-alist)
- (let ((start (dired-get-subdir-min subdir)) ; pos of prev dir
+ (let ((start (cdr subdir)) ; pos of prev dir
(end (save-excursion
(goto-char pos) ; current dir
;; we're somewhere on current dir's line
(forward-line -1)
(point))))
(dired--hide start end))
- (setq pos (dired-get-subdir-min subdir))))))) ; prev dir gets current dir
+ (setq pos (cdr subdir))))))) ; prev dir gets current dir
;;;###end dired-ins.el
;; The subdirectory names in the next two lists are expanded.
(defvar dired-subdir-alist nil
- "Association list of subdirectories and their buffer positions.
-Each subdirectory has an element: (DIRNAME . STARTMARKER).
+ "Alist of listed directories and their buffer positions.
+Alist elements have the form (DIRNAME . STARTMARKER), where
+DIRNAME is the absolute name of the directory and STARTMARKER is
+a marker at the beginning of DIRNAME.
+
The order of elements is the reverse of the order in the buffer.
-In simple cases, this list contains one element.")
+If no subdirectories are listed then the alist contains only one
+element, for the listed directory.")
(defvar-local dired-switches-alist nil
"Keeps track of which switches to use for inserted subdirectories.
(let ((cur-dir (dired-current-directory)))
(beginning-of-line) ; alist stores b-o-l positions
(and (zerop (- (point)
- (dired-get-subdir-min (assoc cur-dir
+ (cdr (assoc cur-dir
dired-subdir-alist))))
cur-dir))))
-;; can't use macro, must be redefinable for other alist format in dired-nstd.
-(defalias 'dired-get-subdir-min 'cdr)
+(define-obsolete-function-alias 'dired-get-subdir-min 'cdr "27.1")
(defun dired-get-subdir-max (elt)
(save-excursion
- (goto-char (dired-get-subdir-min elt))
+ (goto-char (cdr elt))
(dired-subdir-max)))
(defun dired-clear-alist ()
(while dired-subdir-alist
- (set-marker (dired-get-subdir-min (car dired-subdir-alist)) nil)
+ (set-marker (cdr (car dired-subdir-alist)) nil)
(setq dired-subdir-alist (cdr dired-subdir-alist))))
(defun dired-subdir-index (dir)
;; nth with negative arg does not return nil but the first element
(setq index (- (dired-subdir-index this-dir) arg))
(setq pos (if (>= index 0)
- (dired-get-subdir-min (nth index dired-subdir-alist))))
+ (cdr (nth index dired-subdir-alist))))
(if pos
(progn
(goto-char pos)
(setq elt (car alist)
dir (car elt)
;; use `<=' (not `<') as subdir line is part of subdir
- alist (if (<= (dired-get-subdir-min elt) here)
+ alist (if (<= (cdr elt) here)
nil ; found
(cdr alist))))
(if localp