all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Luc Teirlinck <teirllm@dms.auburn.edu>
Cc: emacs-devel@gnu.org
Subject: Re: dired-kill-tree
Date: Mon, 7 Jun 2004 21:39:51 -0500 (CDT)	[thread overview]
Message-ID: <200406080239.i582dpf28840@raven.dms.auburn.edu> (raw)
In-Reply-To: <E1BXEHj-0005dZ-Jh@fencepost.gnu.org> (message from Richard Stallman on Mon, 07 Jun 2004 03:11:07 -0400)

Richard Stallman wrote:

   I think this behavior is rather error-prone and counterintuitive.
   I would rather consider it a bug, and change it to exclude
   DIRNAME even if it is specified in the syntactic form of a file name.

   If this makes it hard to kill a subdir, we could add a new interface
   for doing that, or we could make this command ask whether
   to kill directory DIRNAME as well.  That would provide an accident-proof
   way to ask for either behavior.

What about the following patch, which kills DIRNAME as well if a
prefix argument is given?

===File ~/dired-aux-diff====================================
*** dired-aux.el	07 Jun 2004 15:59:16 -0500	1.120
--- dired-aux.el	07 Jun 2004 21:04:22 -0500	
***************
*** 1852,1870 ****
  			  (> (dired-get-subdir-min elt1)
  			     (dired-get-subdir-min elt2)))))))
  
! (defun dired-kill-tree (dirname &optional remember-marks)
    "Kill all proper subdirs of DIRNAME, excluding DIRNAME itself.
! With optional arg REMEMBER-MARKS, return an alist of marked files."
!   (interactive "DKill tree below directory: ")
!   (setq dirname (expand-file-name dirname))
    (let ((s-alist dired-subdir-alist) dir m-alist)
      (while s-alist
        (setq dir (car (car s-alist))
  	    s-alist (cdr s-alist))
!       (if (and (not (string-equal dir dirname))
! 	       (dired-in-this-tree dir dirname)
! 	       (dired-goto-subdir dir))
! 	  (setq m-alist (nconc (dired-kill-subdir remember-marks) m-alist))))
      m-alist))
  
  (defun dired-insert-subdir-newpos (new-dir)
--- 1852,1874 ----
  			  (> (dired-get-subdir-min elt1)
  			     (dired-get-subdir-min elt2)))))))
  
! (defun dired-kill-tree (dirname &optional remember-marks kill-root)
    "Kill all proper subdirs of DIRNAME, excluding DIRNAME itself.
! Interactively, you can kill DIRNAME as well by using a prefix argument.
! In interactive use, the command prompts for DIRNAME.
! 
! When called from Lisp, if REMEMBER-MARKS is non-nil, return an alist
! of marked files.  If KILL-ROOT is non-nil, kill DIRNAME as well."
!   (interactive "DKill tree below directory: \ni\nP")
!   (setq dirname (file-name-as-directory (expand-file-name dirname)))
    (let ((s-alist dired-subdir-alist) dir m-alist)
      (while s-alist
        (setq dir (car (car s-alist))
  	    s-alist (cdr s-alist))
!       (and (or kill-root (not (string-equal dir dirname)))
! 	   (dired-in-this-tree dir dirname)
! 	   (dired-goto-subdir dir)
! 	   (setq m-alist (nconc (dired-kill-subdir remember-marks) m-alist))))
      m-alist))
  
  (defun dired-insert-subdir-newpos (new-dir)
============================================================

  reply	other threads:[~2004-06-08  2:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-06 21:19 dired-kill-tree Luc Teirlinck
2004-06-06 21:27 ` dired-kill-tree Miles Bader
2004-06-06 21:42   ` dired-kill-tree Luc Teirlinck
2004-06-07  1:08   ` dired-kill-tree Luc Teirlinck
2004-06-07  7:11 ` dired-kill-tree Richard Stallman
2004-06-08  2:39   ` Luc Teirlinck [this message]
2004-06-08 23:31     ` dired-kill-tree Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200406080239.i582dpf28840@raven.dms.auburn.edu \
    --to=teirllm@dms.auburn.edu \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.