[Top][All Lists]

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

bug#7231: 23.3; Don't rebuild buffer list in iswitchb-visit-buffer

From: Stefan Monnier
Subject: bug#7231: 23.3; Don't rebuild buffer list in iswitchb-visit-buffer
Date: Mon, 18 Oct 2010 10:54:40 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

> -         ;; Else `kill-buffer' succeeds so re-make the buffer list
> -         ;; taking into account packages like uniquify may rename
> -         ;; buffers
> -         (iswitchb-make-buflist iswitchb-default))))))
> +         ;; else buffer was killed
> +         (setq iswitchb-buflist
> +               (delq nil (mapcar (lambda (b)
> +                                   (if (bufferp b)
> +                                       (buffer-name b)
> +                                     b))
> +                                 bufobjs))))))))
I was about to install that change when I realized that this is
fundamentally not the right approach: since some of the buffers may have
changed name, the new list of matching buffers may be different (some
buffers that didn't match before may match now and vice-versa).

So iswitchb-make-buflist is more correct.  To deal with the problem of
ordering, we'll need to combine the two: call iswitchb-make-buflist to
get the new list of matches, and then use bufobjs to sort the new

Something like

            (iswitchb-make-buflist iswitchb-default))))))
            ;; Try to preserve the previous sort order.
            (setq iswitchb-buflist
                  (sort iswitchb-buflist
                        (lambda (bn1 bn2)
                          (< (length (or (memq (get-buffer bn1) bufobjs)
                                         ;; Place new buffers at the end.
                             (length (or (memq (get-buffer bn2) bufobjs)


reply via email to

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