[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/sweeprolog a369e46143 160/166: ENHANCED: underline occurre
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/sweeprolog a369e46143 160/166: ENHANCED: underline occurrences of the variable at point |
Date: |
Fri, 30 Sep 2022 04:59:35 -0400 (EDT) |
branch: elpa/sweeprolog
commit a369e461439c3f6ff4ae5a8289b157fa75bf815e
Author: Eshel Yaron <me@eshelyaron.com>
Commit: Eshel Yaron <me@eshelyaron.com>
ENHANCED: underline occurrences of the variable at point
---
sweeprolog.el | 37 +++++++++++++++++++++++++++++++------
1 file changed, 31 insertions(+), 6 deletions(-)
diff --git a/sweeprolog.el b/sweeprolog.el
index 2e9d322956..937e62164c 100644
--- a/sweeprolog.el
+++ b/sweeprolog.el
@@ -992,6 +992,13 @@ module name, F is a functor name and N is its arity."
(:inherit font-lock-keyword-face)
"The empty list.")
+(sweeprolog-defface
+ variable-at-point
+ (:underline t)
+ (:underline t)
+ (:underline t)
+ "Variables.")
+
(sweeprolog-defface
variable
(:inherit font-lock-variable-name-face)
@@ -1111,6 +1118,8 @@ module name, F is a functor name and N is its arity."
(:inherit font-lock-doc-face :foreground "green")
"Structured comments.")
+(defvar-local sweeprolog--variable-at-point nil)
+
(defun sweeprolog--colour-term-to-faces (beg end arg)
(pcase arg
(`("comment" . "structured")
@@ -1202,7 +1211,14 @@ module name, F is a functor name and N is its arity."
("control"
(list (list beg end (sweeprolog-control-face))))
("var"
- (list (list beg end (sweeprolog-variable-face))))
+ (let ((var (buffer-substring-no-properties beg end)))
+ (with-silent-modifications
+ (put-text-property beg end 'cursor-sensor-functions
+ (sweeprolog-cursor-sensor-functions var)))
+ (cons (list beg end (sweeprolog-variable-face))
+ (and sweeprolog--variable-at-point
+ (string= sweeprolog--variable-at-point var)
+ (list (list beg end (sweeprolog-variable-at-point-face)))))))
("fullstop"
(list (list beg end (sweeprolog-fullstop-face))))
("functor"
@@ -1296,11 +1312,11 @@ module name, F is a functor name and N is its arity."
(with-silent-modifications
(font-lock-unfontify-region beg end))
(sweeprolog-open-query "user"
- "sweep"
- "sweep_colourise_some_terms"
- (list contents
- (buffer-file-name)
- beg))
+ "sweep"
+ "sweep_colourise_some_terms"
+ (list contents
+ (buffer-file-name)
+ beg))
(let ((sol (sweeprolog-next-solution)))
(sweeprolog-close-query)
(when (sweeprolog-true-p sol)
@@ -2166,6 +2182,15 @@ Interactively, POINT is set to the current point."
(cancel-timer sweeprolog--timer))))))
+(defun sweeprolog-cursor-sensor-functions (var)
+ (list
+ (lambda (_win old dir)
+ (if (eq dir 'entered)
+ (let ((sweeprolog--variable-at-point var))
+ (font-lock-fontify-region (point) (point)))
+ (let ((sweeprolog--variable-at-point nil))
+ (font-lock-fontify-region old old))))))
+
(provide 'sweeprolog)
;;; sweeprolog.el ends here
- [nongnu] elpa/sweeprolog 5a8f70149f 099/166: FIXED: (sweep-load-buffer): error after prompting for a buffer, (continued)
- [nongnu] elpa/sweeprolog 5a8f70149f 099/166: FIXED: (sweep-load-buffer): error after prompting for a buffer, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 7327016d15 095/166: FIXED: sweep_predicates_collection/2: include preds defined in user, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog a70a730f48 087/166: PORT: don't use the 2nd arg to looking-at, added only in Emacs 29, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog d1a2913f75 115/166: ENHANCED: Update semantic highlighting on idle timer in sweep-mode, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog b168465391 098/166: FIXED: sweep_load_buffer/3: load files in the context of "user", ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog db7ef44a61 083/166: DOC: add manual section about setting Prolog flags, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 521a4bfde5 132/166: BUILD: replaced Makefile with CMakeLists.txt, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog ecf601dd54 133/166: FIXED: indentation error when typing at end of buffer, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 7bca15bd1e 141/166: DOC: fix copy-paste error in README.org, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 83bbd58031 153/166: ADDED: new command sweeprolog-restart for resetting sweep, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog a369e46143 160/166: ENHANCED: underline occurrences of the variable at point,
ELPA Syncer <=
- [nongnu] elpa/sweeprolog 8d13f21c0d 162/166: ADDED: new command sweeprolog-highlight-variable, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 3d5d0deda5 161/166: ADDED: new user option sweeprolog-enable-cursor-sensor, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 8f0e4a644d 164/166: FIXED: error on interactively removing variable highlighting, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog b43b6019ff 154/166: DOC: document the newly added sweeprolog-restart command, ELPA Syncer, 2022/09/30