branch: elpa/symbol-overlay
commit eff8230ffe18553bde9f195263b2415c38acbe6b
Author: Langston Barrett <[email protected]>
Commit: Langston Barrett <[email protected]>
Add a hook for when the cursor enters or leaves the symbol overlay
---
symbol-overlay.el | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/symbol-overlay.el b/symbol-overlay.el
index ca39e28333..be11a8841b 100644
--- a/symbol-overlay.el
+++ b/symbol-overlay.el
@@ -156,6 +156,12 @@
:group 'symbol-overlay
:type 'float)
+(defcustom symbol-overlay-cursor-hook
+ '(lambda (window oldpos entered-or-left) '())
+ "A function that is put in the cursor-sensor-functions on every overlay."
+ :group 'symbol-overlay
+ :type 'hook)
+
(defcustom symbol-overlay-ignore-functions
'((c-mode . symbol-overlay-ignore-function-c)
(c++-mode . symbol-overlay-ignore-function-c++)
@@ -336,7 +342,10 @@ Otherwise apply `symbol-overlay-default-face'."
(if face (progn (overlay-put ov 'face face)
(overlay-put ov 'keymap symbol-overlay-map)
(overlay-put ov 'evaporate t)
- (overlay-put ov 'symbol symbol))
+ (overlay-put ov 'symbol symbol)
+ (overlay-put ov
+ 'cursor-sensor-functions
+ `(,symbol-overlay-cursor-hook)))
(overlay-put ov 'face 'symbol-overlay-default-face)
(overlay-put ov 'symbol ""))))