[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/sweeprolog 6b7626bf23 3/5: ADDED: Highlighting and tooltip
|
From: |
ELPA Syncer |
|
Subject: |
[nongnu] elpa/sweeprolog 6b7626bf23 3/5: ADDED: Highlighting and tooltip info for macros |
|
Date: |
Fri, 26 May 2023 06:02:41 -0400 (EDT) |
branch: elpa/sweeprolog
commit 6b7626bf23999aa4f1f668f0c16f3d6884aa4096
Author: Eshel Yaron <me@eshelyaron.com>
Commit: Eshel Yaron <me@eshelyaron.com>
ADDED: Highlighting and tooltip info for macros
* sweep.pl (sweep_color_normalized_/4): Handle 'macro(String)' terms.
* sweeprolog.el (sweeprolog-macro): New face.
(sweeprolog-analyze-fragment-to-faces)
(sweeprolog-analyze-fragment-help-echo): Handle 'macro' fragments.
---
sweep.pl | 2 ++
sweeprolog.el | 18 +++++++++++++++++-
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/sweep.pl b/sweep.pl
index 154b50ab1d..c8a154c943 100644
--- a/sweep.pl
+++ b/sweep.pl
@@ -550,6 +550,8 @@ sweep_color_normalized_(_, type_error, [Kind0|_],
["type_error"|Kind]) :-
!,
Kind0 =.. [Kind1|_],
atom_string(Kind1, Kind).
+sweep_color_normalized_(_, macro, [String|_], ["macro"|String]) :-
+ !.
sweep_color_normalized_(_, Nom0, _, Nom) :-
atom_string(Nom0, Nom).
diff --git a/sweeprolog.el b/sweeprolog.el
index 39f5c90b9b..a2d8042117 100644
--- a/sweeprolog.el
+++ b/sweeprolog.el
@@ -1581,7 +1581,7 @@ resulting list even when found in the current clause."
(sweeprolog-defface
expanded
- (:inherit font-lock-function-name-face)
+ (:inherit font-lock-preprocessor-face)
(:foreground "blue" :underline t)
(:foreground "cyan" :underline t)
"Expanded predicate calls.")
@@ -2010,6 +2010,13 @@ resulting list even when found in the current clause."
(:box t)
"Holes.")
+(sweeprolog-defface
+ macro
+ (:inherit font-lock-preprocessor-face)
+ (:foreground "blue" :underline t)
+ (:foreground "cyan" :underline t)
+ "Macros.")
+
;;;; Font-lock
(defun sweeprolog-analyze-start-font-lock (beg end)
@@ -2115,6 +2122,10 @@ resulting list even when found in the current clause."
(list (list beg end (sweeprolog-local-face))))
(`("goal" "constraint" . ,_)
(list (list beg end (sweeprolog-constraint-face))))
+ (`("macro" . ,_)
+ (list (list beg end (sweeprolog-macro-face))))
+ ("expanded"
+ (list (list beg end (sweeprolog-expanded-face))))
("instantiation_error"
(list (list beg end (sweeprolog-instantiation-error-face))))
(`("type_error" . ,_)
@@ -2421,6 +2432,9 @@ resulting list even when found in the current clause."
functor arity))
("not_callable" "Call to a non-callable term")))
+(defun sweeprolog--help-echo-for-macro (expansion)
+ (format "Macro indicator, expands to (%s)" expansion))
+
(defun sweeprolog-analyze-fragment-help-echo (beg end arg)
(when-let
(help-echo
@@ -2464,6 +2478,8 @@ resulting list even when found in the current clause."
("chars" "Chars")
(`("module" . ,module)
(sweeprolog--help-echo-for-module module))
+ (`("macro" . ,expansion)
+ (sweeprolog--help-echo-for-macro expansion))
("neck" "Neck")
(`("hook" . ,_) "Hook")
("hook" "Hook")