From: Spencer Baugh via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 74019@debbugs.gnu.org, Juri Linkov <juri@linkov.net>
Subject: bug#74019: [PATCH] Optionally preserve selected candidate across *Completions* update
Date: Mon, 28 Oct 2024 12:01:03 -0400 [thread overview]
Message-ID: <ierjzdstdxc.fsf@janestreet.com> (raw)
In-Reply-To: <jwva5eol3jm.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Mon, 28 Oct 2024 10:21:49 -0400")
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>> Hmm... are we sure here that the `*Completions*`s content is related to
>>> the current completion session? I don't think we want to preserve the
>>> selection when it came from an unrelated use of completion half an
>>> hour earlier.
>>
>> That's why I'm doing get-buffer-window here - I figure that if
>> *Completions* is currently displayed in a window, it's reasonable to
>> preserve the selected candidate.
>>
>> (The selected candidate in that window, I guess - so maybe I should use
>> window-point here?)
>>
>> It still might not be related to the current completion session, since
>> the user might have just manually switched buffers to *Completions*, but
>> I wasn't sure there was a good way to determine that... any suggestions?
>
> Indeed, it might not be related. E.g in my setup, `*Completions*` is
> placed in a dedicated window&frame that is simply iconified/deiconified
> as needed, so your heuristic would fail.
(Interesting, is the code for that published somewhere? What's the
motivation for that instead of a window?)
> I think we need to store in the *Completions* buffer some info about the
> completion session for which it was last used. Or set some buffer-local
> var that indicates that the corresponding completion session is "done"
> (we can do that when we hide the *Completions* buffer, when we exit the
> minibuffer or the `completion-in-region-mode`).
It would be nice to store info about the completion session, but we
don't really have any concrete concept of "a completion session" right
now, right? So it's not clear to me how we would keep track of when it
starts and ends.
Also, I think we sometimes want to avoid reusing *Completions* even
within a completion session: if we're using completion in a directory
tree containing a file /aaa/aaa, if we select "aaa" while completing on
"/a", then "aaa" shouldn't still be selected if we complete on "/aaa/a".
Do you think it would be sufficient to set a "done" buffer-local in
minibuffer-hide-completions? That seems to be called in all the right
places.
Or maybe instead of a buffer-local, we could have
minibuffer-hide-completions do (goto-char (point-min)) so no completion
is selected anymore. Then it becomes harmless to reuse that
*Completions* buffer.
next prev parent reply other threads:[~2024-10-28 16:01 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-25 21:32 bug#74019: [PATCH] Optionally preserve selected candidate across *Completions* update Spencer Baugh via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-26 6:45 ` Eli Zaretskii
2024-10-26 14:59 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-28 14:08 ` Spencer Baugh via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-27 7:55 ` Juri Linkov
2024-10-28 13:57 ` Spencer Baugh via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-26 14:49 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-28 13:51 ` Spencer Baugh via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-28 14:21 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-28 16:01 ` Spencer Baugh via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-10-29 2:53 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-29 16:25 ` Spencer Baugh via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-29 18:27 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ierjzdstdxc.fsf@janestreet.com \
--to=bug-gnu-emacs@gnu.org \
--cc=74019@debbugs.gnu.org \
--cc=juri@linkov.net \
--cc=monnier@iro.umontreal.ca \
--cc=sbaugh@janestreet.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 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).