Function: ido-delete-file-at-head

ido-delete-file-at-head is an interactive and byte-compiled function defined in ido.el.gz.

Signature

(ido-delete-file-at-head)

Documentation

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.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/ido.el.gz
;;; 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))
      (delete-region (point) (line-end-position))
    (let ((enable-recursive-minibuffers t)
	  (file (ido-name (car ido-matches))))
      (if file
	  (setq file (concat ido-current-directory file)))
      (when (and file
		 (file-exists-p file)
		 (not (file-directory-p file))
		 (file-writable-p ido-current-directory)
		 (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
	    (setq ido-rescan t)
	  ;; else file was killed so remove name from list.
	  (setq ido-cur-list (delq (car ido-matches) ido-cur-list)))))))