branch: elpa/treesit-fold
commit f2650076af2b5b25b3a431fd8c99c77813782a1d
Author: JenChieh <[email protected]>
Commit: JenChieh <[email protected]>
fix: Clean compile warngins
---
treesit-fold-summary.el | 60 +++++++++++++++++++++++++------------------------
treesit-fold-util.el | 2 ++
2 files changed, 33 insertions(+), 29 deletions(-)
diff --git a/treesit-fold-summary.el b/treesit-fold-summary.el
index 618e7c5f3d..6168d190f0 100644
--- a/treesit-fold-summary.el
+++ b/treesit-fold-summary.el
@@ -27,6 +27,8 @@
(require 's)
+(require 'treesit-fold-util)
+
(defcustom treesit-fold-summary-show t
"Flag to show summary if available."
:type 'boolean
@@ -194,35 +196,6 @@ type of content by checking the word boundary's existence."
;; (@* "Core" )
;;
-(defun treesit-fold-summary--keep-length (summary)
- "Keep the SUMMARY length to `treesit-fold-summary-max-length'."
- (let ((len-sum (length summary))
- (len-exc (length treesit-fold-summary-exceeded-string)))
- (when (< treesit-fold-summary-max-length len-sum)
- (setq summary (substring summary 0 (- treesit-fold-summary-max-length
len-exc))
- summary (concat summary treesit-fold-summary-exceeded-string))))
- summary)
-
-(defun treesit-fold-summary--apply-format (summary)
- "Return the SUMMARY that has added the summary prefix."
- (format treesit-fold-summary-format summary))
-
-(defun treesit-fold-summary--parser ()
- "Return the summary parser from `treesit-fold-summary-parsers-alist'."
- (assoc (buffer-local-value 'major-mode (current-buffer))
treesit-fold-summary-parsers-alist))
-
-(defun treesit-fold-summary--get (doc-str)
- "Extract summary from DOC-STR in order to display ontop of the overlay."
- (let ((parser (cdr (treesit-fold-summary--parser))) summary)
- (when parser
- (setq summary (funcall parser doc-str))
- (when (integerp treesit-fold-summary-max-length)
- (setq summary (treesit-fold-summary--keep-length summary)))
- (when summary
- (setq summary (treesit-fold-summary--apply-format summary)
- summary (propertize summary 'face
'treesit-fold-replacement-face))))
- summary))
-
;; TODO(everyone): keep this alist alphabetically sorted
(defcustom treesit-fold-summary-parsers-alist
`((actionscript-mode . treesit-fold-summary-javadoc)
@@ -313,5 +286,34 @@ type of content by checking the word boundary's existence."
:type '(alist :key-type symbol :value-type function)
:group 'treesit-fold)
+(defun treesit-fold-summary--keep-length (summary)
+ "Keep the SUMMARY length to `treesit-fold-summary-max-length'."
+ (let ((len-sum (length summary))
+ (len-exc (length treesit-fold-summary-exceeded-string)))
+ (when (< treesit-fold-summary-max-length len-sum)
+ (setq summary (substring summary 0 (- treesit-fold-summary-max-length
len-exc))
+ summary (concat summary treesit-fold-summary-exceeded-string))))
+ summary)
+
+(defun treesit-fold-summary--apply-format (summary)
+ "Return the SUMMARY that has added the summary prefix."
+ (format treesit-fold-summary-format summary))
+
+(defun treesit-fold-summary--parser ()
+ "Return the summary parser from `treesit-fold-summary-parsers-alist'."
+ (assoc (buffer-local-value 'major-mode (current-buffer))
treesit-fold-summary-parsers-alist))
+
+(defun treesit-fold-summary--get (doc-str)
+ "Extract summary from DOC-STR in order to display ontop of the overlay."
+ (let ((parser (cdr (treesit-fold-summary--parser))) summary)
+ (when parser
+ (setq summary (funcall parser doc-str))
+ (when (integerp treesit-fold-summary-max-length)
+ (setq summary (treesit-fold-summary--keep-length summary)))
+ (when summary
+ (setq summary (treesit-fold-summary--apply-format summary)
+ summary (propertize summary 'face
'treesit-fold-replacement-face))))
+ summary))
+
(provide 'treesit-fold-summary)
;;; treesit-fold-summary.el ends here
diff --git a/treesit-fold-util.el b/treesit-fold-util.el
index 8b47cab845..e9a772b3aa 100644
--- a/treesit-fold-util.el
+++ b/treesit-fold-util.el
@@ -25,6 +25,8 @@
;;; Code:
+(require 'tsc)
+
;;
;; (@* "Redisplay" )
;;