GNU bug report logs - #17048
minibuffer history should filter out impossible entries

Previous Next

Package: emacs;

Reported by: Jakub Jankiewicz <jcubic <at> onet.pl>

Date: Thu, 20 Mar 2014 11:11:02 UTC

Severity: wishlist

Tags: wontfix

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

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 17048 in the body.
You can then email your comments to 17048 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#17048; Package emacs. (Thu, 20 Mar 2014 11:11:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jakub Jankiewicz <jcubic <at> onet.pl>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 20 Mar 2014 11:11:02 GMT) Full text and rfc822 format available.

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

From: Jakub Jankiewicz <jcubic <at> onet.pl>
To: bug-gnu-emacs <at> gnu.org
Subject: switch-to-buffer function show killed buffers names
Date: Thu, 20 Mar 2014 12:10:01 +0100
[Message part 1 (text/plain, inline)]
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
[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17048; Package emacs. (Thu, 20 Mar 2014 14:17:01 GMT) Full text and rfc822 format available.

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

From: Stefan <monnier <at> iro.umontreal.ca>
To: Jakub Jankiewicz <jcubic <at> onet.pl>
Cc: 17048 <at> debbugs.gnu.org
Subject: Re: bug#17048: switch-to-buffer function show killed buffers names
Date: Thu, 20 Mar 2014 10:16:43 -0400
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




Changed bug title to 'minibuffer history should filter out impossible entries' from 'switch-to-buffer function show killed buffers names' Request was from Stefan <monnier <at> iro.umontreal.ca> to control <at> debbugs.gnu.org. (Thu, 20 Mar 2014 14:17:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17048; Package emacs. (Thu, 20 Mar 2014 15:14:02 GMT) Full text and rfc822 format available.

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

From: Jakub Jankiewicz <jcubic <at> onet.pl>
To: Stefan <monnier <at> iro.umontreal.ca>
Cc: 17048 <at> debbugs.gnu.org
Subject: Re: bug#17048: switch-to-buffer function show killed buffers names
Date: Thu, 20 Mar 2014 16:13:46 +0100
[Message part 1 (text/plain, inline)]
On Thu, 20 Mar 2014 10:16:43 -0400
Stefan <monnier <at> 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
[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17048; Package emacs. (Thu, 20 Mar 2014 15:46:01 GMT) Full text and rfc822 format available.

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

From: Drew Adams <drew.adams <at> oracle.com>
To: Jakub Jankiewicz <jcubic <at> onet.pl>, Stefan <monnier <at> iro.umontreal.ca>
Cc: 17048 <at> debbugs.gnu.org
Subject: RE: bug#17048: switch-to-buffer function show killed buffers names
Date: Thu, 20 Mar 2014 08:45:31 -0700 (PDT)
> 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'.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17048; Package emacs. (Fri, 20 Aug 2021 14:47:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Jakub Jankiewicz <jcubic <at> onet.pl>
Cc: Stefan <monnier <at> iro.umontreal.ca>, 17048 <at> debbugs.gnu.org
Subject: Re: bug#17048: minibuffer history should filter out impossible entries
Date: Fri, 20 Aug 2021 16:45:50 +0200
Jakub Jankiewicz <jcubic <at> 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




Added tag(s) wontfix. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 20 Aug 2021 14:47:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 17048 <at> debbugs.gnu.org and Jakub Jankiewicz <jcubic <at> onet.pl> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 20 Aug 2021 14:47:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 18 Sep 2021 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 213 days ago.

Previous Next


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