[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/indent-bars 37239a3acb 148/431: save point more locally
From: |
ELPA Syncer |
Subject: |
[elpa] externals/indent-bars 37239a3acb 148/431: save point more locally in draw-line, and highlight-current-depth |
Date: |
Mon, 16 Sep 2024 12:59:22 -0400 (EDT) |
branch: externals/indent-bars
commit 37239a3acbc2f1e7806bdeca8e91cee9dfe78bd4
Author: JD Smith <93749+jdtsmith@users.noreply.github.com>
Commit: JD Smith <93749+jdtsmith@users.noreply.github.com>
save point more locally in draw-line, and highlight-current-depth
---
indent-bars.el | 32 +++++++++++++++++---------------
1 file changed, 17 insertions(+), 15 deletions(-)
diff --git a/indent-bars.el b/indent-bars.el
index a39abbf1fa..ec8443b7c4 100644
--- a/indent-bars.el
+++ b/indent-bars.el
@@ -630,7 +630,9 @@ line's length is insufficient to display all NBARS bars,
bars
will be invented. That is, the line's final newline, which is
only in this case expected to be located at END, will have
display properties set to fill out the remaining bars, if any."
- (let* ((tabs (when (and indent-tabs-mode (looking-at "^\t+"))
+ (let* ((tabs (when (and indent-tabs-mode
+ (save-excursion
+ (goto-char start) (looking-at "^\t+")))
(- (match-end 0) (match-beginning 0))))
(vp indent-bars--offset)
(bar 1) prop fun tnum bcount)
@@ -831,10 +833,10 @@ QUERY is a compiled treesit query."
(treesit-node-start node) (treesit-node-end node) t))
(defsubst indent-bars--indent-at-node (node)
- "Return the current indentation at the start of NODE.
-Moves point."
- (goto-char (treesit-node-start node))
- (current-indentation))
+ "Return the current indentation at the start of NODE."
+ (save-excursion
+ (goto-char (treesit-node-start node))
+ (current-indentation)))
(defun indent-bars--current-indentation-depth (&optional on-bar)
"Calculate current indentation depth.
@@ -846,7 +848,7 @@ and, if found, limits the indentation depth to one more
than the
topmost matching parent node's initial line's indentation depth.
If `indent-bars-no-descend-string' is non-nil, also look for
enclosing string and mark indent depth no deeper than one more
-than the starting line's depth. May move point."
+than the starting line's depth."
(let* ((c (current-indentation))
(d (indent-bars--depth c))
(p (point))
@@ -863,7 +865,7 @@ than the starting line's depth. May move point."
(indent-bars--indent-at-node (car ctx)))))))))
(if dnew (setq d (min dnew d)))
(if (and on-bar (= c (+ indent-bars--offset (* d indent-bars-spacing))))
- (cl-incf d) d)))
+ (1+ d) d)))
(defun indent-bars--ignore-blank (beg)
"See if blank lines at BEG should be ignored using tree-sitter.
@@ -881,12 +883,10 @@ Blank lines to ignore are those with types in
(defun indent-bars--display ()
"Display indentation bars based on line contents."
- (save-excursion
- (let ((b (match-beginning 1))
- (e (match-end 1))
- (n (indent-bars--current-indentation-depth)))
- (goto-char b)
- (when (> n 0) (indent-bars--draw-line n b e))))
+ (let ((b (match-beginning 1))
+ (e (match-end 1))
+ (n (indent-bars--current-indentation-depth)))
+ (when (> n 0) (indent-bars--draw-line n b e)))
nil)
(defsubst indent-bars--context-bars (end)
@@ -1110,7 +1110,8 @@ Adapted from `highlight-indentation-mode'."
(indent-bars--create-faces 9 'reset) ; N.B.: extends as needed
;; No Stipple (e.g. terminal)
- (setq indent-bars--no-stipple (or (not (display-graphic-p))
indent-bars-prefer-character))
+ (setq indent-bars--no-stipple
+ (or (not (display-graphic-p)) indent-bars-prefer-character))
(indent-bars--create-no-stipple-chars 9)
;; Resize
@@ -1132,7 +1133,8 @@ Adapted from `highlight-indentation-mode'."
(treesit-query-compile lang `([,@(mapcar #'list types)] @ctx)))
(when indent-bars-no-descend-string
(setq indent-bars--ts-string-query
- (treesit-query-compile lang `([(,indent-bars-ts-string-type)]
@s)))))
+ (treesit-query-compile
+ lang `([(,indent-bars-ts-string-type)] @s)))))
;; Current depth highlight
(when indent-bars-highlight-current-depth
- [elpa] externals/indent-bars 7bafeb32bc 074/431: README: update with PGTK :stipple Emacs bug fix, (continued)
- [elpa] externals/indent-bars 7bafeb32bc 074/431: README: update with PGTK :stipple Emacs bug fix, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 579aa101be 077/431: Initial no-stipple support, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 4dc2b9e329 057/431: Update README.md, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 44d7d633fc 123/431: Small doc, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars ea53a29562 127/431: Fix unwanted extra bars on over-sufficient blank lines, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 80ca1daeef 134/431: Remove reference to vestigial skip-leftmost-column, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 55852b3cee 128/431: Minor doc improvements, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 9de7111faf 125/431: Initial tab support, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 95f2bac5d9 136/431: blank-string: fix width trailing space calculation for one bar case, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 98784d79e7 169/431: Document no-stipple-char-font-weight, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 37239a3acb 148/431: save point more locally in draw-line, and highlight-current-depth,
ELPA Syncer <=
- [elpa] externals/indent-bars 2350f4dd24 144/431: Update README.md, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars fd5a01d38e 155/431: Update README.md, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 88a995668a 161/431: ts-node-query: restore use of ts-parser to indicate top level node, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 6500da0171 154/431: Update README.md, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars e3e9b72b8d 158/431: Update examples.md, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars c2e409e804 133/431: Bump version, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 27bcefda4b 132/431: increase highlight depth when line starts right on a bar, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 7cca87cf40 143/431: Document treesitter, tab-support, etc., ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 571522bd88 139/431: Add support for go-ts-mode, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars af3472b347 137/431: reorganize font-lock and treesitter sections, ELPA Syncer, 2024/09/16