From: Glenn Morris Date: Sun, 15 Sep 2013 00:35:54 +0000 (-0700) Subject: * eshell/em-unix.el (eshell/rm): Make -f ignore missing files. X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~1622 X-Git-Url: https://code.delx.au/gnu-emacs/commitdiff_plain/307532421098fd42d632b169a0eed9e04a47e822 * eshell/em-unix.el (eshell/rm): Make -f ignore missing files. Does not work until bug=15379 gets fixed. Fixes: debbugs:15373 --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f63a0d6681..e151ca9312 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2013-09-15 Glenn Morris + * eshell/em-unix.el (eshell/rm): + Make -f ignore missing files. (Bug#15373) + * eshell/esh-cmd.el (eshell--local-vars): New variable. (Bug#15372) (eshell-rewrite-for-command): Add for loop vars to eshell--local-vars. * eshell/esh-var.el (eshell-get-variable): Respect eshell--local-vars. diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el index 52d2b4d2a2..5792fe1750 100644 --- a/lisp/eshell/em-unix.el +++ b/lisp/eshell/em-unix.el @@ -284,18 +284,21 @@ Remove (unlink) the FILE(s).") entry))))) (eshell-funcalln 'unintern entry))) ((stringp entry) - (if (and (file-directory-p entry) - (not (file-symlink-p entry))) - (if (or em-recursive - eshell-rm-removes-directories) - (if (or em-preview - (not em-interactive) - (y-or-n-p - (format "rm: descend into directory `%s'? " - entry))) + ;; -f should silently ignore missing files (bug#15373). + (unless (and force-removal + (not (file-exists-p entry))) + (if (and (file-directory-p entry) + (not (file-symlink-p entry))) + (if (or em-recursive + eshell-rm-removes-directories) + (if (or em-preview + (not em-interactive) + (y-or-n-p + (format "rm: descend into directory `%s'? " + entry))) (eshell-remove-entries nil (list entry) t)) - (eshell-error (format "rm: %s: is a directory\n" entry))) - (eshell-remove-entries nil (list entry) t))))) + (eshell-error (format "rm: %s: is a directory\n" entry))) + (eshell-remove-entries nil (list entry) t)))))) (setq args (cdr args))) nil))