diff options
| author | Po Lu | 2023-06-17 17:18:41 +0800 |
|---|---|---|
| committer | Po Lu | 2023-06-17 17:18:41 +0800 |
| commit | bf3bea4460418b82c6de4668659447118fb2de2b (patch) | |
| tree | 49a9e86b83e03db77301e2601599c7b12ceab9cf | |
| parent | 797c30b7abc165d5ebe65474c7398ccad0e3023c (diff) | |
| parent | b51be64a715f9f00d3f413aff4ee8a10d30d2a04 (diff) | |
| download | emacs-bf3bea4460418b82c6de4668659447118fb2de2b.tar.gz emacs-bf3bea4460418b82c6de4668659447118fb2de2b.zip | |
Merge remote-tracking branch 'origin/master' into feature/android
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 |
| 130 | This command is used to change the indentation of all lines that begin | 130 | Indent all lines that begin in the region, moving the affected lines |
| 131 | in the region, moving the affected lines as a rigid unit. | 131 | as a rigid unit (@code{indent-rigidly}). |
| 132 | 132 | ||
| 133 | If called with no argument, the command activates a transient mode for | 133 | If called with no argument, this command activates a transient mode for |
| 134 | adjusting the indentation of the affected lines interactively. While | 134 | adjusting the indentation of the affected lines interactively. While |
| 135 | this transient mode is active, typing @kbd{@key{LEFT}} or | 135 | this 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 |
| 179 | This variable controls whether Emacs ignores the system mousewheel | 179 | This variable controls whether Emacs ignores the system mousewheel |
| 180 | acceleration. When nil each `click' of the mousewheel will correspond | 180 | acceleration. When @code{nil} each `click' of the mousewheel will |
| 181 | exactly with one mousewheel event. When non-@code{nil}, the default, each | 181 | correspond exactly with one mousewheel event. When non-@code{nil}, |
| 182 | `click' may correspond with more than one mousewheel event, depending | 182 | the default, each `click' may correspond with more than one mousewheel |
| 183 | on the user's input. | 183 | event, 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. | |||
| 194 | This variable controls the sensitivity of scrolling with the trackpad. | 194 | This variable controls the sensitivity of scrolling with the trackpad. |
| 195 | Apple trackpads scroll by pixels, not lines, so Emacs converts the | 195 | Apple trackpads scroll by pixels, not lines, so Emacs converts the |
| 196 | system's pixel values into lines. When set to a number, this variable | 196 | system's pixel values into lines. When set to a number, this variable |
| 197 | sets the number of pixels Emacs will consider as one line. When nil | 197 | sets the number of pixels Emacs will consider as one line. When |
| 198 | or a non-number the default line height is used. | 198 | @code{nil} or a non-number the default line height is used. |
| 199 | 199 | ||
| 200 | Setting a lower number makes the trackpad more sensitive, and a higher | 200 | Setting a lower number makes the trackpad more sensitive, and a higher |
| 201 | number makes the trackpad less sensitive. | 201 | number 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 |
| 1178 | comment on the current line, along with the whitespace before it. | 1178 | region is not active kills any comment on the current line, along with |
| 1179 | Since the comment is saved to the kill ring, you can reinsert it on | 1179 | the whitespace before it. Since the comment is saved to the kill |
| 1180 | another line by moving to the end of that line, doing @kbd{C-y}, and | 1180 | ring, you can reinsert it on another line by moving to the end of that |
| 1181 | then @kbd{M-;} to realign the comment. You can achieve the same | 1181 | line, doing @kbd{C-y}, and then @kbd{M-;} to realign the comment. You |
| 1182 | effect as @kbd{C-u M-;} by typing @kbd{M-x comment-kill} | 1182 | can 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 | 1183 | comment-kill} (@code{comment-dwim} actually calls @code{comment-kill} |
| 1184 | subroutine when it is given a prefix argument). | 1184 | as 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 | |||
| 8115 | handler is run. | 8115 | handler is run. |
| 8116 | 8116 | ||
| 8117 | Lastly, the first argument to the @code{condition-case} expression, | 8117 | Lastly, the first argument to the @code{condition-case} expression, |
| 8118 | the @var{var} argument, is sometimes bound to a variable that | 8118 | the @var{var} argument, is sometimes bound to a variable that contains |
| 8119 | contains information about the error. However, if that argument is | 8119 | information about the error. However, if that argument is @code{nil}, |
| 8120 | nil, as is the case in @code{kill-region}, that information is | 8120 | as is the case in @code{kill-region}, that information is discarded. |
| 8121 | discarded. | ||
| 8122 | 8121 | ||
| 8123 | @need 1200 | 8122 | @need 1200 |
| 8124 | In brief, in the @code{kill-region} function, the code | 8123 | In 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{}) |
| 695 | Bind the symbol @var{ref} to a submatch that matches | 695 | Bind 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 |
| 697 | the string of the submatch or nil, but can also be used in | 697 | the 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 |
| 741 | This function prints a trace of Lisp function calls currently active. | 741 | This function prints a trace of Lisp function calls currently active. |
| 742 | The trace is identical to the one that @code{debug} would show in the | 742 | The 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 | ||
| 745 | In the following example, a Lisp expression calls @code{backtrace} | 745 | In the following example, a Lisp expression calls @code{backtrace} |
| 746 | explicitly. This prints the backtrace to the stream | 746 | explicitly. 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 |
| 6532 | Draw a horizontal line from the current point to the first element in | 6532 | Draw 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, |
| 6534 | although usually this doesn’t make sense. | 6534 | although 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 | |||
| 6555 | curve from the current point. If there are multiple coordinate sets, | 6555 | curve from the current point. If there are multiple coordinate sets, |
| 6556 | draw a polybezier. Each coordinate set is a list of the form | 6556 | draw 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 |
| 6560 | beginning and at the end, respectively. | 6560 | beginning and at the end, respectively. |
| 6561 | 6561 | ||
| @@ -6572,7 +6572,7 @@ Using the first element in @var{coordinate-sets}, draw a cubic Bézier | |||
| 6572 | curve from the current point. If there are multiple coordinate sets, | 6572 | curve from the current point. If there are multiple coordinate sets, |
| 6573 | draw a polybezier. Each coordinate set is a list of the form | 6573 | draw 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 |
| 6576 | corresponding control point. The first control point is the | 6576 | corresponding control point. The first control point is the |
| 6577 | reflection of the second control point of the previous command | 6577 | reflection of the second control point of the previous command |
| 6578 | relative to the current point, if that command was @command{curveto} | 6578 | relative 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 | |||
| 6592 | Bézier curve from the current point. If there are multiple coordinate | 6592 | Bézier curve from the current point. If there are multiple coordinate |
| 6593 | sets, draw a polybezier. Each coordinate set is a list of the form | 6593 | sets, 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 |
| 6596 | control point. | 6596 | control point. |
| 6597 | 6597 | ||
| 6598 | @lisp | 6598 | @lisp |
| @@ -6609,7 +6609,7 @@ control point. | |||
| 6609 | Using the first element in @var{coordinate-sets}, draw a quadratic | 6609 | Using the first element in @var{coordinate-sets}, draw a quadratic |
| 6610 | Bézier curve from the current point. If there are multiple coordinate | 6610 | Bézier curve from the current point. If there are multiple coordinate |
| 6611 | sets, draw a polybezier. Each coordinate set is a list of the form | 6611 | sets, 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 |
| 6613 | end point. The control point is the reflection of the control point | 6613 | end point. The control point is the reflection of the control point |
| 6614 | of the previous command relative to the current point, if that command | 6614 | of the previous command relative to the current point, if that command |
| 6615 | was @command{quadratic-bezier-curveto} or | 6615 | was @command{quadratic-bezier-curveto} or |
| @@ -7270,7 +7270,7 @@ window. | |||
| 7270 | @item :width | 7270 | @item :width |
| 7271 | This is only valid for @code{image} icons, and can be either a number | 7271 | This 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}, |
| 7273 | which will use the width in pixels of the current buffer’s default | 7273 | which will use the width in pixels of the current buffer's default |
| 7274 | face font. | 7274 | face 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}) |
| 2616 | Declare @var{completion-predicate} as a function to determine whether | 2616 | Declare @var{completion-predicate} as a function to determine whether |
| 2617 | to include the symbol in the list of functions when asking for | 2617 | to include a function's symbol in the list of functions when asking |
| 2618 | completions in @kbd{M-x}. @var{completion-predicate} is called with | 2618 | for completions in @kbd{M-x}. This predicate function will only be |
| 2619 | two parameters: The first parameter is the symbol, and the second is | 2619 | called when @code{read-extended-command-predicate} is customized to |
| 2620 | the current buffer. | 2620 | @code{command-completion-default-include-p}; by default the value of |
| 2621 | @code{read-extended-command-predicate} is nil (@pxref{Interactive | ||
| 2622 | Call, execute-extended-command}). The predicate | ||
| 2623 | @var{completion-predicate} is called with two arguments: the | ||
| 2624 | function's symbol and the current buffer. | ||
| 2621 | 2625 | ||
| 2622 | @item (modes @var{modes}) | 2626 | @item (modes @var{modes}) |
| 2623 | Specify that this command is meant to be applicable for @var{modes} | 2627 | Specify that this command is meant to be applicable only to specified |
| 2624 | only. | 2628 | @var{modes}. @xref{Command Modes}. |
| 2625 | 2629 | ||
| 2626 | @item (interactive-args @var{arg} ...) | 2630 | @item (interactive-args @var{arg} ...) |
| 2627 | Specify the arguments that should be stored for @code{repeat-command}. | 2631 | Specify 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 | |||
| 248 | where @var{file} is the name of the dump file, and @var{time} is the | 248 | where @var{file} is the name of the dump file, and @var{time} is the |
| 249 | time in seconds it took to restore the state from the dump file. | 249 | time in seconds it took to restore the state from the dump file. |
| 250 | If the current session was not restored from a dump file, the | 250 | If the current session was not restored from a dump file, the |
| 251 | value is nil. | 251 | value 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 | |||
| 2931 | return non-@code{nil} if the node is a valid node for @var{category}, | 2931 | return non-@code{nil} if the node is a valid node for @var{category}, |
| 2932 | or @code{nil} if not. | 2932 | or @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 |
| 2935 | matched by @var{regexp} and @var{pred} are not grouped under | 2935 | matched 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 |
| 2939 | defun node and returns the name of that defun, e.g., the function name | 2939 | defun node and returns the name of that defun, e.g., the function name |
| 2940 | for a function definition. If @var{name-fn} is @var{nil}, | 2940 | for 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 |
| 2942 | instead. | 2942 | instead. |
| 2943 | 2943 | ||
| @@ -3456,7 +3456,7 @@ This condition matches any element of Font Lock keywords for which | |||
| 3456 | non-@code{nil}. | 3456 | non-@code{nil}. |
| 3457 | 3457 | ||
| 3458 | @item @code{(not @var{condition})} | 3458 | @item @code{(not @var{condition})} |
| 3459 | This matches if @var{condition} doesn’t. | 3459 | This matches if @var{condition} doesn't. |
| 3460 | 3460 | ||
| 3461 | @item @code{(and @var{condition} @dots{})} | 3461 | @item @code{(and @var{condition} @dots{})} |
| 3462 | This matches if each of the @var{condition}s matches. | 3462 | This matches if each of the @var{condition}s matches. |
| @@ -4079,7 +4079,7 @@ Source}) for this purpose. | |||
| 4079 | 4079 | ||
| 4080 | Parser-based font lock and other font lock mechanisms are not mutually | 4080 | Parser-based font lock and other font lock mechanisms are not mutually |
| 4081 | exclusive. By default, if enabled, parser-based font lock runs first, | 4081 | exclusive. By default, if enabled, parser-based font lock runs first, |
| 4082 | replacing syntactic font lock, then the regexp-based font lock. | 4082 | replacing syntactic font lock, followed by regexp-based font lock. |
| 4083 | 4083 | ||
| 4084 | Although parser-based font lock doesn't share the same customization | 4084 | Although parser-based font lock doesn't share the same customization |
| 4085 | variables with regexp-based font lock, it uses similar customization | 4085 | variables with regexp-based font lock, it uses similar customization |
| @@ -4112,7 +4112,7 @@ would be highlighted in @code{font-lock-keyword} face. | |||
| 4112 | For more information about queries, patterns, and capture names, see | 4112 | For more information about queries, patterns, and capture names, see |
| 4113 | @ref{Pattern Matching}. | 4113 | @ref{Pattern Matching}. |
| 4114 | 4114 | ||
| 4115 | To setup tree-sitter fontification, a major mode should first set | 4115 | To 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 | ||
| 4140 | This function takes a series of @var{query-spec}s, where each | 4140 | This 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 |
| 4143 | tree-sitter query in either the string, s-expression or compiled form. | 4143 | query 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. |
| 4146 | For each @var{query}, the @var{:keyword}/@var{value} pairs that | 4146 | For each @var{query}, the @var{keyword}/@var{value} pairs that precede |
| 4147 | precede it add meta information to it. The @code{:language} keyword | 4147 | it add meta information to it. The @code{:language} keyword declares |
| 4148 | declares @var{query}'s language. The @code{:feature} keyword sets the | 4148 | @var{query}'s language. The @code{:feature} keyword sets the feature |
| 4149 | feature name of @var{query}. Users can control which features are | 4149 | name of @var{query}. Users can control which features are enabled |
| 4150 | enabled with @code{treesit-font-lock-level} and | 4150 | with @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 |
| 4152 | keywords are mandatory. | 4152 | keywords 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 | |||
| 4171 | with that face. | 4171 | with that face. |
| 4172 | 4172 | ||
| 4173 | @findex treesit-fontify-with-override | 4173 | @findex treesit-fontify-with-override |
| 4174 | Capture names can also be function names, in which case the function | 4174 | A capture name can also be a function name, in which case the function |
| 4175 | is called with 4 arguments: @var{node} and @var{override}, @var{start} | 4175 | is called with 4 arguments: @var{node} and @var{override}, @var{start} |
| 4176 | and @var{end}, where @var{node} is the node itself, @var{override} is | 4176 | and @var{end}, where @var{node} is the node itself, @var{override} is |
| 4177 | the override property of the rule which captured this node, and | 4177 | the @code{:override} property of the rule which captured this node, |
| 4178 | @var{start} and @var{end} limits the region in which this function | 4178 | and @var{start} and @var{end} limit the region which this function |
| 4179 | should fontify. (If this function wants to respect the @var{override} | 4179 | should fontify. (If this function wants to respect the @var{override} |
| 4180 | argument, it can use @code{treesit-fontify-with-override}.) | 4180 | argument, it can use @code{treesit-fontify-with-override}.) |
| 4181 | 4181 | ||
| @@ -4211,9 +4211,9 @@ Some of these features warrant some explanation: @code{definition} | |||
| 4211 | highlights whatever is being defined, e.g., the function name in a | 4211 | highlights whatever is being defined, e.g., the function name in a |
| 4212 | function definition, the struct name in a struct definition, the | 4212 | function definition, the struct name in a struct definition, the |
| 4213 | variable name in a variable definition; @code{assignment} highlights | 4213 | variable name in a variable definition; @code{assignment} highlights |
| 4214 | the whatever is being assigned to, e.g., the variable or field in an | 4214 | whatever is being assigned to, e.g., the variable or field in an |
| 4215 | assignment statement; @code{key} highlights keys in key-value pairs, | 4215 | assignment statement; @code{key} highlights keys in key-value pairs, |
| 4216 | e.g., keys in a JSON object, or a Python dictionary; @code{doc} | 4216 | e.g., keys in a JSON object or Python dictionary; @code{doc} |
| 4217 | highlights docstrings or doc-comments. | 4217 | highlights docstrings or doc-comments. |
| 4218 | 4218 | ||
| 4219 | For example, the value of this variable could be: | 4219 | For example, the value of this variable could be: |
| @@ -4987,7 +4987,7 @@ source indentation commands. For maximum flexibility, it is possible | |||
| 4987 | to write a custom indentation function that queries the syntax tree | 4987 | to write a custom indentation function that queries the syntax tree |
| 4988 | and indents accordingly for each language, but that is a lot of work. | 4988 | and indents accordingly for each language, but that is a lot of work. |
| 4989 | It is more convenient to use the simple indentation engine described | 4989 | It is more convenient to use the simple indentation engine described |
| 4990 | below: then the major mode needs only to write some indentation rules | 4990 | below: then the major mode needs only write some indentation rules, |
| 4991 | and the engine takes care of the rest. | 4991 | and the engine takes care of the rest. |
| 4992 | 4992 | ||
| 4993 | To enable the parser-based indentation engine, either set | 4993 | To 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 |
| 5009 | This local variable stores indentation rules for every language. It is | 5009 | This local variable stores indentation rules for every language. It |
| 5010 | a list of the form: @w{@code{(@var{language} . @var{rules})}}, where | 5010 | is 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 |
| 5012 | form @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 | ||
| 5014 | First, Emacs passes the smallest tree-sitter node at the beginning of | 5015 | First, Emacs passes the smallest tree-sitter node at the beginning of |
| 5015 | the current line to @var{matcher}; if it returns non-@code{nil}, this | 5016 | the 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 |
| 5045 | This is a list of defaults for @var{matcher}s and @var{anchor}s in | 5046 | This 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 |
| 5047 | that takes 3 arguments: @var{node}, @var{parent} and @var{bol}. The | 5048 | function that takes 3 arguments: @var{node}, @var{parent}, and |
| 5048 | available 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 |
| 5052 | This matcher is a function that is called with 3 arguments: | 5053 | This 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}, |
| 5054 | indicating a match, if @var{node} is @code{nil}, i.e., there is no | 5055 | indicating a match, if @var{node} is @code{nil}, i.e., there is no |
| 5055 | node that starts at @var{bol}. This is the case when @var{bol} is on | 5056 | node that starts at @var{bol}. This is the case when @var{bol} is on |
| 5056 | an empty line or inside a multi-line string, etc. | 5057 | an empty line or inside a multi-line string, etc. |
| @@ -5067,6 +5068,12 @@ function that is called with 3 arguments: @var{node}, @var{parent}, | |||
| 5067 | and @var{bol}, and returns non-@code{nil} if @var{node}'s type matches | 5068 | and @var{bol}, and returns non-@code{nil} if @var{node}'s type matches |
| 5068 | regexp @var{type}. | 5069 | regexp @var{type}. |
| 5069 | 5070 | ||
| 5071 | @item field-is | ||
| 5072 | This matcher is a function of one argument, @var{name}; it returns a | ||
| 5073 | function that is called with 3 arguments: @var{node}, @var{parent}, | ||
| 5074 | and @var{bol}, and returns non-@code{nil} if @var{node}'s field name | ||
| 5075 | in @var{parent} matches regexp @var{name}. | ||
| 5076 | |||
| 5070 | @item query | 5077 | @item query |
| 5071 | This matcher is a function of one argument, @var{query}; it returns a | 5078 | This matcher is a function of one argument, @var{query}; it returns a |
| 5072 | function that is called with 3 arguments: @var{node}, @var{parent}, | 5079 | function 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 |
| 5108 | This matcher is a function that is called with 3 arguments: | 5115 | This 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 |
| 5110 | point is before a comment ending token. Comment ending tokens are | 5117 | point is before a comment-ending token. Comment-ending tokens are |
| 5111 | defined by regular expression @code{comment-end-skip} | 5118 | defined by regexp @code{comment-end-skip}. |
| 5119 | |||
| 5120 | @item catch-all | ||
| 5121 | This matcher is a function that is called with 3 arguments: | ||
| 5122 | @var{node}, @var{parent}, and @var{bol}. It always returns | ||
| 5123 | non-@code{nil}, indicating a match. | ||
| 5112 | 5124 | ||
| 5113 | @item first-sibling | 5125 | @item first-sibling |
| 5114 | This anchor is a function that is called with 3 arguments: @var{node}, | 5126 | This 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 |
| 5116 | of @var{parent}. | 5128 | of @var{parent}. |
| 5117 | 5129 | ||
| 5130 | @item nth-sibling | ||
| 5131 | This anchor is a function of two arguments: @var{n}, and an optional | ||
| 5132 | argument @var{named}. It returns a function that is called with 3 | ||
| 5133 | arguments: @var{node}, @var{parent}, and @var{bol}, and returns the | ||
| 5134 | start of the @var{n}th child of @var{parent}. If @var{named} is | ||
| 5135 | non-@code{nil}, only named children are counted (@pxref{tree-sitter | ||
| 5136 | named node, named node}). | ||
| 5137 | |||
| 5118 | @item parent | 5138 | @item parent |
| 5119 | This anchor is a function that is called with 3 arguments: @var{node}, | 5139 | This 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 | ||
| 5143 | This 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 | ||
| 5145 | parent. | ||
| 5146 | |||
| 5147 | @item great-grand-parent | ||
| 5148 | This 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 | ||
| 5150 | parent's parent. | ||
| 5151 | |||
| 5122 | @item parent-bol | 5152 | @item parent-bol |
| 5123 | This anchor is a function that is called with 3 arguments: @var{node}, | 5153 | This 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 |
| 5125 | on the line which @var{parent}'s start is on. | 5155 | on the line which @var{parent}'s start is on. |
| 5126 | 5156 | ||
| 5127 | @item parent-bol | 5157 | @item standalone-parent |
| 5128 | This anchor is a function that is called with 3 arguments: @var{node}, | 5158 | This 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 |
| 5131 | and return the start of that node. ``Starting on its own line'' means | 5161 | line, and return the start of that node. ``Starting on its own line'' |
| 5132 | there is only whitespace character before the node on the line which | 5162 | means there is only whitespace character before the node on the line |
| 5133 | the node's start is on. | 5163 | which the node's start is on. |
| 5134 | 5164 | ||
| 5135 | @item prev-sibling | 5165 | @item prev-sibling |
| 5136 | This anchor is a function that is called with 3 arguments: @var{node}, | 5166 | This 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 |
| 5162 | This anchor is a function that is called with 3 arguments: @var{node}, | 5192 | This 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 |
| 5164 | previous non-empty line, and matches @code{adaptive-fill-regexp}. If | 5194 | @code{adaptive-fill-regexp} to the text at the beginning of the |
| 5165 | there is a match, this function returns the end of the match, | 5195 | previous non-empty line. If there is a match, this function returns |
| 5166 | otherwise it returns nil. However, if the current line begins with a | 5196 | the end of the match, otherwise it returns @code{nil}. However, if |
| 5167 | prefix (e.g., ``-''), return the beginning of the prefix of the | 5197 | the current line begins with a prefix (e.g., @samp{-}), return the |
| 5168 | previous line instead, so that the two prefixes aligns. This anchor | 5198 | beginning of the prefix of the previous line instead, so that the two |
| 5169 | is useful for a @code{indent-relative}-like indent behavior for block | 5199 | prefixes align. This anchor is useful for an |
| 5170 | comments. | 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. | |||
| 5178 | Here are some utility functions that can help writing parser-based | 5208 | Here are some utility functions that can help writing parser-based |
| 5179 | indentation rules. | 5209 | indentation rules. |
| 5180 | 5210 | ||
| 5181 | @defun treesit-check-indent mode | 5211 | @deffn Command treesit-check-indent mode |
| 5182 | This function checks the current buffer's indentation against major | 5212 | This command checks the current buffer's indentation against major |
| 5183 | mode @var{mode}. It indents the current buffer according to | 5213 | mode @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. |
| 5185 | Then it pops up a buffer showing the differences. Correct | 5215 | Then it pops up a buffer showing the differences. Correct |
| 5186 | indentation (target) is shown in green color, current indentation is | 5216 | indentation (target) is shown in green color, current indentation is |
| 5187 | shown in red color. @c Are colors customizable? faces? | 5217 | shown in red color. @c Are colors customizable? faces? |
| 5188 | @end defun | 5218 | @end deffn |
| 5189 | 5219 | ||
| 5190 | It is also helpful to use @code{treesit-inspect-mode} (@pxref{Language | 5220 | It is also helpful to use @code{treesit-inspect-mode} (@pxref{Language |
| 5191 | Grammar}) when writing indentation rules. | 5221 | Grammar}) 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 @@ | |||
| 9 | Emacs provides various ways to parse program source text and produce a | 9 | Emacs 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 |
| 11 | one-dimensional stream of characters, but a structured tree of nodes, | 11 | one-dimensional stream of characters, but a structured tree of nodes, |
| 12 | where each node representing a piece of text. Thus, a syntax tree can | 12 | where each node represents a piece of text. Thus, a syntax tree can |
| 13 | enable interesting features like precise fontification, indentation, | 13 | enable interesting features like precise fontification, indentation, |
| 14 | navigation, structured editing, etc. | 14 | navigation, structured editing, etc. |
| 15 | 15 | ||
| @@ -19,8 +19,8 @@ generic navigation and indentation (@pxref{SMIE}). | |||
| 19 | 19 | ||
| 20 | In addition to those, Emacs also provides integration with | 20 | In 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 |
| 22 | library}) if support for it was compiled in. The tree-sitter library | 22 | library} if support for it was compiled in. The tree-sitter library |
| 23 | implements an incremental parser and has support from a wide range of | 23 | implements an incremental parser and has support for a wide range of |
| 24 | programming languages. | 24 | programming 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 |
| 68 | Tree-sitter language grammar are distributed as dynamic libraries. | 68 | Tree-sitter language grammars are distributed as dynamic libraries. |
| 69 | In order to use a language grammar in Emacs, you need to make sure | 69 | In order to use a language grammar in Emacs, you need to make sure |
| 70 | that the dynamic library is installed on the system. Emacs looks for | 70 | that the dynamic library is installed on the system. Emacs looks for |
| 71 | language grammar in several places, in the following order: | 71 | language 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. | |||
| 95 | This means that Emacs could not find in the library the expected function | 95 | This means that Emacs could not find in the library the expected function |
| 96 | that every language grammar library should export. | 96 | that every language grammar library should export. |
| 97 | @item (version-mismatch @var{error-msg}) | 97 | @item (version-mismatch @var{error-msg}) |
| 98 | This means that the version of language grammar library is incompatible | 98 | This means that the version of the language grammar library is |
| 99 | with that of the tree-sitter library. | 99 | incompatible 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 |
| 107 | This function returns non-@code{nil} if the language grammar for | 107 | This 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 | ||
| 110 | If @var{detail} is non-@code{nil}, return @code{(t . nil)} when | 110 | If @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 | ||
| 128 | to the list in the variable @code{treesit-load-name-override-list}, where | 128 | to 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 | |||
| 146 | tree-sitter library. By default, it returns the latest ABI version | 146 | tree-sitter library. By default, it returns the latest ABI version |
| 147 | supported by the library, but if @var{min-compatible} is | 147 | supported by the library, but if @var{min-compatible} is |
| 148 | non-@code{nil}, it returns the oldest ABI version which the library | 148 | non-@code{nil}, it returns the oldest ABI version which the library |
| 149 | still can support. language grammar libraries must be built for | 149 | still can support. Language grammar libraries must be built for |
| 150 | ABI versions between the oldest and the latest versions supported by | 150 | ABI versions between the oldest and the latest versions supported by |
| 151 | the tree-sitter library, otherwise the library will be unable to load | 151 | the tree-sitter library, otherwise the library will be unable to load |
| 152 | them. | 152 | them. |
| @@ -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 | ||
| 235 | To aid in understanding the syntax of a language and in debugging of | 235 | To aid in understanding the syntax of a language and in debugging Lisp |
| 236 | Lisp program that use the syntax tree, Emacs provides an ``explore'' | 236 | programs that use the syntax tree, Emacs provides an ``explore'' mode, |
| 237 | mode, which displays the syntax tree of the source in the current | 237 | which displays the syntax tree of the source in the current buffer in |
| 238 | buffer in real time. Emacs also comes with an ``inspect mode'', which | 238 | real time. Emacs also comes with an ``inspect mode'', which displays |
| 239 | displays information of the nodes at point in the mode-line. | 239 | information of the nodes at point in the mode-line. |
| 240 | 240 | ||
| 241 | @deffn Command treesit-explore-mode | 241 | @deffn Command treesit-explore-mode |
| 242 | This mode pops up a window displaying the syntax tree of the source in | 242 | This 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 | ||
| 274 | Authors of language grammar define the @dfn{grammar} of a | 274 | Authors of language grammars define the @dfn{grammar} of a |
| 275 | programming language, which determines how a parser constructs a | 275 | programming language, which determines how a parser constructs a |
| 276 | concrete syntax tree out of the program text. In order to use the | 276 | concrete syntax tree out of the program text. In order to use the |
| 277 | syntax tree effectively, you need to consult the @dfn{grammar file}. | 277 | syntax tree effectively, you need to consult the @dfn{grammar file}. |
| @@ -283,7 +283,7 @@ home page can be found on | |||
| 283 | homepage}. | 283 | homepage}. |
| 284 | 284 | ||
| 285 | The grammar definition is written in JavaScript. For example, the | 285 | The grammar definition is written in JavaScript. For example, the |
| 286 | rule matching a @code{function_definition} node looks like | 286 | rule 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{}) |
| 332 | matches one of the rules in its arguments. | 332 | matches one of the rules in its arguments. |
| 333 | @item repeat(@var{rule}) | 333 | @item repeat(@var{rule}) |
| 334 | matches @var{rule} for @emph{zero or more} times. | 334 | matches @var{rule} @emph{zero or more} times. |
| 335 | This is like the @samp{*} operator in regular expressions. | 335 | This is like the @samp{*} operator in regular expressions. |
| 336 | @item repeat1(@var{rule}) | 336 | @item repeat1(@var{rule}) |
| 337 | matches @var{rule} for @emph{one or more} times. | 337 | matches @var{rule} @emph{one or more} times. |
| 338 | This is like the @samp{+} operator in regular expressions. | 338 | This is like the @samp{+} operator in regular expressions. |
| 339 | @item optional(@var{rule}) | 339 | @item optional(@var{rule}) |
| 340 | matches @var{rule} for @emph{zero or one} time. | 340 | matches @var{rule} @emph{zero or one} times. |
| 341 | This is like the @samp{?} operator in regular expressions. | 341 | This is like the @samp{?} operator in regular expressions. |
| 342 | @item field(@var{name}, @var{rule}) | 342 | @item field(@var{name}, @var{rule}) |
| 343 | assigns field name @var{name} to the child node matched by @var{rule}. | 343 | assigns 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}) |
| 367 | Normally, grammar rules ignore preceding whitespace; this | 367 | Normally, grammar rules ignore preceding whitespace; this |
| 368 | changes @var{rule} to match only when there is no preceding | 368 | changes @var{rule} to match only when there is no preceding |
| 369 | whitespaces. | 369 | whitespace. |
| 370 | @item prec(@var{n}, @var{rule}) | 370 | @item prec(@var{n}, @var{rule}) |
| 371 | gives @var{rule} the level-@var{n} precedence. | 371 | gives @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. | |||
| 412 | If that buffer is an indirect buffer, its base buffer is used instead. | 412 | If that buffer is an indirect buffer, its base buffer is used instead. |
| 413 | That is, indirect buffers use their base buffer's parsers. If the | 413 | That is, indirect buffers use their base buffer's parsers. If the |
| 414 | base buffer is narrowed, an indirect buffer might not be able to | 414 | base buffer is narrowed, an indirect buffer might not be able to |
| 415 | retrieve information of the portion of the buffer text that are | 415 | retrieve information of the portion of the buffer text that is |
| 416 | invisible in the base buffer. Lisp programs should widen as necessary | 416 | invisible in the base buffer. Lisp programs should widen as necessary |
| 417 | should they want to use a parser in an indirect buffer. | 417 | should 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 |
| 443 | When a parser does parse, it checks for the size of the buffer. | 443 | When a parser does parse, it checks for the size of the buffer. |
| 444 | Tree-sitter can only handle buffer no larger than about 4GB. If the | 444 | Tree-sitter can only handle buffers no larger than about 4GB@. If the |
| 445 | size exceeds that, Emacs signals the @code{treesit-buffer-too-large} | 445 | size exceeds that, Emacs signals the @code{treesit-buffer-too-large} |
| 446 | error with signal data being the buffer size. | 446 | error with signal data being the buffer size. |
| 447 | 447 | ||
| @@ -500,13 +500,12 @@ converts text before that token into a comment. Even | |||
| 500 | though the text is not directly edited, it is deemed to be ``changed'' | 500 | though the text is not directly edited, it is deemed to be ``changed'' |
| 501 | nevertheless. | 501 | nevertheless. |
| 502 | 502 | ||
| 503 | Emacs lets a Lisp program to register callback functions | 503 | Emacs 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 |
| 505 | function takes two arguments: @var{ranges} and @var{parser}. | 505 | takes 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} | 506 | list 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 | 507 | where @var{start} and @var{end} mark the start and the end positions |
| 508 | end positions of a range. @var{parser} is the parser issuing the | 508 | of a range. @var{parser} is the parser issuing the notification. |
| 509 | notification. | ||
| 510 | 509 | ||
| 511 | Every time a parser reparses a buffer, it compares the old and new | 510 | Every time a parser reparses a buffer, it compares the old and new |
| 512 | parse-tree, computes the ranges in which nodes have changed, and | 511 | parse-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 |
| 540 | Here's some terminology and conventions we use when documenting | 539 | Here are some terms and conventions we use when documenting |
| 541 | tree-sitter functions. | 540 | tree-sitter functions. |
| 542 | 541 | ||
| 543 | A node in a syntax tree spans some portion of the program text in the | 542 | A 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}. | |||
| 571 | A leaf node is a node that doesn't have any child nodes. | 570 | A leaf node is a node that doesn't have any child nodes. |
| 572 | 571 | ||
| 573 | This function tries to return a node whose span covers @var{pos}: the | 572 | This function tries to return a node whose span covers @var{pos}: the |
| 574 | node's beginning position is less or equal to @var{pos}, and the | 573 | node's beginning position is less than or equal to @var{pos}, and the |
| 575 | node's end position is greater or equal to @var{pos}. | 574 | node's end position is greater than or equal to @var{pos}. |
| 576 | 575 | ||
| 577 | If no leaf node's span covers @var{pos} (e.g., @var{pos} is in the | 576 | If no leaf node's span covers @var{pos} (e.g., @var{pos} is in the |
| 578 | whitespace between two leaf nodes), this function returns the first | 577 | whitespace 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 | |||
| 612 | is at or after @var{end}. | 611 | is 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 |
| 615 | inside any top-level construct (function definition, etc.) most | 614 | inside any top-level construct (function definition, etc.@:) most |
| 616 | probably will give you the root node, because the root node is the | 615 | probably will give you the root node, because the root node is the |
| 617 | smallest node that covers that empty line. Most of the time, you want | 616 | smallest node that covers that empty line. Most of the time, you want |
| 618 | to use @code{treesit-node-at} instead. | 617 | to use @code{treesit-node-at} instead. |
| @@ -656,7 +655,7 @@ it, or query for information about this node. | |||
| 656 | This function returns the immediate parent of @var{node}. | 655 | This function returns the immediate parent of @var{node}. |
| 657 | 656 | ||
| 658 | If @var{node} is more than 1000 levels deep in a parse tree, the | 657 | If @var{node} is more than 1000 levels deep in a parse tree, the |
| 659 | return value is undefined. Currently it returns @var{nil}, but that | 658 | return value is undefined. Currently it returns @code{nil}, but that |
| 660 | could change in the future. | 659 | could 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 | |||
| 672 | is the string text. | 671 | is the string text. |
| 673 | 672 | ||
| 674 | This function returns @code{nil} if there is no @var{n}'th child. | 673 | This 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 | ||
| 697 | To make the syntax tree easier to analyze, many language grammar | 696 | To make the syntax tree easier to analyze, many language grammars |
| 698 | assign @dfn{field names} to child nodes (@pxref{tree-sitter node field | 697 | assign @dfn{field names} to child nodes (@pxref{tree-sitter node field |
| 699 | name, field name}). For example, a @code{function_definition} node | 698 | name, field name}). For example, a @code{function_definition} node |
| 700 | could have a @code{declarator} node and a @code{body} node. | 699 | could have a @code{declarator} node and a @code{body} node. |
| @@ -729,7 +728,7 @@ first named child (@pxref{tree-sitter named node, named node}). | |||
| 729 | This function finds the @emph{smallest} descendant node of @var{node} | 728 | This function finds the @emph{smallest} descendant node of @var{node} |
| 730 | that spans the region of text between positions @var{beg} and | 729 | that 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} |
| 732 | is non-@code{nil}, it looks for smallest named child. | 731 | is 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. | |||
| 755 | Like @code{treesit-search-subtree}, this function also traverses the | 754 | Like @code{treesit-search-subtree}, this function also traverses the |
| 756 | parse tree and matches each node with @var{predicate} (except for | 755 | parse 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. |
| 758 | For a tree like the below where @var{start} is marked S, this function | 757 | For a tree like the one below where @var{start} is marked @samp{S}, |
| 759 | traverses as numbered from 1 to 12: | 758 | this 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 | ||
| 775 | Note that this function doesn't traverse the subtree of @var{start}, | 774 | Note that this function doesn't traverse the subtree of @var{start}, |
| 776 | and it always traverse leaf nodes first, then upwards. | 775 | and it always traverses leaf nodes first, before moving upwards. |
| 777 | 776 | ||
| 778 | Like @code{treesit-search-subtree}, this function only searches for | 777 | Like @code{treesit-search-subtree}, this function only searches for |
| 779 | named nodes by default, but if @var{all} is non-@code{nil}, it | 778 | named 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 | |||
| 786 | start positions greater than the end position of @var{start}. | 785 | start positions greater than the end position of @var{start}. |
| 787 | 786 | ||
| 788 | In the tree shown above, @code{treesit-search-subtree} traverses node | 787 | In the tree shown above, @code{treesit-search-subtree} traverses node |
| 789 | S (@var{start}) and nodes marked with @code{o}, where this function | 788 | @samp{S} (@var{start}) and nodes marked with @code{o}, where this |
| 790 | traverses the nodes marked with numbers. This function is useful for | 789 | function traverses the nodes marked with numbers. This function is |
| 791 | answering questions like ``what is the first node after @var{start} in | 790 | useful for answering questions like ``what is the first node after |
| 792 | the 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 | |||
| 801 | progress in terms of buffer position: the start/end position of the | 800 | progress in terms of buffer position: the start/end position of the |
| 802 | returned node is always greater than that of @var{node}. | 801 | returned node is always greater than that of @var{node}. |
| 803 | 802 | ||
| 804 | Arguments @var{predicate}, @var{backward} and @var{all} are the same | 803 | Arguments @var{predicate}, @var{backward}, and @var{all} are the same |
| 805 | as in @code{treesit-search-forward}. | 804 | as 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. | |||
| 811 | It takes the subtree under @var{root}, and combs it so only the nodes | 810 | It takes the subtree under @var{root}, and combs it so only the nodes |
| 812 | that match @var{predicate} are left. Like previous functions, the | 811 | that 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 |
| 814 | node's type, or a function that takes a node and return non-@code{nil} | 813 | node's type, or a function that takes a node and returns |
| 815 | if it matches. | 814 | non-@code{nil} if it matches. |
| 816 | 815 | ||
| 817 | For example, for a subtree on the left that consist of both numbers | 816 | For example, given the subtree on the left that consists of both |
| 818 | and letters, if @var{predicate} is ``letter only'', the returned tree | 817 | numbers and letters, if @var{predicate} is ``letter only'', the |
| 819 | is the one on the right. | 818 | returned 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 | ||
| 837 | If @var{process-fn} is non-@code{nil}, instead of returning the | 836 | If @var{process-fn} is non-@code{nil}, instead of returning the |
| 838 | matched nodes, this function passes each node to @var{process-fn} and | 837 | matched nodes, this function passes each node to @var{process-fn} and |
| 839 | uses the returned value instead. If non-@code{nil}, @var{depth} is | 838 | uses the returned value instead. If non-@code{nil}, @var{depth} |
| 840 | the number of levels to go down from @var{root}. If @var{depth} is | 839 | limits 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 | ||
| 843 | Each node in the returned tree looks like | 842 | Each 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. | |||
| 900 | This function finds immediate children of @var{node} that satisfy | 899 | This function finds immediate children of @var{node} that satisfy |
| 901 | @var{predicate}. | 900 | @var{predicate}. |
| 902 | 901 | ||
| 903 | The @var{predicate} function takes a node as the argument and should | 902 | The @var{predicate} function takes a node as argument and should |
| 904 | return non-@code{nil} to indicate that the node should be kept. If | 903 | return 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 |
| 906 | nodes. | 905 | nodes. |
| 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 |
| 910 | This function repeatedly finds the parents of @var{node}, and returns | 909 | This function repeatedly finds the parents of @var{node}, and returns |
| 911 | the parent that satisfies @var{pred}, a function that takes a node as | 910 | the parent that satisfies @var{pred}, a function that takes a node as |
| 912 | the argument and returns a boolean that indicates a match. If no | 911 | argument and returns a boolean that indicates a match. If no parent |
| 913 | parent satisfies @var{pred}, this function returns @code{nil}. | 912 | satisfies @var{pred}, this function returns @code{nil}. |
| 914 | 913 | ||
| 915 | Normally this function only looks at the parents of @var{node} but not | 914 | Normally 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 |
| 917 | function returns @var{node} if @var{node} satisfies @var{pred}. | 916 | function 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 |
| 921 | This function goes up the tree starting from @var{node}, and keeps | 920 | This function goes up the tree starting from @var{node}, and keeps |
| 922 | doing so as long as the nodes satisfy @var{pred}, a function that | 921 | doing so as long as the nodes satisfy @var{pred}, a function that |
| 923 | takes a node as the argument. That is, this function returns the | 922 | takes a node as argument. That is, this function returns the highest |
| 924 | highest parent of @var{node} that still satisfies @var{pred}. Note | 923 | parent of @var{node} that still satisfies @var{pred}. Note that if |
| 925 | that if @var{node} satisfies @var{pred} but its immediate parent | 924 | @var{node} satisfies @var{pred} but its immediate parent doesn't, |
| 926 | doesn'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 |
| 1028 | A node is considered @dfn{live} if its parser is not deleted, and the | 1027 | A node is considered @dfn{live} if its parser is not deleted, and the |
| 1029 | buffer to which it belongs to is a live buffer (@pxref{Killing Buffers}). | 1028 | buffer 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 |
| 1032 | This function returns non-@code{nil} if @var{node} has the specified | 1031 | This 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 |
| 1064 | the @var{n}'th child doesn't have a field name. | 1063 | the @var{n}'th child doesn't have a field name. |
| 1065 | 1064 | ||
| 1066 | Note that @var{n} counts both named and anonymous child. And @var{n} | 1065 | Note that @var{n} counts both named and anonymous children, and |
| 1067 | could 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 |
| 1071 | This function finds the number of children of @var{node}. If | 1070 | This 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 |
| 1096 | A @dfn{query} consists of multiple @dfn{patterns}. Each pattern is an | 1095 | A @dfn{query} consists of multiple @dfn{patterns}. Each pattern is an |
| 1097 | s-expression that matches a certain node in the syntax node. A | 1096 | s-expression that matches a certain node in the syntax node. A |
| 1098 | pattern has the form @w{@code{(@var{type} (@var{child}@dots{}))}} | 1097 | pattern has the form @w{@code{(@var{type} (@var{child}@dots{}))}}. |
| 1099 | 1098 | ||
| 1100 | For example, a pattern that matches a @code{binary_expression} node that | 1099 | For example, a pattern that matches a @code{binary_expression} node that |
| 1101 | contains @code{number_literal} child nodes would look like | 1100 | contains @code{number_literal} child nodes would look like |
| @@ -1131,25 +1130,26 @@ example, the capture name @code{biexp}: | |||
| 1131 | Now we can introduce the @dfn{query functions}. | 1130 | Now 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 |
| 1134 | This function matches patterns in @var{query} within @var{node}. | 1133 | This function matches patterns in @var{query} within @var{node}. The |
| 1135 | The argument @var{query} can be either a string, a s-expression, or a | 1134 | argument @var{query} can be either a string, an s-expression, or a |
| 1136 | compiled query object. For now, we focus on the string syntax; | 1135 | compiled query object. For now, we focus on the string syntax; |
| 1137 | s-expression syntax and compiled query are described at the end of the | 1136 | s-expression syntax and compiled queries are described at the end of |
| 1138 | section. | 1137 | the section. |
| 1139 | 1138 | ||
| 1140 | The argument @var{node} can also be a parser or a language symbol. A | 1139 | The argument @var{node} can also be a parser or a language symbol. A |
| 1141 | parser means using its root node, a language symbol means find or | 1140 | parser means use its root node, a language symbol means find or create |
| 1142 | create a parser for that language in the current buffer, and use the | 1141 | a parser for that language in the current buffer, and use the root |
| 1143 | root node. | 1142 | node. |
| 1144 | 1143 | ||
| 1145 | The function returns all the captured nodes in a list of the form | 1144 | The function returns all the captured nodes in an alist with elements |
| 1146 | @w{@code{(@var{capture_name} . @var{node})}}. If @var{node-only} is | 1145 | of the form @w{@code{(@var{capture_name} . @var{node})}}. If |
| 1147 | non-@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 |
| 1148 | entire text of @var{node} is searched, but if @var{beg} and @var{end} | 1147 | instead. By default the entire text of @var{node} is searched, but if |
| 1149 | are 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 |
| 1150 | this function should match nodes. Any matching node whose span | 1149 | region of buffer text where this function should match nodes. Any |
| 1151 | overlaps with the region between @var{beg} and @var{end} are captured, | 1150 | matching node whose span overlaps with the region between @var{beg} |
| 1152 | it doesn't have to be completely in the region. | 1151 | and @var{end} is captured; it doesn't have to be completely contained |
| 1152 | in 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 |
| 1196 | This function parses @var{string} with @var{language}, matches its | 1196 | This function parses @var{string} as @var{language}, matches its root |
| 1197 | root node with @var{query}, and returns the result. | 1197 | node 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 | ||
| 1202 | Besides node type and capture, tree-sitter's pattern syntax can | 1202 | Besides node type and capture name, tree-sitter's pattern syntax can |
| 1203 | express anonymous node, field name, wildcard, quantification, | 1203 | express anonymous node, field name, wildcard, quantification, |
| 1204 | grouping, alternation, anchor, and predicate. | 1204 | grouping, 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 | ||
| 1217 | In a pattern, @samp{(_)} matches any named node, and @samp{_} matches | 1217 | In a pattern, @samp{(_)} matches any named node, and @samp{_} matches |
| 1218 | any named and anonymous node. For example, to capture any named child | 1218 | any named or anonymous node. For example, to capture any named child |
| 1219 | of a @code{binary_expression} node, the pattern would be | 1219 | of 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 | ||
| 1239 | It is also possible to capture a node that doesn't have a certain | 1239 | It is also possible to capture a node that doesn't have a certain |
| 1240 | field, say, a @code{function_definition} without a @code{body} field. | 1240 | field, 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 |
| 1249 | Tree-sitter recognizes quantification operators @samp{*}, @samp{+} and | 1249 | Tree-sitter recognizes quantification operators @samp{*}, @samp{+}, |
| 1250 | @samp{?}. Their meanings are the same as in regular expressions: | 1250 | and @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{+} |
| 1252 | matches one or more times, and @samp{?} matches zero or one time. | 1252 | matches one or more times, and @samp{?} matches zero or one times. |
| 1253 | 1253 | ||
| 1254 | For example, the following pattern matches @code{type_declaration} | 1254 | For example, the following pattern matches @code{type_declaration} |
| 1255 | nodes that has @emph{zero or more} @code{long} keyword. | 1255 | nodes 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 | ||
| 1261 | The following pattern matches a type declaration that has zero or one | 1261 | The following pattern matches a type declaration that may or may not |
| 1262 | @code{long} keyword: | 1262 | have 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 | ||
| 1270 | Similar to groups in regular expression, we can bundle patterns into | 1270 | Similar to groups in regular expressions, we can bundle patterns into |
| 1271 | groups and apply quantification operators to them. For example, to | 1271 | groups and apply quantification operators to them. For example, to |
| 1272 | express a comma separated list of identifiers, one could write | 1272 | express 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 | ||
| 1280 | Again, similar to regular expressions, we can express ``match anyone | 1280 | Again, similar to regular expressions, we can express ``match any one |
| 1281 | from this group of patterns'' in a pattern. The syntax is a list of | 1281 | of these patterns'' in a pattern. The syntax is a list of patterns |
| 1282 | patterns enclosed in square brackets. For example, to capture some | 1282 | enclosed in square brackets. For example, to capture some keywords in |
| 1283 | keywords in C, the pattern would be | 1283 | C, 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 |
| 1342 | tree-sitter only matches arrays where the first element equals to the | 1342 | tree-sitter only matches arrays where the first element is equal to |
| 1343 | last element. To attach a predicate to a pattern, we need to group | 1343 | the last element. To attach a predicate to a pattern, we need to |
| 1344 | them together. A predicate always starts with a @samp{#}. Currently | 1344 | group them together. A predicate always starts with a @samp{#}. |
| 1345 | there are three predicates, @code{#equal}, @code{#match}, and | 1345 | Currently there are three predicates: @code{#equal}, @code{#match}, |
| 1346 | @code{#pred}. | 1346 | and @code{#pred}. |
| 1347 | 1347 | ||
| 1348 | @deffn Predicate equal arg1 arg2 | 1348 | @deffn Predicate equal arg1 arg2 |
| 1349 | Matches if @var{arg1} equals to @var{arg2}. Arguments can be either | 1349 | Matches if @var{arg1} is equal to @var{arg2}. Arguments can be either |
| 1350 | strings or capture names. Capture names represent the text that the | 1350 | strings or capture names. Capture names represent the text that the |
| 1351 | captured node spans in the buffer. | 1351 | captured 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 |
| 1373 | Besides strings, Emacs provides a s-expression based syntax for | 1373 | Besides strings, Emacs provides an s-expression based syntax for |
| 1374 | tree-sitter patterns. It largely resembles the string-based syntax. | 1374 | tree-sitter patterns. It largely resembles the string-based syntax. |
| 1375 | For example, the following query | 1375 | For example, the following query |
| 1376 | 1376 | ||
| @@ -1402,7 +1402,7 @@ is equivalent to | |||
| 1402 | @end example | 1402 | @end example |
| 1403 | 1403 | ||
| 1404 | Most patterns can be written directly as strange but nevertheless | 1404 | Most patterns can be written directly as strange but nevertheless |
| 1405 | valid s-expressions. Only a few of them needs modification: | 1405 | valid 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 |
| 1433 | is written in s-expression as | 1433 | is 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 | |||
| 1488 | need to be assigned different parsers. Traditionally, this is | 1488 | need to be assigned different parsers. Traditionally, this is |
| 1489 | achieved by using narrowing. While tree-sitter works with narrowing | 1489 | achieved 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 |
| 1491 | instead to set regions of buffer text (i.e., ranges) in which a parser | 1491 | instead to specify regions of buffer text (i.e., ranges) in which a |
| 1492 | will operate. This section describes functions for setting and | 1492 | parser will operate. This section describes functions for setting and |
| 1493 | getting ranges for a parser. | 1493 | getting ranges for a parser. |
| 1494 | 1494 | ||
| 1495 | Lisp programs should call @code{treesit-update-ranges} to make sure | 1495 | Lisp 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 |
| 1508 | This function sets up @var{parser} to operate on @var{ranges}. The | 1508 | This 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 |
| 1510 | range in @var{ranges} is a list of the form @w{@code{(@var{beg} | 1510 | range in @var{ranges} is a pair of the form @w{@code{(@var{beg} |
| 1511 | . @var{end})}}. | 1511 | . @var{end})}}. |
| 1512 | 1512 | ||
| 1513 | The ranges in @var{ranges} must come in order and must not overlap. | 1513 | The 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 | ||
| 1583 | It should suffice for general Lisp programs to call the following two | 1583 | It should suffice for general Lisp programs to call the following two |
| 1584 | functions in order to support program sources that mixes multiple | 1584 | functions in order to support program sources that mix multiple |
| 1585 | languages. | 1585 | languages. |
| 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 | |||
| 1617 | embedded languages with that information, and then parses the embedded | 1617 | embedded languages with that information, and then parses the embedded |
| 1618 | languages. | 1618 | languages. |
| 1619 | 1619 | ||
| 1620 | Take a buffer containing @acronym{HTML}, @acronym{CSS} and JavaScript | 1620 | Take a buffer containing @acronym{HTML}, @acronym{CSS}, and JavaScript |
| 1621 | as an example. A Lisp program will first parse the whole buffer with | 1621 | as an example. A Lisp program will first parse the whole buffer with |
| 1622 | an @acronym{HTML} parser, then query the parser for | 1622 | an @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 |
| 1624 | correspond to @acronym{CSS} and JavaScript text, respectively. Then | 1624 | to @acronym{CSS} and JavaScript text, respectively. Then it sets the |
| 1625 | it sets the range of the @acronym{CSS} and JavaScript parser to the | 1625 | range of the @acronym{CSS} and JavaScript parsers to the range which |
| 1626 | ranges in which their corresponding nodes span. | 1626 | their corresponding nodes span. |
| 1627 | 1627 | ||
| 1628 | Given a simple @acronym{HTML} document: | 1628 | Given 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 | ||
| 1699 | It takes a series of @var{query-spec}s, where each @var{query-spec} is | 1699 | It takes a series of @var{query-spec}s, where each @var{query-spec} is |
| 1700 | a @var{query} preceded by zero or more @var{keyword}/@var{value} | 1700 | a @var{query} preceded by zero or more @var{keyword}/@var{value} |
| 1701 | pairs. Each @var{query} is a tree-sitter query in either the | 1701 | pairs. Each @var{query} is a tree-sitter query in either the string, |
| 1702 | string, s-expression or compiled form, or a function. | 1702 | s-expression, or compiled form, or a function. |
| 1703 | 1703 | ||
| 1704 | If @var{query} is a tree-sitter query, it should be preceded by two | 1704 | If @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 |
| 1706 | specifies the embedded language, and the @code{:host} keyword | 1706 | specifies the embedded language, and the @code{:host} keyword |
| 1707 | specified the host language. | 1707 | specifies 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 |
| 1710 | the ranges for parsers for the embedded language. It queries | 1710 | the 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 |
| 1712 | the captured nodes span, and applies these ranges to embedded | 1712 | captured nodes span, and applies these ranges to embedded language |
| 1713 | language parsers. | 1713 | parsers. |
| 1714 | 1714 | ||
| 1715 | If @var{query} is a function, it doesn't need any @var{:keyword} and | 1715 | If @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 |
| 1718 | current buffer in the region between @var{start} and @var{end}. It is | 1718 | current 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 |
| 1766 | enabling tree-sitter aren't met. | 1766 | enabling tree-sitter aren't met. |
| 1767 | 1767 | ||
| 1768 | If a tree-sitter major mode shares setup with their ``native'' | 1768 | If a tree-sitter major mode shares setup with its ``native'' |
| 1769 | counterpart, they can create a ``base mode'' that contains the common | 1769 | counterpart, one can create a ``base mode'' that contains the common |
| 1770 | setup, like this: | 1770 | setup, 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 |
| 1798 | This function checks for conditions for activating tree-sitter. It | 1798 | This function checks for conditions for activating tree-sitter. It |
| 1799 | checks whether Emacs was built with tree-sitter, whether the buffer's | 1799 | checks whether Emacs was built with tree-sitter, whether the buffer's |
| 1800 | size is not too large for tree-sitter to handle it, and whether the | 1800 | size is not too large for tree-sitter to handle, and whether the |
| 1801 | language grammar for @var{language} is available on the system | 1801 | grammar for @var{language} is available on the system (@pxref{Language |
| 1802 | (@pxref{Language Grammar}). | 1802 | Grammar}). |
| 1803 | 1803 | ||
| 1804 | This function emits a warning if tree-sitter cannot be activated. If | 1804 | This 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 | ||
| 1840 | For more information of these built-in tree-sitter features, | 1840 | For 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 |
| 1877 | If non-@code{nil}, this variable's value should be a function that is | 1877 | If non-@code{nil}, this variable's value should be a function that is |
| 1878 | called with a node as its argument, and returns the defun name of the | 1878 | called with a node as its argument, and returns the defun name of the |
| 1879 | node. The function should have the same semantic as | 1879 | node. 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 |
| 1881 | node is a defun node but doesn't have a name, or the node is | 1881 | node 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 | ||
| 1886 | This variable determines which nodes are considered defuns by Emacs. | ||
| 1887 | It can be a regexp that matches the type of defun nodes. | ||
| 1888 | |||
| 1889 | Sometimes not all nodes matched by the regexp are valid defuns. | ||
| 1890 | Therefore, this variable can also be a cons cell of the form | ||
| 1891 | @w{(@var{regexp} . @var{pred})}, where @var{pred} should be a function | ||
| 1892 | that takes a node as its argument, and returns @code{t} if the node is | ||
| 1893 | valid 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 | ||
| 1899 | Emacs' tree-sitter integration doesn't expose every feature | 1888 | Emacs' tree-sitter integration doesn't expose every feature |
| 1900 | provided by tree-sitter's C API. Missing features include: | 1889 | provided 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: | |||
| 1928 | Instead of using byte positions, the Emacs Lisp API uses character | 1917 | Instead of using byte positions, the Emacs Lisp API uses character |
| 1929 | positions. | 1918 | positions. |
| 1930 | @item | 1919 | @item |
| 1931 | Null nodes are converted to nil. | 1920 | Null nodes are converted to @code{nil}. |
| 1932 | @end itemize | 1921 | @end itemize |
| 1933 | 1922 | ||
| 1934 | Below is the correspondence between all C API functions and their | 1923 | Below 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 |
| 847 | The value of this variable is a regexp matching the node type of defun | 847 | This variable determines which nodes are considered defuns by Emacs. |
| 848 | nodes. (For ``node'' and ``node type'', @pxref{Parsing Program Source}.) | 848 | It can be a regexp that matches the type of defun nodes. (For |
| 849 | ``node'' and ``node type'', @pxref{Parsing Program Source}.) | ||
| 849 | 850 | ||
| 850 | For example, @code{python-mode} sets this variable to a regexp that | 851 | For example, @code{python-mode} sets this variable to a regexp that |
| 851 | matches either @code{"function_definition"} or @code{"class_definition"}. | 852 | matches either @samp{function_definition} or @samp{class_definition}. |
| 853 | |||
| 854 | Sometimes not all nodes matched by the regexp are valid defuns. | ||
| 855 | Therefore, this variable can also be a cons cell of the form | ||
| 856 | @w{(@var{regexp} . @var{pred})}, where @var{pred} should be a function | ||
| 857 | that takes a node as its argument, and returns non-@code{nil} if the | ||
| 858 | node 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 |
| 855 | This variable determines how Emacs treats nested defuns. If the | 862 | This variable determines how Emacs treats nested defuns. If the value |
| 856 | value is @code{top-level}, navigation functions only move across | 863 | is @code{top-level}, navigation functions only move across top-level |
| 857 | top-level defuns, if the value is @code{nested}, navigation functions | 864 | defuns. If the value is @code{nested}, navigation functions recognize |
| 858 | recognize nested defuns. | 865 | nested 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 | |||
| 2680 | Library}). Only used for @acronym{TLS} or @acronym{STARTTLS}. To | 2680 | Library}). Only used for @acronym{TLS} or @acronym{STARTTLS}. To |
| 2681 | enable automatic queries of @code{auth-source} when | 2681 | enable 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} |
| 2686 | The return value of this function. If omitted or @code{nil}, return a | 2686 | The 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 |
| 3595 | left unchanged, which normally means they remain zero. | 3595 | left unchanged, which normally means they remain zero. |
| 3596 | When unpacking, this just returns nil. | 3596 | When unpacking, this just returns @code{nil}. |
| 3597 | 3597 | ||
| 3598 | @item align @var{len} | 3598 | @item align @var{len} |
| 3599 | Same as @code{fill} except the number of bytes is that needed to skip | 3599 | Same 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 |
| 1570 | Translate @var{rx-expr} to a string regexp which is returned. | 1570 | Translate @var{rx-expr} to a string regexp which is returned. |
| 1571 | If @var{no-group} is absent or nil, bracket the result in a | 1571 | If @var{no-group} is absent or @code{nil}, bracket the result in a |
| 1572 | non-capturing group, @samp{\(?:@dots{}\)}, if necessary to ensure that | 1572 | non-capturing group, @samp{\(?:@dots{}\)}, if necessary to ensure that |
| 1573 | a postfix operator appended to it will apply to the whole expression. | 1573 | a postfix operator appended to it will apply to the whole expression. |
| 1574 | Example: | 1574 | Example: |
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 | |||
| 4764 | the actual costs exceed this limit, heuristics are used to provide a | 4764 | the actual costs exceed this limit, heuristics are used to provide a |
| 4765 | faster but suboptimal solution. The default value is 1000000. | 4765 | faster 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 |
| 4768 | replacement could be performed. Otherwise, i.e., if @var{max-secs} | 4768 | replacement could be performed. Otherwise, i.e., if @var{max-secs} |
| 4769 | was exceeded, it returns nil. | 4769 | was 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 | |||
| 5569 | value of @code{recenter-redisplay}. Thus, omitting the second | 5569 | value of @code{recenter-redisplay}. Thus, omitting the second |
| 5570 | argument can be used to countermand the effect of | 5570 | argument 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 |
| 5572 | pass non-‘nil’ for @var{redisplay}. | 5572 | pass non-@code{nil} for @var{redisplay}. |
| 5573 | 5573 | ||
| 5574 | When @code{recenter} is called interactively, @var{count} is the raw | 5574 | When @code{recenter} is called interactively, @var{count} is the raw |
| 5575 | prefix argument. Thus, typing @kbd{C-u} as the prefix sets the | 5575 | prefix 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 | |||
| 18617 | factorial function: @samp{gamma(n+1) = fact(n)}. For general complex | 18617 | factorial function: @samp{gamma(n+1) = fact(n)}. For general complex |
| 18618 | arguments the gamma function can be defined by the following definite | 18618 | arguments the gamma function can be defined by the following definite |
| 18619 | integral: | 18619 | integral: |
| 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}]. | |||
| 18709 | The @kbd{f e} (@code{calc-erf}) [@code{erf}] command computes the | 18709 | The @kbd{f e} (@code{calc-erf}) [@code{erf}] command computes the |
| 18710 | error function | 18710 | error 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)}. |
| 18713 | The complementary error function @kbd{I f e} (@code{calc-erfc}) [@code{erfc}] | 18713 | The complementary error function @kbd{I f e} (@code{calc-erfc}) [@code{erfc}] |
| 18714 | is the corresponding integral from @samp{x} to infinity; the sum | 18714 | is 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}. |
| 28476 | the octave numbered 0 was chosen to correspond to the lowest | 28476 | the octave numbered 0 was chosen to correspond to the lowest |
| 28477 | audible frequency. Using this system, middle C (about 261.625 Hz) | 28477 | audible frequency. Using this system, middle C (about 261.625 Hz) |
| 28478 | corresponds to the note @expr{C} in octave 4 and is denoted | 28478 | corresponds 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 |
| 28480 | offset in cents (where a cent is a ratio of frequencies so that a | 28480 | offset in cents (where a cent is a ratio of frequencies so that a |
| 28481 | semitone consists of 100 cents). | 28481 | semitone consists of 100 cents). |
| 28482 | 28482 | ||
| 28483 | The midi note number system assigns numbers to notes so that | 28483 | The 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}} |
| 28485 | corresponds to the midi note number 127. A midi controller can have | 28485 | corresponds to the midi note number 127. A midi controller can have |
| 28486 | up to 128 keys and each midi note number from 0 to 127 corresponds to | 28486 | up to 128 keys and each midi note number from 0 to 127 corresponds to |
| 28487 | a possible key. | 28487 | a 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 |
| 29881 | newline. | 29881 | newline. |
| 29882 | 29882 | ||
| 29883 | You can customize @code{calc-kill-line-numbering} to nil to exclude | 29883 | You can customize @code{calc-kill-line-numbering} to @code{nil} to |
| 29884 | line numbering from kills and copies made by @code{calc-kill} and | 29884 | exclude 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 | 29885 | and @code{calc-copy-as-kill}. This option does not affect calc kill |
| 29886 | copy commands which operate on the region, as that would not make | 29886 | and copy commands which operate on the region, as that would not make |
| 29887 | sense. | 29887 | sense. |
| 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. | |||
| 35595 | See @ref{Displaying Selections}.@* | 35595 | See @ref{Displaying Selections}.@* |
| 35596 | The variable @code{calc-highlight-selections-with-faces} | 35596 | The variable @code{calc-highlight-selections-with-faces} |
| 35597 | determines how selected sub-formulas are distinguished. | 35597 | determines how selected sub-formulas are distinguished. |
| 35598 | If @code{calc-highlight-selections-with-faces} is nil, then | 35598 | If @code{calc-highlight-selections-with-faces} is @code{nil}, then |
| 35599 | a selected sub-formula is distinguished either by changing every | 35599 | a selected sub-formula is distinguished either by changing every |
| 35600 | character not part of the sub-formula with a dot or by changing every | 35600 | character not part of the sub-formula with a dot or by changing every |
| 35601 | character in the sub-formula with a @samp{#} sign. | 35601 | character in the sub-formula with a @samp{#} sign. |
| 35602 | If @code{calc-highlight-selections-with-faces} is t, | 35602 | If @code{calc-highlight-selections-with-faces} is @code{t}, |
| 35603 | then a selected sub-formula is distinguished either by displaying the | 35603 | then a selected sub-formula is distinguished either by displaying the |
| 35604 | non-selected portion of the formula with @code{calc-nonselected-face} | 35604 | non-selected portion of the formula with @code{calc-nonselected-face} |
| 35605 | or by displaying the selected sub-formula with | 35605 | or 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-)} |
| 2195 | When @code{c-asymmetry-fontification-flag} is non-@code{nil} (which it is by | 2195 | When @code{c-asymmetry-fontification-flag} is non-@code{nil} (which it |
| 2196 | default), code like the above, with white space either before or after | 2196 | is by default), code like the above, with white space either before or |
| 2197 | the operator, but not both, is fontified as a declaration. When the | 2197 | after the operator, but not both, is fontified as a declaration. When |
| 2198 | variable is nil, such a construct gets the default face. | 2198 | the variable is @code{nil}, such a construct gets the default face. |
| 2199 | @end defvar | 2199 | @end defvar |
| 2200 | 2200 | ||
| 2201 | When the construct is an expression there will often be white space | 2201 | When the construct is an expression there will often be white space |
| @@ -6036,7 +6036,7 @@ three syntactic symbols, @code{arglist-cont-nonempty}, | |||
| 6036 | List Symbols}). | 6036 | List Symbols}). |
| 6037 | 6037 | ||
| 6038 | This function is intended for use in a list. If the construct being | 6038 | This function is intended for use in a list. If the construct being |
| 6039 | analyzed isn't like the preceding, the function returns nil. | 6039 | analyzed isn't like the preceding, the function returns @code{nil}. |
| 6040 | Otherwise it returns the function | 6040 | Otherwise 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 |
| 6042 | to perform indentation. | 6042 | to 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 | ||
| 6082 | This function is intended for use in a list. If the above structure | 6082 | This function is intended for use in a list. If the above structure |
| 6083 | isn't present, the function returns nil, allowing a different offset | 6083 | isn't present, the function returns @code{nil}, allowing a different |
| 6084 | specification to indent the line. | 6084 | offset 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 | |||
| 6123 | the caller then uses to perform the indentation. | 6123 | the caller then uses to perform the indentation. |
| 6124 | 6124 | ||
| 6125 | This function is intended for use in a list. If the above structure | 6125 | This function is intended for use in a list. If the above structure |
| 6126 | isn't present, the function returns nil, allowing a different offset | 6126 | isn't present, the function returns @code{nil}, allowing a different |
| 6127 | specification to indent the line. | 6127 | offset 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}. | |||
| 1847 | corresponding bus. For the system and session buses, this function is | 1847 | corresponding bus. For the system and session buses, this function is |
| 1848 | called when loading @file{dbus.el}, there is no need to call it again. | 1848 | called when loading @file{dbus.el}, there is no need to call it again. |
| 1849 | 1849 | ||
| 1850 | The function returns the number of connections this Emacs session has | 1850 | If Emacs was invoked when there was no D-Bus session bus available |
| 1851 | established to the @var{bus} under the same unique name | 1851 | yet, you can set the environment variable |
| 1852 | @env{DBUS_SESSION_BUS_ADDRESS} once the session bus daemon is running | ||
| 1853 | and offering the address. Calling @code{dbus-init-bus} initializes | ||
| 1854 | the 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 | ||
| 1867 | session 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 |
| 1853 | linked with, and on the environment Emacs is running. For example, if | 1869 | linked with, and on the environment Emacs is running. For example, if |
| 1854 | Emacs is linked with the GTK+ toolkit, and it runs in a GTK+-aware | 1870 | Emacs 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 |
| 1899 | Get the pre-processor map for project @var{THIS}. | 1899 | Get 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 |
| 1903 | Non @code{nil} if in @var{PROJ} the filename @var{NAME} is a header. | 1903 | Non-@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 |
| 1907 | Get the system include path used by project @var{THIS}. | 1907 | Get 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 |
| 1911 | Within this project @var{PROJ}, find the file @var{NAME}. | 1911 | Within this project @var{proj}, find the file @var{name}. |
| 1912 | This knows details about or source tree. | 1912 | This knows details about or source tree. |
| 1913 | @end deffn | 1913 | @end deffn |
| 1914 | 1914 | ||
| @@ -2796,7 +2796,7 @@ File name of generated Makefile. | |||
| 2796 | Type: @code{boolean} @* | 2796 | Type: @code{boolean} @* |
| 2797 | Default Value: @code{t} | 2797 | Default Value: @code{t} |
| 2798 | 2798 | ||
| 2799 | Non @code{nil} means the rule created is part of the all target. | 2799 | Non-@code{nil} means the rule created is part of the all target. |
| 2800 | Setting this to @code{nil} creates the rule to build this item, but does not | 2800 | Setting this to @code{nil} creates the rule to build this item, but does not |
| 2801 | include it in the @code{all:} rule. | 2801 | include it in the @code{all:} rule. |
| 2802 | 2802 | ||
| @@ -3888,10 +3888,10 @@ themselves. | |||
| 3888 | Type: @code{boolean} @* | 3888 | Type: @code{boolean} @* |
| 3889 | Default Value: @code{nil} | 3889 | Default Value: @code{nil} |
| 3890 | 3890 | ||
| 3891 | Non @code{nil} if this sourcecode type uses subdirectores. | 3891 | Non-@code{nil} if this sourcecode type uses subdirectores. If |
| 3892 | If sourcecode always lives near the target creating it, this should be nil. | 3892 | sourcecode always lives near the target creating it, this should be |
| 3893 | If sourcecode can, or typically lives in a subdirectory of the owning | 3893 | @code{nil}. If sourcecode can, or typically lives in a subdirectory |
| 3894 | target, set this to t. | 3894 | of the owning target, set this to @code{t}. |
| 3895 | 3895 | ||
| 3896 | @item :garbagepattern | 3896 | @item :garbagepattern |
| 3897 | Type: @code{list} @* | 3897 | Type: @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 |
| 412 | Even modest settings for @code{print-level} and @code{print-length} can | 412 | Even modest settings for @code{print-level} and @code{print-length} |
| 413 | produce extremely long lines in backtraces, however, with attendant | 413 | can produce extremely long lines in backtraces, however, with |
| 414 | pauses in execution progress. Set | 414 | attendant 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 |
| 417 | line lengths (that is, to get full backtraces), or a positive integer to | 417 | backtrace line lengths (that is, to get full backtraces), or a |
| 418 | limit backtrace line length to that number. | 418 | positive integer to limit backtrace line length to that number. |
| 419 | 419 | ||
| 420 | @vindex ert-quiet | 420 | @vindex ert-quiet |
| 421 | By default, ERT in batch mode is quite verbose, printing a line with | 421 | By 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: | |||
| 374 | Specifying the function @code{ldap-password-read} for @code{passwd} | 374 | Specifying the function @code{ldap-password-read} for @code{passwd} |
| 375 | will cause Emacs to prompt interactively for the password. The | 375 | will cause Emacs to prompt interactively for the password. The |
| 376 | password will then be validated and cached, unless | 376 | password 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 |
| 379 | password is cached. If you want to clear the cache, call | 379 | password 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 | |||
| 1023 | eudc-bookmark-current-server}. The list is contained in the variable | 1023 | eudc-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 |
| 1025 | file designated by @code{eudc-options-file}, or normal Emacs | 1025 | file designated by @code{eudc-options-file}, or normal Emacs |
| 1026 | initialization if @code{eudc-ignore-options-file} is non-nil. EUDC | 1026 | initialization if @code{eudc-ignore-options-file} is non-@code{nil}. |
| 1027 | also provides a facility to edit the hotlist interactively (@pxref{The | 1027 | EUDC also provides a facility to edit the hotlist interactively |
| 1028 | Hotlist Edit Buffer}). | 1028 | (@pxref{The Hotlist Edit Buffer}). |
| 1029 | 1029 | ||
| 1030 | The hotlist is also used to make queries on multiple servers | 1030 | The hotlist is also used to make queries on multiple servers |
| 1031 | successively (@pxref{Multi-server Queries}). The order in which the | 1031 | successively (@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 |
| 1044 | If non-nil, then EUDC ignores @code{eudc-options-file} and warns or | 1044 | If non-@code{nil}, EUDC ignores @code{eudc-options-file} and warns or |
| 1045 | issues an error when an attempt is made to use it. Most users should | 1045 | issues an error when an attempt is made to use it. Most users should |
| 1046 | set this, and keep their EUDC configuration in the main Emacs | 1046 | set this, and keep their EUDC configuration in the main Emacs |
| 1047 | initialization file instead. The separate eudc-options file has | 1047 | initialization file instead. The separate @file{eudc-options} file |
| 1048 | created confusion for users in the past. | 1048 | has 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 |
| 1052 | The name of a file where EUDC stores its internal variables (the | 1052 | The name of a file where EUDC stores its internal variables (the |
| 1053 | hotlist and the current server). EUDC will try to load that file upon | 1053 | hotlist and the current server). EUDC will try to load that file upon |
| 1054 | initialization so, if you choose a file name different from the | 1054 | initialization so, if you choose a file name different from the |
| 1055 | defaults @file{~/.emacs.d/eudc-options}, be sure to set this variable | 1055 | default @file{~/.emacs.d/eudc-options}, be sure to set this variable |
| 1056 | to the appropriate value @emph{before} EUDC is itself loaded. | 1056 | to 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. | |||
| 368 | The latter, however, tend to be overly large to preserve in the | 368 | The latter, however, tend to be overly large to preserve in the |
| 369 | desktop file, so they get omitted, thus rendering the respective | 369 | desktop file, so they get omitted, thus rendering the respective |
| 370 | entries entirely equivalent. By default, such duplicate entries are | 370 | entries entirely equivalent. By default, such duplicate entries are |
| 371 | not saved. Setting @code{eww-desktop-remove-duplicates} to nil will | 371 | not saved. Setting @code{eww-desktop-remove-duplicates} to @code{nil} |
| 372 | force EWW to save them anyway. | 372 | will 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 |
| 121 | the buffer is saved, unless @code{flymake-start-on-save-buffer} is | 121 | the buffer is saved, unless @code{flymake-start-on-save-buffer} is |
| 122 | nil; | 122 | @code{nil}; |
| 123 | 123 | ||
| 124 | @item | 124 | @item |
| 125 | some changes were made to the buffer more than @code{0.5} seconds ago | 125 | some 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 | |||
| 771 | Binding,,, elisp, The Emacs Lisp Reference Manual}) to be active. | 771 | Binding,,, 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 | |||
| 909 | line-idx col-idx err-text-idx)}. @xref{Parsing the output}. | 918 | line-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 |
| 912 | A function to classify a diagnostic text as particular type of error. | 921 | A function to classify a diagnostic text as a particular type of |
| 913 | Should be a function taking an error text and returning a diagnostic | 922 | error. The value of this variable should be a function taking an |
| 914 | symbol (@pxref{Flymake error types}). If non-@code{nil} is returned but | 923 | error text and returning a diagnostic symbol (@pxref{Flymake error |
| 915 | there is no such symbol in that table, a warning is assumed. If nil | 924 | types}). If it returns a non-@code{nil} value but there is no such |
| 916 | is returned, an error is assumed. Can also be a regular expression | 925 | symbol in that table, the text is interpreted as a warning. If the |
| 917 | that should match only warnings. This variable replaces the old | 926 | function returns @code{nil}, the text is assumed to be an error. |
| 918 | @code{flymake-warning-re} and @code{flymake-warning-predicate}. | 927 | |
| 928 | The value of this variable can alternatively be a regular expression | ||
| 929 | that should match only warnings. | ||
| 930 | |||
| 931 | This 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 |
| 921 | A flag indicating whether compilation and syntax check of the same | 935 | A 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 |
| 5015 | Number of lines in the article. | 5015 | Number of lines in the article. |
| 5016 | @item Z | 5016 | @item Z |
| 5017 | Retrieval Score Value (RSV) of the article; nil if not in an nnselect | 5017 | Retrieval Score Value (RSV) of the article; @code{nil} if not in an |
| 5018 | group. | 5018 | nnselect group. |
| 5019 | @item G | 5019 | @item G |
| 5020 | Originating group name of the article; nil if not in an nnselect | 5020 | Originating group name of the article; @code{nil} if not in an |
| 5021 | group. | 5021 | nnselect group. |
| 5022 | @item g | 5022 | @item g |
| 5023 | Short form of the originating group name of the article; nil if not in | 5023 | Short form of the originating group name of the article; @code{nil} if |
| 5024 | an nnselect group. | 5024 | not in an nnselect group. |
| 5025 | @item c | 5025 | @item c |
| 5026 | Number of characters in the article. This specifier is not supported | 5026 | Number of characters in the article. This specifier is not supported |
| 5027 | in some methods (like nnfolder). | 5027 | in 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 |
| 14573 | When to expunge deleted messages. If @code{never}, deleted articles | 14573 | When to expunge deleted messages. If @code{never}, deleted articles |
| 14574 | are marked with the IMAP @code{\\Delete} flag but not automatically | 14574 | are marked with the @acronym{IMAP} @code{\\Delete} flag but not |
| 14575 | expunged. If @code{immediately}, deleted articles are immediately expunged | 14575 | automatically expunged. If @code{immediately}, deleted articles are |
| 14576 | (this requires the server to support the UID EXPUNGE command). If | 14576 | immediately 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 |
| 14578 | expunged when the group is closed. | 14578 | flagged, and all flagged articles are expunged when the group is |
| 14579 | 14579 | closed. | |
| 14580 | For backwards compatibility, this variable may also be set to t | 14580 | |
| 14581 | or nil. If the server supports UID EXPUNGE, both t and nil are | 14581 | For backwards compatibility, this variable may also be set to @code{t} |
| 14582 | equivalent to @code{immediately}. If the server does not support UID | 14582 | or @code{nil}. If the server supports @code{UID EXPUNGE}, both |
| 14583 | EXPUNGE nil is equivalent to @code{never}, while t will immediately | 14583 | @code{t} and @code{nil} are equivalent to @code{immediately}. If the |
| 14584 | expunge ALL articles that are currently flagged as deleted | 14584 | server does not support @code{UID EXPUNGE}, @code{nil} is equivalent |
| 14585 | (i.e., potentially not only the article that was just deleted). | 14585 | to @code{never}, while @code{t} will immediately expunge @emph{all} |
| 14586 | articles that are currently flagged as deleted (i.e., potentially not | ||
| 14587 | only 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 |
| 15302 | Get mail from a @acronym{IMAP} server. If you don't want to use | 15304 | Get 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., |
| 15304 | with nnimap), for some reason or other, Gnus let you treat it similar | 15306 | with nnimap), for some reason or other, Gnus lets you treat it similar |
| 15305 | to a @acronym{POP} server and fetches articles from a given | 15307 | to 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 |
| 19408 | plugged. Gnus will almost certainly be slower, but it will be kept | 19410 | plugged. Gnus will almost certainly be slower, but it will be kept |
| 19409 | synchronized with the server. That last point probably won't make any | 19411 | synchronized with the server. That last point probably won't make any |
| 19410 | sense if you are using a nntp or nnimap back end. | 19412 | sense 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 | |||
| 26372 | you see them. This is important to making split-to-parent and | 26374 | you see them. This is important to making split-to-parent and |
| 26373 | Message-ID references work correctly, as the registry needs to know | 26375 | Message-ID references work correctly, as the registry needs to know |
| 26374 | where all messages are, but it can slow down group opening and the | 26376 | where all messages are, but it can slow down group opening and the |
| 26375 | saving of Gnus. If this option is nil, entries must be created | 26377 | saving of Gnus. If this option is @code{nil}, entries must be created |
| 26376 | manually, for instance by storing a custom flag or keyword for the | 26378 | manually, for instance by storing a custom flag or keyword for the |
| 26377 | message. | 26379 | message. |
| 26378 | @end defvar | 26380 | @end defvar |
| @@ -26394,8 +26396,8 @@ This option specifies how registry entries are sorted during pruning. | |||
| 26394 | If a function is given, it should sort least valuable entries first, | 26396 | If a function is given, it should sort least valuable entries first, |
| 26395 | as pruning starts from the beginning of the list. The default value | 26397 | as pruning starts from the beginning of the list. The default value |
| 26396 | is @code{gnus-registry-sort-by-creation-time}, which proposes the | 26398 | is @code{gnus-registry-sort-by-creation-time}, which proposes the |
| 26397 | oldest entries for pruning. Set to nil to perform no sorting, which | 26399 | oldest entries for pruning. Set to @code{nil} to perform no sorting, |
| 26398 | will speed up the pruning process. | 26400 | which 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 | ||
| 26469 | in your fancy split setup. | 26471 | in your fancy split setup. |
| 26470 | 26472 | ||
| 26471 | If @code{gnus-registry-register-all} is non-@code{nil} (the default), the | 26473 | If @code{gnus-registry-register-all} is non-@code{nil} (the default), |
| 26472 | registry will perform splitting for all messages. If it is nil, | 26474 | the registry will perform splitting for all messages. If it is |
| 26473 | splitting will only happen for children of messages you've explicitly | 26475 | @code{nil}, splitting will only happen for children of messages you've |
| 26474 | registered. | 26476 | explicitly registered. |
| 26475 | 26477 | ||
| 26476 | In addition, you may want to customize the following variables. | 26478 | In 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 | |||
| 3589 | there are invalid entries in the persistency file, for example if the | 3589 | there are invalid entries in the persistency file, for example if the |
| 3590 | host configuration changes often, or if you plug your laptop to | 3590 | host configuration changes often, or if you plug your laptop to |
| 3591 | different networks frequently, you can set the user option | 3591 | different 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 | ||
| 3594 | After remote host name completion comes completion of file names on | 3594 | After remote host name completion comes completion of file names on |
| 3595 | the remote host. It works the same as with local host file completion | 3595 | the 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 | |||
| 790 | Emacs start as quickly as possible. | 790 | Emacs 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 | ||
| 796 | Where possible, it is better to avoid @code{:preface}, @code{:config} | 796 | Where 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." | |||
| 2780 | The optional arguments FIND-FILE-FUNC and FIND-DIR-FUNC specify | 2780 | The optional arguments FIND-FILE-FUNC and FIND-DIR-FUNC specify |
| 2781 | functions to visit the file and directory, respectively. If | 2781 | functions to visit the file and directory, respectively. If |
| 2782 | omitted or nil, these arguments default to `find-file' and `dired', | 2782 | omitted or nil, these arguments default to `find-file' and `dired', |
| 2783 | respectively." | 2783 | respectively. If `dired-kill-when-opening-new-dired-buffer' is |
| 2784 | non-nil, FIND-DIR-FUNC defaults to `find-alternate-file' instead, | ||
| 2785 | so 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. | |||
| 4402 | Otherwise move to the start of the buffer." | 4402 | Otherwise 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). |
| 1357 | If the region is active and `transient-mark-mode' is on, call | 1357 | If 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 |
| 1359 | case it calls `uncomment-region'). | 1359 | case it calls `uncomment-region'); in this case, prefix numeric |
| 1360 | argument ARG specifies how many characters to remove from each | ||
| 1361 | comment delimiter (so don't specify a prefix argument whose value | ||
| 1362 | is greater than the total length of the comment delimiters). | ||
| 1360 | Else, if the current line is empty, call `comment-insert-comment-function' | 1363 | Else, if the current line is empty, call `comment-insert-comment-function' |
| 1361 | if it is defined, otherwise insert a comment and indent it. | 1364 | if it is defined, otherwise insert a comment and indent it. |
| 1362 | Else if a prefix ARG is specified, call `comment-kill'. | 1365 | Else, if a prefix ARG is specified, call `comment-kill'; in this |
| 1366 | case, prefix numeric argument ARG specifies on how many lines to kill | ||
| 1367 | the comments. | ||
| 1363 | Else, call `comment-indent'. | 1368 | Else, call `comment-indent'. |
| 1364 | You can configure `comment-style' to change the way regions are commented." | 1369 | You 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 | |||
| 4106 | same LABEL argument. | 4106 | same 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. |
| 1341 | These presets that can be used as MATHER and ANCHOR in | 1338 | These 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 |
| 1343 | functions that take 3 arguments: NODE, PARENT and BOL. | 1340 | functions that take 3 arguments: NODE, PARENT, and BOL. |
| 1344 | 1341 | ||
| 1345 | MATCHER: | 1342 | MATCHER: |
| 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 | ||
| 1388 | catch-all | ||
| 1389 | |||
| 1390 | Always matches. | ||
| 1391 | |||
| 1387 | ANCHOR: | 1392 | ANCHOR: |
| 1388 | 1393 | ||
| 1389 | first-sibling | 1394 | first-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 | |||
| 1393 | parent | 1403 | parent |
| 1394 | 1404 | ||
| 1395 | Returns the start of PARENT. | 1405 | Returns the start of PARENT. |
| 1396 | 1406 | ||
| 1407 | grand-parent | ||
| 1408 | |||
| 1409 | Returns the start of PARENT's parent. | ||
| 1410 | |||
| 1411 | great-grand-parent | ||
| 1412 | |||
| 1413 | Returns the start of PARENT's parent's parent. | ||
| 1414 | |||
| 1397 | parent-bol | 1415 | parent-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 | ||
| 1402 | standalone-parent | 1420 | standalone-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 | ||
| 1407 | prev-sibling | 1425 | prev-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 | ||
| 2475 | If `treesit-font-lock-settings' is non-nil, setup fontification and | 2493 | If `treesit-font-lock-settings' is non-nil, set up fontification |
| 2476 | enable `font-lock-mode'. | 2494 | and enable `font-lock-mode'. |
| 2477 | 2495 | ||
| 2478 | If `treesit-simple-indent-rules' is non-nil, setup indentation. | 2496 | If `treesit-simple-indent-rules' is non-nil, set up indentation. |
| 2479 | 2497 | ||
| 2480 | If `treesit-defun-type-regexp' is non-nil, setup | 2498 | If `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 | ||
| 2483 | If `treesit-defun-name-function' is non-nil, setup | 2501 | If `treesit-defun-name-function' is non-nil, set up |
| 2484 | `add-log-current-defun'. | 2502 | `add-log-current-defun'. |
| 2485 | 2503 | ||
| 2486 | If `treesit-simple-imenu-settings' is non-nil, setup Imenu. | 2504 | If `treesit-simple-imenu-settings' is non-nil, set up Imenu. |
| 2487 | 2505 | ||
| 2488 | Make sure necessary parsers are created for the current buffer | 2506 | Make sure necessary parsers are created for the current buffer |
| 2489 | before calling this function." | 2507 | before 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. |
| 8790 | Return the name of the buffer as a string. | 8798 | Return 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 | |||
| 37289 | the current narrowing, or from buffer beginning. The variable | 37289 | the 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 |
| 37291 | to each absolute line number; it also forces line numbers to be counted | 37291 | to each absolute line number; it also forces line numbers to be counted |
| 37292 | from the beginning of the buffer, as if `display-line-numbers-wide' | 37292 | from the beginning of the buffer, as if `display-line-numbers-widen' |
| 37293 | were non-nil. It has no effect when line numbers are not absolute. | 37293 | were non-nil. It has no effect when line numbers are not absolute. |
| 37294 | 37294 | ||
| 37295 | If the value is `relative', display for each line not containing the | 37295 | If 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 |