Commit graph

429 commits

Author SHA1 Message Date
Juri Linkov
6b5831c696 Tree-sitter doc fixes (bug#60524)
* doc/lispref/modes.texi (Parser-based Font Lock):
Replace :lang with :language.

* doc/lispref/parsing.texi (Language Grammar): Replace
treesit-load-suffixes with dynamic-library-suffixes.
(Retrieving Nodes): Fix function names.
(Tree-sitter Major Modes): Fix treesit-ready-p args.
Fix pxref to Parser-based Indentation.
(Tree-sitter C API): Fix function names.

* lisp/treesit.el (treesit--simple-indent-eval): Remove cond BODY
duplicated from CONDITION.
(treesit)<define-short-documentation-group>: Fix function names.
2023-01-04 09:57:06 +02:00
Stefan Kangas
1ddd31bf98 Merge from origin/emacs-29
0d98fac6bb (ruby-ts-add-log-current-function): Fix when between two ...
da69f116bf ; * doc/lispref/positions.texi (List Motion): Minor wordi...
0b0eae0bf7 ; Improve documentation of 'treesit-language-source-alist'
ae0d218d0b ; * etc/NEWS: Mention treesit-install-language-grammar.
de3df3bc51 * lisp/vc/vc-git.el (vc-git-checkin): Pass vc-git-diff-sw...

# Conflicts:
#	etc/NEWS
2023-01-04 06:30:13 +01:00
Eli Zaretskii
0b0eae0bf7 ; Improve documentation of 'treesit-language-source-alist'
* lisp/treesit.el (treesit--install-language-grammar-build-recipe)
(treesit-install-language-grammar):  Doc fixes.
(treesit-install-language-grammar): Autoload it.

* etc/NEWS: Improve wording of the
'treesit-install-language-grammar' documentation.
2023-01-03 15:12:48 +02:00
Stefan Kangas
c209802f7b Merge from origin/emacs-29
4520f09dd8 ; * admin/git-bisect-start: Update failing commits
2569ede9c4 Update to Org 9.6-81-g563a43
d9ed736f0a ruby-ts-mode: Remove some currently unused functions
4561844720 ruby-ts-mode: Highlight singleton method definitions and ...
0562006da3 Add ruby-ts-mode
84e7c2fbc8 Fix fontification of C++ reference return types (bug#60441)
1864b65af6 ; Minor fix for treesit--install-language-grammar-1 (bug#...
8994f87ad4 Adjust function-call fontification in csharp-ts-mode (bug...
411647a3f6 ; Fix NEWS.
7b0b17df67 Rewrite Antinews in ELisp manual for Emacs 29
f12f72b0e0 ; * lisp/simple.el (primitive-undo): Clarify error messag...
7fd822e7f5 Update Antinews in the user manual for Emacs 29
da77d70dee ; * test/lisp/emacs-lisp/copyright-tests.el: Fix and futu...
2baf9e107c Fix shortdoc-tests failure with respect to regexp-opt-cha...
5aeb8de32e ; Fix copyright years in 2 more files.

# Conflicts:
#	etc/NEWS
2023-01-02 12:06:37 +01:00
Yuan Fu
1864b65af6
; Minor fix for treesit--install-language-grammar-1 (bug#60465)
* lisp/treesit.el (treesit--install-language-grammar-1): Fix.
2023-01-01 16:15:36 -08:00
Eli Zaretskii
3c55fbd4ad Merge from origin/emacs-29
cae528457c ; Add 2023 to copyright years.
b394359261 Improve documentation of 'isearch-open-overlay-temporary'
ab3210e709 Document 'use-package' in the 2 main manuals

# Conflicts:
#	etc/refcards/ru-refcard.tex
#	lib/explicit_bzero.c
#	m4/explicit_bzero.m4
2023-01-01 05:47:47 -05:00
Eli Zaretskii
861d3db634 Merge from origin/emacs-29
72a81e2022 ; * lisp/treesit.el (treesit-simple-indent-presets): Fix t...
ddfeee3e8a Build recipe interactively in treesit-install-language-gra...
6837469780 ; Add REVISION to treesit-language-source-alist
0dc788aa01 ; Remove GRAMMAR-DIR from treesit-language-source-alist
f9aef67c36 Tweak csharp-mode font-lock-settings (bug#60376)
46362c0a3a ; * doc/lispref/tips.texi (Documentation Tips): Add indexing.
9a386b682e Revert a recent change which causes errors
9871ee8b14 ; More fixes for documentation of 'defalias'
f309651b67 ; Fix handling of 'not' by 'buffer-match-p'
9292f595a7 ; Fix typos
43c7e05a2a Fix misspelled functions in shortdoc groups
01acecc79c Simplify introduction of use-package manual
2a7e072e53 ; Fix documentation of 'defalias'
eee2aeca25 Fix python-shell-buffer-substring when retrieving a single...
bfdad6c4e5 ; Fix recent treesit-related changes
2023-01-01 05:46:24 -05:00
Eli Zaretskii
cae528457c ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05:00
Yuan Fu
72a81e2022
; * lisp/treesit.el (treesit-simple-indent-presets): Fix typo.
Well it's sort of a typo :-)
2022-12-31 17:11:14 -08:00
Yuan Fu
ddfeee3e8a
Build recipe interactively in treesit-install-language-grammar
If there is not existing recipe for a language, prompt to build the
recipe interactively.

* lisp/treesit.el (treesit--install-language-grammar-build-recipe):
New functions.
(treesit-install-language-grammar): Use the new function.
2022-12-31 16:23:07 -08:00
Yuan Fu
6837469780
; Add REVISION to treesit-language-source-alist
This allows users to install a particular version or branch.  Prompted
by bug#60427 and bug#60223.

* lisp/treesit.el (treesit-language-source-alist)
(treesit--install-language-grammar-1): Add REVISION.
2022-12-31 14:55:10 -08:00
Yuan Fu
0dc788aa01
; Remove GRAMMAR-DIR from treesit-language-source-alist
Removing it doesn't affect building all the language grammars in
batch.sh, so it must be an artifact I added for something else and
later forgot to remove.

* lisp/treesit.el (treesit-language-source-alist)
(treesit--install-language-grammar-1): Remove GRAMMAR-DIR.
2022-12-31 14:27:51 -08:00
Stefan Kangas
9292f595a7 ; Fix typos 2022-12-31 12:43:32 +01:00
Eli Zaretskii
bfdad6c4e5 ; Fix recent treesit-related changes
* lisp/treesit.el (treesit-language-source-alist)
(treesit--install-language-grammar-1): Doc fixes.

* src/treesit.c (Ftreesit_language_abi_version): Fix a typo in
function's Lisp name.  Doc fix.
(Ftreesit_language_available_p): Fix a typo in the function's C
name.

* doc/lispref/parsing.texi (Language Grammar): Fix wording.
2022-12-31 10:13:15 +02:00
Stefan Kangas
2ec4e187c9 Merge from origin/emacs-29
ab1f245f1a Show tree-sitter query source when signaling query error
0b58ea0e60 ; * lisp/treesit.el (treesit--install-language-grammar-1)...
724da28763 Add version tags and mention the new options in NEWS
8675f4136c Add new options for Ruby code indentation
4922de626f ; Fix doc strings of 'treesit-install-language-grammar'
69b2aaaade ; Fix recently modified docs of 'set-face-attribute' (bug...
0248fc9e1a Add treesit-install-language-grammar
0237c5927e Add treesit-language-abi-version
312f82d36f Change "language definition" to "language grammar" in man...
fba35657da ; * lisp/progmodes/c-ts-mode.el (c-ts-mode--fill-paragrap...
dec1b37a32 ; * doc/lispref/parsing.texi (Accessing Node Information)...
39265abf0c * test/lisp/net/tramp-tests.el (tramp-test32-shell-comman...
ebf65c7e7e * lisp/eshell/em-tramp.el (tramp): Require also at runtim...

# Conflicts:
#	etc/NEWS
2022-12-31 06:30:21 +01:00
Yuan Fu
0b58ea0e60
; * lisp/treesit.el (treesit--install-language-grammar-1): Minor fix. 2022-12-30 16:23:39 -08:00
Eli Zaretskii
4922de626f ; Fix doc strings of 'treesit-install-language-grammar'
* lisp/treesit.el (treesit-install-language-grammar)
(treesit--install-language-grammar-1): Doc fixes.
2022-12-30 17:10:22 +02:00
Yuan Fu
0248fc9e1a
Add treesit-install-language-grammar
Per discussion on emacs-devel, I added function to install and compile
language grammars.

* lisp/treesit.el (treesit-language-source-alist): New variable.
(treesit-install-language-grammar)
(treesit--call-process-signal)
(treesit--install-language-grammar-1): New functions.
2022-12-30 02:56:26 -08:00
Yuan Fu
312f82d36f
Change "language definition" to "language grammar" in manual.
"Language grammar" is apparently the more widely used term among
people talking about tree-sitter.  To avoid confusion, I think it's
good to use that rather than "language definition", which is a term
that I made up :-)

Feel free to revert this if it is too much change.

* doc/lispref/elisp.texi:
* doc/lispref/modes.texi:
* doc/lispref/parsing.texi:
* lisp/treesit.el: Change "language definition" to "language grammar".
2022-12-30 00:47:22 -08:00
Stefan Kangas
89e7bb230d Merge from origin/emacs-29
644c71d678 lisp/textmodes/bibtex.el: fix bibtex-beginning-of-entry (...
ab38abfdf7 lisp/textmodes/bibtex.el: Treat $ as punctuation in BibTe...
d086cd6cf8 Clarify the documentation of 'set-face-attribute'
dafa6d6bad Handle non-string values in pcomplete
beed746f94 Fix completion when completion-auto-select is set
7ccb88486e ; * etc/DEBUG: Update MS-Windows specifics for GDB 13 and...
558b59d81b Add color fontification in css-ts-mode (bug#60405)
a96a7c8115 ; * lisp/textmodes/css-mode.el (css-ts-mode): Fix imenu s...
793641a3db ; * lisp/progmodes/js.el: Fix byte-compile warning.
0aea1cf819 * lisp/hi-lock.el (hi-lock--regexps-at-point): Fix bug (b...
60418e6f09 * src/keyboard.c (echo_add_key): Use recently rebound C-h...
706ed85285 Avoid assertion violations in treesit.c with --enable-che...
38c35bf0f6 Clean up treesit-default-defun-skipper and add comments
9371d488be Merge branch 'emacs-29' of git.savannah.gnu.org:/srv/git/...
9d814bea46 ; whitespace.el: Use the new 'ert-with-buffer-selected' i...
784e509bde Fix c-ts-mode bracket indentation (bug#60398)
2022-12-30 06:45:13 +01:00
Yuan Fu
38c35bf0f6
Clean up treesit-default-defun-skipper and add comments
* lisp/treesit.el (treesit-default-defun-skipper): Clean up, fix some
small issue, add comment.
2022-12-29 01:43:28 -08:00
Stefan Kangas
dce6791e99 Merge from origin/emacs-29
db96b1282f * lisp/help.el: Use 'C-h C-q' to toggle 'help-quick' wind...
489865c21e ; Improve markup of long key sequences
d42c2668cf ; * etc/NEWS: Fix wording of a recently edited entry.
7a0eaee198 * lisp/isearch.el: Small fixes.
b69bffeec0 * lisp/vc/diff-mode.el (diff-minor-mode-prefix): Replace ...
9263847ab7 ; * etc/NEWS: Move the paragraph with 'C-u RET' closer to...
62fb2dc37d * doc/emacs/display.texi (Text Scale): Improve section ab...
70480d3b6b * lisp/repeat.el (repeat-echo-function): Suggest 'add-fun...
fd48201ffe * lisp/tab-line.el (tab-line-cache-key-default): More cac...
b164660260 * etc/package-keyring.gpg: Update with new key
c0be51389e ; Yet another declare-function to avoid treesit-related w...
8676bec51d ; * lisp/treesit.el (treesit--simple-imenu-1): Doc fix; w...
2ddc480f44 Warn of absent networks module in ERC
19d00fab9a Avoid "already compiled" warning in erc-compat
2d8f7b66bc ; Fix one more treesit byte-compilation warning.
2d0a921486 ; Avoid treesit-related byte-compiler warnings
8503b370be (python--treesit-settings): Remove duplicate matcher
b464e6c490 Make last change of w32 GUI dialogs conditional and rever...
eedc9d79ae Fix tree-sitter typos
248c13dcfe Update tree-sitter major modes to use the new Imenu facility
b39dc7ab27 Add tree-sitter helper functions for Imenu
ba1ddea9da Fix treesit--things-around (bug#60355)
7512b9025a ; * lisp/treesit.el (treesit-traverse-parent): Remove alias.
5326b04198 Improve treesit-node-top-level and treesit-parent-until
637f5b164f ; Add "src" to the heuristic sub-directory heuristic
8ab6df0c9f ; * lisp/epa-ks.el (epa-ks-do-key-to-fetch): Fix 'when' u...
2b55a48d3e * src/w32menu.c (simple_dialog_show): Use MB_YESNOCANCEL ...
8b8b791567 ; Improve documentation of TAB/SPC indentation
624e382211 ; Improve doc strings of some new faces
41f12e1019 ; * lisp/elide-head.el (elide-head): Doc fix to silence c...
e3b4cd0ac1 ; * lisp/htmlfontify.el (hfy-text-p): Fix whitespace.
1b4dc4691c Fix htmlfontify.el command injection vulnerability.
1fe4b98b4d Improve support for Scheme R6RS and R7RS libraries (bug#5...
2347f37f67 ; * test/src/treesit-tests.el: remove dead store (bytecom...
a6d961ae2f Add a new tree-sitter query predicate 'pred'
835a80dcc4 ; Fix tree-sitter defun tests
a14821d615 Improve gnutls-min-prime-bits docstring
b14bbd108e Improve handling of tab-bar height.
669160d47b ; * nt/INSTALL.W64: More fixes and updates.
26b2ec7cb8 Simplify last change (bug#60311)
082fc6e308 Fix 'json-available-p' on MS-Windows
6c86faec29 loaddefs-gen: Group results by absolute file name
d90d7d15f2 ; Fix vindexes in parsing.texi
eb26872837 Fix imenu for c-ts-mode (bug#60296)
8f68b6497e Clean up python-ts-mode font-lock features
28f26b11a1 Add comment indent and filling to other tree-sitter major...
c6b0282645 ; Remove unused function in c-ts-mode
6e52a9fcad ; * doc/lispref/modes.texi (Parser-based Font Lock): Mino...
2bcd1e9a99 ; * doc/lispref/parsing.texi (Retrieving Nodes): Add notice.
7c7950fe00 Add maintainer stub for tree-sitter files
cf32776622 ; * doc/lispref/parsing.texi (Using Parser): Remove delet...

# Conflicts:
#	etc/NEWS
#	lisp/progmodes/c-ts-mode.el
#	lisp/progmodes/typescript-ts-mode.el
#	lisp/treesit.el
2022-12-28 21:40:59 +01:00
Theodor Thornhill
7e98b8a0fa Add treesit-transpose-sexps (bug#60128)
We don't really need to rely on forward-sexp to define what to
transpose.  In tree-sitter we can consider siblings as "balanced
expressions", and swap them without doing any movement to calculate
where the siblings in question are.

* lisp/simple.el (transpose-sexps-function): New defvar-local.
(transpose-sexps): Use the new defvar-local if available.
(transpose-subr): Check whether the mover function returns a cons of
conses, then run transpose-subr-1 on the position-pairs.
* lisp/treesit.el (treesit-transpose-sexps): New function.
2022-12-28 13:00:43 -05:00
Stefan Kangas
8676bec51d ; * lisp/treesit.el (treesit--simple-imenu-1): Doc fix; wording. 2022-12-28 17:38:20 +01:00
Yuan Fu
b39dc7ab27
Add tree-sitter helper functions for Imenu
We didn't add an integration for Imenu because we aren't sure what
should it look like.  Now we have a pretty good idea.  All the major
modes copy-paste the two Imenu functions and tweaks them in a standard
way.  With the addition of treesit-defun-type-regexp and
treesit-defun-name-function, now is a good time to standardize Imenu
integration.

In the next commit we update all the major modes to use this
integration.

* doc/lispref/modes.texi (Imenu): Add manual.
* doc/lispref/parsing.texi (Tree-sitter major modes): Update manual.
* lisp/treesit.el (treesit-simple-imenu-settings): New varaible.
(treesit--simple-imenu-1)
(treesit-simple-imenu): New functions.
(treesit-major-mode-setup): Setup Imenu.
2022-12-27 20:37:29 -08:00
Yuan Fu
ba1ddea9da
Fix treesit--things-around (bug#60355)
Current implementation of treesit--things-around only searches forward
for REGEXP and go up the tree until it finds a valid thing, if nothing
matches it gives up.  This makes it sometimes miss defuns.  The new
implementation tries multiple times (of search forward + go up) until
it exhausts all possible defun nodes.

* lisp/treesit.el (treesit--things-around): New implementation.
(treesit--navigate-defun): Refactor to use treesit-node-top-level to
simplify code, and add some guards in the predicate function.
* test/src/treesit-tests.el:
(treesit--ert-defun-navigation-elixir-program): New variable.
(treesit-defun-navigation-nested-4): New test.
2022-12-27 17:41:43 -08:00
Yuan Fu
7512b9025a
; * lisp/treesit.el (treesit-traverse-parent): Remove alias.
It was added with treesit-traverse-xxx functions, since now they are
gone, this alias doesn't make sense by itself anymore.
2022-12-27 17:38:13 -08:00
Yuan Fu
5326b04198
Improve treesit-node-top-level and treesit-parent-until
* lisp/treesit.el (treesit-node-top-level): Now it can accept a
predicate function.  Add an optional argument INCLUDE-NODE.
(treesit-parent-until): Add an optional argument INCLUDE-NODE.
2022-12-27 17:17:25 -08:00
Yuan Fu
d90d7d15f2
; Fix vindexes in parsing.texi
* doc/lispref/parsing.texi (Tree-sitter major modes): Replace vindex
with cross-reference to modes.texi.  Add manual entry for
treesit-defun-type-regexp.
* lisp/treesit.el (treesit-defun-type-regexp): Use pred in docstring
since we use pred everywhere else.
2022-12-26 01:47:56 -08:00
Yuan Fu
7c7950fe00
Add maintainer stub for tree-sitter files
* lisp/treesit.el:
* src/treesit.c: Add maintainer.
2022-12-26 01:47:55 -08:00
Stefan Kangas
419ca81809 Merge from origin/emacs-29
6c00d126e7 Remove remaining mentions of 'eval-current-buffer'
1073e96170 ; * doc/lispref/text.texi (Database): Fix a typo.  (Bug#6...
b1e68a33d8 Update to Org 9.6-61-g63e073f
dad73e4de1 ; Review and fix NEWS and related documentation
72786ae237 ; Restore ARGS argument in c-ts-mode--fontify-declarator
940ab2423c ; Always consider :lisp-dir when locating main file of VC...
9ab98cd42a Add heuristic to locate lisp code in source packages
dda011c78d ; * doc/lispref/parsing.texi (Tree-sitter major modes): F...
d62b634d8f ; * src/process.c (Fprocess_running_child_p): Doc fix.
f6c5b3d635 ; * doc/lispref/parsing.texi: Add a reminder.
e6c49c0454 ; Fix byte-copmiler warning in c-ts-mode--fontify-declarator
4234033a47 ; * lisp/treesit.el: Add some comments.
79584a206b Further generalize treesit-defun functions
a819ca5a93 Generalize treesit-defun functions to "things"
e8b34109ee Reorder optional arguments to 'package-vc-install'
b38e56d8a9 Handle missing dependencies for source packages
7bc7b6b4dd ; Partial revert of f3e7820b
2cec78254e ; * nt/INSTALL.W64: Fix wording.
ecee3bd420 ; Fix recent changes in treesit documentation

# Conflicts:
#	etc/NEWS
2022-12-26 06:30:21 +01:00
Yuan Fu
4234033a47
; * lisp/treesit.el: Add some comments. 2022-12-25 01:11:47 -08:00
Yuan Fu
79584a206b
Further generalize treesit-defun functions
Two new functions, treesit-beginning/end-of-thing.  And
treesit-thing-at-point's signature changes.

* lisp/treesit.el (treesit-block-type-regexp): New variable.
(treesit-beginning-of-thing)
(treesit-end-of-thing): Generalized from
treesit-beginning/end-of-defun.
(treesit-beginning-of-defun)
(treesit-end-of-defun): Use the new functions.
(treesit-thing-at-point): Accept PATTERN rather than REGEXP and PRED.
(treesit-defun-at-point): Adjust for the new signature of
treesit-thing-at-point.
2022-12-25 01:11:47 -08:00
Yuan Fu
a819ca5a93
Generalize treesit-defun functions to "things"
Change the "defun" in some functions (e.g. treesit--defuns-around) to
"thing".  Add a function treesit-thing-at-point.

* lisp/treesit.el (treesit--thing-unpack-pattern): New subroutine.
(treesit-beginning-of-defun)
(treesit-end-of-defun): Use new function treesit--navigate-thing.
(treesit--defuns-around): Generalize into treesit--thing-around.
(treesit--top-level-defun): Generalize into treesit--top-level-thing.
(treesit--navigate-defun): Generalize into treesit--navigate-thing.
(treesit-thing-at-point): Generalized from treesit-defun-at-point.
(treesit-defun-at-point): Use treesit-thing-at-point to do tht work.
2022-12-25 01:11:47 -08:00
Eli Zaretskii
ecee3bd420 ; Fix recent changes in treesit documentation
* lisp/treesit.el (treesit-defun-name-function, treesit-node-at)
(treesit-node-on): Doc fixes.

* doc/lispref/parsing.texi (Tree-sitter major modes): Fix wording,
punctuation, and indexing.
(Retrieving Nodes): Fix wording and add cross-references.
2022-12-25 09:29:47 +02:00
Stefan Kangas
48db8b68a8 Merge from origin/emacs-29
c36fe3df17 Fix c-ts-mode imenu defun name (bug#60296)
a24e350170 Fix treesit--children-covering-range-recurse (bug#60301)
fbb4eb919b Support treesit-defun-name in tree-sitter major modes
6253184afc ; * lisp/treesit.el (treesit-defun-at-point): Guard again...
f8e219ebfa Add treesit-defun-name and friends
35c2ca2ca6 Make treesit-node-at/on guess language at point
7f7def2ae6 ; Add treesit-no-parser error
b6a2e1ddf6 * nt/INSTALL.W64: update instructions for setting up W64 ...
265b91d891 Revert "; Bump minimum supported Windows version for MinG...
75155e4586 ; Bump minimum supported Windows version for MinGW64 to W...
677f6c79eb ; Update minimum requirements of MinGW-w64
7723af5e4a ; * lisp/progmodes/c-ts-mode.el: quote literal string in ...
38866510c7 ; * src/xdisp.c (redisplay_internal): Reinstate the FRAME...
a825aa0b13 Fix definition of CNS 11643-15 charset
a42b20dd95 ; * lisp/progmodes/c-ts-mode.el: Add outline section head...
e4e3634539 Improve c-ts-mode block comment indent (bug#60270)
e30621caa2 ; Add treesit_recursion_limit
6a43af5880 Fix block comment indent and filling for c-ts-mode (bug#5...
e492c21e81 Fix treesit_cursor_helper (bug#60267)
4437dbedf7 Fix restart-emacs alarms (Bug#60220)
121a9ff9f6 Fix alternate stack test in configure
84888080ee Add more functions to "string" shortdoc
c90f97d4e5 Make the Contour terminal an alias of xterm-256color
c3fac9465f ; Fix punctuation in last change.
756bb422a4 Correct wrong info in (info)Go to node
a8c3424d28 Fix typo in TUTORIAL.fr (bug#60261)
24cd2f0daf Add some diff-fixup-modifs tests
d32091199a Fix quoted argument in emacsclient-mail.desktop Exec key
286c48137f ert-x: Move window selection logic to its own macro
823c49cea8 ; ert-x: Simplify `ert-with-test-buffer-selected'
38c6abe4d0 ; ert-x: Add test for buffer read-only state
0e39ad6fa5 Fix crash after X error
2022-12-25 06:30:21 +01:00
Yuan Fu
a24e350170
Fix treesit--children-covering-range-recurse (bug#60301)
* lisp/treesit.el (treesit--children-covering-range-recurse): Always
return a list of node.
2022-12-24 18:46:04 -08:00
Yuan Fu
6253184afc
; * lisp/treesit.el (treesit-defun-at-point): Guard against nil. 2022-12-24 18:43:03 -08:00
Yuan Fu
f8e219ebfa
Add treesit-defun-name and friends
1. We now have treesit-defun-name, powered by
treesit-defun-name-function.
2. We now have treesit-add-log-current-defun, which powers
add-log-current-defun.
3. c-ts-mode updates its code to take advantage of these new features.
4. Manual updates.

* doc/lispref/parsing.texi (Tree-sitter major modes): Add manual for
new functions.
* lisp/progmodes/c-ts-mode.el (c-ts-mode--defun-name): New function.
(c-ts-mode--imenu-1): Extract out into c-ts-mode--defun-name.
(c-ts-base-mode): Setup treesit-defun-name-function.
* lisp/treesit.el (treesit-defun-name-function)
(treesit-add-log-defun-delimiter): New variables.
(treesit-defun-at-point)
(treesit-defun-name): New functions.
(treesit-major-mode-setup): Setup add-log-current-defun-function.
2022-12-24 18:43:03 -08:00
Yuan Fu
35c2ca2ca6
Make treesit-node-at/on guess language at point
If PARSER-OR-LANG is nil, it makes more sense to guess the language at
point by treesit-language-at than to simply use the first parser in
the parser list.

* doc/lispref/parsing.texi (Retrieving Nodes): Update manual.
* lisp/treesit.el (treesit-node-at)
(treesit-node-on): Guess language at point.  Update docstring.
(treesit-buffer-root-node): Update docstring.
2022-12-24 18:43:03 -08:00
Yuan Fu
7f7def2ae6
; Add treesit-no-parser error
* lisp/treesit.el (treesit-no-parser): New error.
(treesit-buffer-root-node): Use the new error.
2022-12-24 18:43:03 -08:00
Yuan Fu
6a43af5880
Fix block comment indent and filling for c-ts-mode (bug#59763)
Now indent and filling works like in c-mode.  The only noticeable
missing piece is that the "*/" is not attached to the last sentence
when filling.  c-mode does it by replacing whitespaces between the
"*/" and the end of the last sentence with xxx, fill it, then change
the xxx back. I don't know if we should do that in c-ts-mode's filling.

* doc/lispref/modes.texi (Parser-based Indentation): Add new preset.
* lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): Add new
indent rule.
(c-ts-mode--fill-paragraph): New function.
(c-ts-base-mode): Setup paragraph-start, adaptive-fill, etc.
* lisp/treesit.el (treesit-simple-indent-presets): Add new preset.
2022-12-24 00:33:17 -08:00
Stefan Kangas
99feed933a Merge from origin/emacs-29
0754173c92 ; Fix docstring
014232d384 Eglot: eglot--servers-by-xrefed-file doesn't need to be v...
bbe35c280c Prevent stale servers when using eglot-extend-to-xref
9bf13a3fb9 ; * src/alloc.c (Fmemory_info): Doc fix.
baa33a5c05 * etc/tutorials/TUTORIAL.cn: Fix typos.  (Bug#60221)
98d7f76b45 Merge branch 'emacs-29' of git.savannah.gnu.org:/srv/git/...
a488a6870a Add alias for removed font-lock function
02e046566e Set beginning/end-of-defun-function in treesit-major-mode...
7dea58b88d Add treesit-defun-at-point and fix c-ts-mode-indent-defun
69123d4aa4 ; Fix treesit--defuns-around
05d8310fb5 Use the new keyword ':repeat' in repeatable keymaps.
2022-12-23 06:30:12 +01:00
Yuan Fu
02e046566e
Set beginning/end-of-defun-function in treesit-major-mode-setup
* lisp/treesit.el (treesit-major-mode-setup): Set them.
2022-12-22 00:42:49 -08:00
Yuan Fu
7dea58b88d
Add treesit-defun-at-point and fix c-ts-mode-indent-defun
* lisp/treesit.el (treesit-defun-at-point): New function.
* lisp/progmodes/c-ts-mode.el (c-ts-mode-indent-defun): Implement with
treesit-defun-at-point.
2022-12-22 00:42:49 -08:00
Yuan Fu
69123d4aa4
; Fix treesit--defuns-around
Now it doesn't move point.

* lisp/treesit.el (treesit--defuns-around): Wrap some code with
save-excursion.
2022-12-22 00:42:49 -08:00
Stefan Kangas
05740f05b7 Merge from origin/emacs-29
12b2b8864c Fix empty pairs in js tree-sitter imenu alist (bug#59945)
6d9f367ead ; * lisp/treesit.el (treesit-simple-indent-presets): Fix ...
2022-12-21 06:30:10 +01:00
Yuan Fu
6d9f367ead
; * lisp/treesit.el (treesit-simple-indent-presets): Fix typo. 2022-12-20 20:50:49 -08:00
Stefan Kangas
6c540e38f4 Merge from origin/emacs-29
12e26cc0c1 ; * admin/git-bisect-start: Add mistakenly ommitted commi...
9a751e0a38 ruby-mode: Support endless singleton method definitions too
ce7b7e5af3 Remove comment-start-skip preset in tree-sitter indentati...
c1e015ae32 Fix recent change in tramp-smb.el
cf1b771864 ; * etc/NEWS: Fix typos.
50d18bb6ea Make tramp-archive autoloads robust for older Emacs versions
3941cc29df ; Improve documentation of 'setopt'
6f88de109c ruby-mode: Support endless methods (bug#54702)
91dd893e34 ; * lisp/progmodes/sql.el (sql-product-interactive): Doc ...
138d9dc4cb * lisp/cus-edit.el (setopt--set): Warn instead of rasing ...
d1e0542f33 Allow customising windmove user options with an empty prefix
c2375e7791 Improve and extend admin/git-bisect-start
7cc2313eb0 Make 'rmail-summary-by-thread' faster
88e59b16cb ; Improve documentation of installing tree-sitter and gra...
897f33bf31 Fix the MS-DOS build
660e941235 Avoid crashes in PGTK build due to signal in 'note_mouse_...
0fc5fb2d05 Fix MS-Windows build broken by recent treesit.c changes
5b2e6d04ce Fix wrong capture in typescript-ts-mode (bug#60167)
cb8ccdd267 Add rust-ts-mode (Bug#60136)
9fcf764dd7 Indentation fixes for jsx/tsx (bug#60169)
69f2c71135 Fix treesit-query-validate problem with view-mode
1fc7535546 Use cursor API in treesit-node-parent
5f0286c0af Switch to use cursor API in treesit.c
a275e436df Add treesit_assume_true and treesit_cursor_helper
a54c7a8df0 Remove file-exists-in-trash-p
3e02029642 Update to Org 9.6-49-g47d129
4a8ff671b0 Don’t assume make-directory handler returns nil
44c83b239d Fix copy-directory bug when dest dir exists
bef1edc9ca make-directory now returns t if dir already exists
8a9579ca29 Use make-directory handlers uniformly
627e7e0243 Improve documentation of 'file-exists-p'
c9015ef55f Fix resizing of mini-windows by 'set-minibuffer-message'
5a245bc786 Prevent Abort dialogs from async-compiling jobs on Windows
4d1e4a4893 Fix 'window-max-chars-per-line' when there are no fringes
d65beb820c ; Revert "; * lisp/subr.el (internal--with-narrowing): Si...
1c0b90e5f7 ruby-mode: Recognize instance or global var as first arg ...
3356c0cb16 Fix end-of-defun in ruby-mode

# Conflicts:
#	etc/NEWS
2022-12-19 04:42:19 +01:00
Stefan Kangas
690724f0f1 Merge from origin/emacs-29
67bc96c9d9 Remove treesit-defun-prefer-top-level and friends
4f9bccef55 Add yaml-ts-mode (Bug#60105)
f9cb144d45 Fix indentation in json-ts-mode (bug#60123)
3d348c46e7 ; Handle nil ARG in treesit-beginning/end-of-defun
1a66435dda New input method 'cyrillic-chuvash'
b9227c502d ; Improve wording of 'format' doc string
2022-12-19 04:42:18 +01:00