[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/indent-bars d4ea40e3bb 195/431: relabel faded -> out-of
From: |
ELPA Syncer |
Subject: |
[elpa] externals/indent-bars d4ea40e3bb 195/431: relabel faded -> out-of-scope |
Date: |
Mon, 16 Sep 2024 12:59:28 -0400 (EDT) |
branch: externals/indent-bars
commit d4ea40e3bb1c6b8be26808899655ab1f218875be
Author: JD Smith <93749+jdtsmith@users.noreply.github.com>
Commit: JD Smith <93749+jdtsmith@users.noreply.github.com>
relabel faded -> out-of-scope
Some crazy people may prefer it the other way around.
---
indent-bars-ts.el | 55 ++++++++++++++++++++++++++-----------------------------
1 file changed, 26 insertions(+), 29 deletions(-)
diff --git a/indent-bars-ts.el b/indent-bars-ts.el
index 1db299b1cb..bb4e29bf5a 100644
--- a/indent-bars-ts.el
+++ b/indent-bars-ts.el
@@ -9,9 +9,9 @@
;; (avoiding "too many bars" in e.g. argument lists)
;; - Uses treesitter to avoid adding bars to blank lines in strings
;; or other configurable node types.
-;; - Enable alternate faded styling for bars outside the treesitter
-;; "scope", where scope is defined as the wrapping elements
-;; configured in `indent-bars-ts`.
+;; - Enable alternate out-of-scop styling for bars outside the
+;; treesitter "scope", where scope is defined as the wrapping
+;; elements configured in `indent-bars-treesitscope`.
;; For Developers:
;;
@@ -34,17 +34,17 @@
:group 'indent-bars
:prefix "indent-bars-ts-")
-(defgroup indent-bars-ts-style nil
- "Customization group for indent-bars treesitter styling."
+(defgroup indent-bars-ts-oos-style nil
+ "Customization group for indent-bars treesitter out-of-scope styling."
:group 'indent-bars
- :prefix "indent-bars-ts-")
+ :prefix "indent-bars-ts-oos-")
;;;;; Alternate Style Variables
(defun indent-bars-ts--add-customs ()
- "Add all the relevant custom variables for the de-emphasized style."
+ "Add all the relevant custom variables for the out-of-scope style."
(cl-labels ((ts-cust (var &rest r)
(eval `(indent-bars--alt-custom
- "ts" ,var "Tree-sitter (de-emphasized)" ,@r))))
+ "ts-os" ,var "Tree-sitter (out-of-scope)" ,@r))))
(ts-cust 'color '(nil :blend 0.1) 'add-inherit)
(dolist (c '( width-frac pad-frac pattern zigzag ;simple types
no-stipple-char-font-weight))
@@ -66,11 +66,11 @@ valid node types for the grammar of the language indicated."
:value-type (repeat :tag "Types" (symbol :tag "Type"))))
:group 'indent-bars-ts)
-(defcustom indent-bars-treesit-emphasis-scope nil
+(defcustom indent-bars-treesit-scope nil
"An alist of language and treesitter node types to emphasize.
If non-nil, indentation bars on text outside of the innermost
-matching treesitter scope will be de-emphasized using the
-alternative style specified in the indent-bars-ts-* custom
+matching treesitter scope will use the alternative
+\"out-of-scope\"style specified in the indent-bars-ts-os-* custom
variables, which mirror and inherit from the normal style
variables."
:type '(choice (const :tag "No scope types" nil)
@@ -103,8 +103,7 @@ is disabled."
(defcustom indent-bars-ts-update-delay 0.125
"Minimum delay time in seconds between treesitter scope updates.
-Has effect only if `indent-bars-treesit-emphasis-scope' is
-non-nil."
+Has effect only if `indent-bars-treesit-scope' is non-nil."
:type 'float
:group 'indent-bars-ts)
@@ -124,12 +123,12 @@ Otherwise return nil."
(defun indent-bars-ts--node-query (node query &optional start-only spanning)
"Capture node(s) matching QUERY which overlap with NODE.
QUERY is a compiled treesit query. If START-ONLY is non-nil, the
-query searches for matching nodes which overlap with the start of
-the node at point. Otherwise nodes which intersect anywhere with
+query searches for matching nodes which overlap with NODE's
+starting position. Otherwise nodes which intersect anywhere with
NODE will be returned.
If SPANNING is non-nil, return a single spanning node which fully
-spans the full start..end range of NODE (or just the start ,if
+spans the start..end range of NODE, if any (or just the start, if
START-ONLY is non-nil). If SPANNING is \\='innermost, return the
latest (innermost) node on the list which fully spans NODE, which
could include NODE itself if it matches the QUERY. For any other
@@ -202,10 +201,10 @@ by nodes of those types (e.g. module)."
(unless (indent-bars-ts--ignore-blank (match-beginning 0))
(indent-bars--handle-blank-lines)))
+;; see also ts--handle-blank-lines, below
-;;;; Scope
-(defvar indent-bars-ts-faded-style nil)
-
+;;;; Scope Highlighting
+(defvar indent-bars-ts-out-scope-style nil)
(cl-declaim (optimize (safety 0))) ; no need for type check
(cl-defstruct
(indent-bars-ts-scope
@@ -218,12 +217,11 @@ by nodes of those types (e.g. module)."
(defvar-local ibtcs nil ; N.B. see shorthands at bottom of file
"The current `indent-bars-ts-scope' struct.")
-(defsubst indent-bars-ts--style (pos)
- "Return the style to use based on pos.
-Returns the deemphasized style if POS is outside the current
-treesitter scope, nil otherwise"
- (and ibtcs (or (< pos (ibts/start ibtcs)) (> pos (ibts/end ibtcs)))
- indent-bars-ts-faded-style))
+(defsubst indent-bars-ts--out-of-scope (pos)
+ "Return whether POS is outside the current treesitter scope.
+If there is no scope defined, every position is considered in
+scope."
+ (and ibtcs (or (< pos (ibts/start ibtcs)) (> pos (ibts/end ibtcs)))))
(defun indent-bars-ts--symdiff (a b)
"Return the symmetric difference between ranges A and B.
@@ -291,9 +289,8 @@ both)."
"Initialize scope style and variables."
(unless (get 'indent-bars-ts-setup :init-scope)
(indent-bars-ts--add-customs)
- (setq indent-bars-ts-faded-style (indent-bars--new-style))
- (let ((indent-bars-current-style indent-bars-ts-faded-style))
- (indent-bars--initialize-style))
+ (indent-bars--initialize-style
+ (setq indent-bars-ts-out-scope-style (indent-bars--new-style)))
(put 'indent-bars-ts-setup :init-scope t)))
;;;###autoload
@@ -328,7 +325,7 @@ both)."
err)))))
;; Emphasis Scope: use alternate styling outside current scope
- (when-let ((types (alist-get lang indent-bars-treesit-emphasis-scope)))
+ (when-let ((types (alist-get lang indent-bars-treesit-scope)))
(indent-bars-ts--init-scope)
(setq ibtcs (ibts/create))
(setf (ibts/query ibtcs)
- [elpa] externals/indent-bars b98a82c791 174/431: Update README.md, (continued)
- [elpa] externals/indent-bars b98a82c791 174/431: Update README.md, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 62302b45d9 180/431: Rate-limit highlighting the current depth, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars cd100e4e63 186/431: Bump version, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 2b0a4ad168 165/431: no-descend-string: explicitly test string query for validity, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 62c76468eb 202/431: Merge branch 'main' into treesit-scope, ELPA Syncer, 2024/09/16
- [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 <=
- [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, 2024/09/16
- [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