From: Leo Liu Date: Wed, 3 Jul 2013 03:01:34 +0000 (+0800) Subject: * ido.el (ido-delete-file-at-head): Respect delete-by-moving-to-trash. X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~1945 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e01aa29cd90dc51ecb9b8c4ec6164fb748a6b892;p=emacs.git * ido.el (ido-delete-file-at-head): Respect delete-by-moving-to-trash. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9a5af5e31d2..f717fdcc4e4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2013-07-03 Leo Liu + + * ido.el (ido-delete-file-at-head): Respect delete-by-moving-to-trash. + 2013-07-03 Dmitry Gutov * progmodes/ruby-mode.el (ruby-move-to-block): When we're at a diff --git a/lisp/ido.el b/lisp/ido.el index 4a4ecdcdb1a..bfa515ba26c 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -3986,6 +3986,7 @@ If cursor is not at the end of the user input, delete to end of input." ;;; DELETE CURRENT FILE (defun ido-delete-file-at-head () "Delete the file at the head of `ido-matches'. +Trash the file if `delete-by-moving-to-trash' is non-nil. If cursor is not at the end of the user input, delete to end of input." (interactive) (if (not (eobp)) @@ -3998,8 +3999,9 @@ If cursor is not at the end of the user input, delete to end of input." (file-exists-p file) (not (file-directory-p file)) (file-writable-p ido-current-directory) - (yes-or-no-p (concat "Delete " file "? "))) - (delete-file file) + (or delete-by-moving-to-trash + (yes-or-no-p (concat "Delete " file "? ")))) + (delete-file file 'trash) ;; Check if file still exists. (if (file-exists-p file) ;; file could not be deleted