1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-20 20:50:53 -08:00
Commit graph

584 commits

Author SHA1 Message Date
Yuan Fu
9874561f39
Fix treesit-node-field-name and friends (bug#66674)
So turns out ts_node_field_name_for_child takes a named node index,
but we were passing it normal index that counts both named and
anonymous nodes.  That's what makes the field name all wrong in
treesit explorer.

* doc/lispref/parsing.texi:
(Accessing Node Information): Update docstring.
* lisp/treesit.el (treesit-node-index): Add some unrelated comment.
(treesit-node-field-name): Get named node index rather than all node
index.
* src/treesit.c (Ftreesit_node_field_name_for_child): Update
docstring, use ts_node_named_child_count.
2023-12-10 16:28:21 -08:00
Stefan Kangas
06a12b0ccc ; Fix typos 2023-12-10 13:22:04 +01:00
Eli Zaretskii
e32c57ed4d ; Fix make-obsolete warnings in treesit.el
* lisp/treesit.el (treesit-text-type-regexp)
(treesit-sentence-type-regexp, treesit--things-around)
(treesit-sexp-type-regexp): Fix obsolescence warnings.
2023-11-19 11:37:45 +02:00
Eli Zaretskii
c9d7740574 Merge from origin/emacs-29
ce0ebb91f2 Improve documentation of read syntax and printed represen...
81f84b00a5 ; * doc/lispref/modes.texi (Other Font Lock Variables): A...
434592b074 ; * lisp/dired.el (dired-use-ls-dired): Doc fix (bug#67053).
fe000236cf Improve documentation of signaling errors in batch mode
103ca678ac Fix treesit-simple-indent-presets docstring (bug#67007)
b7871cefe7 Prevent an infinite loop in todo-mode (bug#66994)
fa8cc4c9ee Fix cmake-ts-mode indentation (Bug#66845)
5bdc61bc0e Update to Org 9.6.11
18e2de1bec ; * lisp/bindings.el (right-word, left-word): Doc fix.
4f0fc3bfda ; Document core input events problems with XInput2
2023-11-11 05:31:52 -05:00
Yuan Fu
5dc3c9f4ec
Mark treesit--things-around obsolete
* lisp/treesit.el (treesit--things-around): Mark obsolete.
2023-11-09 21:20:26 -08:00
Yuan Fu
e147128f46
Replace treesit--things-around with new functions (bug#66989)
* lisp/treesit.el (treesit-forward-sexp):
Replace things-around with thing-at.
(treesit--navigate-thing): Replace things-around with
thing-prev/next/at.  Also this should fix the problem described in
bug#66989.
(treesit-thing-at-point): Replace things-around with thing-at.
2023-11-09 21:17:20 -08:00
Yuan Fu
3ad06ed4f0
Add treesit thing-at-point functions
* lisp/treesit.el (treesit--thing-sibling):
(treesit--thing-prev):
(treesit--thing-next):
(treesit--thing-at): New functions.
2023-11-09 20:50:44 -08:00
Yuan Fu
0db75b80e1
Add treesit-node-enclosed-p
* doc/lispref/parsing.texi (Accessing Node Information):
Add manual entry.
* lisp/treesit.el (treesit-node-enclosed-p): New function.
(treesit): Add shortdoc entry.
* test/src/treesit-tests.el (treesit-node-api): Add tests.
2023-11-09 20:49:30 -08:00
Yuan Fu
1653389b57
Add shortdoc for treesit-node-get 2023-11-09 20:09:06 -08:00
Yuan Fu
103ca678ac
Fix treesit-simple-indent-presets docstring (bug#67007)
* lisp/treesit.el (treesit-simple-indent-presets): Fix docstring.
* doc/lispref/modes.texi (Parser-based Indentation): Fix example.
2023-11-08 23:49:15 -08:00
Michael Albinus
54c9467a99 Merge from origin/emacs-29
5f60913208 Fix State button for customize-icon (Bug#66635)
27c71979ff ; Another Texinfo fix
889a550ca0 ; Fix Texinfo warnings
893c344b4e Fix the use of adaptive-fill-regexp in treesit indent preset
1098c114b7 Fix treesit-install-language-grammar (bug#66673)
491ee428c0 Fix treesit-explore-mode (bug#66431)
ee043a2703 tsx-ts-mode--font-lock-compatibility-bb1f97b: Re-fix the ...
2023-10-27 15:28:43 +02:00
Yuan Fu
893c344b4e
Fix the use of adaptive-fill-regexp in treesit indent preset
* lisp/treesit.el (treesit-simple-indent-presets):
adaptive-fill-regexp don't have a capture group (the group in the
default value is supposed to be a non-capture group), so don't use the
group. Also, in the second diff hunk, replace looking-at with
looking-at-p so it doesn't override match data that we use later.
2023-10-21 21:12:59 -07:00
nverno
1098c114b7
Fix treesit-install-language-grammar (bug#66673)
* lisp/treesit.el (treesit-install-language-grammar): Take out the
language symbol when storing the recipe.
2023-10-21 20:39:30 -07:00
Yuan Fu
491ee428c0
Fix treesit-explore-mode (bug#66431)
* lisp/treesit.el (treesit-explore-mode): Reset
treesit--explorer-last-node before calling treesit--explorer-refresh,
so that in the rare case described in the bug report, the explorer
buffer don't show the outdated node.
2023-10-21 20:39:30 -07:00
Yuan Fu
aa6cb41661
Documentation for treesit-font-lock-rules change
* doc/lispref/modes.texi (Parser-based Font Lock): Update manual.
* lisp/treesit.el (treesit-font-lock-rules): Update docstring.
2023-10-21 11:07:30 -07:00
Stefan Monnier
0ad355e9c6 * lisp/treesit.el: Don't require cl-seq directly 2023-10-21 13:40:12 -04:00
Huan Nguyen
8faffc26a6
New keyword :default-language in treesit-font-lock-rules function.
* lisp/treesit.el (treesit-font-lock-rules): Keyword :default-language
LANGUAGE will be chosen for every :feature.  Using :language will
override the :default-language for the next :feature.
2023-10-20 21:09:03 -07:00
Michael Albinus
9f83b46bee Merge from origin/emacs-29
53292c5d81 Fix treesit-query-validate for string input (bug#66400)
81a0c1ed2e ; Improve documentation of VC commands
0590e3e69a Recommend `M-x man` in woman.el docs
809da7fc9a ; * doc/lispref/processes.texi (Process Buffers): More ac...
8f23a02a9e Fix updating process-mark position in 'set-process-buffer'
2023-10-13 16:16:19 +02:00
Yuan Fu
73ccd9d295
Don't call font-lock-mode in treesit-major-mode-setup (bug#66223)
* lisp/treesit.el (treesit-major-mode-setup): Remove.

(cherry picked from commit a3a840c80a)
2023-10-08 22:00:36 -07:00
nverno
53292c5d81
Fix treesit-query-validate for string input (bug#66400)
* lisp/treesit.el (treesit-query-validate): Don't expand if QUERY is
string.
2023-10-08 22:00:32 -07:00
Yuan Fu
247743bd1e ; * lisp/treesit.el (treesit-language-at-point-function): Fix doc.
(cherry picked from commit 07ede5e92a)
(Bug#66183)
2023-10-07 12:03:37 +03:00
Eli Zaretskii
46978fa1ef Merge from origin/emacs-29
4776d90c31 Add new Tramp test
ca5b48fd76 Fix tmm-mid-prompt :type (Bug#66179)
7447d3df94 Fix tree-sitter indentation conflict with multiple languages
bee18e5273 Fix bug#66093 in Tramp
7d5fee0fea Support regeneration of ja-dic.el under '--with-small-ja-...

Conflicts:
	make-dist
2023-09-30 13:50:07 -04:00
Yuan Fu
e881a172d4
; * lisp/treesit.el (treesit--read-major-mode): Use string-suffix-p. 2023-09-27 21:52:59 -07:00
Yuan Fu
a3a840c80a
Don't call font-lock-mode in treesit-major-mode-setup (bug#66223)
* lisp/treesit.el (treesit-major-mode-setup): Remove.
2023-09-27 00:21:40 -07:00
Yuan Fu
07ede5e92a
; * lisp/treesit.el (treesit-language-at-point-function): Fix doc. 2023-09-26 23:23:53 -07:00
Augustin Chéneau
7447d3df94
Fix tree-sitter indentation conflict with multiple languages
* lisp/treesit.el (treesit--indent-1): Use bol instead of point.

Copyright-paperwork-exempt: yes
2023-09-24 14:06:53 -07:00
Eli Zaretskii
617c358da7 Merge from origin/emacs-29
c966e7ec38 * lisp/net/tramp.el (tramp-skeleton-write-region): Fix mi...
a2953ea300 Merge branch 'emacs-29' of git.savannah.gnu.org:/srv/git/...
5cba5ee890 Fix tree-sitter range update function
41333cb2d5 ; * etc/NEWS: Fix typos.
a3a9ed40d8 ; * CONTRIBUTE: Clarify "mark" wrt NEWS entries.  (Bug#66...
0a6a9ac6f1 ; * etc/NEWS: Fix last change.
5611274bbd Announce handling 'org-protocol' URI scheme in NEWS

# Conflicts:
#	lisp/treesit.el
2023-09-23 09:41:02 -04:00
Yuan Fu
5cba5ee890
Fix tree-sitter range update function
* lisp/treesit.el (treesit-update-ranges): If an embedded language
doesn't have any range, don't set its range to nil (which means whole
buffer), instead, set its range to a dummy (1 . 1) zero range.
2023-09-18 20:48:54 -07:00
Yuan Fu
fc7c1f1e93
Fix treesit--update-ranges-local
* lisp/treesit.el (treesit--update-ranges-local): Don't forget to set
local parser's range when creating it.
2023-09-18 20:48:28 -07:00
Danny Freeman
b892da5f61
Offset ranges before applying embedded tree-sitter parser
This feature would allow treesitter major modes to easily specify
offsets when using embeded parsers.  A potential use case for this is
javascript template strings, when we want to apply a different parser
to the string's contents, but do not want to include the template
string's delimiters.

* lisp/treesit.el
(treesit-query-range): Accept an optional offest arg, apply the offset
to all returned ranges.
(treesit-range-rules): Accept an optional :offset keyword arg to adjust
ranges an embded parser is applied to.
(treesit-update-ranges): Forward optional :offset setting from
`treesit-range-rules' to `treesit-query-rang'.
* test/lisp/treesit-tests.el
(treesit-range-offset): Tests the new offset functionality.
2023-09-17 21:12:56 -07:00
Yuan Fu
04fd8b173b
Allow treesit-font-lock-recompute-features to be language-specific
* lisp/treesit.el:
(treesit-font-lock-recompute-features): Add LANGUAGE parameter.
2023-09-15 00:44:23 -07:00
Yuan Fu
de6a652a03
Refactor treesit-font-lock-fontify-region
* lisp/treesit.el (treesit-font-lock-fontify-region): Extract out
treesit--font-lock-fontify-region-1.
2023-09-13 21:04:18 -07:00
Yuan Fu
63766b49e2
Fix treesit-font-lock-fontify-region wrt local parsers
* lisp/treesit.el (treesit--update-ranges-local): Minor change.
(treesit-font-lock-fontify-region): Don't try to fontify if node is
nil.  Don't use alist-get to get the root node for a language: there
might be multiple root nodes (from multiple local parsers) for the
same language.
(treesit-major-mode-setup): Remove existing local parsers when major
mode is activated.
2023-09-13 21:00:29 -07:00
Yuan Fu
8facdb62d3
Improve docstring for treesit-language-at
* lisp/treesit.el (treesit-language-at-point-function)
(treesit-language-at): Several people has confused over this, make it
extra clear than treesit-language-at requires
treesit-language-at-point-function to work.
2023-09-13 18:15:28 -07:00
Yuan Fu
b1c4089171
; * lisp/treesit.el (treesit-explore-mode): Support local parsers. 2023-09-11 18:08:08 -07:00
Yuan Fu
93a458f25f
Fix treesit-node-at wrt local parsers
* lisp/treesit.el (treesit-node-at): Don't compute language at point
first.  Because treesit-language-at uses treesit-node-at with a
language argument. Only call treesit-language-at when PARSER-OR-LANG
is nil.
2023-09-09 12:36:49 -07:00
Yuan Fu
98f98c66e0
; * lisp/treesit.el (treesit--indent-1): Get all parsers. 2023-09-08 09:09:14 -07:00
Yuan Fu
2db725fb24
; * lisp/treesit.el (treesit--indent-1): Add missing call. 2023-09-08 09:08:28 -07:00
Yuan Fu
b1bcd396ed
Fix treesit-thing-definition
* lisp/treesit.el (treesit-thing-definition): Don't modify
treesit-thing-settings itself.
2023-09-07 17:56:11 -07:00
Yuan Fu
9f6cf89fb1
; * lisp/treesit.el (treesit-node-on): Fix treesit-local-parsers-on. 2023-09-07 17:44:32 -07:00
Yuan Fu
30de869a3e
; * lisp/treesit.el (treesit-update-ranges): Fix use of parser-list. 2023-09-07 16:04:47 -07:00
Yuan Fu
a9a096ff8b
Add Ftreesit_parser_tag
* lisp/treesit.el (treesit-parser-tag): Add.
* src/treesit.c (Ftreesit_parser_tag): Add.
2023-09-07 16:04:47 -07:00
Yuan Fu
8aa9dc1c0c
Change treesit-local-parsers-in to treesit-local-parsers-on
To improve consistency. We already have treesit-node-at and
treesit-node-on.

* doc/lispref/parsing.texi (Multiple Languages): Update manual.
* lisp/treesit.el (treesit-local-parsers-on): Change to in.
(treesit-font-lock-fontify-region): Change to in.
2023-09-07 16:04:29 -07:00
Eli Zaretskii
28cb3a4413 ; Fix recent changes in treesit documentation
* lisp/treesit.el (treesit-local-parsers-at)
(treesit-local-parsers-in):
* doc/lispref/parsing.texi (Multiple Languages):
 (Using Parser): Fix wording of recently added docs.
2023-09-07 11:09:56 +03:00
Yuan Fu
d1f916b046
Support local parser in treesit-node-at/on
* lisp/treesit.el (treesit-node-at)
(treesit-node-on): Support local parser.
2023-09-05 21:03:38 -07:00
Yuan Fu
d05494a9ff
Support tree-sitter local parsers
* doc/lispref/parsing.texi (Multiple Languages): Update manual.
* lisp/treesit.el (treesit-range-settings): Add LOCAL-P to range
setting.
(treesit-range-rules): Support :local keyword.
(treesit-local-parsers-at)
(treesit-local-parsers-in)
(treesit--update-ranges-local): New functions.
(treesit-update-ranges)
(treesit-font-lock-fontify-region)
(treesit--indent-1): Support local parsers and prioritize it over
global parsers.
2023-09-05 21:03:38 -07:00
Yuan Fu
722daf6fff
Add tag to tree-sitter parsers
* doc/lispref/parsing.texi (Using Parser): Update manual.
* lisp/treesit.el (treesit-buffer-root-node)
* src/treesit.c (make_treesit_parser)
* src/treesit.c (Ftreesit_parser_create): Add TAG parameter.
(treesit_resolve_node): Create a parser with nil tag.
* src/treesit.h (Lisp_TS_Parser): Add TAG field.
2023-09-05 21:03:37 -07:00
Daniel Martín
cd6dcfad10 Improve completion of treesit-check-indent command
* lisp/treesit.el (treesit--read-major-mode): Helper function to
provide completion for most major modes.
(treesit-check-indent): Use the new interactive spec and improve the
docstring.  (Bug#60001)
2023-09-05 22:40:38 +02:00
Eli Zaretskii
ec3ea8c036 Merge from origin/emacs-29
648a5e33e8 Update to Org 9.6.8-3-g21171d
458442fe78 Escape percent character in treesit--inspect-name (bug#65...
bc0426ce8e Don't add an extraneous slash in remote PATH list in Eshell
34f7a47c9c Fix Tramp on MS Windows
ea5fd6c96b * Fix native disassemble on Windows platforms (bug#65455)
91d2d8439b * Handle missing eln file when trying to disassble (bug#6...
e7ac50a153 * lisp/emacs-lisp/comp.el (comp--native-compile): Fix OUT...
45cf3a0ced Update to Transient v0.4.3
31d3808fb9 Adapt Eshell manual
0c50af054f Fix applying patches with Git on MS-Windows

# Conflicts:
#	doc/misc/transient.texi
#	test/lisp/eshell/esh-util-tests.el
2023-09-02 04:28:17 -04:00
Eli Zaretskii
34414b06f2 ; Minor fixes of treesit docs
* src/treesit.c (treesit_traverse_validate_predicate)
(Ftreesit_search_subtree, Ftreesit_search_forward)
(Ftreesit_induce_sparse_tree, Ftreesit_node_match_p):
* lisp/treesit.el (treesit-beginning-of-thing)
(treesit-end-of-thing, treesit--things-around): Fix commentary and
doc strings.
2023-09-02 10:08:21 +03:00