emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

dired-kill-tree


From: Luc Teirlinck
Subject: dired-kill-tree
Date: Sun, 6 Jun 2004 16:19:03 -0500 (CDT)

The docstring of `dired-kill-tree' says:

"Kill all proper subdirs of DIRNAME, excluding DIRNAME itself.

But you have to understand that this assumes that DIRNAME is a
directory name and not a directory file name.  Otherwise, DIRNAME _is_
killed.  Anybody having taken any look at the Dired Elisp code will
probably have no trouble guessing this implicit assumption.

But `dired-kill-tree' can be used interactively and the implicit
assumption may not be obvious to most interactive users.  Actually, I
myself find it more often useful _in interactive usage_ to
_deliberately_ pass a directory file name to kill the entire tree
including DIRNAME.  This saves me a step, because I nearly invariably
_want_ to kill DIRNAME itself.

So what about turning this bug officially into a feature, with the
following change in the docstring:

===File ~/dired-aux-diff====================================
*** dired-aux.el        05 Jun 2004 21:07:07 -0500      1.119
--- dired-aux.el        06 Jun 2004 15:52:23 -0500      
***************
*** 1834,1839 ****
--- 1834,1844 ----
  
  (defun dired-kill-tree (dirname &optional remember-marks)
    "Kill all proper subdirs of DIRNAME, excluding DIRNAME itself.
+ Note that DIRNAME itself is _only_ excluded if it is a directory name,
+ which on most systems means that it ends with a slash.  If DIRNAME is
+ a directory file name, which on most systems means that it does not end
+ with a slash, then DIRNAME is killed too.  The latter is sometimes useful
+ in interactive usage, when DIRNAME is itself a subdirectory.
  With optional arg REMEMBER-MARKS, return an alist of marked files."
    (interactive "DKill tree below directory: ")
    (setq dirname (expand-file-name dirname))
============================================================




reply via email to

[Prev in Thread] Current Thread [Next in Thread]