From owner-ntemacs-users@june Tue Jan 21 13:38:28 1997 X-VM-v5-Data: ([nil nil nil nil nil nil nil nil nil] [nil "Tue" "21" "January" "1997" "15:36:43" "-0500" "David Biesack" "sasdjb@unx.sas.com" nil "73" "> sending deleted files to recycle bin from dired" "^From:" nil nil "1" nil nil nil nil] nil) Received: from joker.cs.washington.edu (joker.cs.washington.edu [128.95.1.42]) by june.cs.washington.edu (8.8.3+CSE/7.2ju) with SMTP id NAA13132 for ; Tue, 21 Jan 1997 13:21:48 -0800 Received: from june.cs.washington.edu (june.cs.washington.edu [128.95.1.4]) by joker.cs.washington.edu (8.6.12/7.2ws+) with ESMTP id NAA29499 for ; Tue, 21 Jan 1997 13:21:40 -0800 Received: from lamb.sas.com (lamb.sas.com [192.35.83.8]) by june.cs.washington.edu (8.8.3+CSE/7.2ju) with SMTP id MAA09063 for ; Tue, 21 Jan 1997 12:42:09 -0800 Received: from mozart by lamb.sas.com (5.65c/SAS/Gateway/01-23-95) id AA27814; Tue, 21 Jan 1997 15:42:01 -0500 Received: from lambda.unx.sas.com by mozart (5.65c/SAS/Domains/5-6-90) id AA27550; Tue, 21 Jan 1997 15:36:43 -0500 Received: by lambda.unx.sas.com (5.65c/SAS/Generic 9.01/3-26-93) id AA12038; Tue, 21 Jan 1997 15:36:43 -0500 Message-Id: <199701212036.AA12038@lambda.unx.sas.com> In-Reply-To: <199701211811.NAA20700@volte.i-kinetics.com> (message from Peter Breton on Tue, 21 Jan 1997 13:11:15 -0500) From: David Biesack To: ntemacs-users@cs.washington.edu Subject: > sending deleted files to recycle bin from dired Date: Tue, 21 Jan 1997 15:36:43 -0500 > Date: Tue, 21 Jan 1997 13:11:15 -0500 > From: Peter Breton > Cc: ntemacs-users@cs.washington.edu > References: <2E4C4EE0.1645@gsnetworks.gensig.com> > <199701211655.LAA08788@volte.i-kinetics.com> > <32E4B68D.3D15@world.std.com> > Reply-To: pbreton@i-kinetics.com > > Emacs doesn't call an external program but uses its own delete-file > function, so again this wouldn't work (unless it somehow patches the Win32 > API). You could write a delete-file function which used Norton Recycle, > though, perhaps just by calling shell-command and then updating the dired > display. > > Peter Correct. Here is something I have, based on similar elisp I wrote ages ago Unix which used a delete/undelete program from MIT Project Athena. (defvar remove-file-use-delete t "*If non-nil use the delete command instead of rm and rmdir") (defvar file-delete-command "delete" ;; c:/bin/delete.cmd uses Norton Tools SYMAPDEL.EXE "*The command to delete files") (defvar old-delete-fnc nil) ;; save the old delete-file function (or (fboundp 'old-delete-file-fnc) (fset 'old-delete-file-fnc (symbol-function 'delete-file))) (defun delete-file (filename) "Delete specified file. One argument, a file name string.\n\ If file has multiple names, it continues to exist with the other names. If remove-file-use-delete is true, the delete command is used, otherwise rm is used." (interactive "fDelete file: ") (if remove-file-use-delete (call-process file-delete-command nil nil nil ;; Unix delete commands also use the following options here: ;; "-F" "-f" "--" (expand-file-name filename)) (old-delete-file-fnc filename))) My delete.cmd in my PATH uses some perl to change forward slashes to backslashes. (This cmd file was generated from pl2bat.) It uses NTTools for NT symapdel.exe I suppose I could/should do this directly in Emacs... Anyway, this works with M-x delete-file and in dired and other places in Emacs which calls delete-file. @rem = '--*-PERL-*--'; @rem = ' @echo off rem setlocal set ARGS= :loop if .%1==. goto endloop set ARGS=%ARGS% %1 shift goto loop :endloop rem ***** This assumes PERL is in the PATH ***** perl.exe -w -S delete.cmd %ARGS% goto endofperl @rem '; $files= join(' ', @ARGV); $files =~ s-/-\\-g; # print "cmd /c \"echo start c:\\win32app\\nttools\\nfilemgr\\symapdel /CNOS/CFDEL-/QM/NOERR/NOWARN $files\"\n"; system("cmd /c \"start c:\\win32app\\nttools\\nfilemgr\\symapdel /CNOS/CFDEL-/QM/NOERR/NOWARN $files\""); __END__ :endofperl use at your own risk!