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

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

[nongnu] elpa/highlight-parentheses 69c694a 30/49: Allow hl-paren- -[bac


From: ELPA Syncer
Subject: [nongnu] elpa/highlight-parentheses 69c694a 30/49: Allow hl-paren- -[background-]colors, -attributes to be functions
Date: Sun, 15 Aug 2021 03:57:47 -0400 (EDT)

branch: elpa/highlight-parentheses
commit 69c694aca1fe71df1272f313e6e996f5cb773ee2
Author: Constantin Kulikov <zxnotdead@gmail.com>
Commit: Constantin Kulikov <zxnotdead@gmail.com>

    Allow hl-paren- -[background-]colors, -attributes to be functions
---
 highlight-parentheses.el | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/highlight-parentheses.el b/highlight-parentheses.el
index 60471bf..bdffd37 100644
--- a/highlight-parentheses.el
+++ b/highlight-parentheses.el
@@ -51,21 +51,21 @@
   '("firebrick1" "IndianRed1" "IndianRed3" "IndianRed4")
   "List of colors for the highlighted parentheses.
 The list starts with the inside parentheses and moves outwards."
-  :type '(repeat color)
+  :type '(choice (repeat color) function)
   :set 'hl-paren-set
   :group 'highlight-parentheses)
 
 (defcustom hl-paren-background-colors nil
   "List of colors for the background highlighted parentheses.
 The list starts with the inside parentheses and moves outwards."
-  :type '(repeat color)
+  :type '(choice (repeat color) function)
   :set 'hl-paren-set
   :group 'highlight-parentheses)
 
 (defcustom hl-paren-attributes nil
   "List of face attributes for the highlighted parentheses.
 The list starts with the inside parentheses and moves outwards."
-  :type plist
+  :type '(choice plist function)
   :set 'hl-paren-set
   :group 'highlight-parentheses)
 
@@ -154,9 +154,15 @@ overlays when scrolling or moving point by pressing and 
holding
 ;;; overlays 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (defun hl-paren-create-overlays ()
-  (let ((fg hl-paren-colors)
-        (bg hl-paren-background-colors)
-        (attr hl-paren-attributes)
+  (let ((fg (if (functionp hl-paren-colors)
+                (funcall hl-paren-colors)
+              hl-paren-colors))
+        (bg (if (functionp hl-paren-background-colors)
+                (funcall hl-paren-background-colors)
+              hl-paren-background-colors))
+        (attr (if (functionp hl-paren-attributes)
+                  (funcall hl-paren-attributes)
+                hl-paren-attributes))
         attributes)
     (while (or fg bg attr)
       (setq attributes (face-attr-construct 'hl-paren-face))



reply via email to

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