Skip to content

Commit

Permalink
add corresponding "atom" predicate for treesitter
Browse files Browse the repository at this point in the history
  • Loading branch information
countvajhula committed Feb 21, 2025
1 parent ed22d7a commit 3afceb3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions symex-primitives.el
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@
(symex-ts--next-p)
(symex-lisp--next-p)))

(defun symex-atom-p ()
"Check if the selected symex is an atom."
(if (symex-ts-available-p)
(symex-ts-atom-p)
(symex-lisp-atom-p)))

;;; Navigation

(defun symex--go-forward (&optional count)
Expand Down
7 changes: 7 additions & 0 deletions symex-ts.el
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,13 @@ Note that this does not consider global root to be a tree root."
"Check if a succeeding symex exists at this level."
(symex-ts-save-excursion (symex-ts-move-next-sibling)))

(defun symex-ts-atom-p ()
"Check if the selected symex is an atom.
This isn't generally as well-defined as for lisp. It could include
both identifiers as well as empty lists or forms."
(= 0 (symex-ts--count-named-children symex-ts--current-node)))

;;; Navigations

(defun symex-ts-move-prev-sibling (&optional count)
Expand Down

0 comments on commit 3afceb3

Please sign in to comment.