GNU bug report logs -
#74404
[PATCH] Give Completion Preview bindings higher precedence
Previous Next
Reported by: Eshel Yaron <me <at> eshelyaron.com>
Date: Sun, 17 Nov 2024 16:31:02 UTC
Severity: wishlist
Tags: patch
Done: Stefan Kangas <stefankangas <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your bug report
#74404: [PATCH] Give Completion Preview bindings higher precedence
which was filed against the emacs package, has been closed.
The explanation is attached below, along with your original report.
If you require more details, please reply to 74404 <at> debbugs.gnu.org.
--
74404: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=74404
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
Eshel Yaron <me <at> eshelyaron.com> writes:
> close 74492 31.1
> quit
>
> Hi,
>
> Sean Whitton <spwhitton <at> spwhitton.name> writes:
>
>> Hello,
>>
>> On Sun 17 Nov 2024 at 12:16pm -05, Stefan Monnier via "Bug reports for
>> GNU Emacs, the Swiss army knife of text editors" wrote:
>>
>>> BTW, maybe we should add some notion of minor mode precedence since such
>>> problems are actually fairly common. We could do something similar to
>>> what we do with `add-hook`, so `add-minor-mode` takes care of obeying
>>> the ordering constraints.
>>
>> We could also have a customisation option that allows the user to
>> override the default priorities. As minor modes are always interned
>> symbols, this would be possible in a way that it isn't for hook
>> priorities.
>
> I've opened bug#74492 to discuss this broader topic of explicit minor
> mode precedence. For now, I've pushed my patch solving this particular
> issue with Completion Preview mode to master (commit 30bcba27c8c).
>
> With that, I'm closing this bug.
It seems like the bug was not closed, so I'm doing that now.
[Message part 3 (message/rfc822, inline)]
[Message part 4 (text/plain, inline)]
Tags: patch
Whenever Completion Preview mode shows a completion preview, it also
activates keybindings for commands that interact with that preview, most
notably TAB is bound to completion-preview-insert, which inserts the
suggested completion. This is implemented via a minor mode
completion-preview-active-mode whose keymap provides these bindings, and
which is enabled when the preview is displayed.
This all works well, except for when another minor mode, foo-mode, is
enabled, whose keybindings conflict with these active preview bindings.
If foo-mode is defined after completion-preview-active-mode, i.e. if
foo.el is loaded after completion-preview.el, then foo-mode comes first
in minor-mode-map-alist and takes precedence over the bindings in
completion-preview-active-mode-map.
This happens, for example, with eshell-cmpl-mode, a minor mode that is
enabled by default in Eshell, which binds TAB to completion-at-point.
So currently Completion Preview mode doesn't work as expected in Eshell:
when you try to accept the suggested completion (with TAB), you get
completion-at-point instead of completion-preview-insert.
To fix this issue, we need to give the active completion preview
bindings higher precedence than keymaps of minor modes that where
defined after loading completion-preview.el. The patch below does that
by using minor-mode-overriding-map-alist. Any thoughts?
[0001-Give-Completion-Preview-bindings-higher-precedence.patch (text/patch, attachment)]
This bug report was last modified 154 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.