[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/indent-bars bbc97b6c04 277/431: reset-styles for theme
From: |
ELPA Syncer |
Subject: |
[elpa] externals/indent-bars bbc97b6c04 277/431: reset-styles for theme change, all face setup now via styles |
Date: |
Mon, 16 Sep 2024 12:59:38 -0400 (EDT) |
branch: externals/indent-bars
commit bbc97b6c04aa5ec150093cc1d41c3cbece0656d7
Author: JD Smith <93749+jdtsmith@users.noreply.github.com>
Commit: JD Smith <93749+jdtsmith@users.noreply.github.com>
reset-styles for theme change, all face setup now via styles
---
indent-bars.el | 68 +++++++++++++++++++++++++++-------------------------------
1 file changed, 32 insertions(+), 36 deletions(-)
diff --git a/indent-bars.el b/indent-bars.el
index 5074d0c179..c285548c33 100644
--- a/indent-bars.el
+++ b/indent-bars.el
@@ -831,6 +831,36 @@ returned."
(t new)))
+(defun indent-bars-reset-styles (&rest _r)
+ "Reset all styles' colors and faces.
+Useful for calling after theme changes."
+ (interactive)
+ (dolist (s indent-bars--styles) (indent-bars--initialize-style s)))
+
+(defun indent-bars--initialize-style (style)
+ "Initialize STYLE."
+ ;; Colors
+ (setf (ibs/main-color style)
+ (indent-bars--main-color style)
+ (ibs/depth-palette style)
+ (indent-bars--depth-palette style)
+ (ibs/current-depth-palette style)
+ (indent-bars--current-depth-palette style)
+
+ (ibs/faces style) (indent-bars--create-faces style 7 'reset)
+ (ibs/no-stipple-chars style) (indent-bars--create-no-stipple-chars
style 7))
+
+ ;; Base stipple face
+ (face-spec-set (ibs/stipple-face style) nil) ;stipple only via filtered
remaps
+
+ ;; Current depth highlight faces/stipple
+ (setf (ibs/current-bg-color style)
+ (indent-bars--current-bg-color style))
+ (when-let ((stipple (indent-bars--current-depth-stipple nil nil nil style)))
+ (setf (ibs/current-stipple-face style)
+ (indent-bars--tag "indent-bars%s-current-face" style))
+ (face-spec-set (ibs/current-stipple-face style) nil)))
+
;;;; Indentation and Drawing
(defvar-local indent-bars-spacing nil)
(defvar-local indent-bars--offset nil)
@@ -1472,46 +1502,12 @@ Adapted from `highlight-indentation-mode'."
(declare-function indent-bars-ts-setup "indent-bars-ts")
-(defun indent-bars--initialize-style (style)
- "Initialize STYLE."
- ;; Colors
- (setf (ibs/main-color style)
- (indent-bars--main-color style)
- (ibs/depth-palette style)
- (indent-bars--depth-palette style)
- (ibs/current-depth-palette style)
- (indent-bars--current-depth-palette style)
-
- (ibs/faces style) (indent-bars--create-faces style 7 'reset)
- (ibs/no-stipple-chars style) (indent-bars--create-no-stipple-chars
style 7))
-
- ;; Base stipple face
- (face-spec-set (ibs/stipple-face style) nil) ;stipple only via filtered
remaps
-
- ;; Current depth highlight faces/stipple
- (setf (ibs/current-bg-color style)
- (indent-bars--current-bg-color style))
- (when-let ((stipple (indent-bars--current-depth-stipple nil nil nil style)))
- (setf (ibs/current-stipple-face style)
- (indent-bars--tag "indent-bars%s-current-face" style))
- (face-spec-set (ibs/current-stipple-face style) nil)))
-
(defun indent-bars-setup ()
"Setup all face, color, bar size, and indentation info for the current
buffer."
;; Spacing
(setq indent-bars-spacing (indent-bars--guess-spacing)
indent-bars--offset (or indent-bars-starting-column
indent-bars-spacing))
- ;; Colors
- (setq indent-bars--main-color (indent-bars--main-color)
- indent-bars--depth-palette (indent-bars--depth-palette)
- indent-bars--current-depth-palette (indent-bars--current-depth-palette))
-
- ;; Faces
- (indent-bars--create-stipple-face (frame-char-width) (frame-char-height)
- (indent-bars--stipple-rot
(frame-char-width)))
- (indent-bars--create-faces 9) ; N.B.: extends as needed
-
;; No Stipple (e.g. terminal)
(setq indent-bars--no-stipple
(or (not (display-graphic-p)) indent-bars-prefer-character))
@@ -1604,8 +1600,8 @@ Adapted from `highlight-indentation-mode'."
(indent-bars-teardown)))
;; Theme support
-;; (if (boundp 'enable-theme-functions)
-;; (add-hook 'enable-theme-functions #'indent-bars-reset))
+(if (boundp 'enable-theme-functions)
+ (add-hook 'enable-theme-functions #'indent-bars-reset-styles))
(provide 'indent-bars)
- [elpa] externals/indent-bars 6e864e049e 267/431: Disable auto-theme support for now, (continued)
- [elpa] externals/indent-bars 6e864e049e 267/431: Disable auto-theme support for now, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 595b856e12 248/431: De-duplicate seen styles in case a style is re-initialized, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars f7686245cb 264/431: Do set default stipple face attributes: all now via filtered remap, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 4691ab75cc 246/431: Update font-lock expressions to include boundaries are arguments, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars fb986dd71e 253/431: Use #'equal when recording known styles to avoid duplicates, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars ff7a45fe99 247/431: docstring cleanup, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 6d59b8ff3b 272/431: Merge branch 'main' into treesit-scope, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 12204b155b 278/431: Use indent-bars group for everything (with sub-groups), ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 0df7ac5ce5 269/431: Supply correct arguments to handle-blank-lines, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 770d2c7066 251/431: New: text-scale and schedule-remap-cleanup, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars bbc97b6c04 277/431: reset-styles for theme change, all face setup now via styles,
ELPA Syncer <=
- [elpa] externals/indent-bars 748ffeec7f 276/431: New highlight-method, including 'context (new default), ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars ffaaae3d42 265/431: Remove styles on reset so that are recomputed, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars f5f0392ab6 254/431: window-change: remap even if whr val unchanged, use remap-cleanup, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars ceb2eb00e9 266/431: ppss-based no-descend-string/list, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 62d4a834b7 282/431: Restore use of base stipple-face-spec, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars d7af7b3d42 283/431: Restore unspecified for "parent decides" config, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 247b35f55d 286/431: on-bar tweaks and doc improvements, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars f80c712b37 288/431: update-current-depth-highlight: reindent, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 9d374e0650 291/431: Fix timer teardown and run-hooks (which takes a hook name), ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 8d8b0b964b 292/431: Do not test bol but point to skip scope update, simplify markers, ELPA Syncer, 2024/09/16