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

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

[nongnu] elpa/treesit-fold 46fdb65c77 395/417: feat: Add hook after indi


From: ELPA Syncer
Subject: [nongnu] elpa/treesit-fold 46fdb65c77 395/417: feat: Add hook after indicator refresh
Date: Mon, 1 Jul 2024 10:03:09 -0400 (EDT)

branch: elpa/treesit-fold
commit 46fdb65c77c744de24fa3cdcb4212b721fa4cc15
Author: JenChieh <jcs090218@gmail.com>
Commit: JenChieh <jcs090218@gmail.com>

    feat: Add hook after indicator refresh
---
 README.md                  | 6 +++++-
 treesit-fold-indicators.el | 8 +++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index cc308523c7..0c56d3500c 100644
--- a/README.md
+++ b/README.md
@@ -475,7 +475,6 @@ turn off `treesit-fold-mode`
   with this plugin.
 
   ```elisp
-
   (setq treesit-fold-indicators-face-function
         (lambda (pos &rest _)
           ;; Return the face of it's function.
@@ -489,6 +488,11 @@ turn off `treesit-fold-mode`
   (advice-add 'line-reminder-transfer-to-saved-lines :after
               ;; Refresh indicators for package `treesit-fold'.
               #'treesit-fold-indicators-refresh)
+
+  (add-hook 'treesit-fold-indicators-refresh-hook
+            (lambda (&rest _)
+              (line-reminder--render-buffer)
+              (line-reminder--thumb-render-buffer)))
   ```
 
 ### 📝 Summary
diff --git a/treesit-fold-indicators.el b/treesit-fold-indicators.el
index 1401b32b80..3def1d32d6 100644
--- a/treesit-fold-indicators.el
+++ b/treesit-fold-indicators.el
@@ -58,6 +58,11 @@
                  (const :tag "Inaccurate rendering but fast" partial))
   :group 'treesit-fold)
 
+(defcustom treesit-fold-indicators-refresh-hook nil
+  "Hook run after indicators refresh."
+  :type 'hook
+  :group 'treesit-fold)
+
 (fringe-helper-define 'treesit-fold-indicators-fr-plus nil
   "XXXXXXX"
   "X.....X"
@@ -362,7 +367,8 @@ Optional arguments WEND and WSTART are the range for 
caching."
        (treesit-fold-indicators--remove-ovs)
        (thread-last nodes-to-fold
                     (mapcar #'cdr)
-                    (mapc #'treesit-fold-indicators--create))))))
+                    (mapc #'treesit-fold-indicators--create))
+       (run-hooks 'treesit-fold-indicators-refresh-hook)))))
 
 (defun treesit-fold-indicators--remove-ovs (&optional window)
   "Remove all indicators overlays in this WINDOW."



reply via email to

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