emacs-diffs
[Top][All Lists]
Advanced

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

master f19b34376a 2/3: More fixes for recently committed context-menu ad


From: Juri Linkov
Subject: master f19b34376a 2/3: More fixes for recently committed context-menu additions from bug#52973
Date: Sat, 15 Jan 2022 13:37:58 -0500 (EST)

branch: master
commit f19b34376a2fe9f6f06226fb9cb0cb92119dbdca
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>

    More fixes for recently committed context-menu additions from bug#52973
    
    * lisp/hi-lock.el (highlight-symbol-at-mouse): New defalias.
    (hi-lock-face-symbol-at-mouse): Rename from hi-lock-symbol-at-mouse.
    (hi-lock-context-menu): Use thing-at-mouse and middle-separator.
    
    * lisp/man.el (Man-context-menu): Fix Man-at-mouse and use middle-separator.
    
    * lisp/mouse.el (context-menu-functions): Remove context-menu-online-search.
    Add occur-context-menu and dictionary-context-menu (bug#50552).
---
 lisp/hi-lock.el | 17 +++++++++--------
 lisp/man.el     | 10 ++++++----
 lisp/mouse.el   |  5 +++--
 3 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el
index b70d4a7569..b77f9181a9 100644
--- a/lisp/hi-lock.el
+++ b/lisp/hi-lock.el
@@ -855,7 +855,8 @@ SPACES-REGEXP is a regexp to substitute spaces in font-lock 
search."
   nil)
 
 ;;; Mouse support
-(defun hi-lock-symbol-at-mouse (event)
+(defalias 'highlight-symbol-at-mouse 'hi-lock-face-symbol-at-mouse)
+(defun hi-lock-face-symbol-at-mouse (event)
   "Highlight symbol at mouse click EVENT."
   (interactive "e")
   (save-excursion
@@ -865,13 +866,13 @@ SPACES-REGEXP is a regexp to substitute spaces in 
font-lock search."
 ;;;###autoload
 (defun hi-lock-context-menu (menu click)
   "Populate MENU with a menu item to highlight symbol at CLICK."
-  (save-excursion
-    (mouse-set-point click)
-    (when (symbol-at-point)
-      (define-key-after menu [highlight-search-separator] menu-bar-separator)
-      (define-key-after menu [highlight-search-mouse]
-        '(menu-item "Highlight Symbol" highlight-symbol-at-mouse
-                    :help "Highlight symbol at point"))))
+  (when (thing-at-mouse click 'symbol)
+    (define-key-after menu [highlight-search-separator] menu-bar-separator
+      'middle-separator)
+    (define-key-after menu [highlight-search-mouse]
+      '(menu-item "Highlight Symbol" highlight-symbol-at-mouse
+                  :help "Highlight symbol at point")
+      'highlight-search-separator))
   menu)
 
 (provide 'hi-lock)
diff --git a/lisp/man.el b/lisp/man.el
index d6146a2c4d..a53a696c31 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -1993,11 +1993,13 @@ Uses `Man-name-local-regexp'."
             (skip-syntax-backward "^ ")
             (and (looking-at
                   "[[:space:]]*\\([[:alnum:]_-]+([[:alnum:]]+)\\)")
-                  (match-string 1)))
-      (define-key-after menu [man-separator] menu-bar-separator)
+                 (match-string 1)))
+      (define-key-after menu [man-separator] menu-bar-separator
+        'middle-separator)
       (define-key-after menu [man-at-mouse]
-    '(menu-item "Open man page" man-at-mouse
-            :help "Open man page around mouse click"))))
+        '(menu-item "Open man page" Man-at-mouse
+                    :help "Open man page around mouse click")
+        'man-separator)))
   menu)
 
 
diff --git a/lisp/mouse.el b/lisp/mouse.el
index ad69d54fce..82424e3e24 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -298,9 +298,10 @@ and should return the same menu with changes such as added 
new menu items."
                   (function-item context-menu-buffers)
                   (function-item context-menu-vc)
                   (function-item context-menu-ffap)
-                  (function-item Man-context-menu)
                   (function-item hi-lock-context-menu)
-                  (function-item context-menu-online-search)
+                  (function-item occur-context-menu)
+                  (function-item Man-context-menu)
+                  (function-item dictionary-context-menu)
                   (function :tag "Custom function")))
   :version "28.1")
 



reply via email to

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