unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#17048: switch-to-buffer function show killed buffers names
@ 2014-03-20 11:10 Jakub Jankiewicz
  2014-03-20 14:16 ` Stefan
  0 siblings, 1 reply; 5+ messages in thread
From: Jakub Jankiewicz @ 2014-03-20 11:10 UTC (permalink / raw)
  To: 17048

[-- Attachment #1: Type: text/plain, Size: 941 bytes --]

Hi,

When I call switch-to-buffer function <C-x b> and then when I ress up/down
arrows the list show buffers that I've kill, even that when I press Tab that
buffers don't show on the list.

The same happen if I search for buffer <C-x b C-s> but it seems that it don't
search from the beginning and I need to call C-s again to show killed buffer.

Maybe it's another bug that isearch-forward with switch-to-buffer don't
search from the beginning.

I think that problem is that kill-buffer don't remove entry from
Vbuffer_alist even that it call this (buffer.c line 1594)

Vbuffer_alist = Fdelq (Frassq (buffer, Vbuffer_alist), Vbuffer_alist);

emacs-version:
GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.8.2) of 2013-07-27 on
roseapple, modified by Debian

Regards
Jakub

--
𝑱𝒂𝒌𝒖𝒃 𝑱𝒂𝒏𝒌𝒊𝒆𝒘𝒊𝒄𝒛 (𝑊𝑒𝑏 𝐷𝑒𝑣𝑒𝑙𝑜𝑝𝑒𝑟)
http://jcubic.pl

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#17048: switch-to-buffer function show killed buffers names
  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
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan @ 2014-03-20 14:16 UTC (permalink / raw)
  To: Jakub Jankiewicz; +Cc: 17048

retitle 17048 minibuffer history should filter out impossible entries
thanks

> When I call switch-to-buffer function <C-x b> and then when I ress up/down
> arrows the list show buffers that I've kill, even that when I press Tab that
> buffers don't show on the list.

Yes, that's because up/down make you go through the history of what
you've entered.

I actually agree that when the completion is "must-match", it would make
sense of the history commands to skip entries that don't match one of
the current possible answers.  Tho it can be convenient to do <up> to
get the previous killed buffer name, and then tweak it a little, when
killing many buffers with similar names (typically hidden buffers used
for things like Tramp connections ;-).


        Stefan





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#17048: switch-to-buffer function show killed buffers names
  2014-03-20 14:16 ` Stefan
@ 2014-03-20 15:13   ` Jakub Jankiewicz
  2014-03-20 15:45     ` Drew Adams
  2021-08-20 14:45     ` bug#17048: minibuffer history should filter out impossible entries Lars Ingebrigtsen
  0 siblings, 2 replies; 5+ messages in thread
From: Jakub Jankiewicz @ 2014-03-20 15:13 UTC (permalink / raw)
  To: Stefan; +Cc: 17048

[-- Attachment #1: Type: text/plain, Size: 1195 bytes --]


On Thu, 20 Mar 2014 10:16:43 -0400
Stefan <monnier@iro.umontreal.ca> wrote:

> retitle 17048 minibuffer history should filter out impossible entries
> thanks
> 
> > When I call switch-to-buffer function <C-x b> and then when I ress up/down
> > arrows the list show buffers that I've kill, even that when I press Tab
> > that buffers don't show on the list.
> 
> Yes, that's because up/down make you go through the history of what
> you've entered.
> 
> I actually agree that when the completion is "must-match", it would make
> sense of the history commands to skip entries that don't match one of
> the current possible answers.  Tho it can be convenient to do <up> to
> get the previous killed buffer name, and then tweak it a little, when
> killing many buffers with similar names (typically hidden buffers used
> for things like Tramp connections ;-).

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


--
Jakub Jankiewicz, Web Developer
http://jcubic.pl

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#17048: switch-to-buffer function show killed buffers names
  2014-03-20 15:13   ` Jakub Jankiewicz
@ 2014-03-20 15:45     ` Drew Adams
  2021-08-20 14:45     ` bug#17048: minibuffer history should filter out impossible entries Lars Ingebrigtsen
  1 sibling, 0 replies; 5+ messages in thread
From: Drew Adams @ 2014-03-20 15:45 UTC (permalink / raw)
  To: Jakub Jankiewicz, Stefan; +Cc: 17048

> 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'.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#17048: minibuffer history should filter out impossible entries
  2014-03-20 15:13   ` Jakub Jankiewicz
  2014-03-20 15:45     ` Drew Adams
@ 2021-08-20 14:45     ` Lars Ingebrigtsen
  1 sibling, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-20 14:45 UTC (permalink / raw)
  To: Jakub Jankiewicz; +Cc: Stefan, 17048

Jakub Jankiewicz <jcubic@onet.pl> writes:

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

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

I think this is the correct solution here -- adding a user option for
this could make sense (if many wanted this functionality), but I haven't
really seem much demand for that, so I think doing it via this hook is
the right way to go.

So I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-08-20 14:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2021-08-20 14:45     ` bug#17048: minibuffer history should filter out impossible entries Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).