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:50:12 +0100

On 5 May 2010 20:09, Óscar Fuentes <address@hidden> wrote:
> It was installed long time ago.
>
>> BTW, I don't understand why his patch changes (defvar ido-cur-list)
>> and (defvar ido-choice-list) into (defvar ido-cur-list nil)
>> and (defvar ido-choice-list nil).  These changes aren't necessarily bad,
>> but I suspect the change is either unneeded or hiding a bug.
>
> I was unable to obtain a solid insight on how ido managed the list of
> buffers. It looked quite complicated and dispersed to me. So tried some
> code, tested (with Juanma's help) and submitted the patch. The last
> patch posted by Leo looks great because it is so simple, but IIRC I
> considered some simple ways of fixing the bug and they introduced
> strange bugs and annoyances(*), so maybe my fix doesn't contain so much
> gratuitous code at it seems, or maybe Leo is right and I was unlucky
> with my attempts at fixing the bug with a simple change.
>
> * One of those annoyances was changing the "next" item on the list of
>  buffers once you kill the first one, something that I find
>  confusing. Right now ido may change the order of the buffers after a
>  kill, but the previous second item appears as the first item on the
>  new list.
>

Could you try this function to see if it does what you want? Also let
me know what is missing. I will try fix it today. Thanks.

(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))))))

Leo




reply via email to

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