[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/indent-bars 902713b115 198/431: create new -form vars f
From: |
ELPA Syncer |
Subject: |
[elpa] externals/indent-bars 902713b115 198/431: create new -form vars for font-lock keyword callback flexibility |
Date: |
Mon, 16 Sep 2024 12:59:28 -0400 (EDT) |
branch: externals/indent-bars
commit 902713b1151664abb4a0571bab7490d5577927f0
Author: JD Smith <93749+jdtsmith@users.noreply.github.com>
Commit: JD Smith <93749+jdtsmith@users.noreply.github.com>
create new -form vars for font-lock keyword callback flexibility
---
indent-bars-ts.el | 8 ++++----
indent-bars.el | 47 ++++++++++++++++++++++++++++-------------------
2 files changed, 32 insertions(+), 23 deletions(-)
diff --git a/indent-bars-ts.el b/indent-bars-ts.el
index 3963c9d118..1956aea24f 100644
--- a/indent-bars-ts.el
+++ b/indent-bars-ts.el
@@ -344,11 +344,11 @@ performed."
;; Emphasis Scope: use alternate styling outside current scope
(when-let ((types (alist-get lang indent-bars-treesit-scope)))
(indent-bars-ts--init-scope)
- (setq ibtcs (ibts/create))
+ (setq ibtcs (ibts/create)
+ indent-bars--display-form '(indent-bars-ts--display)
+ indent-bars--handle-blank-lines-form
'(indent-bars-ts--handle-blank-lines))
(setf (ibts/query ibtcs)
- (treesit-query-compile lang `([,@(mapcar #'list types)] @ctx))))
-
- (setq indent-bars--style-function #'indent-bars-ts--style)))
+ (treesit-query-compile lang `([,@(mapcar #'list types)] @ctx))))))
(provide 'indent-bars-ts)
;;; indent-bars-ts.el ends here
diff --git a/indent-bars.el b/indent-bars.el
index 78186873a5..f12c4c161d 100644
--- a/indent-bars.el
+++ b/indent-bars.el
@@ -1212,6 +1212,10 @@ Adapted from `highlight-indentation-mode'."
((and (boundp 'standard-indent) standard-indent))
(t 4))) ; backup
+(defvar indent-bars--display-form
+ '(indent-bars--display))
+(defvar indent-bars--handle-blank-lines-form
+ '(indent-bars--handle-blank-lines))
(defun indent-bars--setup-font-lock ()
"Setup font lock keywords and functions for indent-bars."
(unless (eq font-lock-unfontify-region-function #'indent-bars--unfontify)
@@ -1224,37 +1228,42 @@ Adapted from `highlight-indentation-mode'."
`(>= ,(1+ indent-bars--offset) ?\s)
'(+ (any ?\t ?\s))))
(not (any ?\t ?\s ?\n))))
- (1 (indent-bars--display)))))
+ (1 ,indent-bars--display-form))))
(font-lock-add-keywords nil indent-bars--font-lock-keywords t)
(if indent-bars-display-on-blank-lines
(let ((re (rx bol (* (or ?\s ?\t ?\n)) ?\n))) ; multi-line blank regions
(setq indent-bars--font-lock-blank-line-keywords
- `((,re (0 (indent-bars--handle-blank-lines)))))
+ `((,re (0 ,indent-bars--handle-blank-lines-form))))
(font-lock-add-keywords nil indent-bars--font-lock-blank-line-keywords
t)
(add-hook 'font-lock-extend-region-functions
#'indent-bars--extend-blank-line-regions 95 t))))
(declare-function indent-bars-ts-setup "indent-bars-ts")
-(defun indent-bars--initialize-style ()
- "Initialize the current style.
-To initialize a new style, bind `indent-bars-current-style' to
-the it prior to calling."
+(defun indent-bars--initialize-style (style)
+ "Initialize STYLE."
;; Colors
- (setf (ibs/main-color ibcs) (indent-bars--main-color)
- (ibs/depth-palette ibcs) (indent-bars--depth-palette)
- (ibs/current-depth-palette ibcs) (indent-bars--current-depth-palette))
-
+ (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))
+
;; Faces/stipple
- (indent-bars--create-stipple-face
- (frame-char-width) (frame-char-height)
- (indent-bars--stipple-rot (frame-char-width)))
- (indent-bars--create-faces 7 'reset)
- (indent-bars--create-no-stipple-chars 7)
-
+ (face-spec-set (ibs/stipple-face style)
+ (indent-bars--create-stipple-face
+ (frame-char-width) (frame-char-height)
+ (indent-bars--stipple-rot (frame-char-width))))
+
;; Current depth highlight faces/stipple
- (when (indent-bars--style "highlight-current-depth")
- (indent-bars--set-current-bg-color)
- (indent-bars--set-current-depth-stipple)))
+ (when (indent-bars--style style "highlight-current-depth")
+ (setf (ibs/current-bg-color style)
+ (indent-bars--current-bg-color style)
+ (ibs/current-depth-stipple style)
+ (indent-bars--current-depth-stipple style))))
(defun indent-bars-setup ()
"Setup all face, color, bar size, and indentation info for the current
buffer."
- [elpa] externals/indent-bars 6e2f93d194 193/431: ib: improve docs and add shorthands, (continued)
- [elpa] externals/indent-bars 6e2f93d194 193/431: ib: improve docs and add shorthands, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars a195a06b8c 185/431: Correctly call run-at-time, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars ee36aa78ae 192/431: ts: emphasis scope algorithm added, with struct shorthands, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars f2d9c0f95b 188/431: Improve documentation, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars acb9ded166 178/431: docstring and comment improvements, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars d4ea40e3bb 195/431: relabel faded -> out-of-scope, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 09b972f957 156/431: Update README.md, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 9cf88e1403 176/431: Update README.md, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars edab5ee530 203/431: Comment/docstring improvements, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars ce84791086 208/431: Teardown TS forms and PCH on main mode teardown, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 902713b115 198/431: create new -form vars for font-lock keyword callback flexibility,
ELPA Syncer <=
- [elpa] externals/indent-bars 4d4f041cfc 205/431: Make sure beg/end markers point somewhere, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars a6dbf67f74 245/431: Section rename/unused var cleanup, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars fffa4fe52d 236/431: Tweak remap removal., ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 19dd505850 242/431: Reorg stipple display section, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 08fbce35de 214/431: Move treesitter setup above resize (which uses it), ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 070ab26c6d 197/431: new 'force option for init-scope, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 4583e3e9f5 240/431: Add reset to enable-theme-functions, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 301c97550b 219/431: Correctly initialize 'color alt custom (unspecified), ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 315aaaab74 232/431: Correct calls to depth-palette/get-color with STYLE, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars c86c2b670e 213/431: Correctly remove local after-make-frame hook function, ELPA Syncer, 2024/09/16