emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PATCH: Fix IDO interaction with uniquify.el


From: Leo
Subject: Re: PATCH: Fix IDO interaction with uniquify.el
Date: Wed, 5 May 2010 20:59:16 +0100

> (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 (get-buffer (cadr ido-matches))))
>      (when buf
>        (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.
>          (setq ido-default-item (buffer-name nextbuf))
>          (setq ido-text-init ido-text)
>          (setq ido-exit 'refresh)
>          (exit-minibuffer))))))

Robustified version. I think we are close to a fix.

(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)))
      (if (and nextbuf (buffer-live-p nextbuf))
          (setq nextbuf (get-buffer nextbuf))
        (setq nextbuf nil))
      (when buf
        (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.
          (and nextbuf (setq ido-default-item (buffer-name nextbuf)))
          (setq ido-text-init ido-text)
          (setq ido-exit 'refresh)
          (exit-minibuffer))))))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]