[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/treesit-fold 1602759fdd 178/417: Rename util module withou
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/treesit-fold 1602759fdd 178/417: Rename util module without util prefix |
Date: |
Mon, 1 Jul 2024 10:02:23 -0400 (EDT) |
branch: elpa/treesit-fold
commit 1602759fdd8d42eb01abb64f6f265e72dbc9575a
Author: Jen-Chieh Shen <jcs090218@gmail.com>
Commit: Jen-Chieh Shen <jcs090218@gmail.com>
Rename util module without util prefix
---
ts-fold-indicators.el | 26 +++++++-------
ts-fold-summary.el | 8 ++---
ts-fold-util.el | 24 ++++++-------
ts-fold.el | 96 +++++++++++++++++++++++++--------------------------
4 files changed, 77 insertions(+), 77 deletions(-)
diff --git a/ts-fold-indicators.el b/ts-fold-indicators.el
index 27bcbb946a..66523c4178 100644
--- a/ts-fold-indicators.el
+++ b/ts-fold-indicators.el
@@ -144,8 +144,8 @@
(mouse-set-point event)
(beginning-of-line)
(setq cur-ln (line-number-at-pos (point)))
- (setq ovs (append (ts-fold-util--overlays-in 'type
'ts-fold-indicators-fr-plus)
- (ts-fold-util--overlays-in 'type
'ts-fold-indicators-fr-minus-tail)))
+ (setq ovs (append (ts-fold--overlays-in 'type
'ts-fold-indicators-fr-plus)
+ (ts-fold--overlays-in 'type
'ts-fold-indicators-fr-minus-tail)))
(when ovs
(setq ov (cl-some
(lambda (ov) (= cur-ln (line-number-at-pos (overlay-start
ov))))
@@ -263,17 +263,17 @@ head (first line) of the region."
"Refresh indicators for all folding range."
(when ts-fold-indicators-mode
(ts-fold--ensure-ts
- (when-let* ((node (tsc-root-node tree-sitter-tree))
- (patterns (seq-mapcat (lambda (type) `(,(list type) @name))
- (alist-get major-mode
ts-fold-foldable-node-alist)
- 'vector))
- (query (ignore-errors
- (tsc-make-query tree-sitter-language patterns)))
- (nodes-to-fold (tsc-query-captures query node #'ignore)))
- (ts-fold-indicators--remove-overlays)
- (thread-last nodes-to-fold
- (mapcar #'cdr)
- (mapc #'ts-fold-indicators--create))))))
+ (when-let* ((node (tsc-root-node tree-sitter-tree))
+ (patterns (seq-mapcat (lambda (type) `(,(list type) @name))
+ (alist-get major-mode
ts-fold-foldable-node-alist)
+ 'vector))
+ (query (ignore-errors
+ (tsc-make-query tree-sitter-language patterns)))
+ (nodes-to-fold (tsc-query-captures query node #'ignore)))
+ (ts-fold-indicators--remove-overlays)
+ (thread-last nodes-to-fold
+ (mapcar #'cdr)
+ (mapc #'ts-fold-indicators--create))))))
(defun ts-fold-indicators--remove-overlays ()
"Remove all indicators overlays."
diff --git a/ts-fold-summary.el b/ts-fold-summary.el
index 628d4c9e8b..d1ce6b4e1e 100644
--- a/ts-fold-summary.el
+++ b/ts-fold-summary.el
@@ -93,7 +93,7 @@ type of content by checking the word boundary's existence."
(defun ts-fold-summary--generic (doc-str sym)
"Generic DOC-STR extraction using SYM."
- (when (ts-fold-util--doc-faces-p doc-str)
+ (when (ts-fold--doc-faces-p doc-str)
(ts-fold-summary--doc-extract doc-str sym)))
(defun ts-fold-summary-batch (doc-str)
@@ -138,9 +138,9 @@ type of content by checking the word boundary's existence."
(defun ts-fold-summary-c-macro (doc-str)
"Parse C macro summary from DOC-STR."
- (when (ts-fold-util--is-face doc-str
- '(font-lock-preprocessor-face
- preproc-font-lock-preprocessor-background))
+ (when (ts-fold--is-face doc-str
+ '(font-lock-preprocessor-face
+ preproc-font-lock-preprocessor-background))
(ts-fold-summary--doc-extract doc-str "")))
(defun ts-fold-summary-c (doc-str)
diff --git a/ts-fold-util.el b/ts-fold-util.el
index a05b2dc746..e3aa14eba6 100644
--- a/ts-fold-util.el
+++ b/ts-fold-util.el
@@ -29,7 +29,7 @@
;; (@* "Cons" )
;;
-(defun ts-fold-util--cons-add (c1 c2)
+(defun ts-fold--cons-add (c1 c2)
"Addition for two cons C1 and C2."
(cons (+ (car c1) (car c2)) (+ (cdr c1) (cdr c2))))
@@ -37,7 +37,7 @@
;; (@* "Overlay" )
;;
-(defun ts-fold-util--overlays-in (prop name &optional beg end)
+(defun ts-fold--overlays-in (prop name &optional beg end)
"Return overlays with PROP of NAME, from region BEG to END."
(unless beg (setq beg (point-min))) (unless end (setq end (point-max)))
(let ((lst '()) (ovs (overlays-in beg end)))
@@ -50,7 +50,7 @@
;; (@* "Face" )
;;
-(defvar ts-fold-util--doc-faces
+(defvar ts-fold--doc-faces
'(font-lock-doc-face
font-lock-comment-face
font-lock-comment-delimiter-face
@@ -59,30 +59,30 @@
hl-todo)
"List of face that apply for document string.")
-(defun ts-fold-util--get-face (obj trim)
+(defun ts-fold--get-face (obj trim)
"Return face name from OBJ.
If argument TRIM is non-nil, trim the OBJ."
(get-text-property 0 'face (if trim (string-trim obj) obj)))
-(defun ts-fold-util--is-face (obj lst-face &optional trim)
+(defun ts-fold--is-face (obj lst-face &optional trim)
"Return non-nil if OBJ's face is define inside list LST-FACE.
-Optional argument TRIM, see function `ts-fold-util--get-face'."
+Optional argument TRIM, see function `ts-fold--get-face'."
(unless (listp lst-face) (setq lst-face (list lst-face)))
- (let ((faces (ts-fold-util--get-face obj trim)))
+ (let ((faces (ts-fold--get-face obj trim)))
(cond ((listp faces)
(cl-some (lambda (face) (memq face lst-face)) faces))
(t (memq faces lst-face)))))
-(defun ts-fold-util--doc-faces-p (obj &optional trim)
- "Return non-nil if face at OBJ is within `ts-fold-util--doc-faces' list.
-Optional argument TRIM, see function `ts-fold-util--get-face'."
- (ts-fold-util--is-face obj ts-fold-util--doc-faces trim))
+(defun ts-fold--doc-faces-p (obj &optional trim)
+ "Return non-nil if face at OBJ is within `ts-fold--doc-faces' list.
+Optional argument TRIM, see function `ts-fold--get-face'."
+ (ts-fold--is-face obj ts-fold--doc-faces trim))
;;
;; (@* "Math" )
;;
-(defun ts-fold-util--in-range-p (in-val in-min in-max)
+(defun ts-fold--in-range-p (in-val in-min in-max)
"Check to see if IN-VAL is between IN-MIN and IN-MAX."
(and (<= in-min in-val) (<= in-val in-max)))
diff --git a/ts-fold.el b/ts-fold.el
index 7ccf1ab2dd..e7dc8b2f38 100644
--- a/ts-fold.el
+++ b/ts-fold.el
@@ -147,7 +147,7 @@ the fold in a cons cell. See `ts-fold-range-python' for an
example."
(when (bound-and-true-p evil-fold-list)
(add-to-list 'evil-fold-list
'((ts-fold-mode)
- :toggle ts-fold-toggle
+ :toggle ts-fold-toggle
:open ts-fold-open
:close ts-fold-close
:open-rec ts-fold-open-recursively
@@ -230,11 +230,11 @@ Return nil otherwise."
((memq (tsc-node-type node) foldable-types))
(range (ts-fold--get-fold-range node)))
(thread-last (overlays-in (car range) (cdr range))
- (seq-filter (lambda (ov)
- (and (eq (overlay-get ov 'invisible) 'ts-fold)
- (= (overlay-start ov) (car range))
- (= (overlay-end ov) (cdr range)))))
- car)))
+ (seq-filter (lambda (ov)
+ (and (eq (overlay-get ov 'invisible) 'ts-fold)
+ (= (overlay-start ov) (car range))
+ (= (overlay-end ov) (cdr range)))))
+ car)))
;;
;; (@* "Commands" )
@@ -255,11 +255,11 @@ Foldable nodes are defined in
`ts-fold-foldable-node-alist' for the
current `major-mode'. If no foldable NODE is found in point, do nothing."
(interactive)
(ts-fold--ensure-ts
- (let ((node (or node (ts-fold--foldable-node-at-pos))))
- ;; make sure I do not create multiple overlays for the same fold
- (when-let* ((ov (ts-fold-overlay-at node)))
- (delete-overlay ov))
- (ts-fold--create-overlay (ts-fold--get-fold-range node)))))
+ (let ((node (or node (ts-fold--foldable-node-at-pos))))
+ ;; make sure I do not create multiple overlays for the same fold
+ (when-let* ((ov (ts-fold-overlay-at node)))
+ (delete-overlay ov))
+ (ts-fold--create-overlay (ts-fold--get-fold-range node)))))
;;;###autoload
(defun ts-fold-open ()
@@ -267,45 +267,45 @@ current `major-mode'. If no foldable NODE is found in
point, do nothing."
If the current node is not folded or not foldable, do nothing."
(interactive)
(ts-fold--ensure-ts
- (when-let* ((node (ts-fold--foldable-node-at-pos))
- (ov (ts-fold-overlay-at node)))
- (delete-overlay ov))))
+ (when-let* ((node (ts-fold--foldable-node-at-pos))
+ (ov (ts-fold-overlay-at node)))
+ (delete-overlay ov))))
;;;###autoload
(defun ts-fold-open-recursively ()
"Open recursively folded syntax NODE that are contained in the node at
point."
(interactive)
(ts-fold--ensure-ts
- (when-let* ((node (ts-fold--foldable-node-at-pos))
- (beg (tsc-node-start-position node))
- (end (tsc-node-end-position node)))
- (thread-last (overlays-in beg end)
- (seq-filter (lambda (ov) (eq (overlay-get ov 'invisible) 'ts-fold)))
- (mapc #'delete-overlay)))))
+ (when-let* ((node (ts-fold--foldable-node-at-pos))
+ (beg (tsc-node-start-position node))
+ (end (tsc-node-end-position node)))
+ (thread-last (overlays-in beg end)
+ (seq-filter (lambda (ov) (eq (overlay-get ov 'invisible)
'ts-fold)))
+ (mapc #'delete-overlay)))))
;;;###autoload
(defun ts-fold-close-all ()
"Fold all foldable syntax nodes in the buffer."
(interactive)
(ts-fold--ensure-ts
- (let* ((node (tsc-root-node tree-sitter-tree))
- (patterns (seq-mapcat (lambda (type) `(,(list type) @name))
- (alist-get major-mode
ts-fold-foldable-node-alist)
- 'vector))
- (query (tsc-make-query tree-sitter-language patterns))
- (nodes-to-fold (tsc-query-captures query node #'ignore)))
- (thread-last nodes-to-fold
- (mapcar #'cdr)
- (mapc #'ts-fold-close)))))
+ (let* ((node (tsc-root-node tree-sitter-tree))
+ (patterns (seq-mapcat (lambda (type) `(,(list type) @name))
+ (alist-get major-mode
ts-fold-foldable-node-alist)
+ 'vector))
+ (query (tsc-make-query tree-sitter-language patterns))
+ (nodes-to-fold (tsc-query-captures query node #'ignore)))
+ (thread-last nodes-to-fold
+ (mapcar #'cdr)
+ (mapc #'ts-fold-close)))))
;;;###autoload
(defun ts-fold-open-all ()
"Unfold all syntax nodes in the buffer."
(interactive)
(ts-fold--ensure-ts
- (thread-last (overlays-in (point-min) (point-max))
- (seq-filter (lambda (ov) (eq (overlay-get ov 'invisible) 'ts-fold)))
- (mapc #'delete-overlay))))
+ (thread-last (overlays-in (point-min) (point-max))
+ (seq-filter (lambda (ov) (eq (overlay-get ov 'invisible)
'ts-fold)))
+ (mapc #'delete-overlay))))
;;;###autoload
(defun ts-fold-toggle ()
@@ -313,10 +313,10 @@ If the current node is not folded or not foldable, do
nothing."
If the current syntax node is not foldable, do nothing."
(interactive)
(ts-fold--ensure-ts
- (if-let* ((node (ts-fold--foldable-node-at-pos (point)))
- (ov (ts-fold-overlay-at node)))
- (progn (delete-overlay ov) t)
- (ts-fold-close))))
+ (if-let* ((node (ts-fold--foldable-node-at-pos (point)))
+ (ov (ts-fold-overlay-at node)))
+ (progn (delete-overlay ov) t)
+ (ts-fold-close))))
(defun ts-fold--after-command (&rest _)
"Function call after interactive commands."
@@ -355,7 +355,7 @@ in backward direction."
line (car (tsc-node-start-point iter-node))
line-range (1+ (s-count-matches "\n" text))
max-line-range (max line-range last-line-range))
- (if (and (ts-fold-util--in-range-p line (- last-line max-line-range) (+
last-line max-line-range))
+ (if (and (ts-fold--in-range-p line (- last-line max-line-range) (+
last-line max-line-range))
(string-prefix-p prefix text))
(setq last-node iter-node last-line line
last-line-range (1+ (s-count-matches "\n" text)))
@@ -369,7 +369,7 @@ in backward direction."
Argument OFFSET can be used to tweak the final beginning and end position."
(let ((beg (1+ (tsc-node-start-position node)))
(end (1- (tsc-node-end-position node))))
- (ts-fold-util--cons-add (cons beg end) offset)))
+ (ts-fold--cons-add (cons beg end) offset)))
(defun ts-fold-range-line-comment (node offset prefix)
"Define fold range for line comment.
@@ -383,14 +383,14 @@ Argument PREFIX is the comment prefix in string."
(prefix-len (length prefix))
(beg (+ (tsc-node-start-position first-node) prefix-len))
(end (tsc-node-end-position last-node)))
- (ts-fold-util--cons-add (cons beg end) offset)))
+ (ts-fold--cons-add (cons beg end) offset)))
(defun ts-fold-range-block-comment (node offset)
"Define fold range for block comment.
For arguments NODE and OFFSET, see function `ts-fold-range-seq' for
more information."
- (ts-fold-range-seq node (ts-fold-util--cons-add '(1 . -1) offset)))
+ (ts-fold-range-seq node (ts-fold--cons-add '(1 . -1) offset)))
(defun ts-fold-range-c-like-comment (node offset)
"Define fold range for C-like comemnt."
@@ -411,7 +411,7 @@ more information."
(else (tsc-get-child-by-field node :alternative))
(beg (tsc-node-end-position named-node))
(end (1- (tsc-node-start-position else))))
- (ts-fold-util--cons-add (cons beg end) offset)))
+ (ts-fold--cons-add (cons beg end) offset)))
(defun ts-fold-range-c-preproc-ifdef (node offset)
"Define fold range for `ifdef' and `ifndef' preprocessor."
@@ -419,7 +419,7 @@ more information."
(else (tsc-get-child-by-field node :alternative))
(beg (tsc-node-end-position named-node))
(end (1- (tsc-node-start-position else))))
- (ts-fold-util--cons-add (cons beg end) offset)))
+ (ts-fold--cons-add (cons beg end) offset)))
(defun ts-fold-range-c-preproc-elif (node offset)
"Define fold range for `elif' preprocessor."
@@ -427,7 +427,7 @@ more information."
(else (tsc-get-child-by-field node :alternative))
(beg (tsc-node-end-position named-node))
(end (1- (tsc-node-start-position else))))
- (ts-fold-util--cons-add (cons beg end) offset)))
+ (ts-fold--cons-add (cons beg end) offset)))
(defun ts-fold-range-c-preproc-else (node offset)
"Define fold range for `else' preprocessor."
@@ -435,14 +435,14 @@ more information."
(len (length target))
(beg (+ (tsc-node-start-position node) len))
(end (tsc-node-end-position node)))
- (ts-fold-util--cons-add (cons beg end) offset)))
+ (ts-fold--cons-add (cons beg end) offset)))
(defun ts-fold-range-html (node offset)
"Define fold range for tag in HTML."
(let* ((beg (tsc-node-end-position (tsc-get-nth-child node 0)))
(end-node (tsc-get-nth-child node (1- (tsc-count-children node))))
(end (tsc-node-start-position end-node)))
- (ts-fold-util--cons-add (cons beg end) offset)))
+ (ts-fold--cons-add (cons beg end) offset)))
(defun ts-fold-range-python (node offset)
"Define fold range for `function_definition' and `class_definition'.
@@ -456,7 +456,7 @@ more information."
;; the colon is an anonymous node after return_type or
parameters node
(beg (tsc-node-end-position (tsc-get-next-sibling named-node)))
(end (tsc-node-end-position node)))
- (ts-fold-util--cons-add (cons beg end) offset)))
+ (ts-fold--cons-add (cons beg end) offset)))
(defun ts-fold-range-ruby (node offset)
"Define fold range for `method' and `class' in Ruby.
@@ -468,7 +468,7 @@ more information."
(tsc-get-child-by-field node :name)))
(beg (tsc-node-end-position named-node))
(end (tsc-node-end-position node)))
- (ts-fold-util--cons-add (cons beg end) offset)))
+ (ts-fold--cons-add (cons beg end) offset)))
(defun ts-fold-range-rust-macro (node offset)
"Return the fold range for `macro_definition' NODE in Rust.
@@ -480,7 +480,7 @@ more information."
(first_bracket (tsc-get-nth-child node 2))
(beg (tsc-node-start-position first_bracket))
(end (1+ (tsc-node-start-position last_bracket))))
- (ts-fold-util--cons-add (cons beg end) offset)))
+ (ts-fold--cons-add (cons beg end) offset)))
(provide 'ts-fold)
;;; ts-fold.el ends here
- [nongnu] elpa/treesit-fold 665dd1e46d 017/417: Merge pull request #1 from jakejx/go-support, (continued)
- [nongnu] elpa/treesit-fold 665dd1e46d 017/417: Merge pull request #1 from jakejx/go-support, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 2b10944ca4 027/417: Remove old readme, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold a3b5c852ac 044/417: WIP js support, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold bf8fef92c1 050/417: Update core, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold c89ccafa7d 052/417: Simplify, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 5551d9ebd8 086/417: Fix toggle, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold b429fd33dc 087/417: Move face, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 4f281a727f 097/417: Use autoload instead, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold a68579c4f7 098/417: Fix ind overlays, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 66a8b272cc 101/417: Fix docstring extract condition, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 1602759fdd 178/417: Rename util module without util prefix,
ELPA Syncer <=
- [nongnu] elpa/treesit-fold b505f0719f 183/417: ci: No more platform specific, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold e9d26a8e18 186/417: Update Eask, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 4e59c763c4 187/417: ci: cancel last workflow on push, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 62667ad992 189/417: Update README.md, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold d6fbca3748 168/417: Update changelog, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 9fdf72dc20 201/417: docs(README): order contribute section, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 4a2996eb5e 109/417: Organize, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 8a5c66d099 110/417: Add support for PHP, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 0fe507ba03 111/417: Support sharp blocks, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 91fdf441bf 366/417: chore: Update copyright year, ELPA Syncer, 2024/07/01