comparison lisp/dired-aux.el @ 55992:b711ea364657

(dired-kill-tree): Do not kill DIRNAME, even if it does not end in a slash. Add optional argument KILL-ROOT. Update docstring.
author Luc Teirlinck <teirllm@auburn.edu>
date Wed, 09 Jun 2004 00:25:30 +0000
parents 8fb154d735bb
children 7f35f020d8d8
comparison
equal deleted inserted replaced
55991:60906ddcbf22 55992:b711ea364657
1850 (sort dired-subdir-alist 1850 (sort dired-subdir-alist
1851 (function (lambda (elt1 elt2) 1851 (function (lambda (elt1 elt2)
1852 (> (dired-get-subdir-min elt1) 1852 (> (dired-get-subdir-min elt1)
1853 (dired-get-subdir-min elt2))))))) 1853 (dired-get-subdir-min elt2)))))))
1854 1854
1855 (defun dired-kill-tree (dirname &optional remember-marks) 1855 (defun dired-kill-tree (dirname &optional remember-marks kill-root)
1856 "Kill all proper subdirs of DIRNAME, excluding DIRNAME itself. 1856 "Kill all proper subdirs of DIRNAME, excluding DIRNAME itself.
1857 With optional arg REMEMBER-MARKS, return an alist of marked files." 1857 Interactively, you can kill DIRNAME as well by using a prefix argument.
1858 (interactive "DKill tree below directory: ") 1858 In interactive use, the command prompts for DIRNAME.
1859 (setq dirname (expand-file-name dirname)) 1859
1860 When called from Lisp, if REMEMBER-MARKS is non-nil, return an alist
1861 of marked files. If KILL-ROOT is non-nil, kill DIRNAME as well."
1862 (interactive "DKill tree below directory: \ni\nP")
1863 (setq dirname (file-name-as-directory (expand-file-name dirname)))
1860 (let ((s-alist dired-subdir-alist) dir m-alist) 1864 (let ((s-alist dired-subdir-alist) dir m-alist)
1861 (while s-alist 1865 (while s-alist
1862 (setq dir (car (car s-alist)) 1866 (setq dir (car (car s-alist))
1863 s-alist (cdr s-alist)) 1867 s-alist (cdr s-alist))
1864 (if (and (not (string-equal dir dirname)) 1868 (and (or kill-root (not (string-equal dir dirname)))
1865 (dired-in-this-tree dir dirname) 1869 (dired-in-this-tree dir dirname)
1866 (dired-goto-subdir dir)) 1870 (dired-goto-subdir dir)
1867 (setq m-alist (nconc (dired-kill-subdir remember-marks) m-alist)))) 1871 (setq m-alist (nconc (dired-kill-subdir remember-marks) m-alist))))
1868 m-alist)) 1872 m-alist))
1869 1873
1870 (defun dired-insert-subdir-newpos (new-dir) 1874 (defun dired-insert-subdir-newpos (new-dir)
1871 ;; Find pos for new subdir, according to tree order. 1875 ;; Find pos for new subdir, according to tree order.
1872 ;;(goto-char (point-max)) 1876 ;;(goto-char (point-max))