From: Eshel Yaron Date: Tue, 22 Nov 2022 18:42:48 +0000 (+0200) Subject: New user-option to controlling highlighting of holes X-Git-Tag: V8.5.20-sweep-0.8.12~1 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e2cf80d0a82ba43d3f89570f71ddf2b685d6a8e8;p=sweep.git New user-option to controlling highlighting of holes * sweeprolog.el (sweeprolog-highlight-holes): new user-option. (sweeprolog-analyze-fragment-to-faces): respect it. --- diff --git a/sweeprolog.el b/sweeprolog.el index 767c456..282d26b 100644 --- a/sweeprolog.el +++ b/sweeprolog.el @@ -338,6 +338,13 @@ non-terminals)." :type 'string :group 'sweeprolog-top-level) +(defcustom sweeprolog-highlight-holes t + "If non-nil, highlight holes in a dedicated faces." + :package-version '((sweeprolog "0.8.12")) + :type 'boolean + :group 'sweeprolog) + + ;;;; Keymaps (defvar sweeprolog-mode-map @@ -1812,7 +1819,8 @@ resulting list even when found in the current clause." (list (list beg end (sweeprolog-recursion-face)))) (`("goal" "meta" . ,_) (cons (list beg end (sweeprolog-meta-face)) - (when (get-text-property beg 'sweeprolog-hole) + (when (and sweeprolog-highlight-holes + (get-text-property beg 'sweeprolog-hole)) (list (list beg end (sweeprolog-hole-face)))))) (`("goal" "built_in" . ,_) (list (list beg end (sweeprolog-built-in-face)))) @@ -1889,7 +1897,11 @@ resulting list even when found in the current clause." ("int" (list (list beg end (sweeprolog-int-face)))) ("singleton" - (list (list beg end (sweeprolog-singleton-face)))) + (if (get-text-property beg 'sweeprolog-hole) + (cons (list beg end (sweeprolog-variable-face)) + (when sweeprolog-highlight-holes + (list (list beg end (sweeprolog-hole-face))))) + (list (list beg end (sweeprolog-singleton-face))))) ("option_name" (list (list beg end (sweeprolog-option-name-face)))) ("no_option_name" @@ -1898,7 +1910,8 @@ resulting list even when found in the current clause." (list (list beg end (sweeprolog-control-face)))) ("var" (cons (list beg end (sweeprolog-variable-face)) - (when (get-text-property beg 'sweeprolog-hole) + (when (and sweeprolog-highlight-holes + (get-text-property beg 'sweeprolog-hole)) (list (list beg end (sweeprolog-hole-face)))))) ("fullstop" (save-excursion