Function: ido-kill-buffer-at-head

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

Signature

(ido-kill-buffer-at-head)

Documentation

Kill the buffer at the head of ido-matches.

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
;;; KILL CURRENT BUFFER
(defun ido-kill-buffer-at-head ()
  "Kill the buffer at the head of `ido-matches'.
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)
	  (buf (ido-name (car ido-matches)))
	  (nextbuf (cadr ido-matches)))
      (cond
       ((get-buffer buf)
	;; If next match names a buffer use the buffer object; buffer
	;; name may be changed by packages such as uniquify.
	(when (and nextbuf (get-buffer nextbuf))
	  (setq nextbuf (get-buffer nextbuf)))
	(if (null (kill-buffer buf))
	    ;; Buffer couldn't be killed.
	    (setq ido-rescan t)
	  ;; Else `kill-buffer' succeeds so re-make the buffer list
	  ;; taking into account packages like uniquify may rename
	  ;; buffers.
	  (if (bufferp nextbuf)
	      (setq nextbuf (buffer-name nextbuf)))
	  (setq ido-default-item nextbuf
		ido-text-init ido-text
		ido-exit 'refresh)
	  (exit-minibuffer)))
       ;; Handle virtual buffers
       ((assoc buf ido-virtual-buffers)
	(setq recentf-list
	      (delete (cdr (assoc buf ido-virtual-buffers)) recentf-list))
	(setq ido-cur-list (delete buf ido-cur-list))
	(setq ido-rescan t))))))