all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Leo <sdl.web@gmail.com>
Cc: "Óscar Fuentes" <ofv@wanadoo.es>, 7231@debbugs.gnu.org
Subject: bug#7231: 23.3; Don't rebuild buffer list in iswitchb-visit-buffer
Date: Mon, 18 Oct 2010 10:54:40 -0400	[thread overview]
Message-ID: <jwv8w1vwobl.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <m1sk04bper.fsf@cam.ac.uk> (Leo's message of "Mon, 18 Oct 2010 03:16:44 +0800")

> -	    ;; 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
iswitchb-buflist.

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.
                                         bufobjs))
                             (length (or (memq (get-buffer bn2) bufobjs)
                                         bufobjs))))))



        Stefan





  reply	other threads:[~2010-10-18 14:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-17 17:59 bug#7231: 23.3; Don't rebuild buffer list in iswitchb-visit-buffer Leo
2010-10-17 18:22 ` Óscar Fuentes
2010-10-17 19:16   ` Leo
2010-10-18 14:54     ` Stefan Monnier [this message]
2010-10-20  3:00       ` Leo
2010-10-20  4:53         ` Leo
2010-10-20  9:19           ` Óscar Fuentes
2010-10-21  7:19           ` Leo
2010-10-20 16:13         ` Stefan Monnier
2010-10-23  5:36           ` Leo
2010-10-28  1:31     ` Stefan Monnier
2010-10-17 18:48 ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv8w1vwobl.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=7231@debbugs.gnu.org \
    --cc=ofv@wanadoo.es \
    --cc=sdl.web@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.