bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#74019: [PATCH] Optionally preserve selected candidate across *Comple


From: Stefan Monnier
Subject: bug#74019: [PATCH] Optionally preserve selected candidate across *Completions* update
Date: Mon, 28 Oct 2024 10:21:49 -0400
User-agent: Gnus/5.13 (Gnus v5.13)

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

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

> This is kind of an unrelated improvement, since this is probably nicer
> anyway - if the user moves point around manually in *Completions*, IMO
> that should have the same behavior as minibuffer-next-completion, but
> currently it doesn't highlight the same way if they leave *Completions*
> because cursor-face-highlight-nonselected-window doesn't get set.

I see, thanks.


        Stefan






reply via email to

[Prev in Thread] Current Thread [Next in Thread]