GNU bug report logs - #12916
24.2; Completion for "C-x b" does not include current buffer

Previous Next

Package: emacs;

Reported by: Richard Copley <rcopley <at> gmail.com>

Date: Sat, 17 Nov 2012 15:46:02 UTC

Severity: normal

Merged with 9598

Found in versions 23.0, 24.0.50, 24.2

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #13 received at 12916 <at> debbugs.gnu.org (full text, mbox):

From: Richard Copley <rcopley <at> gmail.com>
To: 12916 <at> debbugs.gnu.org
Subject: Fwd: bug#12916: 24.2;
	Completion for "C-x b" does not include current buffer
Date: Mon, 19 Nov 2012 20:10:56 +0000
Stefan, sorry I replied to you personally without replying to the tracker.

On 19 November 2012 14:22, Stefan Monnier <monnier <at> iro.umontreal.ca> wrote:
>> In older Emacs versions (*), to switch buffer, I could type "C-x b",
>> followed by a unique prefix of the desired buffer's name, then "TAB
>> RET".  This routine no longer works.  Specifically, the completion fails
>> when the desired buffer is already the current buffer.  So before I can
>> switch, I first have to work out which window is selected and whether
>> its buffer is the one I want.
>
> Hmm... I'd expect the user to know in which buffer she is when she hits
> C-x b.  Can you give us a few more hints about your use-case to try and
> help me understand why you don't know in which buffer you are when you
> hit C-x b?

The short answer is, when I've just killed a buffer (and I'm reading
Wikipedia, talking to a co-worker and watching TV).

The longer answer is: when there are two windows visible, I've just
killed a buffer, the two windows are now showing the same buffer (and
by the way, who ordered that?!), I want both windows to show the same
buffer, and there's a family of ducklings walking past the window and
they're really cute.

My mental map of recently-used buffers is not per-window, so to me it
is now unpredictable what other buffer will be shown after I kill a
buffer. Now that I come to think about it, perhaps this is really my
problem.

>> In my opinion this was a bad decision, and I think we should go back
>> to using "B" as the interactive spec for switch-to-buffer.  Others
>> might disagree, so would it be possible to add a custom variable to
>> control whether the current buffer is included in the list of completions?
>
> I'm not sure this deserves such a customization variable. But in any
> case, in the mean time, you can get back the previous behavior with the
> following hack:
>
>    (defadvice internal-complete-buffer-except (around rc-all-buffers activate)
>      (setq ad-return-value #'internal-complete-buffer))
>
> Maybe a cleaner workaround might be:
>
>    (put 'switch-to-buffer 'interactive-form
>         '(interactive "BSwitch to buffer: "))

Thank you! That seems to behave just as I want.

> -- Stefan




This bug report was last modified 3 years and 106 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.