emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/sweeprolog 0dc3a896f0 2/5: ADDED: highlighting and tooltip


From: ELPA Syncer
Subject: [nongnu] elpa/sweeprolog 0dc3a896f0 2/5: ADDED: highlighting and tooltip info for declaration options
Date: Thu, 1 Jun 2023 16:02:04 -0400 (EDT)

branch: elpa/sweeprolog
commit 0dc3a896f0cbe0b45ee599f59753628659f0ec2f
Author: Eshel Yaron <me@eshelyaron.com>
Commit: Eshel Yaron <me@eshelyaron.com>

    ADDED: highlighting and tooltip info for declaration options
    
    * sweep.pl (sweep_color_normalized_/4): Handle 'decl_option/1'
    fragments.
    
    * sweeprolog.el (sweeprolog-declaration-option): New face, used in...
    (sweeprolog-analyze-fragment-to-faces): ...for 'decl_option' frags.
    (sweeprolog--help-echo-for-declaration-option): New function.
    (sweeprolog-analyze-fragment-help-echo): Use it.
---
 sweep.pl      |  3 +++
 sweeprolog.el | 27 +++++++++++++++++++++++++--
 2 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/sweep.pl b/sweep.pl
index 5dfc17d0e5..31aa7594a0 100644
--- a/sweep.pl
+++ b/sweep.pl
@@ -554,6 +554,9 @@ sweep_color_normalized_(_, type_error, [Kind0|_], 
["type_error"|Kind]) :-
     atom_string(Kind1, Kind).
 sweep_color_normalized_(_, macro, [String|_], ["macro"|String]) :-
     !.
+sweep_color_normalized_(_, decl_option, [Opt0|_], ["decl_option"|Opt]) :-
+    !,
+    term_string(Opt0, Opt).
 sweep_color_normalized_(_, Nom0, _, Nom) :-
     atom_string(Nom0, Nom).
 
diff --git a/sweeprolog.el b/sweeprolog.el
index 2ac05503e4..8b57c8bde1 100644
--- a/sweeprolog.el
+++ b/sweeprolog.el
@@ -2027,6 +2027,13 @@ resulting list even when found in the current clause."
   (:foreground "cyan" :underline t)
   "Macros.")
 
+(sweeprolog-defface
+  declaration-option
+  (:weight bold)
+  (:weight bold)
+  (:weight bold)
+  "Declaration options.")
+
 ;;;; Font-lock
 
 (defun sweeprolog-analyze-start-font-lock (beg end)
@@ -2305,7 +2312,9 @@ resulting list even when found in the current clause."
     ("method"
      (list (list beg end nil) (list beg end (sweeprolog-method-face))))
     ("class"
-     (list (list beg end (sweeprolog-class-face))))))
+     (list (list beg end (sweeprolog-class-face))))
+    (`("decl_option" . ,_)
+     (list (list beg end (sweeprolog-declaration-option-face))))))
 
 (defun sweeprolog-analyze-fragment-font-lock (beg end arg)
   (when-let ((face-fragments (sweeprolog-analyze-fragment-to-faces
@@ -2445,6 +2454,18 @@ resulting list even when found in the current clause."
 (defun sweeprolog--help-echo-for-macro (expansion)
   (format "Macro indicator, expands to (%s)" expansion))
 
+(defun sweeprolog--help-echo-for-declaration-option (option)
+  (pcase option
+    ("incremental"
+     (concat
+      "Incremental declaration "
+      "(tables that depend on this predicate are updated it changes)"))
+    ("volatile"
+     (concat
+      "Volatile declaration "
+      "(predicate excluded from saved program)"))
+    (_ (format "%s predicate property declaration" option))))
+
 (defun sweeprolog-analyze-fragment-help-echo (beg end arg)
   (when-let
       (help-echo
@@ -2510,7 +2531,9 @@ resulting list even when found in the current clause."
          ("rational" "Rational")
          ("dict_function" "Dict function")
          ("dict_return_op" "Dict return operator")
-         ("func_dot" "Dict function dot")))
+         ("func_dot" "Dict function dot")
+         (`("decl_option" . ,option)
+          (sweeprolog--help-echo-for-declaration-option option))))
     (with-silent-modifications
       (put-text-property beg end 'help-echo help-echo))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]