From: Juri Linkov Date: Thu, 18 Nov 2021 18:23:58 +0000 (+0200) Subject: Fix flyspell-correct-word selected from context menu opened with the keyboard X-Git-Tag: emacs-28.0.90~58 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=14271d050a30b8121358361ba671ba29493e03dd;p=emacs.git Fix flyspell-correct-word selected from context menu opened with the keyboard * lisp/mouse.el (context-menu-open): Call interactively a command returned by `context-menu-map' such as `flyspell-correct-word' (bug#50067). * lisp/textmodes/flyspell.el (flyspell-correct-word): Handle the case when it's called by a key bound to `context-menu-open'. Then it should work the same way as `C-c $' typed on misspelled word where the arg `event' of `flyspell-correct-word-before-point' is nil. --- diff --git a/lisp/mouse.el b/lisp/mouse.el index 091383bf110..b6448a13f3a 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -541,8 +541,11 @@ activates the menu whose contents depends on its surrounding context." "Start key navigation of the context menu. This is the keyboard interface to \\[context-menu-map]." (interactive) - (let ((inhibit-mouse-event-check t)) - (popup-menu (context-menu-map) (point)))) + (let ((inhibit-mouse-event-check t) + (map (context-menu-map))) + (if (commandp map) + (call-interactively map) + (popup-menu map (point))))) (global-set-key [S-f10] 'context-menu-open) diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el index 1d450b50012..258e5fde674 100644 --- a/lisp/textmodes/flyspell.el +++ b/lisp/textmodes/flyspell.el @@ -2160,7 +2160,7 @@ The word checked is the word at the mouse position." (interactive "e") (let ((save (point))) (mouse-set-point event) - (flyspell-correct-word-before-point event save))) + (flyspell-correct-word-before-point (and (consp event) event) save))) (defun flyspell-correct-word-before-point (&optional event opoint) "Pop up a menu of possible corrections for misspelled word before point.