summaryrefslogtreecommitdiff
path: root/lisp/hi-lock.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/hi-lock.el')
-rw-r--r--lisp/hi-lock.el20
1 files changed, 20 insertions, 0 deletions
diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el
index fbd698e234a..b70d4a75690 100644
--- a/lisp/hi-lock.el
+++ b/lisp/hi-lock.el
@@ -854,6 +854,26 @@ SPACES-REGEXP is a regexp to substitute spaces in font-lock search."
;; continue standard unloading
nil)
+;;; Mouse support
+(defun hi-lock-symbol-at-mouse (event)
+ "Highlight symbol at mouse click EVENT."
+ (interactive "e")
+ (save-excursion
+ (mouse-set-point event)
+ (highlight-symbol-at-point)))
+
+;;;###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"))))
+ menu)
+
(provide 'hi-lock)
;;; hi-lock.el ends here