branch: elpa/eldoc-mouse
commit 770fd0fc0b7552826e9f07a6fa58673e4851907f
Author: huangfeiyu <[email protected]>
Commit: GitHub <[email protected]>

    Add interested thing function for eldoc-mouse
    
    if the function return false, no overlay will be created at the mouse point.
---
 eldoc-mouse.el | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/eldoc-mouse.el b/eldoc-mouse.el
index 2b152a8d4ba..98f21bb63a7 100644
--- a/eldoc-mouse.el
+++ b/eldoc-mouse.el
@@ -135,6 +135,9 @@ A leading space make the buffer hidden."
 (defvar-local eldoc-mouse--original-track-mouse nil
   "The original buffer local value of variable `track-mouse'.")
 
+(defvar-local eldoc-mouse-interested-thing-function nil
+  "The function which determines if the current thing at point is interested.")
+
 (defvar-local eldoc-mouse-eldoc-documentation-functions
     (list #'eldoc-mouse--eglot-eldoc-documentation-function 
#'eldoc-mouse--elisp-eldoc-documentation-function)
   "The `eldoc-documentation-functions' for `eldoc-mouse-mode'.
@@ -228,11 +231,13 @@ POS is the buffer position under the mouse cursor."
                    (not (eolp))
                    (not (nth 4 (syntax-ppss))))
           (eldoc-print-current-symbol-info)
-          (setq-local eldoc-mouse-mouse-overlay
-                      (make-overlay
-                       (car eldoc-mouse-last-symbol-bounds)
-                       (cdr eldoc-mouse-last-symbol-bounds)))
-          (overlay-put eldoc-mouse-mouse-overlay 'face 
'secondary-selection))))))
+          (when (or (null eldoc-mouse-interested-thing-function)
+                    (funcall eldoc-mouse-interested-thing-function))
+            (setq-local eldoc-mouse-mouse-overlay
+                        (make-overlay
+                         (car eldoc-mouse-last-symbol-bounds)
+                         (cdr eldoc-mouse-last-symbol-bounds)))
+            (overlay-put eldoc-mouse-mouse-overlay 'face 
'secondary-selection)))))))
 
 (defun eldoc-mouse--hide-posframe ()
   "Hide the posframe."

Reply via email to