aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPo Lu2023-06-17 17:18:41 +0800
committerPo Lu2023-06-17 17:18:41 +0800
commitbf3bea4460418b82c6de4668659447118fb2de2b (patch)
tree49a9e86b83e03db77301e2601599c7b12ceab9cf
parent797c30b7abc165d5ebe65474c7398ccad0e3023c (diff)
parentb51be64a715f9f00d3f413aff4ee8a10d30d2a04 (diff)
downloademacs-bf3bea4460418b82c6de4668659447118fb2de2b.tar.gz
emacs-bf3bea4460418b82c6de4668659447118fb2de2b.zip
Merge remote-tracking branch 'origin/master' into feature/android
-rw-r--r--doc/emacs/indent.texi6
-rw-r--r--doc/emacs/macos.texi12
-rw-r--r--doc/emacs/programs.texi19
-rw-r--r--doc/lispintro/emacs-lisp-intro.texi7
-rw-r--r--doc/lispref/control.texi2
-rw-r--r--doc/lispref/debugging.texi2
-rw-r--r--doc/lispref/display.texi12
-rw-r--r--doc/lispref/functions.texi16
-rw-r--r--doc/lispref/internals.texi2
-rw-r--r--doc/lispref/modes.texi124
-rw-r--r--doc/lispref/parsing.texi303
-rw-r--r--doc/lispref/positions.texi21
-rw-r--r--doc/lispref/processes.texi4
-rw-r--r--doc/lispref/searching.texi2
-rw-r--r--doc/lispref/text.texi4
-rw-r--r--doc/lispref/windows.texi2
-rw-r--r--doc/misc/calc.texi24
-rw-r--r--doc/misc/cc-mode.texi18
-rw-r--r--doc/misc/dbus.texi20
-rw-r--r--doc/misc/ede.texi18
-rw-r--r--doc/misc/ert.texi14
-rw-r--r--doc/misc/eudc.texi16
-rw-r--r--doc/misc/eww.texi4
-rw-r--r--doc/misc/flymake.texi32
-rw-r--r--doc/misc/gnus.texi58
-rw-r--r--doc/misc/tramp.texi2
-rw-r--r--doc/misc/use-package.texi2
-rw-r--r--lisp/apropos.el3
-rw-r--r--lisp/dired.el11
-rw-r--r--lisp/minibuffer.el6
-rw-r--r--lisp/newcomment.el9
-rw-r--r--lisp/nxml/xmltok.el2
-rw-r--r--lisp/progmodes/c-ts-mode.el2
-rw-r--r--lisp/progmodes/cmake-ts-mode.el3
-rw-r--r--lisp/progmodes/java-ts-mode.el4
-rw-r--r--lisp/progmodes/js.el4
-rw-r--r--lisp/progmodes/python.el2
-rw-r--r--lisp/progmodes/rust-ts-mode.el12
-rw-r--r--lisp/progmodes/sh-script.el2
-rw-r--r--lisp/progmodes/typescript-ts-mode.el4
-rw-r--r--lisp/simple.el5
-rw-r--r--lisp/subr.el2
-rw-r--r--lisp/textmodes/tex-mode.el6
-rw-r--r--lisp/treesit.el56
-rw-r--r--lisp/window.el8
-rw-r--r--src/dbusbind.c2
-rw-r--r--src/lread.c2
-rw-r--r--src/xdisp.c2
-rw-r--r--test/lisp/minibuffer-tests.el15
-rw-r--r--test/src/treesit-tests.el4
50 files changed, 515 insertions, 397 deletions
diff --git a/doc/emacs/indent.texi b/doc/emacs/indent.texi
index 95ad726828d..17b663d22e1 100644
--- a/doc/emacs/indent.texi
+++ b/doc/emacs/indent.texi
@@ -127,10 +127,10 @@ that column number.
127@kindex C-x TAB 127@kindex C-x TAB
128@findex indent-rigidly 128@findex indent-rigidly
129@cindex remove indentation 129@cindex remove indentation
130This command is used to change the indentation of all lines that begin 130Indent all lines that begin in the region, moving the affected lines
131in the region, moving the affected lines as a rigid unit. 131as a rigid unit (@code{indent-rigidly}).
132 132
133If called with no argument, the command activates a transient mode for 133If called with no argument, this command activates a transient mode for
134adjusting the indentation of the affected lines interactively. While 134adjusting the indentation of the affected lines interactively. While
135this transient mode is active, typing @kbd{@key{LEFT}} or 135this transient mode is active, typing @kbd{@key{LEFT}} or
136@kbd{@key{RIGHT}} indents leftward and rightward, respectively, by one 136@kbd{@key{RIGHT}} indents leftward and rightward, respectively, by one
diff --git a/doc/emacs/macos.texi b/doc/emacs/macos.texi
index 9f2c4721cab..18811291a9e 100644
--- a/doc/emacs/macos.texi
+++ b/doc/emacs/macos.texi
@@ -177,10 +177,10 @@ These variables only apply to macOS 10.7 (Lion) and above.
177@vindex ns-use-mwheel-acceleration 177@vindex ns-use-mwheel-acceleration
178@item ns-use-mwheel-acceleration 178@item ns-use-mwheel-acceleration
179This variable controls whether Emacs ignores the system mousewheel 179This variable controls whether Emacs ignores the system mousewheel
180acceleration. When nil each `click' of the mousewheel will correspond 180acceleration. When @code{nil} each `click' of the mousewheel will
181exactly with one mousewheel event. When non-@code{nil}, the default, each 181correspond exactly with one mousewheel event. When non-@code{nil},
182`click' may correspond with more than one mousewheel event, depending 182the default, each `click' may correspond with more than one mousewheel
183on the user's input. 183event, depending on the user's input.
184 184
185@vindex ns-use-mwheel-momentum 185@vindex ns-use-mwheel-momentum
186@item ns-use-mwheel-momentum 186@item ns-use-mwheel-momentum
@@ -194,8 +194,8 @@ while after the user has lifted their fingers off the trackpad.
194This variable controls the sensitivity of scrolling with the trackpad. 194This variable controls the sensitivity of scrolling with the trackpad.
195Apple trackpads scroll by pixels, not lines, so Emacs converts the 195Apple trackpads scroll by pixels, not lines, so Emacs converts the
196system's pixel values into lines. When set to a number, this variable 196system's pixel values into lines. When set to a number, this variable
197sets the number of pixels Emacs will consider as one line. When nil 197sets the number of pixels Emacs will consider as one line. When
198or a non-number the default line height is used. 198@code{nil} or a non-number the default line height is used.
199 199
200Setting a lower number makes the trackpad more sensitive, and a higher 200Setting a lower number makes the trackpad more sensitive, and a higher
201number makes the trackpad less sensitive. 201number makes the trackpad less sensitive.
diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi
index 62df88a731e..953de2e4786 100644
--- a/doc/emacs/programs.texi
+++ b/doc/emacs/programs.texi
@@ -1174,14 +1174,17 @@ were negated.
1174 1174
1175@findex comment-kill 1175@findex comment-kill
1176@kindex C-u M-; 1176@kindex C-u M-;
1177 @kbd{C-u M-;} (@code{comment-dwim} with a prefix argument) kills any 1177 @kbd{C-u M-;} (@code{comment-dwim} with a prefix argument) when the
1178comment on the current line, along with the whitespace before it. 1178region is not active kills any comment on the current line, along with
1179Since the comment is saved to the kill ring, you can reinsert it on 1179the whitespace before it. Since the comment is saved to the kill
1180another line by moving to the end of that line, doing @kbd{C-y}, and 1180ring, you can reinsert it on another line by moving to the end of that
1181then @kbd{M-;} to realign the comment. You can achieve the same 1181line, doing @kbd{C-y}, and then @kbd{M-;} to realign the comment. You
1182effect as @kbd{C-u M-;} by typing @kbd{M-x comment-kill} 1182can achieve the same effect as @kbd{C-u M-;} by typing @kbd{M-x
1183(@code{comment-dwim} actually calls @code{comment-kill} as a 1183comment-kill} (@code{comment-dwim} actually calls @code{comment-kill}
1184subroutine when it is given a prefix argument). 1184as a subroutine when it is given a prefix argument). Invoking
1185@code{comment-dwim} with a prefix numeric argument, as in @w{@kbd{C-u
1186@var{n} M-;}}, when there's no active region, tells
1187@code{comment-kill} to kill comments on @var{n} lines.
1185 1188
1186@kindex C-c C-c @r{(C mode)} 1189@kindex C-c C-c @r{(C mode)}
1187@findex comment-region 1190@findex comment-region
diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi
index 6447ff74bc9..37ef6133fb4 100644
--- a/doc/lispintro/emacs-lisp-intro.texi
+++ b/doc/lispintro/emacs-lisp-intro.texi
@@ -8115,10 +8115,9 @@ than one error handler. When an error occurs, the first applicable
8115handler is run. 8115handler is run.
8116 8116
8117Lastly, the first argument to the @code{condition-case} expression, 8117Lastly, the first argument to the @code{condition-case} expression,
8118the @var{var} argument, is sometimes bound to a variable that 8118the @var{var} argument, is sometimes bound to a variable that contains
8119contains information about the error. However, if that argument is 8119information about the error. However, if that argument is @code{nil},
8120nil, as is the case in @code{kill-region}, that information is 8120as is the case in @code{kill-region}, that information is discarded.
8121discarded.
8122 8121
8123@need 1200 8122@need 1200
8124In brief, in the @code{kill-region} function, the code 8123In brief, in the @code{kill-region} function, the code
diff --git a/doc/lispref/control.texi b/doc/lispref/control.texi
index e621a28acda..3aee9dd80e4 100644
--- a/doc/lispref/control.texi
+++ b/doc/lispref/control.texi
@@ -694,7 +694,7 @@ contain the following constructs:
694@item (let @var{ref} @var{rx-expr}@dots{}) 694@item (let @var{ref} @var{rx-expr}@dots{})
695Bind the symbol @var{ref} to a submatch that matches 695Bind the symbol @var{ref} to a submatch that matches
696@var{rx-expr}@enddots{}. @var{ref} is bound in @var{body-forms} to 696@var{rx-expr}@enddots{}. @var{ref} is bound in @var{body-forms} to
697the string of the submatch or nil, but can also be used in 697the string of the submatch or @code{nil}, but can also be used in
698@code{backref}. 698@code{backref}.
699 699
700@item (backref @var{ref}) 700@item (backref @var{ref})
diff --git a/doc/lispref/debugging.texi b/doc/lispref/debugging.texi
index d2e4f687f64..ea11d2d8d9c 100644
--- a/doc/lispref/debugging.texi
+++ b/doc/lispref/debugging.texi
@@ -740,7 +740,7 @@ of @code{debug} (@pxref{Invoking the Debugger}).
740@cindex call stack 740@cindex call stack
741This function prints a trace of Lisp function calls currently active. 741This function prints a trace of Lisp function calls currently active.
742The trace is identical to the one that @code{debug} would show in the 742The trace is identical to the one that @code{debug} would show in the
743@file{*Backtrace*} buffer. The return value is always nil. 743@file{*Backtrace*} buffer. The return value is always @code{nil}.
744 744
745In the following example, a Lisp expression calls @code{backtrace} 745In the following example, a Lisp expression calls @code{backtrace}
746explicitly. This prints the backtrace to the stream 746explicitly. This prints the backtrace to the stream
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index f91a2715bca..e44b4aeb235 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -6531,7 +6531,7 @@ specified, draw a polyline.
6531@deffn Command horizontal-lineto x-coordinates 6531@deffn Command horizontal-lineto x-coordinates
6532Draw a horizontal line from the current point to the first element in 6532Draw a horizontal line from the current point to the first element in
6533@var{x-coordinates}. Specifying multiple coordinates is possible, 6533@var{x-coordinates}. Specifying multiple coordinates is possible,
6534although usually this doesn’t make sense. 6534although this usually doesn't make sense.
6535 6535
6536@lisp 6536@lisp
6537(svg-path svg '((moveto ((100 . 200))) 6537(svg-path svg '((moveto ((100 . 200)))
@@ -6555,7 +6555,7 @@ Using the first element in @var{coordinate-sets}, draw a cubic Bézier
6555curve from the current point. If there are multiple coordinate sets, 6555curve from the current point. If there are multiple coordinate sets,
6556draw a polybezier. Each coordinate set is a list of the form 6556draw a polybezier. Each coordinate set is a list of the form
6557@code{(@var{x1} @var{y1} @var{x2} @var{y2} @var{x} @var{y})}, where 6557@code{(@var{x1} @var{y1} @var{x2} @var{y2} @var{x} @var{y})}, where
6558@w{(@var{x}, @var{y})} is the curve’s end point. @w{(@var{x1}, 6558@w{(@var{x}, @var{y})} is the curve's end point. @w{(@var{x1},
6559@var{y1})} and @w{(@var{x2}, @var{y2})} are control points at the 6559@var{y1})} and @w{(@var{x2}, @var{y2})} are control points at the
6560beginning and at the end, respectively. 6560beginning and at the end, respectively.
6561 6561
@@ -6572,7 +6572,7 @@ Using the first element in @var{coordinate-sets}, draw a cubic Bézier
6572curve from the current point. If there are multiple coordinate sets, 6572curve from the current point. If there are multiple coordinate sets,
6573draw a polybezier. Each coordinate set is a list of the form 6573draw a polybezier. Each coordinate set is a list of the form
6574@code{(@var{x2} @var{y2} @var{x} @var{y})}, where @w{(@var{x}, 6574@code{(@var{x2} @var{y2} @var{x} @var{y})}, where @w{(@var{x},
6575@var{y})} is the curve’s end point and @w{(@var{x2}, @var{y2})} is the 6575@var{y})} is the curve's end point and @w{(@var{x2}, @var{y2})} is the
6576corresponding control point. The first control point is the 6576corresponding control point. The first control point is the
6577reflection of the second control point of the previous command 6577reflection of the second control point of the previous command
6578relative to the current point, if that command was @command{curveto} 6578relative to the current point, if that command was @command{curveto}
@@ -6592,7 +6592,7 @@ Using the first element in @var{coordinate-sets}, draw a quadratic
6592Bézier curve from the current point. If there are multiple coordinate 6592Bézier curve from the current point. If there are multiple coordinate
6593sets, draw a polybezier. Each coordinate set is a list of the form 6593sets, draw a polybezier. Each coordinate set is a list of the form
6594@code{(@var{x1} @var{y1} @var{x} @var{y})}, where @w{(@var{x}, 6594@code{(@var{x1} @var{y1} @var{x} @var{y})}, where @w{(@var{x},
6595@var{y})} is the curve’s end point and @w{(@var{x1}, @var{y1})} is the 6595@var{y})} is the curve's end point and @w{(@var{x1}, @var{y1})} is the
6596control point. 6596control point.
6597 6597
6598@lisp 6598@lisp
@@ -6609,7 +6609,7 @@ control point.
6609Using the first element in @var{coordinate-sets}, draw a quadratic 6609Using the first element in @var{coordinate-sets}, draw a quadratic
6610Bézier curve from the current point. If there are multiple coordinate 6610Bézier curve from the current point. If there are multiple coordinate
6611sets, draw a polybezier. Each coordinate set is a list of the form 6611sets, draw a polybezier. Each coordinate set is a list of the form
6612@code{(@var{x} @var{y})}, where @w{(@var{x}, @var{y})} is the curve’s 6612@code{(@var{x} @var{y})}, where @w{(@var{x}, @var{y})} is the curve's
6613end point. The control point is the reflection of the control point 6613end point. The control point is the reflection of the control point
6614of the previous command relative to the current point, if that command 6614of the previous command relative to the current point, if that command
6615was @command{quadratic-bezier-curveto} or 6615was @command{quadratic-bezier-curveto} or
@@ -7270,7 +7270,7 @@ window.
7270@item :width 7270@item :width
7271This is only valid for @code{image} icons, and can be either a number 7271This is only valid for @code{image} icons, and can be either a number
7272(which specifies the width in pixels), or the symbol @code{font}, 7272(which specifies the width in pixels), or the symbol @code{font},
7273which will use the width in pixels of the current buffer’s default 7273which will use the width in pixels of the current buffer's default
7274face font. 7274face font.
7275@end table 7275@end table
7276 7276
diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi
index a94fdee1d82..af116f62973 100644
--- a/doc/lispref/functions.texi
+++ b/doc/lispref/functions.texi
@@ -2614,14 +2614,18 @@ be passed to @code{gv-define-setter}.
2614 2614
2615@item (completion @var{completion-predicate}) 2615@item (completion @var{completion-predicate})
2616Declare @var{completion-predicate} as a function to determine whether 2616Declare @var{completion-predicate} as a function to determine whether
2617to include the symbol in the list of functions when asking for 2617to include a function's symbol in the list of functions when asking
2618completions in @kbd{M-x}. @var{completion-predicate} is called with 2618for completions in @kbd{M-x}. This predicate function will only be
2619two parameters: The first parameter is the symbol, and the second is 2619called when @code{read-extended-command-predicate} is customized to
2620the current buffer. 2620@code{command-completion-default-include-p}; by default the value of
2621@code{read-extended-command-predicate} is nil (@pxref{Interactive
2622Call, execute-extended-command}). The predicate
2623@var{completion-predicate} is called with two arguments: the
2624function's symbol and the current buffer.
2621 2625
2622@item (modes @var{modes}) 2626@item (modes @var{modes})
2623Specify that this command is meant to be applicable for @var{modes} 2627Specify that this command is meant to be applicable only to specified
2624only. 2628@var{modes}. @xref{Command Modes}.
2625 2629
2626@item (interactive-args @var{arg} ...) 2630@item (interactive-args @var{arg} ...)
2627Specify the arguments that should be stored for @code{repeat-command}. 2631Specify the arguments that should be stored for @code{repeat-command}.
diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi
index 9928361f7b2..0951e60433a 100644
--- a/doc/lispref/internals.texi
+++ b/doc/lispref/internals.texi
@@ -248,7 +248,7 @@ time it took to restore the Emacs state. The value is an alist
248where @var{file} is the name of the dump file, and @var{time} is the 248where @var{file} is the name of the dump file, and @var{time} is the
249time in seconds it took to restore the state from the dump file. 249time in seconds it took to restore the state from the dump file.
250If the current session was not restored from a dump file, the 250If the current session was not restored from a dump file, the
251value is nil. 251value is @code{nil}.
252@end defun 252@end defun
253 253
254@node Pure Storage 254@node Pure Storage
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi
index d2a05fe29e4..3bb3ae9b939 100644
--- a/doc/lispref/modes.texi
+++ b/doc/lispref/modes.texi
@@ -2931,13 +2931,13 @@ nodes that belong to @var{category}. @var{pred} should be either
2931return non-@code{nil} if the node is a valid node for @var{category}, 2931return non-@code{nil} if the node is a valid node for @var{category},
2932or @code{nil} if not. 2932or @code{nil} if not.
2933 2933
2934@var{category} could also be @code{nil}. In which case the entries 2934@var{category} could also be @code{nil}, in which case the entries
2935matched by @var{regexp} and @var{pred} are not grouped under 2935matched by @var{regexp} and @var{pred} are not grouped under
2936@var{category}. 2936@var{category}.
2937 2937
2938@var{name-fn} should be either @var{nil} or a function that takes a 2938@var{name-fn} should be either @code{nil} or a function that takes a
2939defun node and returns the name of that defun, e.g., the function name 2939defun node and returns the name of that defun, e.g., the function name
2940for a function definition. If @var{name-fn} is @var{nil}, 2940for a function definition. If @var{name-fn} is @code{nil},
2941@code{treesit-defun-name} (@pxref{Tree-sitter Major Modes}) is used 2941@code{treesit-defun-name} (@pxref{Tree-sitter Major Modes}) is used
2942instead. 2942instead.
2943 2943
@@ -3456,7 +3456,7 @@ This condition matches any element of Font Lock keywords for which
3456non-@code{nil}. 3456non-@code{nil}.
3457 3457
3458@item @code{(not @var{condition})} 3458@item @code{(not @var{condition})}
3459This matches if @var{condition} doesn’t. 3459This matches if @var{condition} doesn't.
3460 3460
3461@item @code{(and @var{condition} @dots{})} 3461@item @code{(and @var{condition} @dots{})}
3462This matches if each of the @var{condition}s matches. 3462This matches if each of the @var{condition}s matches.
@@ -4079,7 +4079,7 @@ Source}) for this purpose.
4079 4079
4080Parser-based font lock and other font lock mechanisms are not mutually 4080Parser-based font lock and other font lock mechanisms are not mutually
4081exclusive. By default, if enabled, parser-based font lock runs first, 4081exclusive. By default, if enabled, parser-based font lock runs first,
4082replacing syntactic font lock, then the regexp-based font lock. 4082replacing syntactic font lock, followed by regexp-based font lock.
4083 4083
4084Although parser-based font lock doesn't share the same customization 4084Although parser-based font lock doesn't share the same customization
4085variables with regexp-based font lock, it uses similar customization 4085variables with regexp-based font lock, it uses similar customization
@@ -4112,7 +4112,7 @@ would be highlighted in @code{font-lock-keyword} face.
4112For more information about queries, patterns, and capture names, see 4112For more information about queries, patterns, and capture names, see
4113@ref{Pattern Matching}. 4113@ref{Pattern Matching}.
4114 4114
4115To setup tree-sitter fontification, a major mode should first set 4115To set up tree-sitter fontification, a major mode should first set
4116@code{treesit-font-lock-settings} with the output of 4116@code{treesit-font-lock-settings} with the output of
4117@code{treesit-font-lock-rules}, then call 4117@code{treesit-font-lock-rules}, then call
4118@code{treesit-major-mode-setup}. 4118@code{treesit-major-mode-setup}.
@@ -4139,15 +4139,15 @@ example:
4139 4139
4140This function takes a series of @var{query-spec}s, where each 4140This function takes a series of @var{query-spec}s, where each
4141@var{query-spec} is a @var{query} preceded by one or more 4141@var{query-spec} is a @var{query} preceded by one or more
4142@var{:keyword}/@var{value} pairs. Each @var{query} is a 4142@var{keyword}/@var{value} pairs. Each @var{query} is a tree-sitter
4143tree-sitter query in either the string, s-expression or compiled form. 4143query in either the string, s-expression, or compiled form.
4144 4144
4145@c FIXME: Cross-ref treesit-font-lock-level to user manual. 4145@c FIXME: Cross-ref treesit-font-lock-level to user manual.
4146For each @var{query}, the @var{:keyword}/@var{value} pairs that 4146For each @var{query}, the @var{keyword}/@var{value} pairs that precede
4147precede it add meta information to it. The @code{:language} keyword 4147it add meta information to it. The @code{:language} keyword declares
4148declares @var{query}'s language. The @code{:feature} keyword sets the 4148@var{query}'s language. The @code{:feature} keyword sets the feature
4149feature name of @var{query}. Users can control which features are 4149name of @var{query}. Users can control which features are enabled
4150enabled with @code{treesit-font-lock-level} and 4150with @code{treesit-font-lock-level} and
4151@code{treesit-font-lock-feature-list} (described below). These two 4151@code{treesit-font-lock-feature-list} (described below). These two
4152keywords are mandatory. 4152keywords are mandatory.
4153 4153
@@ -4155,9 +4155,9 @@ Other keywords are optional:
4155 4155
4156@multitable @columnfractions .15 .15 .6 4156@multitable @columnfractions .15 .15 .6
4157@headitem Keyword @tab Value @tab Description 4157@headitem Keyword @tab Value @tab Description
4158@item @code{:override} @tab nil 4158@item @code{:override} @tab @code{nil}
4159@tab If the region already has a face, discard the new face 4159@tab If the region already has a face, discard the new face
4160@item @tab t @tab Always apply the new face 4160@item @tab @code{t} @tab Always apply the new face
4161@item @tab @code{append} @tab Append the new face to existing ones 4161@item @tab @code{append} @tab Append the new face to existing ones
4162@item @tab @code{prepend} @tab Prepend the new face to existing ones 4162@item @tab @code{prepend} @tab Prepend the new face to existing ones
4163@item @tab @code{keep} @tab Fill-in regions without an existing face 4163@item @tab @code{keep} @tab Fill-in regions without an existing face
@@ -4171,11 +4171,11 @@ fontification, capture names in @var{query} should be face names like
4171with that face. 4171with that face.
4172 4172
4173@findex treesit-fontify-with-override 4173@findex treesit-fontify-with-override
4174Capture names can also be function names, in which case the function 4174A capture name can also be a function name, in which case the function
4175is called with 4 arguments: @var{node} and @var{override}, @var{start} 4175is called with 4 arguments: @var{node} and @var{override}, @var{start}
4176and @var{end}, where @var{node} is the node itself, @var{override} is 4176and @var{end}, where @var{node} is the node itself, @var{override} is
4177the override property of the rule which captured this node, and 4177the @code{:override} property of the rule which captured this node,
4178@var{start} and @var{end} limits the region in which this function 4178and @var{start} and @var{end} limit the region which this function
4179should fontify. (If this function wants to respect the @var{override} 4179should fontify. (If this function wants to respect the @var{override}
4180argument, it can use @code{treesit-fontify-with-override}.) 4180argument, it can use @code{treesit-fontify-with-override}.)
4181 4181
@@ -4211,9 +4211,9 @@ Some of these features warrant some explanation: @code{definition}
4211highlights whatever is being defined, e.g., the function name in a 4211highlights whatever is being defined, e.g., the function name in a
4212function definition, the struct name in a struct definition, the 4212function definition, the struct name in a struct definition, the
4213variable name in a variable definition; @code{assignment} highlights 4213variable name in a variable definition; @code{assignment} highlights
4214the whatever is being assigned to, e.g., the variable or field in an 4214whatever is being assigned to, e.g., the variable or field in an
4215assignment statement; @code{key} highlights keys in key-value pairs, 4215assignment statement; @code{key} highlights keys in key-value pairs,
4216e.g., keys in a JSON object, or a Python dictionary; @code{doc} 4216e.g., keys in a JSON object or Python dictionary; @code{doc}
4217highlights docstrings or doc-comments. 4217highlights docstrings or doc-comments.
4218 4218
4219For example, the value of this variable could be: 4219For example, the value of this variable could be:
@@ -4987,7 +4987,7 @@ source indentation commands. For maximum flexibility, it is possible
4987to write a custom indentation function that queries the syntax tree 4987to write a custom indentation function that queries the syntax tree
4988and indents accordingly for each language, but that is a lot of work. 4988and indents accordingly for each language, but that is a lot of work.
4989It is more convenient to use the simple indentation engine described 4989It is more convenient to use the simple indentation engine described
4990below: then the major mode needs only to write some indentation rules 4990below: then the major mode needs only write some indentation rules,
4991and the engine takes care of the rest. 4991and the engine takes care of the rest.
4992 4992
4993To enable the parser-based indentation engine, either set 4993To enable the parser-based indentation engine, either set
@@ -5006,10 +5006,11 @@ more complex indentation engines.
5006@cindex indentation rules, for parser-based indentation 5006@cindex indentation rules, for parser-based indentation
5007 5007
5008@defvar treesit-simple-indent-rules 5008@defvar treesit-simple-indent-rules
5009This local variable stores indentation rules for every language. It is 5009This local variable stores indentation rules for every language. It
5010a list of the form: @w{@code{(@var{language} . @var{rules})}}, where 5010is an alist with elements of the form @w{@code{(@var{language}
5011@var{language} is a language symbol, and @var{rules} is a list of the 5011. @var{rules})}}, where @var{language} is a language symbol, and
5012form @w{@code{(@var{matcher} @var{anchor} @var{offset})}}. 5012@var{rules} is a list with elements of the form
5013@w{@code{(@var{matcher} @var{anchor} @var{offset})}}.
5013 5014
5014First, Emacs passes the smallest tree-sitter node at the beginning of 5015First, Emacs passes the smallest tree-sitter node at the beginning of
5015the current line to @var{matcher}; if it returns non-@code{nil}, this 5016the current line to @var{matcher}; if it returns non-@code{nil}, this
@@ -5043,14 +5044,14 @@ anchors.
5043 5044
5044@defvar treesit-simple-indent-presets 5045@defvar treesit-simple-indent-presets
5045This is a list of defaults for @var{matcher}s and @var{anchor}s in 5046This is a list of defaults for @var{matcher}s and @var{anchor}s in
5046@code{treesit-simple-indent-rules}. Each of them represents a function 5047@code{treesit-simple-indent-rules}. Each of them represents a
5047that takes 3 arguments: @var{node}, @var{parent} and @var{bol}. The 5048function that takes 3 arguments: @var{node}, @var{parent}, and
5048available default functions are: 5049@var{bol}. The available default functions are:
5049 5050
5050@ftable @code 5051@ftable @code
5051@item no-node 5052@item no-node
5052This matcher is a function that is called with 3 arguments: 5053This matcher is a function that is called with 3 arguments:
5053@var{node}, @var{parent}, and @var{bol}, and returns non-@code{nil}, 5054@var{node}, @var{parent}, and @var{bol}. It returns non-@code{nil},
5054indicating a match, if @var{node} is @code{nil}, i.e., there is no 5055indicating a match, if @var{node} is @code{nil}, i.e., there is no
5055node that starts at @var{bol}. This is the case when @var{bol} is on 5056node that starts at @var{bol}. This is the case when @var{bol} is on
5056an empty line or inside a multi-line string, etc. 5057an empty line or inside a multi-line string, etc.
@@ -5067,6 +5068,12 @@ function that is called with 3 arguments: @var{node}, @var{parent},
5067and @var{bol}, and returns non-@code{nil} if @var{node}'s type matches 5068and @var{bol}, and returns non-@code{nil} if @var{node}'s type matches
5068regexp @var{type}. 5069regexp @var{type}.
5069 5070
5071@item field-is
5072This matcher is a function of one argument, @var{name}; it returns a
5073function that is called with 3 arguments: @var{node}, @var{parent},
5074and @var{bol}, and returns non-@code{nil} if @var{node}'s field name
5075in @var{parent} matches regexp @var{name}.
5076
5070@item query 5077@item query
5071This matcher is a function of one argument, @var{query}; it returns a 5078This matcher is a function of one argument, @var{query}; it returns a
5072function that is called with 3 arguments: @var{node}, @var{parent}, 5079function that is called with 3 arguments: @var{node}, @var{parent},
@@ -5107,30 +5114,53 @@ of @var{node-type}, @var{parent-type}, and @var{grandparent-type} is
5107@item comment-end 5114@item comment-end
5108This matcher is a function that is called with 3 arguments: 5115This matcher is a function that is called with 3 arguments:
5109@var{node}, @var{parent}, and @var{bol}, and returns non-@code{nil} if 5116@var{node}, @var{parent}, and @var{bol}, and returns non-@code{nil} if
5110point is before a comment ending token. Comment ending tokens are 5117point is before a comment-ending token. Comment-ending tokens are
5111defined by regular expression @code{comment-end-skip} 5118defined by regexp @code{comment-end-skip}.
5119
5120@item catch-all
5121This matcher is a function that is called with 3 arguments:
5122@var{node}, @var{parent}, and @var{bol}. It always returns
5123non-@code{nil}, indicating a match.
5112 5124
5113@item first-sibling 5125@item first-sibling
5114This anchor is a function that is called with 3 arguments: @var{node}, 5126This anchor is a function that is called with 3 arguments: @var{node},
5115@var{parent}, and @var{bol}, and returns the start of the first child 5127@var{parent}, and @var{bol}, and returns the start of the first child
5116of @var{parent}. 5128of @var{parent}.
5117 5129
5130@item nth-sibling
5131This anchor is a function of two arguments: @var{n}, and an optional
5132argument @var{named}. It returns a function that is called with 3
5133arguments: @var{node}, @var{parent}, and @var{bol}, and returns the
5134start of the @var{n}th child of @var{parent}. If @var{named} is
5135non-@code{nil}, only named children are counted (@pxref{tree-sitter
5136named node, named node}).
5137
5118@item parent 5138@item parent
5119This anchor is a function that is called with 3 arguments: @var{node}, 5139This anchor is a function that is called with 3 arguments: @var{node},
5120@var{parent}, and @var{bol}, and returns the start of @var{parent}. 5140@var{parent}, and @var{bol}, and returns the start of @var{parent}.
5121 5141
5142@item grand-parent
5143This anchor is a function that is called with 3 arguments: @var{node},
5144@var{parent}, and @var{bol}, and returns the start of @var{parent}'s
5145parent.
5146
5147@item great-grand-parent
5148This anchor is a function that is called with 3 arguments: @var{node},
5149@var{parent}, and @var{bol}, and returns the start of @var{parent}'s
5150parent's parent.
5151
5122@item parent-bol 5152@item parent-bol
5123This anchor is a function that is called with 3 arguments: @var{node}, 5153This anchor is a function that is called with 3 arguments: @var{node},
5124@var{parent}, and @var{bol}, and returns the first non-space character 5154@var{parent}, and @var{bol}, and returns the first non-space character
5125on the line which @var{parent}'s start is on. 5155on the line which @var{parent}'s start is on.
5126 5156
5127@item parent-bol 5157@item standalone-parent
5128This anchor is a function that is called with 3 arguments: @var{node}, 5158This anchor is a function that is called with 3 arguments: @var{node},
5129@var{parent}, and @var{bol}. It finds the first ancestor node 5159@var{parent}, and @var{bol}. It finds the first ancestor node
5130(parent, grandparent, etc) of @var{node} that starts on its own line, 5160(parent, grandparent, etc.@:) of @var{node} that starts on its own
5131and return the start of that node. ``Starting on its own line'' means 5161line, and return the start of that node. ``Starting on its own line''
5132there is only whitespace character before the node on the line which 5162means there is only whitespace character before the node on the line
5133the node's start is on. 5163which the node's start is on.
5134 5164
5135@item prev-sibling 5165@item prev-sibling
5136This anchor is a function that is called with 3 arguments: @var{node}, 5166This anchor is a function that is called with 3 arguments: @var{node},
@@ -5160,14 +5190,14 @@ expression @code{comment-start-skip}. This function assumes
5160 5190
5161@item prev-adaptive-prefix 5191@item prev-adaptive-prefix
5162This anchor is a function that is called with 3 arguments: @var{node}, 5192This anchor is a function that is called with 3 arguments: @var{node},
5163@var{parent}, and @var{bol}. It tries to go to the beginning of the 5193@var{parent}, and @var{bol}. It tries to match
5164previous non-empty line, and matches @code{adaptive-fill-regexp}. If 5194@code{adaptive-fill-regexp} to the text at the beginning of the
5165there is a match, this function returns the end of the match, 5195previous non-empty line. If there is a match, this function returns
5166otherwise it returns nil. However, if the current line begins with a 5196the end of the match, otherwise it returns @code{nil}. However, if
5167prefix (e.g., ``-''), return the beginning of the prefix of the 5197the current line begins with a prefix (e.g., @samp{-}), return the
5168previous line instead, so that the two prefixes aligns. This anchor 5198beginning of the prefix of the previous line instead, so that the two
5169is useful for a @code{indent-relative}-like indent behavior for block 5199prefixes align. This anchor is useful for an
5170comments. 5200@code{indent-relative}-like indent behavior for block comments.
5171 5201
5172@end ftable 5202@end ftable
5173@end defvar 5203@end defvar
@@ -5178,14 +5208,14 @@ comments.
5178Here are some utility functions that can help writing parser-based 5208Here are some utility functions that can help writing parser-based
5179indentation rules. 5209indentation rules.
5180 5210
5181@defun treesit-check-indent mode 5211@deffn Command treesit-check-indent mode
5182This function checks the current buffer's indentation against major 5212This command checks the current buffer's indentation against major
5183mode @var{mode}. It indents the current buffer according to 5213mode @var{mode}. It indents the current buffer according to
5184@var{mode} and compares the results with the current indentation. 5214@var{mode} and compares the results with the current indentation.
5185Then it pops up a buffer showing the differences. Correct 5215Then it pops up a buffer showing the differences. Correct
5186indentation (target) is shown in green color, current indentation is 5216indentation (target) is shown in green color, current indentation is
5187shown in red color. @c Are colors customizable? faces? 5217shown in red color. @c Are colors customizable? faces?
5188@end defun 5218@end deffn
5189 5219
5190It is also helpful to use @code{treesit-inspect-mode} (@pxref{Language 5220It is also helpful to use @code{treesit-inspect-mode} (@pxref{Language
5191Grammar}) when writing indentation rules. 5221Grammar}) when writing indentation rules.
diff --git a/doc/lispref/parsing.texi b/doc/lispref/parsing.texi
index b0824faaaa2..1ec985f6d70 100644
--- a/doc/lispref/parsing.texi
+++ b/doc/lispref/parsing.texi
@@ -9,7 +9,7 @@
9Emacs provides various ways to parse program source text and produce a 9Emacs provides various ways to parse program source text and produce a
10@dfn{syntax tree}. In a syntax tree, text is no longer considered a 10@dfn{syntax tree}. In a syntax tree, text is no longer considered a
11one-dimensional stream of characters, but a structured tree of nodes, 11one-dimensional stream of characters, but a structured tree of nodes,
12where each node representing a piece of text. Thus, a syntax tree can 12where each node represents a piece of text. Thus, a syntax tree can
13enable interesting features like precise fontification, indentation, 13enable interesting features like precise fontification, indentation,
14navigation, structured editing, etc. 14navigation, structured editing, etc.
15 15
@@ -19,8 +19,8 @@ generic navigation and indentation (@pxref{SMIE}).
19 19
20In addition to those, Emacs also provides integration with 20In addition to those, Emacs also provides integration with
21@uref{https://tree-sitter.github.io/tree-sitter, the tree-sitter 21@uref{https://tree-sitter.github.io/tree-sitter, the tree-sitter
22library}) if support for it was compiled in. The tree-sitter library 22library} if support for it was compiled in. The tree-sitter library
23implements an incremental parser and has support from a wide range of 23implements an incremental parser and has support for a wide range of
24programming languages. 24programming languages.
25 25
26@defun treesit-available-p 26@defun treesit-available-p
@@ -65,10 +65,10 @@ For example, the C language grammar is represented as the symbol
65 65
66@vindex treesit-extra-load-path 66@vindex treesit-extra-load-path
67@vindex treesit-load-language-error 67@vindex treesit-load-language-error
68Tree-sitter language grammar are distributed as dynamic libraries. 68Tree-sitter language grammars are distributed as dynamic libraries.
69In order to use a language grammar in Emacs, you need to make sure 69In order to use a language grammar in Emacs, you need to make sure
70that the dynamic library is installed on the system. Emacs looks for 70that the dynamic library is installed on the system. Emacs looks for
71language grammar in several places, in the following order: 71language grammars in several places, in the following order:
72 72
73@itemize @bullet 73@itemize @bullet
74@item 74@item
@@ -95,8 +95,8 @@ This means that Emacs could not find the language grammar library.
95This means that Emacs could not find in the library the expected function 95This means that Emacs could not find in the library the expected function
96that every language grammar library should export. 96that every language grammar library should export.
97@item (version-mismatch @var{error-msg}) 97@item (version-mismatch @var{error-msg})
98This means that the version of language grammar library is incompatible 98This means that the version of the language grammar library is
99with that of the tree-sitter library. 99incompatible with that of the tree-sitter library.
100@end table 100@end table
101 101
102@noindent 102@noindent
@@ -105,7 +105,7 @@ details about the failure.
105 105
106@defun treesit-language-available-p language &optional detail 106@defun treesit-language-available-p language &optional detail
107This function returns non-@code{nil} if the language grammar for 107This function returns non-@code{nil} if the language grammar for
108@var{language} exist and can be loaded. 108@var{language} exists and can be loaded.
109 109
110If @var{detail} is non-@code{nil}, return @code{(t . nil)} when 110If @var{detail} is non-@code{nil}, return @code{(t . nil)} when
111@var{language} is available, and @code{(nil . @var{data})} when it's 111@var{language} is available, and @code{(nil . @var{data})} when it's
@@ -126,7 +126,7 @@ doesn't follow this convention, you should add an entry
126@end example 126@end example
127 127
128to the list in the variable @code{treesit-load-name-override-list}, where 128to the list in the variable @code{treesit-load-name-override-list}, where
129@var{library-base-name} is the basename of the dynamic library's file name, 129@var{library-base-name} is the basename of the dynamic library's file name
130(usually, @file{libtree-sitter-@var{language}}), and 130(usually, @file{libtree-sitter-@var{language}}), and
131@var{function-name} is the function provided by the library 131@var{function-name} is the function provided by the library
132(usually, @code{tree_sitter_@var{language}}). For example, 132(usually, @code{tree_sitter_@var{language}}). For example,
@@ -146,7 +146,7 @@ Application Binary Interface (@acronym{ABI}) supported by the
146tree-sitter library. By default, it returns the latest ABI version 146tree-sitter library. By default, it returns the latest ABI version
147supported by the library, but if @var{min-compatible} is 147supported by the library, but if @var{min-compatible} is
148non-@code{nil}, it returns the oldest ABI version which the library 148non-@code{nil}, it returns the oldest ABI version which the library
149still can support. language grammar libraries must be built for 149still can support. Language grammar libraries must be built for
150ABI versions between the oldest and the latest versions supported by 150ABI versions between the oldest and the latest versions supported by
151the tree-sitter library, otherwise the library will be unable to load 151the tree-sitter library, otherwise the library will be unable to load
152them. 152them.
@@ -232,11 +232,11 @@ assign @dfn{field names} to child nodes. For example, a
232@cindex explore tree-sitter syntax tree 232@cindex explore tree-sitter syntax tree
233@cindex inspection of tree-sitter parse tree nodes 233@cindex inspection of tree-sitter parse tree nodes
234 234
235To aid in understanding the syntax of a language and in debugging of 235To aid in understanding the syntax of a language and in debugging Lisp
236Lisp program that use the syntax tree, Emacs provides an ``explore'' 236programs that use the syntax tree, Emacs provides an ``explore'' mode,
237mode, which displays the syntax tree of the source in the current 237which displays the syntax tree of the source in the current buffer in
238buffer in real time. Emacs also comes with an ``inspect mode'', which 238real time. Emacs also comes with an ``inspect mode'', which displays
239displays information of the nodes at point in the mode-line. 239information of the nodes at point in the mode-line.
240 240
241@deffn Command treesit-explore-mode 241@deffn Command treesit-explore-mode
242This mode pops up a window displaying the syntax tree of the source in 242This mode pops up a window displaying the syntax tree of the source in
@@ -271,7 +271,7 @@ parser in @code{(treesit-parser-list)} (@pxref{Using Parser}).
271@heading Reading the grammar definition 271@heading Reading the grammar definition
272@cindex reading grammar definition, tree-sitter 272@cindex reading grammar definition, tree-sitter
273 273
274Authors of language grammar define the @dfn{grammar} of a 274Authors of language grammars define the @dfn{grammar} of a
275programming language, which determines how a parser constructs a 275programming language, which determines how a parser constructs a
276concrete syntax tree out of the program text. In order to use the 276concrete syntax tree out of the program text. In order to use the
277syntax tree effectively, you need to consult the @dfn{grammar file}. 277syntax tree effectively, you need to consult the @dfn{grammar file}.
@@ -283,7 +283,7 @@ home page can be found on
283homepage}. 283homepage}.
284 284
285The grammar definition is written in JavaScript. For example, the 285The grammar definition is written in JavaScript. For example, the
286rule matching a @code{function_definition} node looks like 286rule matching a @code{function_definition} node may look like
287 287
288@example 288@example
289@group 289@group
@@ -331,13 +331,13 @@ matches each rule one after another.
331@item choice(@var{rule1}, @var{rule2}, @dots{}) 331@item choice(@var{rule1}, @var{rule2}, @dots{})
332matches one of the rules in its arguments. 332matches one of the rules in its arguments.
333@item repeat(@var{rule}) 333@item repeat(@var{rule})
334matches @var{rule} for @emph{zero or more} times. 334matches @var{rule} @emph{zero or more} times.
335This is like the @samp{*} operator in regular expressions. 335This is like the @samp{*} operator in regular expressions.
336@item repeat1(@var{rule}) 336@item repeat1(@var{rule})
337matches @var{rule} for @emph{one or more} times. 337matches @var{rule} @emph{one or more} times.
338This is like the @samp{+} operator in regular expressions. 338This is like the @samp{+} operator in regular expressions.
339@item optional(@var{rule}) 339@item optional(@var{rule})
340matches @var{rule} for @emph{zero or one} time. 340matches @var{rule} @emph{zero or one} times.
341This is like the @samp{?} operator in regular expressions. 341This is like the @samp{?} operator in regular expressions.
342@item field(@var{name}, @var{rule}) 342@item field(@var{name}, @var{rule})
343assigns field name @var{name} to the child node matched by @var{rule}. 343assigns field name @var{name} to the child node matched by @var{rule}.
@@ -366,7 +366,7 @@ Nodes}.
366@item token.immediate(@var{rule}) 366@item token.immediate(@var{rule})
367Normally, grammar rules ignore preceding whitespace; this 367Normally, grammar rules ignore preceding whitespace; this
368changes @var{rule} to match only when there is no preceding 368changes @var{rule} to match only when there is no preceding
369whitespaces. 369whitespace.
370@item prec(@var{n}, @var{rule}) 370@item prec(@var{n}, @var{rule})
371gives @var{rule} the level-@var{n} precedence. 371gives @var{rule} the level-@var{n} precedence.
372@item prec.left([@var{n},] @var{rule}) 372@item prec.left([@var{n},] @var{rule})
@@ -412,7 +412,7 @@ non-@code{nil}, this function always creates a new parser.
412If that buffer is an indirect buffer, its base buffer is used instead. 412If that buffer is an indirect buffer, its base buffer is used instead.
413That is, indirect buffers use their base buffer's parsers. If the 413That is, indirect buffers use their base buffer's parsers. If the
414base buffer is narrowed, an indirect buffer might not be able to 414base buffer is narrowed, an indirect buffer might not be able to
415retrieve information of the portion of the buffer text that are 415retrieve information of the portion of the buffer text that is
416invisible in the base buffer. Lisp programs should widen as necessary 416invisible in the base buffer. Lisp programs should widen as necessary
417should they want to use a parser in an indirect buffer. 417should they want to use a parser in an indirect buffer.
418@end defun 418@end defun
@@ -441,7 +441,7 @@ change is made in the buffer, a parser doesn't re-parse immediately.
441 441
442@vindex treesit-buffer-too-large 442@vindex treesit-buffer-too-large
443When a parser does parse, it checks for the size of the buffer. 443When a parser does parse, it checks for the size of the buffer.
444Tree-sitter can only handle buffer no larger than about 4GB. If the 444Tree-sitter can only handle buffers no larger than about 4GB@. If the
445size exceeds that, Emacs signals the @code{treesit-buffer-too-large} 445size exceeds that, Emacs signals the @code{treesit-buffer-too-large}
446error with signal data being the buffer size. 446error with signal data being the buffer size.
447 447
@@ -500,13 +500,12 @@ converts text before that token into a comment. Even
500though the text is not directly edited, it is deemed to be ``changed'' 500though the text is not directly edited, it is deemed to be ``changed''
501nevertheless. 501nevertheless.
502 502
503Emacs lets a Lisp program to register callback functions 503Emacs lets a Lisp program register callback functions (a.k.a.@:
504(a.k.a.@: @dfn{notifiers}) for this kind of changes. A notifier 504@dfn{notifiers}) for these kinds of changes. A notifier function
505function takes two arguments: @var{ranges} and @var{parser}. 505takes two arguments: @var{ranges} and @var{parser}. @var{ranges} is a
506@var{ranges} is a list of cons cells of the form @w{@code{(@var{start} 506list of cons cells of the form @w{@code{(@var{start} . @var{end})}},
507. @var{end})}}, where @var{start} and @var{end} mark the start and the 507where @var{start} and @var{end} mark the start and the end positions
508end positions of a range. @var{parser} is the parser issuing the 508of a range. @var{parser} is the parser issuing the notification.
509notification.
510 509
511Every time a parser reparses a buffer, it compares the old and new 510Every time a parser reparses a buffer, it compares the old and new
512parse-tree, computes the ranges in which nodes have changed, and 511parse-tree, computes the ranges in which nodes have changed, and
@@ -537,7 +536,7 @@ This function returns the list of @var{parser}'s notifier functions.
537@cindex get node, tree-sitter 536@cindex get node, tree-sitter
538 537
539@cindex terminology, for tree-sitter functions 538@cindex terminology, for tree-sitter functions
540Here's some terminology and conventions we use when documenting 539Here are some terms and conventions we use when documenting
541tree-sitter functions. 540tree-sitter functions.
542 541
543A node in a syntax tree spans some portion of the program text in the 542A node in a syntax tree spans some portion of the program text in the
@@ -571,8 +570,8 @@ This function returns a @dfn{leaf} node at buffer position @var{pos}.
571A leaf node is a node that doesn't have any child nodes. 570A leaf node is a node that doesn't have any child nodes.
572 571
573This function tries to return a node whose span covers @var{pos}: the 572This function tries to return a node whose span covers @var{pos}: the
574node's beginning position is less or equal to @var{pos}, and the 573node's beginning position is less than or equal to @var{pos}, and the
575node's end position is greater or equal to @var{pos}. 574node's end position is greater than or equal to @var{pos}.
576 575
577If no leaf node's span covers @var{pos} (e.g., @var{pos} is in the 576If no leaf node's span covers @var{pos} (e.g., @var{pos} is in the
578whitespace between two leaf nodes), this function returns the first 577whitespace between two leaf nodes), this function returns the first
@@ -612,7 +611,7 @@ start of the node is before or at @var{beg}, and the end of the node
612is at or after @var{end}. 611is at or after @var{end}.
613 612
614@emph{Beware:} calling this function on an empty line that is not 613@emph{Beware:} calling this function on an empty line that is not
615inside any top-level construct (function definition, etc.) most 614inside any top-level construct (function definition, etc.@:) most
616probably will give you the root node, because the root node is the 615probably will give you the root node, because the root node is the
617smallest node that covers that empty line. Most of the time, you want 616smallest node that covers that empty line. Most of the time, you want
618to use @code{treesit-node-at} instead. 617to use @code{treesit-node-at} instead.
@@ -656,7 +655,7 @@ it, or query for information about this node.
656This function returns the immediate parent of @var{node}. 655This function returns the immediate parent of @var{node}.
657 656
658If @var{node} is more than 1000 levels deep in a parse tree, the 657If @var{node} is more than 1000 levels deep in a parse tree, the
659return value is undefined. Currently it returns @var{nil}, but that 658return value is undefined. Currently it returns @code{nil}, but that
660could change in the future. 659could change in the future.
661@end defun 660@end defun
662 661
@@ -672,7 +671,7 @@ first child is the opening quote @code{"}, and the first named child
672is the string text. 671is the string text.
673 672
674This function returns @code{nil} if there is no @var{n}'th child. 673This function returns @code{nil} if there is no @var{n}'th child.
675@var{n} could be negative, e.g., @code{-1} represents the last child. 674@var{n} could be negative, e.g., @minus{}1 represents the last child.
676@end defun 675@end defun
677 676
678@defun treesit-node-children node &optional named 677@defun treesit-node-children node &optional named
@@ -694,7 +693,7 @@ This function finds the previous sibling of @var{node}. If
694@cindex nodes, by field name 693@cindex nodes, by field name
695@cindex syntax tree nodes, by field name 694@cindex syntax tree nodes, by field name
696 695
697To make the syntax tree easier to analyze, many language grammar 696To make the syntax tree easier to analyze, many language grammars
698assign @dfn{field names} to child nodes (@pxref{tree-sitter node field 697assign @dfn{field names} to child nodes (@pxref{tree-sitter node field
699name, field name}). For example, a @code{function_definition} node 698name, field name}). For example, a @code{function_definition} node
700could have a @code{declarator} node and a @code{body} node. 699could have a @code{declarator} node and a @code{body} node.
@@ -729,7 +728,7 @@ first named child (@pxref{tree-sitter named node, named node}).
729This function finds the @emph{smallest} descendant node of @var{node} 728This function finds the @emph{smallest} descendant node of @var{node}
730that spans the region of text between positions @var{beg} and 729that spans the region of text between positions @var{beg} and
731@var{end}. It is similar to @code{treesit-node-at}. If @var{named} 730@var{end}. It is similar to @code{treesit-node-at}. If @var{named}
732is non-@code{nil}, it looks for smallest named child. 731is non-@code{nil}, it looks for the smallest named child.
733@end defun 732@end defun
734 733
735@heading Searching for node 734@heading Searching for node
@@ -755,8 +754,8 @@ defaults to 1000.
755Like @code{treesit-search-subtree}, this function also traverses the 754Like @code{treesit-search-subtree}, this function also traverses the
756parse tree and matches each node with @var{predicate} (except for 755parse tree and matches each node with @var{predicate} (except for
757@var{start}), where @var{predicate} can be a regexp or a function. 756@var{start}), where @var{predicate} can be a regexp or a function.
758For a tree like the below where @var{start} is marked S, this function 757For a tree like the one below where @var{start} is marked @samp{S},
759traverses as numbered from 1 to 12: 758this function traverses as numbered from 1 to 12:
760 759
761@example 760@example
762@group 761@group
@@ -773,7 +772,7 @@ o o +-+-+ +--+--+
773@end example 772@end example
774 773
775Note that this function doesn't traverse the subtree of @var{start}, 774Note that this function doesn't traverse the subtree of @var{start},
776and it always traverse leaf nodes first, then upwards. 775and it always traverses leaf nodes first, before moving upwards.
777 776
778Like @code{treesit-search-subtree}, this function only searches for 777Like @code{treesit-search-subtree}, this function only searches for
779named nodes by default, but if @var{all} is non-@code{nil}, it 778named nodes by default, but if @var{all} is non-@code{nil}, it
@@ -786,10 +785,10 @@ that comes after it in the buffer position order, i.e., nodes with
786start positions greater than the end position of @var{start}. 785start positions greater than the end position of @var{start}.
787 786
788In the tree shown above, @code{treesit-search-subtree} traverses node 787In the tree shown above, @code{treesit-search-subtree} traverses node
789S (@var{start}) and nodes marked with @code{o}, where this function 788@samp{S} (@var{start}) and nodes marked with @code{o}, where this
790traverses the nodes marked with numbers. This function is useful for 789function traverses the nodes marked with numbers. This function is
791answering questions like ``what is the first node after @var{start} in 790useful for answering questions like ``what is the first node after
792the buffer that satisfies some condition?'' 791@var{start} in the buffer that satisfies some condition?''
793@end defun 792@end defun
794 793
795@defun treesit-search-forward-goto node predicate &optional start backward all 794@defun treesit-search-forward-goto node predicate &optional start backward all
@@ -801,7 +800,7 @@ This function guarantees that the matched node it returns makes
801progress in terms of buffer position: the start/end position of the 800progress in terms of buffer position: the start/end position of the
802returned node is always greater than that of @var{node}. 801returned node is always greater than that of @var{node}.
803 802
804Arguments @var{predicate}, @var{backward} and @var{all} are the same 803Arguments @var{predicate}, @var{backward}, and @var{all} are the same
805as in @code{treesit-search-forward}. 804as in @code{treesit-search-forward}.
806@end defun 805@end defun
807 806
@@ -811,12 +810,12 @@ This function creates a sparse tree from @var{root}'s subtree.
811It takes the subtree under @var{root}, and combs it so only the nodes 810It takes the subtree under @var{root}, and combs it so only the nodes
812that match @var{predicate} are left. Like previous functions, the 811that match @var{predicate} are left. Like previous functions, the
813@var{predicate} can be a regexp string that matches against each 812@var{predicate} can be a regexp string that matches against each
814node's type, or a function that takes a node and return non-@code{nil} 813node's type, or a function that takes a node and returns
815if it matches. 814non-@code{nil} if it matches.
816 815
817For example, for a subtree on the left that consist of both numbers 816For example, given the subtree on the left that consists of both
818and letters, if @var{predicate} is ``letter only'', the returned tree 817numbers and letters, if @var{predicate} is ``letter only'', the
819is the one on the right. 818returned tree is the one on the right.
820 819
821@example 820@example
822@group 821@group
@@ -836,13 +835,13 @@ b 1 2 b | | b c d
836 835
837If @var{process-fn} is non-@code{nil}, instead of returning the 836If @var{process-fn} is non-@code{nil}, instead of returning the
838matched nodes, this function passes each node to @var{process-fn} and 837matched nodes, this function passes each node to @var{process-fn} and
839uses the returned value instead. If non-@code{nil}, @var{depth} is 838uses the returned value instead. If non-@code{nil}, @var{depth}
840the number of levels to go down from @var{root}. If @var{depth} is 839limits the number of levels to go down from @var{root}. If
841@code{nil}, it defaults to 1000. 840@var{depth} is @code{nil}, it defaults to 1000.
842 841
843Each node in the returned tree looks like 842Each node in the returned tree looks like
844@w{@code{(@var{tree-sitter-node} . (@var{child} @dots{}))}}. The 843@w{@code{(@var{tree-sitter-node} . (@var{child} @dots{}))}}. The
845@var{tree-sitter-node} of the root of this tree will be nil if 844@var{tree-sitter-node} of the root of this tree will be @code{nil} if
846@var{root} doesn't match @var{predicate}. If no node matches 845@var{root} doesn't match @var{predicate}. If no node matches
847@var{predicate}, the function returns @code{nil}. 846@var{predicate}, the function returns @code{nil}.
848@end defun 847@end defun
@@ -900,30 +899,30 @@ omitted, unlike in their original functions.
900This function finds immediate children of @var{node} that satisfy 899This function finds immediate children of @var{node} that satisfy
901@var{predicate}. 900@var{predicate}.
902 901
903The @var{predicate} function takes a node as the argument and should 902The @var{predicate} function takes a node as argument and should
904return non-@code{nil} to indicate that the node should be kept. If 903return non-@code{nil} to indicate that the node should be kept. If
905@var{named} is non-@code{nil}, this function only examines the named 904@var{named} is non-@code{nil}, this function only examines named
906nodes. 905nodes.
907@end defun 906@end defun
908 907
909@defun treesit-parent-until node predicate &optional include-node 908@defun treesit-parent-until node predicate &optional include-node
910This function repeatedly finds the parents of @var{node}, and returns 909This function repeatedly finds the parents of @var{node}, and returns
911the parent that satisfies @var{pred}, a function that takes a node as 910the parent that satisfies @var{pred}, a function that takes a node as
912the argument and returns a boolean that indicates a match. If no 911argument and returns a boolean that indicates a match. If no parent
913parent satisfies @var{pred}, this function returns @code{nil}. 912satisfies @var{pred}, this function returns @code{nil}.
914 913
915Normally this function only looks at the parents of @var{node} but not 914Normally this function only looks at the parents of @var{node} but not
916@var{node} itself. But if @var{include-node} is non-@var{nil}, this 915@var{node} itself. But if @var{include-node} is non-@code{nil}, this
917function returns @var{node} if @var{node} satisfies @var{pred}. 916function returns @var{node} if @var{node} satisfies @var{pred}.
918@end defun 917@end defun
919 918
920@defun treesit-parent-while node pred 919@defun treesit-parent-while node pred
921This function goes up the tree starting from @var{node}, and keeps 920This function goes up the tree starting from @var{node}, and keeps
922doing so as long as the nodes satisfy @var{pred}, a function that 921doing so as long as the nodes satisfy @var{pred}, a function that
923takes a node as the argument. That is, this function returns the 922takes a node as argument. That is, this function returns the highest
924highest parent of @var{node} that still satisfies @var{pred}. Note 923parent of @var{node} that still satisfies @var{pred}. Note that if
925that if @var{node} satisfies @var{pred} but its immediate parent 924@var{node} satisfies @var{pred} but its immediate parent doesn't,
926doesn't, @var{node} itself is returned. 925@var{node} itself is returned.
927@end defun 926@end defun
928 927
929@defun treesit-node-top-level node &optional type 928@defun treesit-node-top-level node &optional type
@@ -1026,7 +1025,7 @@ has an error.
1026@cindex tree-sitter, live parsing node 1025@cindex tree-sitter, live parsing node
1027@cindex live node, tree-sitter 1026@cindex live node, tree-sitter
1028A node is considered @dfn{live} if its parser is not deleted, and the 1027A node is considered @dfn{live} if its parser is not deleted, and the
1029buffer to which it belongs to is a live buffer (@pxref{Killing Buffers}). 1028buffer to which it belongs is a live buffer (@pxref{Killing Buffers}).
1030 1029
1031@defun treesit-node-check node property 1030@defun treesit-node-check node property
1032This function returns non-@code{nil} if @var{node} has the specified 1031This function returns non-@code{nil} if @var{node} has the specified
@@ -1063,12 +1062,12 @@ This function returns the field name of the @var{n}'th child of
1063@var{node}. It returns @code{nil} if there is no @var{n}'th child, or 1062@var{node}. It returns @code{nil} if there is no @var{n}'th child, or
1064the @var{n}'th child doesn't have a field name. 1063the @var{n}'th child doesn't have a field name.
1065 1064
1066Note that @var{n} counts both named and anonymous child. And @var{n} 1065Note that @var{n} counts both named and anonymous children, and
1067could be negative, e.g., @code{-1} represents the last child. 1066@var{n} can be negative, e.g., @minus{}1 represents the last child.
1068@end defun 1067@end defun
1069 1068
1070@defun treesit-node-child-count node &optional named 1069@defun treesit-node-child-count node &optional named
1071This function finds the number of children of @var{node}. If 1070This function returns the number of children of @var{node}. If
1072@var{named} is non-@code{nil}, it only counts named children 1071@var{named} is non-@code{nil}, it only counts named children
1073(@pxref{tree-sitter named node, named node}). 1072(@pxref{tree-sitter named node, named node}).
1074@end defun 1073@end defun
@@ -1095,7 +1094,7 @@ finally the more advanced pattern syntax.
1095@cindex query, tree-sitter 1094@cindex query, tree-sitter
1096A @dfn{query} consists of multiple @dfn{patterns}. Each pattern is an 1095A @dfn{query} consists of multiple @dfn{patterns}. Each pattern is an
1097s-expression that matches a certain node in the syntax node. A 1096s-expression that matches a certain node in the syntax node. A
1098pattern has the form @w{@code{(@var{type} (@var{child}@dots{}))}} 1097pattern has the form @w{@code{(@var{type} (@var{child}@dots{}))}}.
1099 1098
1100For example, a pattern that matches a @code{binary_expression} node that 1099For example, a pattern that matches a @code{binary_expression} node that
1101contains @code{number_literal} child nodes would look like 1100contains @code{number_literal} child nodes would look like
@@ -1131,25 +1130,26 @@ example, the capture name @code{biexp}:
1131Now we can introduce the @dfn{query functions}. 1130Now we can introduce the @dfn{query functions}.
1132 1131
1133@defun treesit-query-capture node query &optional beg end node-only 1132@defun treesit-query-capture node query &optional beg end node-only
1134This function matches patterns in @var{query} within @var{node}. 1133This function matches patterns in @var{query} within @var{node}. The
1135The argument @var{query} can be either a string, a s-expression, or a 1134argument @var{query} can be either a string, an s-expression, or a
1136compiled query object. For now, we focus on the string syntax; 1135compiled query object. For now, we focus on the string syntax;
1137s-expression syntax and compiled query are described at the end of the 1136s-expression syntax and compiled queries are described at the end of
1138section. 1137the section.
1139 1138
1140The argument @var{node} can also be a parser or a language symbol. A 1139The argument @var{node} can also be a parser or a language symbol. A
1141parser means using its root node, a language symbol means find or 1140parser means use its root node, a language symbol means find or create
1142create a parser for that language in the current buffer, and use the 1141a parser for that language in the current buffer, and use the root
1143root node. 1142node.
1144 1143
1145The function returns all the captured nodes in a list of the form 1144The function returns all the captured nodes in an alist with elements
1146@w{@code{(@var{capture_name} . @var{node})}}. If @var{node-only} is 1145of the form @w{@code{(@var{capture_name} . @var{node})}}. If
1147non-@code{nil}, it returns the list of nodes instead. By default the 1146@var{node-only} is non-@code{nil}, it returns the list of @var{node}s
1148entire text of @var{node} is searched, but if @var{beg} and @var{end} 1147instead. By default the entire text of @var{node} is searched, but if
1149are both non-@code{nil}, they specify the region of buffer text where 1148@var{beg} and @var{end} are both non-@code{nil}, they specify the
1150this function should match nodes. Any matching node whose span 1149region of buffer text where this function should match nodes. Any
1151overlaps with the region between @var{beg} and @var{end} are captured, 1150matching node whose span overlaps with the region between @var{beg}
1152it doesn't have to be completely in the region. 1151and @var{end} is captured; it doesn't have to be completely contained
1152in the region.
1153 1153
1154@vindex treesit-query-error 1154@vindex treesit-query-error
1155@findex treesit-query-validate 1155@findex treesit-query-validate
@@ -1193,13 +1193,13 @@ For example, it could have two top-level patterns:
1193@end example 1193@end example
1194 1194
1195@defun treesit-query-string string query language 1195@defun treesit-query-string string query language
1196This function parses @var{string} with @var{language}, matches its 1196This function parses @var{string} as @var{language}, matches its root
1197root node with @var{query}, and returns the result. 1197node with @var{query}, and returns the result.
1198@end defun 1198@end defun
1199 1199
1200@heading More query syntax 1200@heading More query syntax
1201 1201
1202Besides node type and capture, tree-sitter's pattern syntax can 1202Besides node type and capture name, tree-sitter's pattern syntax can
1203express anonymous node, field name, wildcard, quantification, 1203express anonymous node, field name, wildcard, quantification,
1204grouping, alternation, anchor, and predicate. 1204grouping, alternation, anchor, and predicate.
1205 1205
@@ -1215,11 +1215,11 @@ pattern matching (and capturing) keyword @code{return} would be
1215@subheading Wild card 1215@subheading Wild card
1216 1216
1217In a pattern, @samp{(_)} matches any named node, and @samp{_} matches 1217In a pattern, @samp{(_)} matches any named node, and @samp{_} matches
1218any named and anonymous node. For example, to capture any named child 1218any named or anonymous node. For example, to capture any named child
1219of a @code{binary_expression} node, the pattern would be 1219of a @code{binary_expression} node, the pattern would be
1220 1220
1221@example 1221@example
1222(binary_expression (_) @@in_biexp) 1222(binary_expression (_) @@in-biexp)
1223@end example 1223@end example
1224 1224
1225@subheading Field name 1225@subheading Field name
@@ -1237,7 +1237,7 @@ names, indicated by the colon following them.
1237@end example 1237@end example
1238 1238
1239It is also possible to capture a node that doesn't have a certain 1239It is also possible to capture a node that doesn't have a certain
1240field, say, a @code{function_definition} without a @code{body} field. 1240field, say, a @code{function_definition} without a @code{body} field:
1241 1241
1242@example 1242@example
1243(function_definition !body) @@func-no-body 1243(function_definition !body) @@func-no-body
@@ -1246,20 +1246,20 @@ field, say, a @code{function_definition} without a @code{body} field.
1246@subheading Quantify node 1246@subheading Quantify node
1247 1247
1248@cindex quantify node, tree-sitter 1248@cindex quantify node, tree-sitter
1249Tree-sitter recognizes quantification operators @samp{*}, @samp{+} and 1249Tree-sitter recognizes quantification operators @samp{*}, @samp{+},
1250@samp{?}. Their meanings are the same as in regular expressions: 1250and @samp{?}. Their meanings are the same as in regular expressions:
1251@samp{*} matches the preceding pattern zero or more times, @samp{+} 1251@samp{*} matches the preceding pattern zero or more times, @samp{+}
1252matches one or more times, and @samp{?} matches zero or one time. 1252matches one or more times, and @samp{?} matches zero or one times.
1253 1253
1254For example, the following pattern matches @code{type_declaration} 1254For example, the following pattern matches @code{type_declaration}
1255nodes that has @emph{zero or more} @code{long} keyword. 1255nodes that have @emph{zero or more} @code{long} keywords.
1256 1256
1257@example 1257@example
1258(type_declaration "long"*) @@long-type 1258(type_declaration "long"*) @@long-type
1259@end example 1259@end example
1260 1260
1261The following pattern matches a type declaration that has zero or one 1261The following pattern matches a type declaration that may or may not
1262@code{long} keyword: 1262have a @code{long} keyword:
1263 1263
1264@example 1264@example
1265(type_declaration "long"?) @@long-type 1265(type_declaration "long"?) @@long-type
@@ -1267,9 +1267,9 @@ The following pattern matches a type declaration that has zero or one
1267 1267
1268@subheading Grouping 1268@subheading Grouping
1269 1269
1270Similar to groups in regular expression, we can bundle patterns into 1270Similar to groups in regular expressions, we can bundle patterns into
1271groups and apply quantification operators to them. For example, to 1271groups and apply quantification operators to them. For example, to
1272express a comma separated list of identifiers, one could write 1272express a comma-separated list of identifiers, one could write
1273 1273
1274@example 1274@example
1275(identifier) ("," (identifier))* 1275(identifier) ("," (identifier))*
@@ -1277,10 +1277,10 @@ express a comma separated list of identifiers, one could write
1277 1277
1278@subheading Alternation 1278@subheading Alternation
1279 1279
1280Again, similar to regular expressions, we can express ``match anyone 1280Again, similar to regular expressions, we can express ``match any one
1281from this group of patterns'' in a pattern. The syntax is a list of 1281of these patterns'' in a pattern. The syntax is a list of patterns
1282patterns enclosed in square brackets. For example, to capture some 1282enclosed in square brackets. For example, to capture some keywords in
1283keywords in C, the pattern would be 1283C, the pattern would be
1284 1284
1285@example 1285@example
1286@group 1286@group
@@ -1339,14 +1339,14 @@ example, with the following pattern:
1339@end example 1339@end example
1340 1340
1341@noindent 1341@noindent
1342tree-sitter only matches arrays where the first element equals to the 1342tree-sitter only matches arrays where the first element is equal to
1343last element. To attach a predicate to a pattern, we need to group 1343the last element. To attach a predicate to a pattern, we need to
1344them together. A predicate always starts with a @samp{#}. Currently 1344group them together. A predicate always starts with a @samp{#}.
1345there are three predicates, @code{#equal}, @code{#match}, and 1345Currently there are three predicates: @code{#equal}, @code{#match},
1346@code{#pred}. 1346and @code{#pred}.
1347 1347
1348@deffn Predicate equal arg1 arg2 1348@deffn Predicate equal arg1 arg2
1349Matches if @var{arg1} equals to @var{arg2}. Arguments can be either 1349Matches if @var{arg1} is equal to @var{arg2}. Arguments can be either
1350strings or capture names. Capture names represent the text that the 1350strings or capture names. Capture names represent the text that the
1351captured node spans in the buffer. 1351captured node spans in the buffer.
1352@end deffn 1352@end deffn
@@ -1370,7 +1370,7 @@ names in other patterns.
1370 1370
1371@cindex tree-sitter patterns as sexps 1371@cindex tree-sitter patterns as sexps
1372@cindex patterns, tree-sitter, in sexp form 1372@cindex patterns, tree-sitter, in sexp form
1373Besides strings, Emacs provides a s-expression based syntax for 1373Besides strings, Emacs provides an s-expression based syntax for
1374tree-sitter patterns. It largely resembles the string-based syntax. 1374tree-sitter patterns. It largely resembles the string-based syntax.
1375For example, the following query 1375For example, the following query
1376 1376
@@ -1402,7 +1402,7 @@ is equivalent to
1402@end example 1402@end example
1403 1403
1404Most patterns can be written directly as strange but nevertheless 1404Most patterns can be written directly as strange but nevertheless
1405valid s-expressions. Only a few of them needs modification: 1405valid s-expressions. Only a few of them need modification:
1406 1406
1407@itemize 1407@itemize
1408@item 1408@item
@@ -1430,7 +1430,7 @@ For example,
1430@end example 1430@end example
1431 1431
1432@noindent 1432@noindent
1433is written in s-expression as 1433is written in s-expression syntax as
1434 1434
1435@example 1435@example
1436@group 1436@group
@@ -1488,8 +1488,8 @@ example. In that case, text segments written in different languages
1488need to be assigned different parsers. Traditionally, this is 1488need to be assigned different parsers. Traditionally, this is
1489achieved by using narrowing. While tree-sitter works with narrowing 1489achieved by using narrowing. While tree-sitter works with narrowing
1490(@pxref{tree-sitter narrowing, narrowing}), the recommended way is 1490(@pxref{tree-sitter narrowing, narrowing}), the recommended way is
1491instead to set regions of buffer text (i.e., ranges) in which a parser 1491instead to specify regions of buffer text (i.e., ranges) in which a
1492will operate. This section describes functions for setting and 1492parser will operate. This section describes functions for setting and
1493getting ranges for a parser. 1493getting ranges for a parser.
1494 1494
1495Lisp programs should call @code{treesit-update-ranges} to make sure 1495Lisp programs should call @code{treesit-update-ranges} to make sure
@@ -1507,7 +1507,7 @@ end of the section.
1507@defun treesit-parser-set-included-ranges parser ranges 1507@defun treesit-parser-set-included-ranges parser ranges
1508This function sets up @var{parser} to operate on @var{ranges}. The 1508This function sets up @var{parser} to operate on @var{ranges}. The
1509@var{parser} will only read the text of the specified ranges. Each 1509@var{parser} will only read the text of the specified ranges. Each
1510range in @var{ranges} is a list of the form @w{@code{(@var{beg} 1510range in @var{ranges} is a pair of the form @w{@code{(@var{beg}
1511. @var{end})}}. 1511. @var{end})}}.
1512 1512
1513The ranges in @var{ranges} must come in order and must not overlap. 1513The ranges in @var{ranges} must come in order and must not overlap.
@@ -1581,7 +1581,7 @@ Like other query functions, this function raises the
1581@heading Supporting multiple languages in Lisp programs 1581@heading Supporting multiple languages in Lisp programs
1582 1582
1583It should suffice for general Lisp programs to call the following two 1583It should suffice for general Lisp programs to call the following two
1584functions in order to support program sources that mixes multiple 1584functions in order to support program sources that mix multiple
1585languages. 1585languages.
1586 1586
1587@defun treesit-update-ranges &optional beg end 1587@defun treesit-update-ranges &optional beg end
@@ -1617,13 +1617,13 @@ language's parser, retrieves some information, sets ranges for the
1617embedded languages with that information, and then parses the embedded 1617embedded languages with that information, and then parses the embedded
1618languages. 1618languages.
1619 1619
1620Take a buffer containing @acronym{HTML}, @acronym{CSS} and JavaScript 1620Take a buffer containing @acronym{HTML}, @acronym{CSS}, and JavaScript
1621as an example. A Lisp program will first parse the whole buffer with 1621as an example. A Lisp program will first parse the whole buffer with
1622an @acronym{HTML} parser, then query the parser for 1622an @acronym{HTML} parser, then query the parser for
1623@code{style_element} and @code{script_element} nodes, which 1623@code{style_element} and @code{script_element} nodes, which correspond
1624correspond to @acronym{CSS} and JavaScript text, respectively. Then 1624to @acronym{CSS} and JavaScript text, respectively. Then it sets the
1625it sets the range of the @acronym{CSS} and JavaScript parser to the 1625range of the @acronym{CSS} and JavaScript parsers to the range which
1626ranges in which their corresponding nodes span. 1626their corresponding nodes span.
1627 1627
1628Given a simple @acronym{HTML} document: 1628Given a simple @acronym{HTML} document:
1629 1629
@@ -1677,17 +1677,17 @@ directly translate into operations shown above.
1677 1677
1678@example 1678@example
1679@group 1679@group
1680(setq-local treesit-range-settings 1680(setq treesit-range-settings
1681 (treesit-range-rules 1681 (treesit-range-rules
1682 :embed 'javascript 1682 :embed 'javascript
1683 :host 'html 1683 :host 'html
1684 '((script_element (raw_text) @@capture)) 1684 '((script_element (raw_text) @@capture))
1685@end group 1685@end group
1686 1686
1687@group 1687@group
1688 :embed 'css 1688 :embed 'css
1689 :host 'html 1689 :host 'html
1690 '((style_element (raw_text) @@capture)))) 1690 '((style_element (raw_text) @@capture))))
1691@end group 1691@end group
1692@end example 1692@end example
1693 1693
@@ -1698,21 +1698,21 @@ value that @code{treesit-range-settings} can have.
1698 1698
1699It takes a series of @var{query-spec}s, where each @var{query-spec} is 1699It takes a series of @var{query-spec}s, where each @var{query-spec} is
1700a @var{query} preceded by zero or more @var{keyword}/@var{value} 1700a @var{query} preceded by zero or more @var{keyword}/@var{value}
1701pairs. Each @var{query} is a tree-sitter query in either the 1701pairs. Each @var{query} is a tree-sitter query in either the string,
1702string, s-expression or compiled form, or a function. 1702s-expression, or compiled form, or a function.
1703 1703
1704If @var{query} is a tree-sitter query, it should be preceded by two 1704If @var{query} is a tree-sitter query, it should be preceded by two
1705@var{:keyword}/@var{value} pairs, where the @code{:embed} keyword 1705@var{keyword}/@var{value} pairs, where the @code{:embed} keyword
1706specifies the embedded language, and the @code{:host} keyword 1706specifies the embedded language, and the @code{:host} keyword
1707specified the host language. 1707specifies the host language.
1708 1708
1709@code{treesit-update-ranges} uses @var{query} to figure out how to set 1709@code{treesit-update-ranges} uses @var{query} to figure out how to set
1710the ranges for parsers for the embedded language. It queries 1710the ranges for parsers for the embedded language. It queries
1711@var{query} in a host language parser, computes the ranges in which 1711@var{query} in a host language parser, computes the ranges which the
1712the captured nodes span, and applies these ranges to embedded 1712captured nodes span, and applies these ranges to embedded language
1713language parsers. 1713parsers.
1714 1714
1715If @var{query} is a function, it doesn't need any @var{:keyword} and 1715If @var{query} is a function, it doesn't need any @var{keyword} and
1716@var{value} pair. It should be a function that takes 2 arguments, 1716@var{value} pair. It should be a function that takes 2 arguments,
1717@var{start} and @var{end}, and sets the ranges for parsers in the 1717@var{start} and @var{end}, and sets the ranges for parsers in the
1718current buffer in the region between @var{start} and @var{end}. It is 1718current buffer in the region between @var{start} and @var{end}. It is
@@ -1765,8 +1765,8 @@ this pattern:
1765@code{treesit-ready-p} automatically emits a warning if conditions for 1765@code{treesit-ready-p} automatically emits a warning if conditions for
1766enabling tree-sitter aren't met. 1766enabling tree-sitter aren't met.
1767 1767
1768If a tree-sitter major mode shares setup with their ``native'' 1768If a tree-sitter major mode shares setup with its ``native''
1769counterpart, they can create a ``base mode'' that contains the common 1769counterpart, one can create a ``base mode'' that contains the common
1770setup, like this: 1770setup, like this:
1771 1771
1772@example 1772@example
@@ -1797,9 +1797,9 @@ setup, like this:
1797@defun treesit-ready-p language &optional quiet 1797@defun treesit-ready-p language &optional quiet
1798This function checks for conditions for activating tree-sitter. It 1798This function checks for conditions for activating tree-sitter. It
1799checks whether Emacs was built with tree-sitter, whether the buffer's 1799checks whether Emacs was built with tree-sitter, whether the buffer's
1800size is not too large for tree-sitter to handle it, and whether the 1800size is not too large for tree-sitter to handle, and whether the
1801language grammar for @var{language} is available on the system 1801grammar for @var{language} is available on the system (@pxref{Language
1802(@pxref{Language Grammar}). 1802Grammar}).
1803 1803
1804This function emits a warning if tree-sitter cannot be activated. If 1804This function emits a warning if tree-sitter cannot be activated. If
1805@var{quiet} is @code{message}, the warning is turned into a message; 1805@var{quiet} is @code{message}, the warning is turned into a message;
@@ -1837,7 +1837,7 @@ non-@code{nil}, it sets up Imenu.
1837@end itemize 1837@end itemize
1838@end defun 1838@end defun
1839 1839
1840For more information of these built-in tree-sitter features, 1840For more information on these built-in tree-sitter features,
1841@pxref{Parser-based Font Lock}, @pxref{Parser-based Indentation}, and 1841@pxref{Parser-based Font Lock}, @pxref{Parser-based Indentation}, and
1842@pxref{List Motion}. 1842@pxref{List Motion}.
1843 1843
@@ -1876,28 +1876,17 @@ always returns @code{nil}.
1876@defvar treesit-defun-name-function 1876@defvar treesit-defun-name-function
1877If non-@code{nil}, this variable's value should be a function that is 1877If non-@code{nil}, this variable's value should be a function that is
1878called with a node as its argument, and returns the defun name of the 1878called with a node as its argument, and returns the defun name of the
1879node. The function should have the same semantic as 1879node. The function should have the same semantics as
1880@code{treesit-defun-name}: if the node is not a defun node, or the 1880@code{treesit-defun-name}: if the node is not a defun node, or the
1881node is a defun node but doesn't have a name, or the node is 1881node is a defun node but doesn't have a name, or the node is
1882@code{nil}, it should return @code{nil}. 1882@code{nil}, it should return @code{nil}.
1883@end defvar 1883@end defvar
1884 1884
1885@defvar treesit-defun-type-regexp
1886This variable determines which nodes are considered defuns by Emacs.
1887It can be a regexp that matches the type of defun nodes.
1888
1889Sometimes not all nodes matched by the regexp are valid defuns.
1890Therefore, this variable can also be a cons cell of the form
1891@w{(@var{regexp} . @var{pred})}, where @var{pred} should be a function
1892that takes a node as its argument, and returns @code{t} if the node is
1893valid defun, or @code{nil} if it is not valid.
1894@end defvar
1895
1896@node Tree-sitter C API 1885@node Tree-sitter C API
1897@section Tree-sitter C API Correspondence 1886@section Tree-sitter C API Correspondence
1898 1887
1899Emacs' tree-sitter integration doesn't expose every feature 1888Emacs' tree-sitter integration doesn't expose every feature
1900provided by tree-sitter's C API. Missing features include: 1889provided by tree-sitter's C API@. Missing features include:
1901 1890
1902@itemize 1891@itemize
1903@item 1892@item
@@ -1928,7 +1917,7 @@ convenient and idiomatic:
1928Instead of using byte positions, the Emacs Lisp API uses character 1917Instead of using byte positions, the Emacs Lisp API uses character
1929positions. 1918positions.
1930@item 1919@item
1931Null nodes are converted to nil. 1920Null nodes are converted to @code{nil}.
1932@end itemize 1921@end itemize
1933 1922
1934Below is the correspondence between all C API functions and their 1923Below is the correspondence between all C API functions and their
diff --git a/doc/lispref/positions.texi b/doc/lispref/positions.texi
index 1305daa7a2e..a308f2dfc4e 100644
--- a/doc/lispref/positions.texi
+++ b/doc/lispref/positions.texi
@@ -844,18 +844,25 @@ the mode can get navigation-by-defun functionality for free, by using
844@code{treesit-beginning-of-defun} and @code{treesit-end-of-defun}. 844@code{treesit-beginning-of-defun} and @code{treesit-end-of-defun}.
845 845
846@defvar treesit-defun-type-regexp 846@defvar treesit-defun-type-regexp
847The value of this variable is a regexp matching the node type of defun 847This variable determines which nodes are considered defuns by Emacs.
848nodes. (For ``node'' and ``node type'', @pxref{Parsing Program Source}.) 848It can be a regexp that matches the type of defun nodes. (For
849``node'' and ``node type'', @pxref{Parsing Program Source}.)
849 850
850For example, @code{python-mode} sets this variable to a regexp that 851For example, @code{python-mode} sets this variable to a regexp that
851matches either @code{"function_definition"} or @code{"class_definition"}. 852matches either @samp{function_definition} or @samp{class_definition}.
853
854Sometimes not all nodes matched by the regexp are valid defuns.
855Therefore, this variable can also be a cons cell of the form
856@w{(@var{regexp} . @var{pred})}, where @var{pred} should be a function
857that takes a node as its argument, and returns non-@code{nil} if the
858node is a valid defun, or @code{nil} if it is not valid.
852@end defvar 859@end defvar
853 860
854@defvar treesit-defun-tactic 861@defvar treesit-defun-tactic
855This variable determines how Emacs treats nested defuns. If the 862This variable determines how Emacs treats nested defuns. If the value
856value is @code{top-level}, navigation functions only move across 863is @code{top-level}, navigation functions only move across top-level
857top-level defuns, if the value is @code{nested}, navigation functions 864defuns. If the value is @code{nested}, navigation functions recognize
858recognize nested defuns. 865nested defuns.
859@end defvar 866@end defvar
860 867
861@defvar treesit-sentence-type-regexp 868@defvar treesit-sentence-type-regexp
diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi
index 7cbe87240c9..adab9eb0d0c 100644
--- a/doc/lispref/processes.texi
+++ b/doc/lispref/processes.texi
@@ -2680,7 +2680,7 @@ naming the certificate key file and certificate file itself, or
2680Library}). Only used for @acronym{TLS} or @acronym{STARTTLS}. To 2680Library}). Only used for @acronym{TLS} or @acronym{STARTTLS}. To
2681enable automatic queries of @code{auth-source} when 2681enable automatic queries of @code{auth-source} when
2682@code{:client-certificate} is not specified customize 2682@code{:client-certificate} is not specified customize
2683@code{network-stream-use-client-certificates} to t. 2683@code{network-stream-use-client-certificates} to @code{t}.
2684 2684
2685@item :return-list @var{cons-or-nil} 2685@item :return-list @var{cons-or-nil}
2686The return value of this function. If omitted or @code{nil}, return a 2686The return value of this function. If omitted or @code{nil}, return a
@@ -3593,7 +3593,7 @@ and @code{#x1c} @code{#x28} to @w{@code{(3 5 10 11 12)}}.
3593@item fill @var{len} 3593@item fill @var{len}
3594@var{len} bytes used as a mere filler. In packing, these bytes are 3594@var{len} bytes used as a mere filler. In packing, these bytes are
3595left unchanged, which normally means they remain zero. 3595left unchanged, which normally means they remain zero.
3596When unpacking, this just returns nil. 3596When unpacking, this just returns @code{nil}.
3597 3597
3598@item align @var{len} 3598@item align @var{len}
3599Same as @code{fill} except the number of bytes is that needed to skip 3599Same as @code{fill} except the number of bytes is that needed to skip
diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi
index 06b3556c855..b8d9094b28d 100644
--- a/doc/lispref/searching.texi
+++ b/doc/lispref/searching.texi
@@ -1568,7 +1568,7 @@ used, a Lisp expression that evaluates to a string. Example:
1568 1568
1569@defun rx-to-string rx-expr &optional no-group 1569@defun rx-to-string rx-expr &optional no-group
1570Translate @var{rx-expr} to a string regexp which is returned. 1570Translate @var{rx-expr} to a string regexp which is returned.
1571If @var{no-group} is absent or nil, bracket the result in a 1571If @var{no-group} is absent or @code{nil}, bracket the result in a
1572non-capturing group, @samp{\(?:@dots{}\)}, if necessary to ensure that 1572non-capturing group, @samp{\(?:@dots{}\)}, if necessary to ensure that
1573a postfix operator appended to it will apply to the whole expression. 1573a postfix operator appended to it will apply to the whole expression.
1574Example: 1574Example:
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi
index dac8d0d8ce9..08e64980ee0 100644
--- a/doc/lispref/text.texi
+++ b/doc/lispref/text.texi
@@ -4764,9 +4764,9 @@ and exceeded, it will fall back to @code{delete-region} and
4764the actual costs exceed this limit, heuristics are used to provide a 4764the actual costs exceed this limit, heuristics are used to provide a
4765faster but suboptimal solution. The default value is 1000000. 4765faster but suboptimal solution. The default value is 1000000.
4766 4766
4767@code{replace-buffer-contents} returns t if a non-destructive 4767@code{replace-buffer-contents} returns @code{t} if a non-destructive
4768replacement could be performed. Otherwise, i.e., if @var{max-secs} 4768replacement could be performed. Otherwise, i.e., if @var{max-secs}
4769was exceeded, it returns nil. 4769was exceeded, it returns @code{nil}.
4770@end deffn 4770@end deffn
4771 4771
4772@defun replace-region-contents beg end replace-fn &optional max-secs max-costs 4772@defun replace-region-contents beg end replace-fn &optional max-secs max-costs
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index 0196ed0e813..a49e63e49de 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -5569,7 +5569,7 @@ non-@code{nil}, this function may redraw the frame, according to the
5569value of @code{recenter-redisplay}. Thus, omitting the second 5569value of @code{recenter-redisplay}. Thus, omitting the second
5570argument can be used to countermand the effect of 5570argument can be used to countermand the effect of
5571@code{recenter-redisplay} being non-@code{nil}. Interactive calls 5571@code{recenter-redisplay} being non-@code{nil}. Interactive calls
5572pass non-‘nil’ for @var{redisplay}. 5572pass non-@code{nil} for @var{redisplay}.
5573 5573
5574When @code{recenter} is called interactively, @var{count} is the raw 5574When @code{recenter} is called interactively, @var{count} is the raw
5575prefix argument. Thus, typing @kbd{C-u} as the prefix sets the 5575prefix argument. Thus, typing @kbd{C-u} as the prefix sets the
diff --git a/doc/misc/calc.texi b/doc/misc/calc.texi
index f5f4dff0e18..00c0fa6001a 100644
--- a/doc/misc/calc.texi
+++ b/doc/misc/calc.texi
@@ -18617,8 +18617,8 @@ gamma function. For positive integer arguments, this is related to the
18617factorial function: @samp{gamma(n+1) = fact(n)}. For general complex 18617factorial function: @samp{gamma(n+1) = fact(n)}. For general complex
18618arguments the gamma function can be defined by the following definite 18618arguments the gamma function can be defined by the following definite
18619integral: 18619integral:
18620@texline @math{\Gamma(a) = \int_0^\infty t^{a-1} e^t dt}. 18620@texline @math{\Gamma(a) = \int_0^\infty t^{a-1} e^{-t} dt}.
18621@infoline @expr{gamma(a) = integ(t^(a-1) exp(t), t, 0, inf)}. 18621@infoline @expr{gamma(a) = integ(t^(a-1) exp(-t), t, 0, inf)}.
18622(The actual implementation uses far more efficient computational methods.) 18622(The actual implementation uses far more efficient computational methods.)
18623 18623
18624@kindex f G 18624@kindex f G
@@ -18709,7 +18709,7 @@ un-normalized version [@code{betaB}].
18709The @kbd{f e} (@code{calc-erf}) [@code{erf}] command computes the 18709The @kbd{f e} (@code{calc-erf}) [@code{erf}] command computes the
18710error function 18710error function
18711@texline @math{\hbox{erf}(x) = {2 \over \sqrt{\pi}} \int_0^x e^{-t^2} dt}. 18711@texline @math{\hbox{erf}(x) = {2 \over \sqrt{\pi}} \int_0^x e^{-t^2} dt}.
18712@infoline @expr{erf(x) = 2 integ(exp(-(t^2)), t, 0, x) / sqrt(pi)}. 18712@infoline @expr{erf(x) = 2 integ(exp(-(t^(2))), t, 0, x) / sqrt(pi)}.
18713The complementary error function @kbd{I f e} (@code{calc-erfc}) [@code{erfc}] 18713The complementary error function @kbd{I f e} (@code{calc-erfc}) [@code{erfc}]
18714is the corresponding integral from @samp{x} to infinity; the sum 18714is the corresponding integral from @samp{x} to infinity; the sum
18715@texline @math{\hbox{erf}(x) + \hbox{erfc}(x) = 1}. 18715@texline @math{\hbox{erf}(x) + \hbox{erfc}(x) = 1}.
@@ -28475,13 +28475,13 @@ B and
28475@c flat and @expr{B}. 28475@c flat and @expr{B}.
28476the octave numbered 0 was chosen to correspond to the lowest 28476the octave numbered 0 was chosen to correspond to the lowest
28477audible frequency. Using this system, middle C (about 261.625 Hz) 28477audible frequency. Using this system, middle C (about 261.625 Hz)
28478corresponds to the note @expr{C} in octave 4 and is denoted 28478corresponds to the note @slanted{C} in octave 4 and is denoted
28479@expr{C_4}. Any frequency can be described by giving a note plus an 28479@slanted{C@sub{4}}. Any frequency can be described by giving a note plus an
28480offset in cents (where a cent is a ratio of frequencies so that a 28480offset in cents (where a cent is a ratio of frequencies so that a
28481semitone consists of 100 cents). 28481semitone consists of 100 cents).
28482 28482
28483The midi note number system assigns numbers to notes so that 28483The midi note number system assigns numbers to notes so that
28484@expr{C_(-1)} corresponds to the midi note number 0 and @expr{G_9} 28484@slanted{C@sub{-1}} corresponds to the midi note number 0 and @slanted{G@sub{9}}
28485corresponds to the midi note number 127. A midi controller can have 28485corresponds to the midi note number 127. A midi controller can have
28486up to 128 keys and each midi note number from 0 to 127 corresponds to 28486up to 128 keys and each midi note number from 0 to 127 corresponds to
28487a possible key. 28487a possible key.
@@ -29880,10 +29880,10 @@ with no argument copies only the number itself into the kill ring, whereas
29880@kbd{C-k} with a prefix argument of 1 copies the number with its trailing 29880@kbd{C-k} with a prefix argument of 1 copies the number with its trailing
29881newline. 29881newline.
29882 29882
29883You can customize @code{calc-kill-line-numbering} to nil to exclude 29883You can customize @code{calc-kill-line-numbering} to @code{nil} to
29884line numbering from kills and copies made by @code{calc-kill} and 29884exclude line numbering from kills and copies made by @code{calc-kill}
29885@code{calc-copy-as-kill}. This option does not affect calc kill and 29885and @code{calc-copy-as-kill}. This option does not affect calc kill
29886copy commands which operate on the region, as that would not make 29886and copy commands which operate on the region, as that would not make
29887sense. 29887sense.
29888 29888
29889@node Yanking Into Stack 29889@node Yanking Into Stack
@@ -35595,11 +35595,11 @@ The default value of @code{calc-note-threshold} is 1.
35595See @ref{Displaying Selections}.@* 35595See @ref{Displaying Selections}.@*
35596The variable @code{calc-highlight-selections-with-faces} 35596The variable @code{calc-highlight-selections-with-faces}
35597determines how selected sub-formulas are distinguished. 35597determines how selected sub-formulas are distinguished.
35598If @code{calc-highlight-selections-with-faces} is nil, then 35598If @code{calc-highlight-selections-with-faces} is @code{nil}, then
35599a selected sub-formula is distinguished either by changing every 35599a selected sub-formula is distinguished either by changing every
35600character not part of the sub-formula with a dot or by changing every 35600character not part of the sub-formula with a dot or by changing every
35601character in the sub-formula with a @samp{#} sign. 35601character in the sub-formula with a @samp{#} sign.
35602If @code{calc-highlight-selections-with-faces} is t, 35602If @code{calc-highlight-selections-with-faces} is @code{t},
35603then a selected sub-formula is distinguished either by displaying the 35603then a selected sub-formula is distinguished either by displaying the
35604non-selected portion of the formula with @code{calc-nonselected-face} 35604non-selected portion of the formula with @code{calc-nonselected-face}
35605or by displaying the selected sub-formula with 35605or by displaying the selected sub-formula with
diff --git a/doc/misc/cc-mode.texi b/doc/misc/cc-mode.texi
index 71bf3fcee4a..4ac9cc3ca2d 100644
--- a/doc/misc/cc-mode.texi
+++ b/doc/misc/cc-mode.texi
@@ -2192,10 +2192,10 @@ foo& bar
2192 2192
2193@defvar c-asymmetry-fontification-flag 2193@defvar c-asymmetry-fontification-flag
2194@vindex asymmetry-fontification-flag @r{(c-)} 2194@vindex asymmetry-fontification-flag @r{(c-)}
2195When @code{c-asymmetry-fontification-flag} is non-@code{nil} (which it is by 2195When @code{c-asymmetry-fontification-flag} is non-@code{nil} (which it
2196default), code like the above, with white space either before or after 2196is by default), code like the above, with white space either before or
2197the operator, but not both, is fontified as a declaration. When the 2197after the operator, but not both, is fontified as a declaration. When
2198variable is nil, such a construct gets the default face. 2198the variable is @code{nil}, such a construct gets the default face.
2199@end defvar 2199@end defvar
2200 2200
2201When the construct is an expression there will often be white space 2201When the construct is an expression there will often be white space
@@ -6036,7 +6036,7 @@ three syntactic symbols, @code{arglist-cont-nonempty},
6036List Symbols}). 6036List Symbols}).
6037 6037
6038This function is intended for use in a list. If the construct being 6038This function is intended for use in a list. If the construct being
6039analyzed isn't like the preceding, the function returns nil. 6039analyzed isn't like the preceding, the function returns @code{nil}.
6040Otherwise it returns the function 6040Otherwise it returns the function
6041@code{c-lineup-arglist-intro-after-paren}, which the caller then uses 6041@code{c-lineup-arglist-intro-after-paren}, which the caller then uses
6042to perform indentation. 6042to perform indentation.
@@ -6080,8 +6080,8 @@ also has a syntactic element with the symbol @code{brace-list-entry}
6080(@pxref{Brace List Symbols}). 6080(@pxref{Brace List Symbols}).
6081 6081
6082This function is intended for use in a list. If the above structure 6082This function is intended for use in a list. If the above structure
6083isn't present, the function returns nil, allowing a different offset 6083isn't present, the function returns @code{nil}, allowing a different
6084specification to indent the line. 6084offset specification to indent the line.
6085 6085
6086@workswith{} @code{brace-list-intro}. 6086@workswith{} @code{brace-list-intro}.
6087@end defun 6087@end defun
@@ -6123,8 +6123,8 @@ returning the symbol @code{c-lineup-arglist-intro-after-paren}, which
6123the caller then uses to perform the indentation. 6123the caller then uses to perform the indentation.
6124 6124
6125This function is intended for use in a list. If the above structure 6125This function is intended for use in a list. If the above structure
6126isn't present, the function returns nil, allowing a different offset 6126isn't present, the function returns @code{nil}, allowing a different
6127specification to indent the line. 6127offset specification to indent the line.
6128 6128
6129@workswith{} @code{brace-list-intro}. 6129@workswith{} @code{brace-list-intro}.
6130@end defun 6130@end defun
diff --git a/doc/misc/dbus.texi b/doc/misc/dbus.texi
index 97a0f39ea13..2bd6b9556c8 100644
--- a/doc/misc/dbus.texi
+++ b/doc/misc/dbus.texi
@@ -1847,8 +1847,24 @@ This function establishes the connection to D-Bus @var{bus}.
1847corresponding bus. For the system and session buses, this function is 1847corresponding bus. For the system and session buses, this function is
1848called when loading @file{dbus.el}, there is no need to call it again. 1848called when loading @file{dbus.el}, there is no need to call it again.
1849 1849
1850The function returns the number of connections this Emacs session has 1850If Emacs was invoked when there was no D-Bus session bus available
1851established to the @var{bus} under the same unique name 1851yet, you can set the environment variable
1852@env{DBUS_SESSION_BUS_ADDRESS} once the session bus daemon is running
1853and offering the address. Calling @code{dbus-init-bus} initializes
1854the connection to the session bus.
1855
1856@lisp
1857(setenv "DBUS_SESSION_BUS_ADDRESS" "unix:path=/run/user/1000/bus")
1858
1859@result{} "unix:path=/run/user/1000/bus"
1860
1861(dbus-init-bus :session)
1862
1863@result{} 2
1864@end lisp
1865
1866@code{dbus-init-bus} returns the number of connections this Emacs
1867session has established to the @var{bus} under the same unique name
1852(@pxref{dbus-get-unique-name}). It depends on the libraries Emacs is 1868(@pxref{dbus-get-unique-name}). It depends on the libraries Emacs is
1853linked with, and on the environment Emacs is running. For example, if 1869linked with, and on the environment Emacs is running. For example, if
1854Emacs is linked with the GTK+ toolkit, and it runs in a GTK+-aware 1870Emacs is linked with the GTK+ toolkit, and it runs in a GTK+-aware
diff --git a/doc/misc/ede.texi b/doc/misc/ede.texi
index e4ec72af5cd..d49d2296aa7 100644
--- a/doc/misc/ede.texi
+++ b/doc/misc/ede.texi
@@ -1896,19 +1896,19 @@ Make sure the @code{:file} is fully expanded.
1896@end deffn 1896@end deffn
1897 1897
1898@deffn Method ede-preprocessor-map :AFTER this 1898@deffn Method ede-preprocessor-map :AFTER this
1899Get the pre-processor map for project @var{THIS}. 1899Get the pre-processor map for project @var{this}.
1900@end deffn 1900@end deffn
1901 1901
1902@deffn Method ede-cpp-root-header-file-p :AFTER proj name 1902@deffn Method ede-cpp-root-header-file-p :AFTER proj name
1903Non @code{nil} if in @var{PROJ} the filename @var{NAME} is a header. 1903Non-@code{nil} if in @var{proj} the filename @var{name} is a header.
1904@end deffn 1904@end deffn
1905 1905
1906@deffn Method ede-system-include-path :AFTER this 1906@deffn Method ede-system-include-path :AFTER this
1907Get the system include path used by project @var{THIS}. 1907Get the system include path used by project @var{this}.
1908@end deffn 1908@end deffn
1909 1909
1910@deffn Method ede-expand-filename-impl :AFTER proj name 1910@deffn Method ede-expand-filename-impl :AFTER proj name
1911Within this project @var{PROJ}, find the file @var{NAME}. 1911Within this project @var{proj}, find the file @var{name}.
1912This knows details about or source tree. 1912This knows details about or source tree.
1913@end deffn 1913@end deffn
1914 1914
@@ -2796,7 +2796,7 @@ File name of generated Makefile.
2796Type: @code{boolean} @* 2796Type: @code{boolean} @*
2797Default Value: @code{t} 2797Default Value: @code{t}
2798 2798
2799Non @code{nil} means the rule created is part of the all target. 2799Non-@code{nil} means the rule created is part of the all target.
2800Setting this to @code{nil} creates the rule to build this item, but does not 2800Setting this to @code{nil} creates the rule to build this item, but does not
2801include it in the @code{all:} rule. 2801include it in the @code{all:} rule.
2802 2802
@@ -3888,10 +3888,10 @@ themselves.
3888Type: @code{boolean} @* 3888Type: @code{boolean} @*
3889Default Value: @code{nil} 3889Default Value: @code{nil}
3890 3890
3891Non @code{nil} if this sourcecode type uses subdirectores. 3891Non-@code{nil} if this sourcecode type uses subdirectores. If
3892If sourcecode always lives near the target creating it, this should be nil. 3892sourcecode always lives near the target creating it, this should be
3893If sourcecode can, or typically lives in a subdirectory of the owning 3893@code{nil}. If sourcecode can, or typically lives in a subdirectory
3894target, set this to t. 3894of the owning target, set this to @code{t}.
3895 3895
3896@item :garbagepattern 3896@item :garbagepattern
3897Type: @code{list} @* 3897Type: @code{list} @*
diff --git a/doc/misc/ert.texi b/doc/misc/ert.texi
index fd96fcf8b8c..a6b62a058f2 100644
--- a/doc/misc/ert.texi
+++ b/doc/misc/ert.texi
@@ -409,13 +409,13 @@ emacs -batch -l ert -l my-tests.el \
409@end example 409@end example
410 410
411@vindex ert-batch-backtrace-line-length 411@vindex ert-batch-backtrace-line-length
412Even modest settings for @code{print-level} and @code{print-length} can 412Even modest settings for @code{print-level} and @code{print-length}
413produce extremely long lines in backtraces, however, with attendant 413can produce extremely long lines in backtraces, however, with
414pauses in execution progress. Set 414attendant pauses in execution progress. Set
415@code{ert-batch-backtrace-line-length} to t to use the value of 415@code{ert-batch-backtrace-line-length} to @code{t} to use the value of
416@code{backtrace-line-length}, @code{nil} to stop any limitations on backtrace 416@code{backtrace-line-length}, @code{nil} to stop any limitations on
417line lengths (that is, to get full backtraces), or a positive integer to 417backtrace line lengths (that is, to get full backtraces), or a
418limit backtrace line length to that number. 418positive integer to limit backtrace line length to that number.
419 419
420@vindex ert-quiet 420@vindex ert-quiet
421By default, ERT in batch mode is quite verbose, printing a line with 421By default, ERT in batch mode is quite verbose, printing a line with
diff --git a/doc/misc/eudc.texi b/doc/misc/eudc.texi
index 743d7da946b..d82dec971cd 100644
--- a/doc/misc/eudc.texi
+++ b/doc/misc/eudc.texi
@@ -374,7 +374,7 @@ LDAP:
374Specifying the function @code{ldap-password-read} for @code{passwd} 374Specifying the function @code{ldap-password-read} for @code{passwd}
375will cause Emacs to prompt interactively for the password. The 375will cause Emacs to prompt interactively for the password. The
376password will then be validated and cached, unless 376password will then be validated and cached, unless
377@code{password-cache} is nil. You can customize 377@code{password-cache} is @code{nil}. You can customize
378@code{password-cache-expiry} to control the duration for which the 378@code{password-cache-expiry} to control the duration for which the
379password is cached. If you want to clear the cache, call 379password is cached. If you want to clear the cache, call
380@code{password-reset}. 380@code{password-reset}.
@@ -1023,9 +1023,9 @@ current server to the list with the command @kbd{M-x
1023eudc-bookmark-current-server}. The list is contained in the variable 1023eudc-bookmark-current-server}. The list is contained in the variable
1024@code{eudc-server-hotlist} which is stored in and retrieved from the 1024@code{eudc-server-hotlist} which is stored in and retrieved from the
1025file designated by @code{eudc-options-file}, or normal Emacs 1025file designated by @code{eudc-options-file}, or normal Emacs
1026initialization if @code{eudc-ignore-options-file} is non-nil. EUDC 1026initialization if @code{eudc-ignore-options-file} is non-@code{nil}.
1027also provides a facility to edit the hotlist interactively (@pxref{The 1027EUDC also provides a facility to edit the hotlist interactively
1028Hotlist Edit Buffer}). 1028(@pxref{The Hotlist Edit Buffer}).
1029 1029
1030The hotlist is also used to make queries on multiple servers 1030The hotlist is also used to make queries on multiple servers
1031successively (@pxref{Multi-server Queries}). The order in which the 1031successively (@pxref{Multi-server Queries}). The order in which the
@@ -1041,18 +1041,18 @@ Add the current server to the hotlist of servers
1041@end deffn 1041@end deffn
1042 1042
1043@defvar eudc-ignore-options-file 1043@defvar eudc-ignore-options-file
1044If non-nil, then EUDC ignores @code{eudc-options-file} and warns or 1044If non-@code{nil}, EUDC ignores @code{eudc-options-file} and warns or
1045issues an error when an attempt is made to use it. Most users should 1045issues an error when an attempt is made to use it. Most users should
1046set this, and keep their EUDC configuration in the main Emacs 1046set this, and keep their EUDC configuration in the main Emacs
1047initialization file instead. The separate eudc-options file has 1047initialization file instead. The separate @file{eudc-options} file
1048created confusion for users in the past. 1048has created confusion for users in the past.
1049@end defvar 1049@end defvar
1050 1050
1051@defvar eudc-options-file 1051@defvar eudc-options-file
1052The name of a file where EUDC stores its internal variables (the 1052The name of a file where EUDC stores its internal variables (the
1053hotlist and the current server). EUDC will try to load that file upon 1053hotlist and the current server). EUDC will try to load that file upon
1054initialization so, if you choose a file name different from the 1054initialization so, if you choose a file name different from the
1055defaults @file{~/.emacs.d/eudc-options}, be sure to set this variable 1055default @file{~/.emacs.d/eudc-options}, be sure to set this variable
1056to the appropriate value @emph{before} EUDC is itself loaded. 1056to the appropriate value @emph{before} EUDC is itself loaded.
1057@end defvar 1057@end defvar
1058 1058
diff --git a/doc/misc/eww.texi b/doc/misc/eww.texi
index 836eb38503e..c02e9db11c9 100644
--- a/doc/misc/eww.texi
+++ b/doc/misc/eww.texi
@@ -368,8 +368,8 @@ point positions or the actual Web page contents.
368The latter, however, tend to be overly large to preserve in the 368The latter, however, tend to be overly large to preserve in the
369desktop file, so they get omitted, thus rendering the respective 369desktop file, so they get omitted, thus rendering the respective
370entries entirely equivalent. By default, such duplicate entries are 370entries entirely equivalent. By default, such duplicate entries are
371not saved. Setting @code{eww-desktop-remove-duplicates} to nil will 371not saved. Setting @code{eww-desktop-remove-duplicates} to @code{nil}
372force EWW to save them anyway. 372will force EWW to save them anyway.
373 373
374@vindex eww-restore-desktop 374@vindex eww-restore-desktop
375 Restoring EWW buffers' contents may prove to take too long to 375 Restoring EWW buffers' contents may prove to take too long to
diff --git a/doc/misc/flymake.texi b/doc/misc/flymake.texi
index b6a540a6ea3..237f0702778 100644
--- a/doc/misc/flymake.texi
+++ b/doc/misc/flymake.texi
@@ -115,11 +115,11 @@ Syntax checks happen ``on-the-fly''. Each check is started whenever:
115@itemize @bullet 115@itemize @bullet
116@item 116@item
117@code{flymake-mode} is started, unless 117@code{flymake-mode} is started, unless
118@code{flymake-start-on-flymake-mode} is nil; 118@code{flymake-start-on-flymake-mode} is @code{nil};
119 119
120@item 120@item
121the buffer is saved, unless @code{flymake-start-on-save-buffer} is 121the buffer is saved, unless @code{flymake-start-on-save-buffer} is
122nil; 122@code{nil};
123 123
124@item 124@item
125some changes were made to the buffer more than @code{0.5} seconds ago 125some changes were made to the buffer more than @code{0.5} seconds ago
@@ -771,9 +771,13 @@ The following code needs lexical binding (@pxref{Using Lexical
771Binding,,, elisp, The Emacs Lisp Reference Manual}) to be active. 771Binding,,, elisp, The Emacs Lisp Reference Manual}) to be active.
772 772
773@example 773@example
774@group
774;;; ruby-flymake.el --- A ruby Flymake backend -*- lexical-binding: t; -*- 775;;; ruby-flymake.el --- A ruby Flymake backend -*- lexical-binding: t; -*-
776(require 'cl-lib)
775(defvar-local ruby--flymake-proc nil) 777(defvar-local ruby--flymake-proc nil)
778@end group
776 779
780@group
777(defun ruby-flymake (report-fn &rest _args) 781(defun ruby-flymake (report-fn &rest _args)
778 ;; Not having a ruby interpreter is a serious problem which should cause 782 ;; Not having a ruby interpreter is a serious problem which should cause
779 ;; the backend to disable itself, so an @code{error} is signaled. 783 ;; the backend to disable itself, so an @code{error} is signaled.
@@ -787,7 +791,9 @@ Binding,,, elisp, The Emacs Lisp Reference Manual}) to be active.
787 ;; 791 ;;
788 (when (process-live-p ruby--flymake-proc) 792 (when (process-live-p ruby--flymake-proc)
789 (kill-process ruby--flymake-proc)) 793 (kill-process ruby--flymake-proc))
794@end group
790 795
796@group
791 ;; Save the current buffer, the narrowing restriction, remove any 797 ;; Save the current buffer, the narrowing restriction, remove any
792 ;; narrowing restriction. 798 ;; narrowing restriction.
793 ;; 799 ;;
@@ -853,11 +859,14 @@ Binding,,, elisp, The Emacs Lisp Reference Manual}) to be active.
853 ;; 859 ;;
854 (process-send-region ruby--flymake-proc (point-min) (point-max)) 860 (process-send-region ruby--flymake-proc (point-min) (point-max))
855 (process-send-eof ruby--flymake-proc)))) 861 (process-send-eof ruby--flymake-proc))))
862@end group
856 863
864@group
857(defun ruby-setup-flymake-backend () 865(defun ruby-setup-flymake-backend ()
858 (add-hook 'flymake-diagnostic-functions 'ruby-flymake nil t)) 866 (add-hook 'flymake-diagnostic-functions 'ruby-flymake nil t))
859 867
860(add-hook 'ruby-mode-hook 'ruby-setup-flymake-backend) 868(add-hook 'ruby-mode-hook 'ruby-setup-flymake-backend)
869@end group
861@end example 870@end example
862 871
863@node The legacy Proc backend 872@node The legacy Proc backend
@@ -909,13 +918,18 @@ Patterns for error/warning messages in the form @code{(regexp file-idx
909line-idx col-idx err-text-idx)}. @xref{Parsing the output}. 918line-idx col-idx err-text-idx)}. @xref{Parsing the output}.
910 919
911@item flymake-proc-diagnostic-type-pred 920@item flymake-proc-diagnostic-type-pred
912A function to classify a diagnostic text as particular type of error. 921A function to classify a diagnostic text as a particular type of
913Should be a function taking an error text and returning a diagnostic 922error. The value of this variable should be a function taking an
914symbol (@pxref{Flymake error types}). If non-@code{nil} is returned but 923error text and returning a diagnostic symbol (@pxref{Flymake error
915there is no such symbol in that table, a warning is assumed. If nil 924types}). If it returns a non-@code{nil} value but there is no such
916is returned, an error is assumed. Can also be a regular expression 925symbol in that table, the text is interpreted as a warning. If the
917that should match only warnings. This variable replaces the old 926function returns @code{nil}, the text is assumed to be an error.
918@code{flymake-warning-re} and @code{flymake-warning-predicate}. 927
928The value of this variable can alternatively be a regular expression
929that should match only warnings.
930
931This variable replaces the old @code{flymake-warning-re} and
932@code{flymake-warning-predicate}.
919 933
920@item flymake-proc-compilation-prevents-syntax-check 934@item flymake-proc-compilation-prevents-syntax-check
921A flag indicating whether compilation and syntax check of the same 935A flag indicating whether compilation and syntax check of the same
diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi
index e08a5587962..8d25e868c8a 100644
--- a/doc/misc/gnus.texi
+++ b/doc/misc/gnus.texi
@@ -5014,14 +5014,14 @@ the @code{a} spec.
5014@item L 5014@item L
5015Number of lines in the article. 5015Number of lines in the article.
5016@item Z 5016@item Z
5017Retrieval Score Value (RSV) of the article; nil if not in an nnselect 5017Retrieval Score Value (RSV) of the article; @code{nil} if not in an
5018group. 5018nnselect group.
5019@item G 5019@item G
5020Originating group name of the article; nil if not in an nnselect 5020Originating group name of the article; @code{nil} if not in an
5021group. 5021nnselect group.
5022@item g 5022@item g
5023Short form of the originating group name of the article; nil if not in 5023Short form of the originating group name of the article; @code{nil} if
5024an nnselect group. 5024not in an nnselect group.
5025@item c 5025@item c
5026Number of characters in the article. This specifier is not supported 5026Number of characters in the article. This specifier is not supported
5027in some methods (like nnfolder). 5027in some methods (like nnfolder).
@@ -14571,18 +14571,20 @@ requires using the @file{oauth2.el} library.)
14571@vindex nnimap-expunge 14571@vindex nnimap-expunge
14572@item nnimap-expunge 14572@item nnimap-expunge
14573When to expunge deleted messages. If @code{never}, deleted articles 14573When to expunge deleted messages. If @code{never}, deleted articles
14574are marked with the IMAP @code{\\Delete} flag but not automatically 14574are marked with the @acronym{IMAP} @code{\\Delete} flag but not
14575expunged. If @code{immediately}, deleted articles are immediately expunged 14575automatically expunged. If @code{immediately}, deleted articles are
14576(this requires the server to support the UID EXPUNGE command). If 14576immediately expunged (this requires the server to support the
14577@code{on-exit}, deleted articles are flagged, and all flagged articles are 14577@code{UID EXPUNGE} command). If @code{on-exit}, deleted articles are
14578expunged when the group is closed. 14578flagged, and all flagged articles are expunged when the group is
14579 14579closed.
14580For backwards compatibility, this variable may also be set to t 14580
14581or nil. If the server supports UID EXPUNGE, both t and nil are 14581For backwards compatibility, this variable may also be set to @code{t}
14582equivalent to @code{immediately}. If the server does not support UID 14582or @code{nil}. If the server supports @code{UID EXPUNGE}, both
14583EXPUNGE nil is equivalent to @code{never}, while t will immediately 14583@code{t} and @code{nil} are equivalent to @code{immediately}. If the
14584expunge ALL articles that are currently flagged as deleted 14584server does not support @code{UID EXPUNGE}, @code{nil} is equivalent
14585(i.e., potentially not only the article that was just deleted). 14585to @code{never}, while @code{t} will immediately expunge @emph{all}
14586articles that are currently flagged as deleted (i.e., potentially not
14587only the article that was just deleted).
14586 14588
14587@vindex nnimap-streaming 14589@vindex nnimap-streaming
14588@item nnimap-streaming 14590@item nnimap-streaming
@@ -15299,9 +15301,9 @@ Two example maildir mail sources:
15299@end lisp 15301@end lisp
15300 15302
15301@item imap 15303@item imap
15302Get mail from a @acronym{IMAP} server. If you don't want to use 15304Get mail from an @acronym{IMAP} server. If you don't want to use
15303@acronym{IMAP} as intended, as a network mail reading protocol (i.e., 15305@acronym{IMAP} as intended, as a network mail reading protocol (i.e.,
15304with nnimap), for some reason or other, Gnus let you treat it similar 15306with nnimap), for some reason or other, Gnus lets you treat it similar
15305to a @acronym{POP} server and fetches articles from a given 15307to a @acronym{POP} server and fetches articles from a given
15306@acronym{IMAP} mailbox. @xref{Using IMAP}, for more information. 15308@acronym{IMAP} mailbox. @xref{Using IMAP}, for more information.
15307 15309
@@ -19407,7 +19409,7 @@ If you so desire, you can configure the agent (see @code{gnus-agent-cache}
19407@pxref{Agent Variables}) to always download headers and articles while 19409@pxref{Agent Variables}) to always download headers and articles while
19408plugged. Gnus will almost certainly be slower, but it will be kept 19410plugged. Gnus will almost certainly be slower, but it will be kept
19409synchronized with the server. That last point probably won't make any 19411synchronized with the server. That last point probably won't make any
19410sense if you are using a nntp or nnimap back end. 19412sense if you are using an nntp or nnimap back end.
19411 19413
19412@node Agent Expiry 19414@node Agent Expiry
19413@subsection Agent Expiry 19415@subsection Agent Expiry
@@ -26372,7 +26374,7 @@ If this option is non-@code{nil}, the registry will register all messages, as
26372you see them. This is important to making split-to-parent and 26374you see them. This is important to making split-to-parent and
26373Message-ID references work correctly, as the registry needs to know 26375Message-ID references work correctly, as the registry needs to know
26374where all messages are, but it can slow down group opening and the 26376where all messages are, but it can slow down group opening and the
26375saving of Gnus. If this option is nil, entries must be created 26377saving of Gnus. If this option is @code{nil}, entries must be created
26376manually, for instance by storing a custom flag or keyword for the 26378manually, for instance by storing a custom flag or keyword for the
26377message. 26379message.
26378@end defvar 26380@end defvar
@@ -26394,8 +26396,8 @@ This option specifies how registry entries are sorted during pruning.
26394If a function is given, it should sort least valuable entries first, 26396If a function is given, it should sort least valuable entries first,
26395as pruning starts from the beginning of the list. The default value 26397as pruning starts from the beginning of the list. The default value
26396is @code{gnus-registry-sort-by-creation-time}, which proposes the 26398is @code{gnus-registry-sort-by-creation-time}, which proposes the
26397oldest entries for pruning. Set to nil to perform no sorting, which 26399oldest entries for pruning. Set to @code{nil} to perform no sorting,
26398will speed up the pruning process. 26400which will speed up the pruning process.
26399@end defvar 26401@end defvar
26400 26402
26401@defvar gnus-registry-cache-file 26403@defvar gnus-registry-cache-file
@@ -26468,10 +26470,10 @@ have to put a rule like this:
26468 26470
26469in your fancy split setup. 26471in your fancy split setup.
26470 26472
26471If @code{gnus-registry-register-all} is non-@code{nil} (the default), the 26473If @code{gnus-registry-register-all} is non-@code{nil} (the default),
26472registry will perform splitting for all messages. If it is nil, 26474the registry will perform splitting for all messages. If it is
26473splitting will only happen for children of messages you've explicitly 26475@code{nil}, splitting will only happen for children of messages you've
26474registered. 26476explicitly registered.
26475 26477
26476In addition, you may want to customize the following variables. 26478In addition, you may want to customize the following variables.
26477 26479
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi
index 43792c4e9e3..a854c15f2b3 100644
--- a/doc/misc/tramp.texi
+++ b/doc/misc/tramp.texi
@@ -3589,7 +3589,7 @@ completion lists. If you want to suppress this completion because
3589there are invalid entries in the persistency file, for example if the 3589there are invalid entries in the persistency file, for example if the
3590host configuration changes often, or if you plug your laptop to 3590host configuration changes often, or if you plug your laptop to
3591different networks frequently, you can set the user option 3591different networks frequently, you can set the user option
3592@code{tramp-completion-use-cache} to nil. 3592@code{tramp-completion-use-cache} to @code{nil}.
3593 3593
3594After remote host name completion comes completion of file names on 3594After remote host name completion comes completion of file names on
3595the remote host. It works the same as with local host file completion 3595the remote host. It works the same as with local host file completion
diff --git a/doc/misc/use-package.texi b/doc/misc/use-package.texi
index d75cb67e089..55e56f7ce4e 100644
--- a/doc/misc/use-package.texi
+++ b/doc/misc/use-package.texi
@@ -790,7 +790,7 @@ possible, and put as much as you can get away with into the
790Emacs start as quickly as possible. 790Emacs start as quickly as possible.
791 791
792@node Best practices 792@node Best practices
793@subheading When to use @code{:preface}, @code{:config} and @code{:init}? 793@subsection When to use @code{:preface}, @code{:config} and @code{:init}?
794@cindex tips for using @code{:preface}, @code{:config}, @code{:init} 794@cindex tips for using @code{:preface}, @code{:config}, @code{:init}
795 795
796Where possible, it is better to avoid @code{:preface}, @code{:config} 796Where possible, it is better to avoid @code{:preface}, @code{:config}
diff --git a/lisp/apropos.el b/lisp/apropos.el
index e95f45f1804..0e286f3069d 100644
--- a/lisp/apropos.el
+++ b/lisp/apropos.el
@@ -899,7 +899,8 @@ Optional arg BUFFER (default: current buffer) is the buffer to check."
899 ;; state of the `obarray' when we dumped, which we may also be able to 899 ;; state of the `obarray' when we dumped, which we may also be able to
900 ;; use in `bytecomp' to provide a clean initial environment?) 900 ;; use in `bytecomp' to provide a clean initial environment?)
901 (dolist (x load-history) 901 (dolist (x load-history)
902 (when (string-match preloaded-regexp (car x)) 902 (when (let ((elt (car x)))
903 (and (stringp elt) (string-match preloaded-regexp elt)))
903 (dolist (def (cdr x)) 904 (dolist (def (cdr x))
904 (cond 905 (cond
905 ((symbolp def) (funcall f def)) 906 ((symbolp def) (funcall f def))
diff --git a/lisp/dired.el b/lisp/dired.el
index e70467ca53b..914d0a0e783 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -2780,10 +2780,11 @@ This kills the Dired buffer, then visits the current line's file or directory."
2780The optional arguments FIND-FILE-FUNC and FIND-DIR-FUNC specify 2780The optional arguments FIND-FILE-FUNC and FIND-DIR-FUNC specify
2781functions to visit the file and directory, respectively. If 2781functions to visit the file and directory, respectively. If
2782omitted or nil, these arguments default to `find-file' and `dired', 2782omitted or nil, these arguments default to `find-file' and `dired',
2783respectively." 2783respectively. If `dired-kill-when-opening-new-dired-buffer' is
2784non-nil, FIND-DIR-FUNC defaults to `find-alternate-file' instead,
2785so that the original Dired buffer is not kept."
2784 (interactive "e") 2786 (interactive "e")
2785 (or find-file-func (setq find-file-func 'find-file)) 2787 (or find-file-func (setq find-file-func 'find-file))
2786 (or find-dir-func (setq find-dir-func 'dired))
2787 (let (window pos file) 2788 (let (window pos file)
2788 (save-excursion 2789 (save-excursion
2789 (setq window (posn-window (event-end event)) 2790 (setq window (posn-window (event-end event))
@@ -2791,6 +2792,12 @@ respectively."
2791 (if (not (windowp window)) 2792 (if (not (windowp window))
2792 (error "No file chosen")) 2793 (error "No file chosen"))
2793 (set-buffer (window-buffer window)) 2794 (set-buffer (window-buffer window))
2795 (unless find-dir-func
2796 (setq find-dir-func
2797 (if (and dired-kill-when-opening-new-dired-buffer
2798 (< (length (get-buffer-window-list)) 2))
2799 'find-alternate-file
2800 'dired)))
2794 (goto-char pos) 2801 (goto-char pos)
2795 (setq file (dired-get-file-for-visit))) 2802 (setq file (dired-get-file-for-visit)))
2796 (if (file-directory-p file) 2803 (if (file-directory-p file)
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index a1ee5a0396e..01d30e153e0 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -4402,9 +4402,9 @@ after the end of the prompt, move to the end of the prompt.
4402Otherwise move to the start of the buffer." 4402Otherwise move to the start of the buffer."
4403 (declare (interactive-only "use `(goto-char (point-min))' instead.")) 4403 (declare (interactive-only "use `(goto-char (point-min))' instead."))
4404 (interactive "^P") 4404 (interactive "^P")
4405 (when (or (consp arg) 4405 (or (consp arg)
4406 (region-active-p)) 4406 (region-active-p)
4407 (push-mark)) 4407 (push-mark))
4408 (goto-char (cond 4408 (goto-char (cond
4409 ;; We want to go N/10th of the way from the beginning. 4409 ;; We want to go N/10th of the way from the beginning.
4410 ((and arg (not (consp arg))) 4410 ((and arg (not (consp arg)))
diff --git a/lisp/newcomment.el b/lisp/newcomment.el
index 022bf3059be..9ae7de70a0e 100644
--- a/lisp/newcomment.el
+++ b/lisp/newcomment.el
@@ -1356,10 +1356,15 @@ is passed on to the respective function."
1356 "Call the comment command you want (Do What I Mean). 1356 "Call the comment command you want (Do What I Mean).
1357If the region is active and `transient-mark-mode' is on, call 1357If the region is active and `transient-mark-mode' is on, call
1358`comment-region' (unless it only consists of comments, in which 1358`comment-region' (unless it only consists of comments, in which
1359case it calls `uncomment-region'). 1359case it calls `uncomment-region'); in this case, prefix numeric
1360argument ARG specifies how many characters to remove from each
1361comment delimiter (so don't specify a prefix argument whose value
1362is greater than the total length of the comment delimiters).
1360Else, if the current line is empty, call `comment-insert-comment-function' 1363Else, if the current line is empty, call `comment-insert-comment-function'
1361if it is defined, otherwise insert a comment and indent it. 1364if it is defined, otherwise insert a comment and indent it.
1362Else if a prefix ARG is specified, call `comment-kill'. 1365Else, if a prefix ARG is specified, call `comment-kill'; in this
1366case, prefix numeric argument ARG specifies on how many lines to kill
1367the comments.
1363Else, call `comment-indent'. 1368Else, call `comment-indent'.
1364You can configure `comment-style' to change the way regions are commented." 1369You can configure `comment-style' to change the way regions are commented."
1365 (interactive "*P") 1370 (interactive "*P")
diff --git a/lisp/nxml/xmltok.el b/lisp/nxml/xmltok.el
index 6f9df554da0..78fa91b5cdc 100644
--- a/lisp/nxml/xmltok.el
+++ b/lisp/nxml/xmltok.el
@@ -738,7 +738,7 @@ and VALUE-END, otherwise a STRING giving the value."
738 ;; avoid slowdowns due to the quadratic 738 ;; avoid slowdowns due to the quadratic
739 ;; complexity of the regexp. See bug#61514. 739 ;; complexity of the regexp. See bug#61514.
740 (when (with-restriction 740 (when (with-restriction
741 (point) (min (+ (point) 10000) (point-max)) 741 (point) (min (+ (point) 10000) (point-max))
742 (looking-at (concat "[^<>\n]+?" 742 (looking-at (concat "[^<>\n]+?"
743 (xmltok-attribute regexp)))) 743 (xmltok-attribute regexp))))
744 (unless recovering 744 (unless recovering
diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
index 4b83c6733a2..b99388a4074 100644
--- a/lisp/progmodes/c-ts-mode.el
+++ b/lisp/progmodes/c-ts-mode.el
@@ -701,7 +701,7 @@ MODE is either `c' or `cpp'."
701 `(((call_expression 701 `(((call_expression
702 (call_expression function: (identifier) @fn) 702 (call_expression function: (identifier) @fn)
703 @c-ts-mode--fontify-DEFUN) 703 @c-ts-mode--fontify-DEFUN)
704 (:match "^DEFUN$" @fn)) 704 (:match "\\`DEFUN\\'" @fn))
705 705
706 ((function_definition type: (_) @for-each-tail) 706 ((function_definition type: (_) @for-each-tail)
707 @c-ts-mode--fontify-for-each-tail 707 @c-ts-mode--fontify-for-each-tail
diff --git a/lisp/progmodes/cmake-ts-mode.el b/lisp/progmodes/cmake-ts-mode.el
index d83a956af21..9d35d8077bd 100644
--- a/lisp/progmodes/cmake-ts-mode.el
+++ b/lisp/progmodes/cmake-ts-mode.el
@@ -134,7 +134,8 @@
134 :language 'cmake 134 :language 'cmake
135 :feature 'number 135 :feature 'number
136 '(((unquoted_argument) @font-lock-number-face 136 '(((unquoted_argument) @font-lock-number-face
137 (:match "^[[:digit:]]*\\.?[[:digit:]]*\\.?[[:digit:]]+$" @font-lock-number-face))) 137 (:match "\\`[[:digit:]]*\\.?[[:digit:]]*\\.?[[:digit:]]+\\'"
138 @font-lock-number-face)))
138 139
139 :language 'cmake 140 :language 'cmake
140 :feature 'string 141 :feature 'string
diff --git a/lisp/progmodes/java-ts-mode.el b/lisp/progmodes/java-ts-mode.el
index 8a396a8c977..d7fb833d72b 100644
--- a/lisp/progmodes/java-ts-mode.el
+++ b/lisp/progmodes/java-ts-mode.el
@@ -168,7 +168,7 @@ the available version of Tree-sitter for java."
168 :override t 168 :override t
169 :feature 'constant 169 :feature 'constant
170 `(((identifier) @font-lock-constant-face 170 `(((identifier) @font-lock-constant-face
171 (:match "^[A-Z_][A-Z_\\d]*$" @font-lock-constant-face)) 171 (:match "\\`[A-Z_][A-Z_\\d]*\\'" @font-lock-constant-face))
172 [(true) (false)] @font-lock-constant-face) 172 [(true) (false)] @font-lock-constant-face)
173 :language 'java 173 :language 'java
174 :override t 174 :override t
@@ -237,7 +237,7 @@ the available version of Tree-sitter for java."
237 (scoped_identifier (identifier) @font-lock-constant-face) 237 (scoped_identifier (identifier) @font-lock-constant-face)
238 238
239 ((scoped_identifier name: (identifier) @font-lock-type-face) 239 ((scoped_identifier name: (identifier) @font-lock-type-face)
240 (:match "^[A-Z]" @font-lock-type-face)) 240 (:match "\\`[A-Z]" @font-lock-type-face))
241 241
242 (type_identifier) @font-lock-type-face 242 (type_identifier) @font-lock-type-face
243 243
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index f68ecb6fa6c..0aeea163b31 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -3493,7 +3493,7 @@ This function is intended for use in `after-change-functions'."
3493 :language 'javascript 3493 :language 'javascript
3494 :feature 'constant 3494 :feature 'constant
3495 '(((identifier) @font-lock-constant-face 3495 '(((identifier) @font-lock-constant-face
3496 (:match "^[A-Z_][A-Z_\\d]*$" @font-lock-constant-face)) 3496 (:match "\\`[A-Z_][A-Z_\\d]*\\'" @font-lock-constant-face))
3497 3497
3498 [(true) (false) (null)] @font-lock-constant-face) 3498 [(true) (false) (null)] @font-lock-constant-face)
3499 3499
@@ -3612,7 +3612,7 @@ This function is intended for use in `after-change-functions'."
3612 :feature 'number 3612 :feature 'number
3613 '((number) @font-lock-number-face 3613 '((number) @font-lock-number-face
3614 ((identifier) @font-lock-number-face 3614 ((identifier) @font-lock-number-face
3615 (:match "^\\(:?NaN\\|Infinity\\)$" @font-lock-number-face))) 3615 (:match "\\`\\(:?NaN\\|Infinity\\)\\'" @font-lock-number-face)))
3616 3616
3617 :language 'javascript 3617 :language 'javascript
3618 :feature 'operator 3618 :feature 'operator
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 86bbf51dab7..26dafde7591 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -1106,7 +1106,7 @@ fontified."
1106 :language 'python 1106 :language 'python
1107 `([,@python--treesit-keywords] @font-lock-keyword-face 1107 `([,@python--treesit-keywords] @font-lock-keyword-face
1108 ((identifier) @font-lock-keyword-face 1108 ((identifier) @font-lock-keyword-face
1109 (:match "^self$" @font-lock-keyword-face))) 1109 (:match "\\`self\\'" @font-lock-keyword-face)))
1110 1110
1111 :feature 'definition 1111 :feature 'definition
1112 :language 'python 1112 :language 'python
diff --git a/lisp/progmodes/rust-ts-mode.el b/lisp/progmodes/rust-ts-mode.el
index c3cf8d0cf44..b55af0b49e3 100644
--- a/lisp/progmodes/rust-ts-mode.el
+++ b/lisp/progmodes/rust-ts-mode.el
@@ -143,7 +143,7 @@
143 eol)) 143 eol))
144 @font-lock-builtin-face))) 144 @font-lock-builtin-face)))
145 ((identifier) @font-lock-type-face 145 ((identifier) @font-lock-type-face
146 (:match "^\\(:?Err\\|Ok\\|None\\|Some\\)$" @font-lock-type-face))) 146 (:match "\\`\\(:?Err\\|Ok\\|None\\|Some\\)\\'" @font-lock-type-face)))
147 147
148 :language 'rust 148 :language 'rust
149 :feature 'comment 149 :feature 'comment
@@ -212,11 +212,11 @@
212 (scoped_use_list path: (scoped_identifier 212 (scoped_use_list path: (scoped_identifier
213 name: (identifier) @font-lock-constant-face)) 213 name: (identifier) @font-lock-constant-face))
214 ((use_as_clause alias: (identifier) @font-lock-type-face) 214 ((use_as_clause alias: (identifier) @font-lock-type-face)
215 (:match "^[A-Z]" @font-lock-type-face)) 215 (:match "\\`[A-Z]" @font-lock-type-face))
216 ((use_as_clause path: (identifier) @font-lock-type-face) 216 ((use_as_clause path: (identifier) @font-lock-type-face)
217 (:match "^[A-Z]" @font-lock-type-face)) 217 (:match "\\`[A-Z]" @font-lock-type-face))
218 ((use_list (identifier) @font-lock-type-face) 218 ((use_list (identifier) @font-lock-type-face)
219 (:match "^[A-Z]" @font-lock-type-face)) 219 (:match "\\`[A-Z]" @font-lock-type-face))
220 (use_wildcard [(identifier) @rust-ts-mode--fontify-scope 220 (use_wildcard [(identifier) @rust-ts-mode--fontify-scope
221 (scoped_identifier 221 (scoped_identifier
222 name: (identifier) @rust-ts-mode--fontify-scope)]) 222 name: (identifier) @rust-ts-mode--fontify-scope)])
@@ -233,7 +233,7 @@
233 ((scoped_identifier name: (identifier) @rust-ts-mode--fontify-tail)) 233 ((scoped_identifier name: (identifier) @rust-ts-mode--fontify-tail))
234 ((scoped_identifier path: (identifier) @font-lock-type-face) 234 ((scoped_identifier path: (identifier) @font-lock-type-face)
235 (:match 235 (:match
236 "^\\(u8\\|u16\\|u32\\|u64\\|u128\\|usize\\|i8\\|i16\\|i32\\|i64\\|i128\\|isize\\|char\\|str\\)$" 236 "\\`\\(u8\\|u16\\|u32\\|u64\\|u128\\|usize\\|i8\\|i16\\|i32\\|i64\\|i128\\|isize\\|char\\|str\\)\\'"
237 @font-lock-type-face)) 237 @font-lock-type-face))
238 ((scoped_identifier path: (identifier) @rust-ts-mode--fontify-scope)) 238 ((scoped_identifier path: (identifier) @rust-ts-mode--fontify-scope))
239 ((scoped_type_identifier path: (identifier) @rust-ts-mode--fontify-scope)) 239 ((scoped_type_identifier path: (identifier) @rust-ts-mode--fontify-scope))
@@ -249,7 +249,7 @@
249 :feature 'constant 249 :feature 'constant
250 `((boolean_literal) @font-lock-constant-face 250 `((boolean_literal) @font-lock-constant-face
251 ((identifier) @font-lock-constant-face 251 ((identifier) @font-lock-constant-face
252 (:match "^[A-Z][A-Z\\d_]*$" @font-lock-constant-face))) 252 (:match "\\`[A-Z][A-Z\\d_]*\\'" @font-lock-constant-face)))
253 253
254 :language 'rust 254 :language 'rust
255 :feature 'variable 255 :feature 'variable
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 0cde1f387e0..6beff9f41e9 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -3374,7 +3374,7 @@ See `sh-mode--treesit-other-keywords' and
3374 :feature 'number 3374 :feature 'number
3375 :language 'bash 3375 :language 'bash
3376 `(((word) @font-lock-number-face 3376 `(((word) @font-lock-number-face
3377 (:match "^[0-9]+$" @font-lock-number-face))) 3377 (:match "\\`[0-9]+\\'" @font-lock-number-face)))
3378 3378
3379 :feature 'bracket 3379 :feature 'bracket
3380 :language 'bash 3380 :language 'bash
diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el
index 3ba2f86bee8..684f69b3567 100644
--- a/lisp/progmodes/typescript-ts-mode.el
+++ b/lisp/progmodes/typescript-ts-mode.el
@@ -153,7 +153,7 @@ Argument LANGUAGE is either `typescript' or `tsx'."
153 :language language 153 :language language
154 :feature 'constant 154 :feature 'constant
155 `(((identifier) @font-lock-constant-face 155 `(((identifier) @font-lock-constant-face
156 (:match "^[A-Z_][A-Z_\\d]*$" @font-lock-constant-face)) 156 (:match "\\`[A-Z_][A-Z_\\d]*\\'" @font-lock-constant-face))
157 [(true) (false) (null)] @font-lock-constant-face) 157 [(true) (false) (null)] @font-lock-constant-face)
158 158
159 :language language 159 :language language
@@ -311,7 +311,7 @@ Argument LANGUAGE is either `typescript' or `tsx'."
311 :feature 'number 311 :feature 'number
312 `((number) @font-lock-number-face 312 `((number) @font-lock-number-face
313 ((identifier) @font-lock-number-face 313 ((identifier) @font-lock-number-face
314 (:match "^\\(:?NaN\\|Infinity\\)$" @font-lock-number-face))) 314 (:match "\\`\\(:?NaN\\|Infinity\\)\\'" @font-lock-number-face)))
315 315
316 :language language 316 :language language
317 :feature 'operator 317 :feature 'operator
diff --git a/lisp/simple.el b/lisp/simple.el
index 3757f91d11a..6d5ec9ecea9 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2226,7 +2226,10 @@ are available:
2226 This excludes from completion candidates those commands 2226 This excludes from completion candidates those commands
2227 which have been marked specific to modes other than the 2227 which have been marked specific to modes other than the
2228 current buffer's mode. Commands that are not specific 2228 current buffer's mode. Commands that are not specific
2229 to any mode are included. 2229 to any mode are included. If a command has a
2230 `(declare completion...' form which specifies a predicate,
2231 that predicate will be called to determine whether to
2232 include the command in the completion candidates.
2230 2233
2231 `command-completion-using-modes-p' 2234 `command-completion-using-modes-p'
2232 This includes in completion candidates only commands 2235 This includes in completion candidates only commands
diff --git a/lisp/subr.el b/lisp/subr.el
index f270bff1aa4..a353bee89a9 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -4106,7 +4106,7 @@ to other portions of the buffer, use `without-restriction' with the
4106same LABEL argument. 4106same LABEL argument.
4107 4107
4108\(fn START END [:label LABEL] BODY)" 4108\(fn START END [:label LABEL] BODY)"
4109 (declare (indent 0) (debug t)) 4109 (declare (indent 2) (debug t))
4110 (if (eq (car rest) :label) 4110 (if (eq (car rest) :label)
4111 `(internal--with-restriction ,start ,end (lambda () ,@(cddr rest)) 4111 `(internal--with-restriction ,start ,end (lambda () ,@(cddr rest))
4112 ,(cadr rest)) 4112 ,(cadr rest))
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index fcb01fb6c08..294c9792f39 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -2025,7 +2025,7 @@ In the tex shell buffer this command behaves like `comint-send-input'."
2025 2025
2026(defun tex-display-shell () 2026(defun tex-display-shell ()
2027 "Make the TeX shell buffer visible in a window." 2027 "Make the TeX shell buffer visible in a window."
2028 (display-buffer (tex-shell-buf) display-comint-buffer-action) 2028 (display-buffer (tex-shell-buf) display-tex-shell-buffer-action)
2029 (tex-recenter-output-buffer nil)) 2029 (tex-recenter-output-buffer nil))
2030 2030
2031(defun tex-shell-sentinel (proc _msg) 2031(defun tex-shell-sentinel (proc _msg)
@@ -2426,7 +2426,7 @@ Only applies the FSPEC to the args part of FORMAT."
2426 (if cmds (tex-format-cmd (caar cmds) fspec)))))) 2426 (if cmds (tex-format-cmd (caar cmds) fspec))))))
2427 2427
2428(defun tex-cmd-doc-view (file) 2428(defun tex-cmd-doc-view (file)
2429 (pop-to-buffer (find-file-noselect file) display-comint-buffer-action)) 2429 (pop-to-buffer (find-file-noselect file)))
2430 2430
2431(defun tex-compile (dir cmd) 2431(defun tex-compile (dir cmd)
2432 "Run a command CMD on current TeX buffer's file in DIR." 2432 "Run a command CMD on current TeX buffer's file in DIR."
@@ -2681,7 +2681,7 @@ line LINE of the window, or centered if LINE is nil."
2681 (window)) 2681 (window))
2682 (if (null tex-shell) 2682 (if (null tex-shell)
2683 (message "No TeX output buffer") 2683 (message "No TeX output buffer")
2684 (setq window (display-buffer tex-shell display-comint-buffer-action)) 2684 (setq window (display-buffer tex-shell display-tex-shell-buffer-action))
2685 (with-selected-window window 2685 (with-selected-window window
2686 (bury-buffer tex-shell) 2686 (bury-buffer tex-shell)
2687 (goto-char (point-max)) 2687 (goto-char (point-max))
diff --git a/lisp/treesit.el b/lisp/treesit.el
index d79e7732387..df13dd9f424 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -1210,7 +1210,6 @@ See `treesit-simple-indent-presets'.")
1210 (save-excursion 1210 (save-excursion
1211 (goto-char bol) 1211 (goto-char bol)
1212 (looking-at-p comment-end-skip)))) 1212 (looking-at-p comment-end-skip))))
1213 ;; TODO: Document.
1214 (cons 'catch-all (lambda (&rest _) t)) 1213 (cons 'catch-all (lambda (&rest _) t))
1215 1214
1216 (cons 'query (lambda (pattern) 1215 (cons 'query (lambda (pattern)
@@ -1224,7 +1223,6 @@ See `treesit-simple-indent-presets'.")
1224 (cons 'first-sibling (lambda (_n parent &rest _) 1223 (cons 'first-sibling (lambda (_n parent &rest _)
1225 (treesit-node-start 1224 (treesit-node-start
1226 (treesit-node-child parent 0)))) 1225 (treesit-node-child parent 0))))
1227 ;; TODO: Document.
1228 (cons 'nth-sibling (lambda (n &optional named) 1226 (cons 'nth-sibling (lambda (n &optional named)
1229 (lambda (_n parent &rest _) 1227 (lambda (_n parent &rest _)
1230 (treesit-node-start 1228 (treesit-node-start
@@ -1266,7 +1264,6 @@ See `treesit-simple-indent-presets'.")
1266 (or (and this-line-has-prefix 1264 (or (and this-line-has-prefix
1267 (match-beginning 1)) 1265 (match-beginning 1))
1268 (match-end 0))))))) 1266 (match-end 0)))))))
1269 ;; TODO: Document.
1270 (cons 'grand-parent 1267 (cons 'grand-parent
1271 (lambda (_n parent &rest _) 1268 (lambda (_n parent &rest _)
1272 (treesit-node-start (treesit-node-parent parent)))) 1269 (treesit-node-start (treesit-node-parent parent))))
@@ -1337,10 +1334,10 @@ See `treesit-simple-indent-presets'.")
1337 (mapcar (lambda (fn) 1334 (mapcar (lambda (fn)
1338 (funcall fn node parent bol)) 1335 (funcall fn node parent bol))
1339 fns))))) 1336 fns)))))
1340 "A list of presets. 1337 "A list of indent rule presets.
1341These presets that can be used as MATHER and ANCHOR in 1338These presets can be used as MATCHER and ANCHOR values in
1342`treesit-simple-indent-rules'. MACHTERs and ANCHORs are 1339`treesit-simple-indent-rules'. MATCHERs and ANCHORs are
1343functions that take 3 arguments: NODE, PARENT and BOL. 1340functions that take 3 arguments: NODE, PARENT, and BOL.
1344 1341
1345MATCHER: 1342MATCHER:
1346 1343
@@ -1371,6 +1368,10 @@ no-node
1371 1368
1372 Checks that NODE's type matches regexp TYPE. 1369 Checks that NODE's type matches regexp TYPE.
1373 1370
1371\(field-is NAME)
1372
1373 Checks that NODE's field name in PARENT matches regexp NAME.
1374
1374\(n-p-gp NODE-TYPE PARENT-TYPE GRANDPARENT-TYPE) 1375\(n-p-gp NODE-TYPE PARENT-TYPE GRANDPARENT-TYPE)
1375 1376
1376 Checks for NODE's, its parent's, and its grandparent's type. 1377 Checks for NODE's, its parent's, and its grandparent's type.
@@ -1384,16 +1385,33 @@ comment-end
1384 1385
1385 Matches if text after point matches `treesit-comment-end'. 1386 Matches if text after point matches `treesit-comment-end'.
1386 1387
1388catch-all
1389
1390 Always matches.
1391
1387ANCHOR: 1392ANCHOR:
1388 1393
1389first-sibling 1394first-sibling
1390 1395
1391 Returns the start of the first child of PARENT. 1396 Returns the start of the first child of PARENT.
1392 1397
1398\(nth-sibling N &optional NAMED)
1399
1400 Returns the start of the Nth child of PARENT.
1401 NAMED non-nil means count only named nodes.
1402
1393parent 1403parent
1394 1404
1395 Returns the start of PARENT. 1405 Returns the start of PARENT.
1396 1406
1407grand-parent
1408
1409 Returns the start of PARENT's parent.
1410
1411great-grand-parent
1412
1413 Returns the start of PARENT's parent's parent.
1414
1397parent-bol 1415parent-bol
1398 1416
1399 Returns the beginning of non-space characters on the line where 1417 Returns the beginning of non-space characters on the line where
@@ -1401,8 +1419,8 @@ parent-bol
1401 1419
1402standalone-parent 1420standalone-parent
1403 1421
1404 Finds the first ancestor node (parent, grandparent, etc) that 1422 Finds the first ancestor node (parent, grandparent, etc.) that
1405 starts on its own line, and return the start of that node. 1423 starts on its own line, and returns the start of that node.
1406 1424
1407prev-sibling 1425prev-sibling
1408 1426
@@ -1433,7 +1451,7 @@ prev-adaptive-prefix
1433 end of the match, otherwise return nil. However, if the 1451 end of the match, otherwise return nil. However, if the
1434 current line begins with a prefix, return the beginning of 1452 current line begins with a prefix, return the beginning of
1435 the prefix of the previous line instead, so that the two 1453 the prefix of the previous line instead, so that the two
1436 prefixes aligns. This is useful for a `indent-relative'-like 1454 prefixes aligns. This is useful for an `indent-relative'-like
1437 indent behavior for block comments.") 1455 indent behavior for block comments.")
1438 1456
1439(defun treesit--simple-indent-eval (exp) 1457(defun treesit--simple-indent-eval (exp)
@@ -2472,24 +2490,24 @@ instead of emitting a warning."
2472(defun treesit-major-mode-setup () 2490(defun treesit-major-mode-setup ()
2473 "Activate tree-sitter to power major-mode features. 2491 "Activate tree-sitter to power major-mode features.
2474 2492
2475If `treesit-font-lock-settings' is non-nil, setup fontification and 2493If `treesit-font-lock-settings' is non-nil, set up fontification
2476enable `font-lock-mode'. 2494and enable `font-lock-mode'.
2477 2495
2478If `treesit-simple-indent-rules' is non-nil, setup indentation. 2496If `treesit-simple-indent-rules' is non-nil, set up indentation.
2479 2497
2480If `treesit-defun-type-regexp' is non-nil, setup 2498If `treesit-defun-type-regexp' is non-nil, set up
2481`beginning/end-of-defun' functions. 2499`beginning-of-defun-function' and `end-of-defun-function'.
2482 2500
2483If `treesit-defun-name-function' is non-nil, setup 2501If `treesit-defun-name-function' is non-nil, set up
2484`add-log-current-defun'. 2502`add-log-current-defun'.
2485 2503
2486If `treesit-simple-imenu-settings' is non-nil, setup Imenu. 2504If `treesit-simple-imenu-settings' is non-nil, set up Imenu.
2487 2505
2488Make sure necessary parsers are created for the current buffer 2506Make sure necessary parsers are created for the current buffer
2489before calling this function." 2507before calling this function."
2490 ;; Font-lock. 2508 ;; Font-lock.
2491 (when treesit-font-lock-settings 2509 (when treesit-font-lock-settings
2492 ;; `font-lock-mode' wouldn't setup properly if 2510 ;; `font-lock-mode' wouldn't set up properly if
2493 ;; `font-lock-defaults' is nil, see `font-lock-specified-p'. 2511 ;; `font-lock-defaults' is nil, see `font-lock-specified-p'.
2494 (setq-local font-lock-defaults 2512 (setq-local font-lock-defaults
2495 '( nil nil nil nil 2513 '( nil nil nil nil
@@ -2949,7 +2967,7 @@ window."
2949 (display-buffer treesit--explorer-buffer 2967 (display-buffer treesit--explorer-buffer
2950 (cons nil '((inhibit-same-window . t)))) 2968 (cons nil '((inhibit-same-window . t))))
2951 (treesit--explorer-refresh) 2969 (treesit--explorer-refresh)
2952 ;; Setup variables and hooks. 2970 ;; Set up variables and hooks.
2953 (add-hook 'post-command-hook 2971 (add-hook 'post-command-hook
2954 #'treesit--explorer-post-command 0 t) 2972 #'treesit--explorer-post-command 0 t)
2955 (add-hook 'kill-buffer-hook 2973 (add-hook 'kill-buffer-hook
diff --git a/lisp/window.el b/lisp/window.el
index ab7dd5ced12..5964fe37ee6 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -8785,6 +8785,14 @@ another window."
8785 :group 'windows 8785 :group 'windows
8786 :group 'comint) 8786 :group 'comint)
8787 8787
8788(defcustom display-tex-shell-buffer-action '(display-buffer-in-previous-window)
8789 "`display-buffer' action for displaying TeX shell buffers."
8790 :type display-buffer--action-custom-type
8791 :risky t
8792 :version "29.1"
8793 :group 'windows
8794 :group 'tex-run)
8795
8788(defun read-buffer-to-switch (prompt) 8796(defun read-buffer-to-switch (prompt)
8789 "Read the name of a buffer to switch to, prompting with PROMPT. 8797 "Read the name of a buffer to switch to, prompting with PROMPT.
8790Return the name of the buffer as a string. 8798Return the name of the buffer as a string.
diff --git a/src/dbusbind.c b/src/dbusbind.c
index d96b735c79a..97094e407d7 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -276,7 +276,7 @@ XD_OBJECT_TO_STRING (Lisp_Object object)
276 276
277#define XD_DBUS_VALIDATE_BUS_ADDRESS(bus) \ 277#define XD_DBUS_VALIDATE_BUS_ADDRESS(bus) \
278 do { \ 278 do { \
279 char const *session_bus_address = getenv ("DBUS_SESSION_BUS_ADDRESS"); \ 279 char const *session_bus_address = egetenv ("DBUS_SESSION_BUS_ADDRESS"); \
280 if (STRINGP (bus)) \ 280 if (STRINGP (bus)) \
281 { \ 281 { \
282 DBusAddressEntry **entries; \ 282 DBusAddressEntry **entries; \
diff --git a/src/lread.c b/src/lread.c
index eb52329f5a8..c3829d2a3a3 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -3532,7 +3532,7 @@ bytecode_from_rev_list (Lisp_Object elems, Lisp_Object readcharfun)
3532 Convert them back to the original unibyte form. */ 3532 Convert them back to the original unibyte form. */
3533 vec[COMPILED_BYTECODE] = Fstring_as_unibyte (vec[COMPILED_BYTECODE]); 3533 vec[COMPILED_BYTECODE] = Fstring_as_unibyte (vec[COMPILED_BYTECODE]);
3534 } 3534 }
3535 // Bytecode must be immovable. 3535 /* Bytecode must be immovable. */
3536 pin_string (vec[COMPILED_BYTECODE]); 3536 pin_string (vec[COMPILED_BYTECODE]);
3537 } 3537 }
3538 3538
diff --git a/src/xdisp.c b/src/xdisp.c
index bec3f143b1f..d0b0720b005 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -37289,7 +37289,7 @@ shown in a window. Absolute line numbers count from the beginning of
37289the current narrowing, or from buffer beginning. The variable 37289the current narrowing, or from buffer beginning. The variable
37290`display-line-numbers-offset', if non-zero, is a signed offset added 37290`display-line-numbers-offset', if non-zero, is a signed offset added
37291to each absolute line number; it also forces line numbers to be counted 37291to each absolute line number; it also forces line numbers to be counted
37292from the beginning of the buffer, as if `display-line-numbers-wide' 37292from the beginning of the buffer, as if `display-line-numbers-widen'
37293were non-nil. It has no effect when line numbers are not absolute. 37293were non-nil. It has no effect when line numbers are not absolute.
37294 37294
37295If the value is `relative', display for each line not containing the 37295If the value is `relative', display for each line not containing the
diff --git a/test/lisp/minibuffer-tests.el b/test/lisp/minibuffer-tests.el
index 1de8e56cbd4..a67fc555772 100644
--- a/test/lisp/minibuffer-tests.el
+++ b/test/lisp/minibuffer-tests.el
@@ -353,12 +353,23 @@
353 '("a" "ab" "ac") 353 '("a" "ab" "ac")
354 (execute-kbd-macro (kbd "a TAB TAB")) 354 (execute-kbd-macro (kbd "a TAB TAB"))
355 (should (equal (car messages) "Complete, but not unique")) 355 (should (equal (car messages) "Complete, but not unique"))
356 (should-not (get-buffer-window "*Completions*" 0)))) 356 (should-not (get-buffer-window "*Completions*" 0))
357 (execute-kbd-macro (kbd "b TAB"))
358 (should (equal (car messages) "Sole completion"))))
357 (let ((completion-auto-help t)) 359 (let ((completion-auto-help t))
358 (completing-read-with-minibuffer-setup 360 (completing-read-with-minibuffer-setup
359 '("a" "ab" "ac") 361 '("a" "ab" "ac")
360 (execute-kbd-macro (kbd "a TAB TAB")) 362 (execute-kbd-macro (kbd "a TAB TAB"))
361 (should (get-buffer-window "*Completions*" 0))))))) 363 (should (get-buffer-window "*Completions*" 0))
364 (execute-kbd-macro (kbd "b TAB"))
365 (should (equal (car messages) "Sole completion"))))
366 (let ((completion-auto-help 'visible))
367 (completing-read-with-minibuffer-setup
368 '("a" "ab" "ac" "achoo")
369 (execute-kbd-macro (kbd "a TAB TAB"))
370 (should (get-buffer-window "*Completions*" 0))
371 (execute-kbd-macro (kbd "ch TAB"))
372 (should (equal (car messages) "Sole completion")))))))
362 373
363(ert-deftest completion-auto-select-test () 374(ert-deftest completion-auto-select-test ()
364 (let ((completion-auto-select t)) 375 (let ((completion-auto-select t))
diff --git a/test/src/treesit-tests.el b/test/src/treesit-tests.el
index 04aa91ddca6..6e7d0fc48d2 100644
--- a/test/src/treesit-tests.el
+++ b/test/src/treesit-tests.el
@@ -425,14 +425,14 @@ BODY is the test body."
425 ;; String query. 425 ;; String query.
426 '("(string) @string 426 '("(string) @string
427(pair key: (_) @keyword) 427(pair key: (_) @keyword)
428((_) @bob (#match \"^B.b$\" @bob)) 428((_) @bob (#match \"\\\\`B.b\\\\'\" @bob))
429(number) @number 429(number) @number
430((number) @n3 (#equal \"3\" @n3)) 430((number) @n3 (#equal \"3\" @n3))
431((number) @n3p (#pred treesit--ert-pred-last-sibling @n3p))" 431((number) @n3p (#pred treesit--ert-pred-last-sibling @n3p))"
432 ;; Sexp query. 432 ;; Sexp query.
433 ((string) @string 433 ((string) @string
434 (pair key: (_) @keyword) 434 (pair key: (_) @keyword)
435 ((_) @bob (:match "^B.b$" @bob)) 435 ((_) @bob (:match "\\`B.b\\'" @bob))
436 (number) @number 436 (number) @number
437 ((number) @n3 (:equal "3" @n3)) 437 ((number) @n3 (:equal "3" @n3))
438 ((number) @n3p (:pred treesit--ert-pred-last-sibling 438 ((number) @n3p (:pred treesit--ert-pred-last-sibling