Function: dired-rename-subdir-2
dired-rename-subdir-2 is a byte-compiled function defined in
dired-aux.el.gz.
Signature
(dired-rename-subdir-2 ELT DIR TO)
Source Code
;; Defined in /usr/src/emacs/lisp/dired-aux.el.gz
(defun dired-rename-subdir-2 (elt dir to)
;; Update the headerline and dired-subdir-alist element, as well as
;; dired-switches-alist element, of directory described by
;; alist-element ELT to reflect the moving of DIR to TO. Thus, ELT
;; describes either DIR itself or a subdir of DIR.
(save-excursion
(let ((regexp (regexp-quote (directory-file-name dir)))
(newtext (directory-file-name to))
buffer-read-only)
(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?"
dir)
(goto-char (match-beginning 1))
(if (re-search-forward regexp (match-end 1) t)
(replace-match newtext t t)
(error "Expected to find `%s' in headerline of %s" dir (car elt))))
;; Update buffer-local dired-subdir-alist and dired-switches-alist
(let ((cons (assoc-string (car elt) dired-switches-alist))
(cur-dir (dired-normalize-subdir
(replace-regexp-in-string regexp newtext (car elt)))))
(setcar elt cur-dir)
(when cons (setcar cons cur-dir))))))