emacs-devel
[Top][All Lists]
Advanced

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

Re: Context menus and mouse-3


From: Tak Kunihiro
Subject: Re: Context menus and mouse-3
Date: Wed, 21 Jul 2021 13:39:30 +0900
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (windows-nt)

I think most of the time, a thing under mouse cursor matters for
context-menu instead of mode.

For example, when a thing under mouse cursor is with face
'flyspell-incorrect, it is nice to have 'flyspell-correct-word as shown
below.

(defun poplife-mouse-word-menu (event)
  "Return 'flyspell-correct-word when word under mouse cursor on EVENT is 
incorrect."
  (and
   (not (region-active-p))
   (let ((faces-at-point (mapcar (lambda (xxx) (overlay-get xxx 'face))
                                 (overlays-at (posn-point (event-start 
event))))))
     (when (or (member 'flyspell-incorrect faces-at-point)
               (member 'flyspell-duplicate faces-at-point))
       #'flyspell-correct-word))))



reply via email to

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