[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/treesit-fold 557df0a4fe 045/417: Add replacement customiza
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/treesit-fold 557df0a4fe 045/417: Add replacement customization |
Date: |
Mon, 1 Jul 2024 10:02:09 -0400 (EDT) |
branch: elpa/treesit-fold
commit 557df0a4fe88464820602e91063e483feb8510d8
Author: Jen-Chieh <jcs090218@gmail.com>
Commit: Jen-Chieh <jcs090218@gmail.com>
Add replacement customization
---
tree-sitter-fold.el | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/tree-sitter-fold.el b/tree-sitter-fold.el
index 736529899a..3a479821e9 100644
--- a/tree-sitter-fold.el
+++ b/tree-sitter-fold.el
@@ -65,8 +65,7 @@
(nix-mode . (attrset function))
(python-mode . (function_definition class_definition))
(typescript-mode . (export_clause)))
- "An alist of
-(mode . (list of tree-sitter-nodes considered foldable in this mode))."
+ "An alist of (mode . (list of tree-sitter-nodes considered foldable in this
mode))."
:type '(alist :key-type symbol :value-type (repeat symbol))
:group 'tree-sitter-fold)
@@ -105,10 +104,20 @@ the fold in a cons cell. See
`tree-sitter-fold-range-python' for an example."
:group 'tree-sitter-fold)
(defcustom tree-sitter-fold-mode-hook nil
- "Hook to run when enabling `tree-sitter-fold-mode'."
+ "Hook to run when enabling `tree-sitter-fold-mode`."
:type 'hook
:group 'tree-sitter-fold)
+(defcustom tree-sitter-fold-replacement "..."
+ "Show this string instead of the folded text."
+ :type 'string
+ :group 'tree-sitter-fold)
+
+(defface tree-sitter-fold-replacement-face
+ '((t :foreground "#808080" :box '(:line-width -1 :style 'pressed-button)))
+ "Face used to display the fold replacement text."
+ :group 'tree-sitter-fold)
+
;;
;; (@* "Entry" )
;;
@@ -181,6 +190,8 @@ This function is borrowed from `tree-sitter-node-at-point'."
(when (not (null range))
(let ((ov (make-overlay (car range) (cdr range))))
(overlay-put ov 'invisible 'tree-sitter-fold)
+ (overlay-put ov 'display tree-sitter-fold-replacement)
+ (overlay-put ov 'face 'tree-sitter-fold-replacement-face)
(overlay-put ov 'isearch-open-invisible
#'tree-sitter-fold--isearch-open))))
(defun tree-sitter-fold--isearch-open (ov)
- [nongnu] elpa/treesit-fold 2f826374a8 007/417: add installation guide, (continued)
- [nongnu] elpa/treesit-fold 2f826374a8 007/417: add installation guide, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold e28c905a45 006/417: improve error message when no foldable node under point, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold d3665fd07a 013/417: update readme, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 26bcac9cfb 008/417: add contribution guide, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 510f3ff119 018/417: update readme, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 3a66cdeb1a 002/417: update readme, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold e7dd19b2d1 005/417: fix compile bug: add to evil-fold-list only if it exist, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 568085877e 014/417: better notes on how to install additional grammars, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 2ad70aae0d 023/417: Remove unused format function, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 88b0e6eab0 039/417: Update doc, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 557df0a4fe 045/417: Add replacement customization,
ELPA Syncer <=
- [nongnu] elpa/treesit-fold 6603e0ddbb 057/417: Split parser, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 7127f4bbcc 061/417: Add comment, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold c6f58d41d5 068/417: Fix, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 445b209eb0 062/417: Fix compatible, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold f57a136cb8 075/417: Fix externals, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold b493772d32 080/417: Fix autoload, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 8d2599d54d 071/417: Fix warnings, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold ac7f2d0071 084/417: Try ruby, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 570305133e 003/417: version 0.0.1, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold cbe049d1bf 010/417: fix typo, ELPA Syncer, 2024/07/01