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

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

[elpa] externals/indent-bars 4fa1058326 293/431: Never recreate the same


From: ELPA Syncer
Subject: [elpa] externals/indent-bars 4fa1058326 293/431: Never recreate the same style TAG
Date: Mon, 16 Sep 2024 12:59:40 -0400 (EDT)

branch: externals/indent-bars
commit 4fa105832638fed11776d3c9642ec8108582d04f
Author: JD Smith <93749+jdtsmith@users.noreply.github.com>
Commit: JD Smith <93749+jdtsmith@users.noreply.github.com>

    Never recreate the same style TAG
---
 indent-bars.el | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/indent-bars.el b/indent-bars.el
index 1911e72c1e..8bb0da54aa 100644
--- a/indent-bars.el
+++ b/indent-bars.el
@@ -551,10 +551,13 @@ Additional `format' arguments can be passed as R."
                 (if (ibs/tag s) (concat "-" (ibs/tag s)) "") r)))
 
 (defun indent-bars--new-style (&optional tag)
-  "Create and record a new style struct with TAG."
-  (let ((style (ibs/create tag)))
-    (cl-pushnew style indent-bars--styles :test #'equal)
-    style))
+  "Create and record a new style struct with TAG.
+A new style is only created if an existing style with that TAG is
+no yet recorded."
+  (or (seq-find (lambda (s) (eq (ibs/tag s) tag)) indent-bars--styles)
+      (let ((style (ibs/create tag)))
+       (cl-pushnew style indent-bars--styles :test #'equal)
+       style)))
 
 ;;;;; Colors
 (defun indent-bars--main-color (style &optional tint tint-blend blend-override)
@@ -837,7 +840,8 @@ returned."
   "Reset all styles' colors and faces.
 Useful for calling after theme changes."
   (interactive)
-  (dolist (s indent-bars--styles) (indent-bars--initialize-style s)))
+  (dolist (s indent-bars--styles)
+    (indent-bars--initialize-style s)))
 
 (defun indent-bars--initialize-style (style)
   "Initialize STYLE."



reply via email to

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