all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Jakub Jankiewicz <jcubic@onet.pl>, Stefan <monnier@iro.umontreal.ca>
Cc: 17048@debbugs.gnu.org
Subject: bug#17048: switch-to-buffer function show killed buffers names
Date: Thu, 20 Mar 2014 08:45:31 -0700 (PDT)	[thread overview]
Message-ID: <0ef3a4c3-3d8f-47ca-91c5-26ccc08c3046@default> (raw)
In-Reply-To: <20140320161346.3b7e1e87@jcubic>

> Yes it's history, I think this fix the bug (but only for buffer names)
> 
> (add-hook 'kill-buffer-hook
>           (lambda ()
>             (setq buffer-name-history (delete (buffer-name)
>                                               buffer-name-history))))
> 

Bad idea.  And not a bug.

The history is supposed to be just that: a history of buffer names
that the user has entered as minibuffer input.

That this or that command might use this history for various things
is irrelevant to this.  If a given command has no use for buffer
names that do not correspond to currently live buffers then it is
_up to that command_ to DTRT for its own use.  And not by modifying
the history list but by filtering a copy of it.

IOW, any such filtering should be done, if needed, by the code that
USES the history variable.  It should not be done to the variable
itself, and especially not by some general code such as a kill-buffer
hook.

And in particular, command `switch-to-buffer' should NOT filter out
such buffer names.  Besides the full history being important, _a
priori_, this command is specifically designed to let you create a
new buffer, including a new buffer with the same name as one that
previously existed but has been killed.  Or, as Stefan pointed out,
one that has a similar name (e.g. by editing a history-list entry).

It is trivial for a user to write a command that, for example,
lets her choose only among existing (live) buffers.  And in that
case she can also decide whether she wants the available history
to be filtered similarly.  Nothing wrong with that.

But that is not `switch-to-buffer'.





  reply	other threads:[~2014-03-20 15:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-20 11:10 bug#17048: switch-to-buffer function show killed buffers names Jakub Jankiewicz
2014-03-20 14:16 ` Stefan
2014-03-20 15:13   ` Jakub Jankiewicz
2014-03-20 15:45     ` Drew Adams [this message]
2021-08-20 14:45     ` bug#17048: minibuffer history should filter out impossible entries Lars Ingebrigtsen

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=0ef3a4c3-3d8f-47ca-91c5-26ccc08c3046@default \
    --to=drew.adams@oracle.com \
    --cc=17048@debbugs.gnu.org \
    --cc=jcubic@onet.pl \
    --cc=monnier@iro.umontreal.ca \
    /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.