GNU bug report logs - #50067
Context menus

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Sun, 15 Aug 2021 08:52:01 UTC

Severity: normal

Tags: fixed

Fixed in version 28.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Tak Kunihiro <tkk <at> misasa.okayama-u.ac.jp>
To: juri <at> linkov.net
Cc: mattiase <at> acm.org, alan <at> idiocy.org, 50067 <at> debbugs.gnu.org, larsi <at> gnus.org, tkk <at> misasa.okayama-u.ac.jp
Subject: bug#50067: Context menus
Date: Wed, 25 Aug 2021 08:43:29 +0900 (JST)
* flyspell menu

It is handy to show 'flyspell-correct-word when click on typo word.
However, menu is embedded inside of pre existing
'flyspell-correct-word and it is hard to collect menu.  Since
popup-menu interface can accept both menu and function with `e', it's
good to utilize 'flyspell-correct-word.

How about something like below to interrupt evaluation of
context-menu-functions in the middle when one of
context-menu-functions returns symbol instead of menu?

diff --git a/lisp/mouse.el b/lisp/mouse.el
index 6332d9fcec..23f0dda3e8 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -308,7 +308,7 @@ context-menu-map
     (run-hook-wrapped 'context-menu-functions
                       (lambda (fun)
                         (setq menu (funcall fun menu))
-                        nil))
+                        (not (keymapp menu))))
     (when (functionp context-menu-filter-function)
       (setq menu (funcall context-menu-filter-function menu)))
     menu))

Then function something below will pop word choices.

(defun context-menu-spell (menu)
  "Return 'flyspell-correct-word when word under mouse click is incorrect."
  (let ((faces-at-point (mapcar (lambda (xxx) (overlay-get xxx 'face))
                                (overlays-at (posn-point (event-start last-input-event))))))
    (if (or (member 'flyspell-incorrect faces-at-point)
            (member 'flyspell-duplicate faces-at-point))
        #'flyspell-correct-word
      menu)))

(setq context-menu-functions '(context-menu-spell ;; flyspell
                               context-menu-undo
                               context-menu-region
                               context-menu-local
                               context-menu-minor))




This bug report was last modified 3 years and 171 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.