emacs-diffs
[Top][All Lists]
Advanced

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

emacs-28 14271d0: Fix flyspell-correct-word selected from context menu o


From: Juri Linkov
Subject: emacs-28 14271d0: Fix flyspell-correct-word selected from context menu opened with the keyboard
Date: Thu, 18 Nov 2021 13:24:20 -0500 (EST)

branch: emacs-28
commit 14271d050a30b8121358361ba671ba29493e03dd
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>

    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.
---
 lisp/mouse.el              | 7 +++++--
 lisp/textmodes/flyspell.el | 2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/lisp/mouse.el b/lisp/mouse.el
index 091383b..b6448a1 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 1d450b5..258e5fd 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.



reply via email to

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