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

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

[elpa] externals/indent-bars edab5ee530 203/431: Comment/docstring impro


From: ELPA Syncer
Subject: [elpa] externals/indent-bars edab5ee530 203/431: Comment/docstring improvements
Date: Mon, 16 Sep 2024 12:59:29 -0400 (EDT)

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

    Comment/docstring improvements
---
 indent-bars-ts.el | 22 +++++++++++-----------
 indent-bars.el    |  3 ---
 2 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/indent-bars-ts.el b/indent-bars-ts.el
index 1956aea24f..ef2cf291c2 100644
--- a/indent-bars-ts.el
+++ b/indent-bars-ts.el
@@ -21,6 +21,7 @@
 ;;    ibts/  => indent-bars-ts-scope- (slot accessors)
 ;;    ibtcs  => indent-bars-ts-current-scope (struct)
 
+;;; Code:
 
 ;;;; Requires
 (require 'cl-lib)
@@ -183,6 +184,7 @@ arguments)."
     d))
 
 ;;;; Ignoring Certain Blank Lines
+;; see also ts--handle-blank-lines, below
 (defun indent-bars-ts--ignore-blank (beg)
   "See if blank lines at BEG should be ignored using tree-sitter.
 Blank lines to ignore are those within nodes of the types
@@ -193,8 +195,6 @@ mentioned in 
`indent-bars-treesit-ignore-blank-lines-types'."
         (seq-contains-p indent-bars-treesit-ignore-blank-lines-types
                         (treesit-node-type n)))))
 
-;; see also ts--handle-blank-lines, below
-
 ;;;; Scope Highlighting
 (defvar indent-bars-ts-out-scope-style nil)
 (cl-declaim (optimize (safety 0))) ; no need for type check
@@ -216,26 +216,27 @@ scope."
   (and ibtcs (or (< pos (ibts/start ibtcs)) (> pos (ibts/end ibtcs)))))
 
 (defun indent-bars-ts--display ()
-  "Display indentation bars accounting for current treesitter scope."
+  "Display indentation bars, accounting for current treesitter scope."
   (if (indent-bars-ts--out-of-scope (match-beginning 1))
-      (indent-bars--display indent-bars-ts-out-scope-style) ; fully faded, or
-    (indent-bars--display indent-bars-ts-out-scope-style       ;  switch from
-                         (ibts/start-bars ibtcs)       ; faded to normal
+      (indent-bars--display indent-bars-ts-out-scope-style)
+    (indent-bars--display indent-bars-ts-out-scope-style
+                         (ibts/start-bars ibtcs)
                          indent-bars-style)))
 
 (defun indent-bars-ts--handle-blank-lines ()
   "Display bars on blank lines, respecting treesitter scope."
   (let ((beg (match-beginning 0)))
     (unless (indent-bars-ts--ignore-blank beg)
-      (if (indent-bars-ts--out-of-scope beg) ;fully faded
+      (if (indent-bars-ts--out-of-scope beg) ;fully out of scope
          (indent-bars--handle-blank-lines indent-bars-ts-out-scope-style)
+       ;; Switch from out of scope to in scope after start-bars
        (indent-bars--handle-blank-lines indent-bars-ts-out-scope-style
                                         (ibts/start-bars ibtcs)
                                         indent-bars-style)))))
 
 (defun indent-bars-ts--symdiff (a b)
     "Return the symmetric difference between ranges A and B.
-A and B ranges of (start . end) conses.  Their symmetric
+Ranges A and B are (start . end) conses.  Their symmetric
 difference is a list of ranges, possibly nil, that one (but not
 both) of them cover."
     (let ((l '()))
@@ -257,12 +258,11 @@ both) of them cover."
   "Perform the treesitter scope update.
 If the buffer is modified or the point has moved, re-query the
 scope bounds.  If it has changed (beyond normal marker movement),
-refontify the symmetric difference between old and new
+refontify the symmetric difference between the old and new
 ranges (i.e those ranges covered by either old or new, but not
 both)."
   (unless (and (= (point) (ibts/point ibtcs))
               (= (buffer-modified-tick) (ibts/tick ibtcs)))
-    ;; scope may have changed
     (when-let ((node (treesit-node-on
                      (max (point-min) (1- (point))) (point)
                      indent-bars-ts--parser))
@@ -282,7 +282,7 @@ both)."
                  (indent-bars--current-indentation-depth)))
          (set-marker (ibts/start ibtcs) tsc-start)
          (set-marker (ibts/end ibtcs) tsc-end)
-         (cl-loop for (beg . end) in   ; refontify
+         (cl-loop for (beg . end) in   ; refontify where needed
                   (indent-bars-ts--symdiff
                    (cons old-start old-end) (cons tsc-start tsc-end))
                   do (font-lock-flush beg end)))))))
diff --git a/indent-bars.el b/indent-bars.el
index e147dfdfb6..239fc12940 100644
--- a/indent-bars.el
+++ b/indent-bars.el
@@ -1040,9 +1040,6 @@ font-lock properties."
          (append '(display) font-lock-extra-managed-props)))
     (funcall indent-bars-orig-unfontify-region beg end)))
 
-;; local variables to be dynamically bound
-(defvar-local indent-bars--switch-after nil)
-
 (defun indent-bars--display (&optional style switch-after style2)
   "Draw indentation bars based on line contents.
 STYLE, SWITCH-AFTER and STYLE2 are as in



reply via email to

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