Function: icomplete-fido-kill

icomplete-fido-kill is an interactive and byte-compiled function defined in icomplete.el.gz.

Signature

(icomplete-fido-kill)

Documentation

Kill line or current completion, like ido-mode(var)/ido-mode(fun).

If killing to the end of line make sense, call kill-line, otherwise kill the currently selected completion candidate. Exactly what killing entails is dependent on the things being completed. If completing files, it means delete the file. If completing buffers it means kill the buffer. Both actions require user confirmation.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/icomplete.el.gz
;;;_* Helpers for `fido-mode' (or `ido-mode' emulation)

(defun icomplete-fido-kill ()
  "Kill line or current completion, like `ido-mode'.
If killing to the end of line make sense, call `kill-line',
otherwise kill the currently selected completion candidate.
Exactly what killing entails is dependent on the things being
completed.  If completing files, it means delete the file.  If
completing buffers it means kill the buffer.  Both actions
require user confirmation."
  (interactive)
  (let ((end (icomplete--field-end)))
    (if (< (point) end)
        (call-interactively 'kill-line)
      (let* ((all (completion-all-sorted-completions))
             (thing (car all))
             (cat (icomplete--category))
             (action
              (cl-case cat
                (buffer
                 (lambda ()
                   (when (yes-or-no-p (concat "Kill buffer " thing "? "))
                     (kill-buffer thing))))
                ((project-file file)
                 (lambda ()
                   (let* ((dir (file-name-directory (icomplete--field-string)))
                          (path (expand-file-name thing dir)))
                     (when (yes-or-no-p (concat "Delete file " path "? "))
                       (delete-file path) t))))
                (t
                 (error "Sorry, don't know how to kill things for `%s'" cat)))))
        (when (let (;; Allow `yes-or-no-p' to work and don't let it
                    ;; `icomplete-exhibit' anything.
                    (enable-recursive-minibuffers t)
                    (icomplete-mode nil))
                (funcall action))
          (completion--cache-all-sorted-completions
           (icomplete--field-beg)
           (icomplete--field-end)
           (cdr all)))
        (message nil)))))