From: Jim Porter <jporterbugs@gmail.com>
To: 49104@debbugs.gnu.org
Subject: bug#49104: [PATCH] 28.0.50; Handle remapped commands for M-TAB in `flyspell-prog-mode'
Date: Fri, 18 Jun 2021 16:09:55 -0700 [thread overview]
Message-ID: <CANh=_JEQTZu_UZN9QCNNYWa5sS7Ko53HVY-mQuPxbwpbWd-9kA@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 696 bytes --]
`flyspell-prog-mode' uses the original M-TAB binding outside of
comments, which is nice (see bug#18533). However, it doesn't account
for remapped commands. For example, I remap `completion-at-point' to
`company-complete' when `company-mode' is active. If I hit M-TAB while
`company-mode' and `flyspell-prog-mode' are active, I get
`completion-at-point', which isn't what I want.
To reproduce this issue, you can do the following:
emacs -Q
(global-set-key [remap completion-at-point]
(lambda () (interactive) (message "remapped")))
M-x flyspell-prog-mode
M-TAB ;; Or C-M-i
I've attached a patch that fixes the issue (hopefully it works in all
cases; it works for me).
[-- Attachment #2: 0001-Handle-remapped-commands-for-original-M-TAB-binding-.patch --]
[-- Type: application/octet-stream, Size: 1299 bytes --]
From 734890adff84cf8fbec9cff0a5bb6ad620877216 Mon Sep 17 00:00:00 2001
From: Jim Porter <jporterbugs@gmail.com>
Date: Fri, 18 Jun 2021 16:02:07 -0700
Subject: [PATCH] Handle remapped commands for original M-TAB binding in
'flyspell-prog-mode'
* lisp/textmodes/flyspell.el (flyspell-prog-mode): Get the remapped
command for the original M-TAB binding if necessary.
---
lisp/textmodes/flyspell.el | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el
index ba48e5de21..eb4c5cde28 100644
--- a/lisp/textmodes/flyspell.el
+++ b/lisp/textmodes/flyspell.el
@@ -410,9 +410,11 @@ flyspell-prog-mode
(interactive)
(setq flyspell-generic-check-word-predicate
#'flyspell-generic-progmode-verify)
- (setq-local flyspell--prev-meta-tab-binding
- (or (local-key-binding "\M-\t" t)
- (global-key-binding "\M-\t" t)))
+ (let ((prev-meta-tab-binding (or (local-key-binding "\M-\t" t)
+ (global-key-binding "\M-\t" t))))
+ (setq-local flyspell--prev-meta-tab-binding
+ (or (command-remapping prev-meta-tab-binding)
+ prev-meta-tab-binding)))
(flyspell-mode 1)
(run-hooks 'flyspell-prog-mode-hook))
--
2.25.1
next reply other threads:[~2021-06-18 23:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-18 23:09 Jim Porter [this message]
2021-06-19 6:07 ` bug#49104: [PATCH] 28.0.50; Handle remapped commands for M-TAB in `flyspell-prog-mode' Eli Zaretskii
2021-06-19 11:51 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-06-19 12:20 ` Eli Zaretskii
2021-06-19 17:24 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-06-19 17:31 ` Jim Porter
2021-06-27 19:07 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-06-28 4:44 ` Jim Porter
2021-07-20 12:13 ` Lars Ingebrigtsen
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CANh=_JEQTZu_UZN9QCNNYWa5sS7Ko53HVY-mQuPxbwpbWd-9kA@mail.gmail.com' \
--to=jporterbugs@gmail.com \
--cc=49104@debbugs.gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.