+2013-07-03 Leo Liu <sdl.web@gmail.com>
+
+ * ido.el (ido-delete-file-at-head): Respect delete-by-moving-to-trash.
+
2013-07-03 Dmitry Gutov <dgutov@yandex.ru>
* progmodes/ruby-mode.el (ruby-move-to-block): When we're at a
;;; 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))
(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