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

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

[nongnu] elpa/treesit-fold ecf27f49d4 1/5: feat: Make cons add accept mu


From: ELPA Syncer
Subject: [nongnu] elpa/treesit-fold ecf27f49d4 1/5: feat: Make cons add accept mulitple args
Date: Wed, 24 Jul 2024 22:01:31 -0400 (EDT)

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

    feat: Make cons add accept mulitple args
---
 treesit-fold-summary.el |  4 ++--
 treesit-fold-util.el    | 24 ++++++++++++++----------
 2 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/treesit-fold-summary.el b/treesit-fold-summary.el
index e1d85ec052..a7c309a826 100644
--- a/treesit-fold-summary.el
+++ b/treesit-fold-summary.el
@@ -157,8 +157,8 @@ type of content by checking the word boundary's existence."
 (defun treesit-fold-summary-c-macro (doc-str)
   "Parse C macro summary from DOC-STR."
   (when (treesit-fold--is-face doc-str
-                               '(font-lock-preprocessor-face
-                                 preproc-font-lock-preprocessor-background))
+                               '( font-lock-preprocessor-face
+                                  preproc-font-lock-preprocessor-background))
     (treesit-fold-summary--doc-extract doc-str "")))
 
 (defun treesit-fold-summary-c (doc-str)
diff --git a/treesit-fold-util.el b/treesit-fold-util.el
index 3feee3970f..85a5010c18 100644
--- a/treesit-fold-util.el
+++ b/treesit-fold-util.el
@@ -62,9 +62,13 @@ Like function `s-count-matches' but faster."
 ;; (@* "Cons" )
 ;;
 
-(defun treesit-fold--cons-add (c1 c2)
-  "Addition for two cons C1 and C2."
-  (cons (+ (car c1) (car c2)) (+ (cdr c1) (cdr c2))))
+(defun treesit-fold--cons-add (&rest args)
+  "Addition for list of cons ARGS."
+  (let ((v1 0) (v2 0))
+    (dolist (c args)
+      (setq v1 (+ v1 (car c))
+            v2 (+ v2 (cdr c))))
+    (cons v1 v2)))
 
 ;;
 ;; (@* "Overlay" )
@@ -84,13 +88,13 @@ Like function `s-count-matches' but faster."
 ;;
 
 (defvar treesit-fold--doc-faces
-  '(font-lock-doc-face
-    font-lock-comment-face
-    font-lock-comment-delimiter-face
-    tree-sitter-hl-face:comment
-    tree-sitter-hl-face:doc
-    hl-todo
-    rst-comment)
+  '( font-lock-doc-face
+     font-lock-comment-face
+     font-lock-comment-delimiter-face
+     tree-sitter-hl-face:comment
+     tree-sitter-hl-face:doc
+     hl-todo
+     rst-comment)
   "List of face that apply for document string.")
 
 (defun treesit-fold--get-face (obj trim)



reply via email to

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