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

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

[elpa] externals/indent-bars ce84791086 208/431: Teardown TS forms and P


From: ELPA Syncer
Subject: [elpa] externals/indent-bars ce84791086 208/431: Teardown TS forms and PCH on main mode teardown
Date: Mon, 16 Sep 2024 12:59:29 -0400 (EDT)

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

    Teardown TS forms and PCH on main mode teardown
---
 indent-bars-ts.el | 10 +++++++++-
 indent-bars.el    |  5 ++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/indent-bars-ts.el b/indent-bars-ts.el
index 6639228272..1a71357513 100644
--- a/indent-bars-ts.el
+++ b/indent-bars-ts.el
@@ -311,6 +311,13 @@ performed."
      (setq indent-bars-ts-out-scope-style (indent-bars--new-style)))
     (put 'indent-bars-ts-setup :init-scope t)))
 
+(defun indent-bars-ts--teardown ()
+  "Teardown indent-bars-ts."
+  (setq
+   indent-bars--display-form nil
+   indent-bars--handle-blank-lines-form nil)
+  (remove-hook 'post-command-hook #'indent-bars-ts--update-scope t))
+
 ;;;###autoload
 (defun indent-bars-ts-setup ()
   "Setup indent-bars for using with treesiter."
@@ -349,8 +356,9 @@ performed."
            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))))))
+           (treesit-query-compile lang `([,@(mapcar #'list types)] @ctx)))
       (add-hook 'post-command-hook #'indent-bars-ts--update-scope nil t)
+      (add-hook 'indent-bars--teardown-functions 'indent-bars-ts--teardown))))
 
 (provide 'indent-bars-ts)
 ;;; indent-bars-ts.el ends here
diff --git a/indent-bars.el b/indent-bars.el
index 59c5af63a3..7f669d6b62 100644
--- a/indent-bars.el
+++ b/indent-bars.el
@@ -1342,6 +1342,8 @@ Adapted from `highlight-indentation-mode'."
   (indent-bars--setup-font-lock)
   (font-lock-flush))
 
+
+(defvar indent-bars--teardown-functions nil)
 (defun indent-bars-teardown ()
   "Tears down indent-bars."
   (dolist (s indent-bars--styles)
@@ -1365,7 +1367,8 @@ Adapted from `highlight-indentation-mode'."
   (remove-hook 'text-scale-mode-hook #'indent-bars--resize-stipple t)
   (remove-hook 'post-command-hook #'indent-bars--highlight-current-depth t)
   (remove-hook 'font-lock-extend-region-functions
-              #'indent-bars--extend-blank-line-regions t))
+              #'indent-bars--extend-blank-line-regions t)
+  (apply #'run-hooks indent-bars--teardown-functions))
 
 (defun indent-bars-reset ()
   "Reset indent-bars config."



reply via email to

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