unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Eshel Yaron <me@eshelyaron.com>,
	Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 74404@debbugs.gnu.org
Subject: bug#74404: [PATCH] Give Completion Preview bindings higher precedence
Date: Sun, 17 Nov 2024 19:04:33 +0200	[thread overview]
Message-ID: <86ttc5vljy.fsf@gnu.org> (raw)
In-Reply-To: <m1jzd1j008.fsf@macbookpro.home> (bug-gnu-emacs@gnu.org)

> Date: Sun, 17 Nov 2024 17:30:47 +0100
> From:  Eshel Yaron via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> 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?

Can't you instead use the 'keymap' text or overlay property?  That
would avoid the "arms race" of precedences.

Adding Stefan, in case he has comments or suggestions.





  reply	other threads:[~2024-11-17 17:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-17 16:30 bug#74404: [PATCH] Give Completion Preview bindings higher precedence Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-17 17:04 ` Eli Zaretskii [this message]
2024-11-17 17:16   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-17 17:31     ` Eshel Yaron 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=86ttc5vljy.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=74404@debbugs.gnu.org \
    --cc=me@eshelyaron.com \
    --cc=monnier@iro.umontreal.ca \
    /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).