Emacs bug report logs - #4408
23.1; suggestion: a elisp function for copying and deleting whole dir

Previous Next

Package: emacs;

Reported by: "Xah Lee" <xah <at> xahlee.org>

Date: Fri, 11 Sep 2009 20:15:03 UTC

Severity: wishlist

Merged with 4416

To reply to this bug, email your comments to 4408 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4408; Package emacs. (Fri, 11 Sep 2009 20:15:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Xah Lee" <xah <at> xahlee.org>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Fri, 11 Sep 2009 20:15:04 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Xah Lee" <xah <at> xahlee.org>
To: <bug-gnu-emacs <at> gnu.org>
Subject: 23.1; suggestion: a elisp function for copying and deleting whole dir
Date: Fri, 11 Sep 2009 13:05:28 -0700
it appears to me, this is a good suggestion.

there lacks a function to copy and delete directories recursively.

in the elisp manual, the closest is:
(info "(elisp) Create/Delete Dirs")

it would be good to have a function that copy a whole dir, and another for 
deleting whole dir.

Emacs does implement them in dired, or in eshell, apparently, but it's not 
easy to use them.

many scripting langs provide such functions, and is very convenient.

for deleting dir, perhaps this can be implemented:
(delete-directory dirname &optional recursive)

for copying dir, perhaps it can be modeled on copy-file:
-- Command: copy-file oldname newname &optional ok-if-exists time

these should be perhaps few hours to implement for elisp developers, perhaps 
by just pulling existing implementation from dired or eshell.

Once implemented, they'd be standard functions in elisp manual. They would 
be great convience for average elisp coders.

As a personal example, i needed to both copy dir recursively and also delete 
whole dir, in my use of elisp as a text processing lang. So far i've been 
just calling shell. e.g.
(shell-command (concat "cp -R " fromDir " " toDir))
(shell-command (concat "find " destDir " -type d -name \"xx*\" -exec rm -R 
{} \\;"))

my script worked well in the past 2 years, but replying on unix shell has 
many complications. For example, recently i need my script to work on 
Windows. With Windows, there's many complications, e.g. which unix shell you 
use cygwin, msys, their config, their path env var config in emacs, both are 
inter-related to which emacs distribution one is using (e.g. what shell runs 
when you do M-x shell). Then, recently in one emacs distro i'm trying out 
eshell (in hope that it perhaps more cross-platform than M-x shell or 
Lennart emacsW23's shell, cmd-shell, msys-shell), but discovered that eshell 
chocks on this standard bash syntax
find -name "*el" -exec rm {} \;
(reported in bug #4406. Doesn't work when called as shell-command neither)

In short, something trivial turns out to be 5 or more hours to trying to get 
it work.

emacs + elisp is a great text processing lang, and one big advantage is that 
it is cross platform. So, all things considered, i think the suggestion in 
this report is a very good one, in particular its ratio of 
impact/ease-to-implement is relatively high.

if i eventually got a solution from looking into dired or eshell for 
copying/deleting dir, i'll update this report with code for draft 
implementation.

Thanks.

 Xah
∑ http://xahlee.org/

Merged 4408 4416. Request was from Juanma Barranquero <lekktu <at> gmail.com> to control <at> emacsbugs.donarmstrong.com. (Sat, 12 Sep 2009 12:00:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4408; Package emacs. (Sat, 12 Sep 2009 12:05:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juanma Barranquero <lekktu <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sat, 12 Sep 2009 12:05:05 GMT) Full text and rfc822 format available.

Message #12 received at 4408 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Xah Lee <xah <at> xahlee.org>, 4408 <at> emacsbugs.donarmstrong.com
Subject: Re: bug#4416: 23.1; suggestion: a elisp function for copying and 
	deleting whole dir
Date: Sat, 12 Sep 2009 13:56:52 +0200
On Sat, Sep 12, 2009 at 07:21, Xah Lee <xah <at> xahlee.org> wrote:

> here's my draft implementation. (thanks to Andreas Politz who pointed out
> the dired-aux function)

Please, when adding information to an already existing bug or feature
suggestion, remember to reply to the bugtracker number address (in
this case, to 4408 AT emacsbugs.donarmstrong.com), and NOT to
bug-gnu-emacs, because otherwise you're creating multiple bug reports
for the same issue (every message to bug-gnu-emacs creates one entry
in the bug list).

Thanks,

    Juanma



Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4408; Package emacs. (Sat, 12 Sep 2009 12:35:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Xah Lee" <xah <at> xahlee.org>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sat, 12 Sep 2009 12:35:04 GMT) Full text and rfc822 format available.

Message #17 received at 4408 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Xah Lee" <xah <at> xahlee.org>
To: "Juanma Barranquero" <lekktu <at> gmail.com>, <4408 <at> emacsbugs.donarmstrong.com>
Subject: Re: bug#4416: 23.1; suggestion: a elisp function for copying and deleting whole dir
Date: Sat, 12 Sep 2009 05:26:21 -0700
sorry it was a mistake. ^^

Xah

----- Original Message ----- 
From: "Juanma Barranquero" <lekktu <at> gmail.com>
To: "Xah Lee" <xah <at> xahlee.org>; <4408 <at> emacsbugs.donarmstrong.com>
Sent: Saturday, September 12, 2009 4:56 AM
Subject: Re: bug#4416: 23.1; suggestion: a elisp function for copying and 
deleting whole dir


> On Sat, Sep 12, 2009 at 07:21, Xah Lee <xah <at> xahlee.org> wrote:
>
>> here's my draft implementation. (thanks to Andreas Politz who pointed out
>> the dired-aux function)
>
> Please, when adding information to an already existing bug or feature
> suggestion, remember to reply to the bugtracker number address (in
> this case, to 4408 AT emacsbugs.donarmstrong.com), and NOT to
> bug-gnu-emacs, because otherwise you're creating multiple bug reports
> for the same issue (every message to bug-gnu-emacs creates one entry
> in the bug list).
>
> Thanks,
>
>    Juanma 




Severity set to 'wishlist' from 'normal' Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 15 Jan 2010 02:35:02 GMT) Full text and rfc822 format available.

Previous Next


Emacs bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.