diff options
| author | Yuan Fu | 2022-12-24 23:46:19 -0800 |
|---|---|---|
| committer | Yuan Fu | 2022-12-25 01:11:47 -0800 |
| commit | 4234033a47ae06d6aa7db41d36dbc3dcbfcf897e (patch) | |
| tree | eea88a0cf8e162f32d7be55c9c5c14447b9f552d | |
| parent | 79584a206b9b36e4937c32845464bfc9b438dade (diff) | |
| download | emacs-4234033a47ae06d6aa7db41d36dbc3dcbfcf897e.tar.gz emacs-4234033a47ae06d6aa7db41d36dbc3dcbfcf897e.zip | |
; * lisp/treesit.el: Add some comments.
| -rw-r--r-- | lisp/treesit.el | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lisp/treesit.el b/lisp/treesit.el index e8e93d09de4..24fb316fab9 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el | |||
| @@ -1583,6 +1583,34 @@ BACKWARD and ALL are the same as in `treesit-search-forward'." | |||
| 1583 | node)) | 1583 | node)) |
| 1584 | 1584 | ||
| 1585 | ;;; Navigation, defun, things | 1585 | ;;; Navigation, defun, things |
| 1586 | ;; | ||
| 1587 | ;; Emacs lets you define "things" by a regexp that matches the type of | ||
| 1588 | ;; a node, and here are some functions that lets you find the "things" | ||
| 1589 | ;; at/around point, navigate backward/forward a "thing", etc. | ||
| 1590 | ;; | ||
| 1591 | ;; The most obvious "thing" is a defun, and there are thin wrappers | ||
| 1592 | ;; around thing functions for defun for convenience. | ||
| 1593 | ;; | ||
| 1594 | ;; We have more command-like functions like: | ||
| 1595 | ;; - treesit-beginning-of-thing/defun | ||
| 1596 | ;; - treesit-end-of-thing/defun | ||
| 1597 | ;; - treesit-thing/defun-at-point | ||
| 1598 | ;; | ||
| 1599 | ;; And more generic functions like: | ||
| 1600 | ;; - treesit--things-around | ||
| 1601 | ;; - treesit--top-level-thing | ||
| 1602 | ;; - treesit--navigate-thing | ||
| 1603 | ;; | ||
| 1604 | ;; There are also some defun-specific functions, like | ||
| 1605 | ;; treesit-defun-name, treesit-add-log-current-defun. | ||
| 1606 | ;; | ||
| 1607 | ;; TODO: I'm not entirely sure how would this go, so I only documented | ||
| 1608 | ;; the "defun" functions and didn't document any "thing" functions. | ||
| 1609 | ;; We should also document `treesit-block-type-regexp' and support it | ||
| 1610 | ;; in major modes if we can meaningfully intergrate hideshow: I tried | ||
| 1611 | ;; and failed, we need SomeOne that understands hideshow to look at | ||
| 1612 | ;; it. (BTW, hideshow should use its own | ||
| 1613 | ;; `treesit-hideshow-block-type-regexp'.) | ||
| 1586 | 1614 | ||
| 1587 | (defvar-local treesit-defun-type-regexp nil | 1615 | (defvar-local treesit-defun-type-regexp nil |
| 1588 | "A regexp that matches the node type of defun nodes. | 1616 | "A regexp that matches the node type of defun nodes. |