| Commit message (Collapse) | Author | Age |
|\ |
|
| |
| |
| |
| |
| |
| |
| | |
* doc/lispref/modes.texi (Defining Minor Modes):
* lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode):
Improve documentation of the :predicate keyword in defining
globalized minor modes.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The original formatting dates back to the earliest commits. It saved
a few lines but was harder to follow. As windows are typically taller
now than the terminals of the time, this reformatting now makes better
sense for readabiity. See bug#57080.
* doc/lispref/modes.texi: Order change for consistency. Add index.
|
| |
| |
| |
| | |
Bug #57080.
|
|/
|
|
|
| |
* src/xdisp.c (global-mode-string): Update docstring.
* doc/lispref/modes.texi: Update manual.
|
|
|
|
|
|
|
|
|
|
| |
* lisp/progmodes/c-ts-mode.el:
(c-ts-mode--indent-styles): Handle the empty line case.
* test/lisp/progmodes/c-ts-mode-resources/indent.erts: New test.
* doc/lispref/modes.texi (Parser-based Indentation): Update manual.
* lisp/treesit.el (treesit-simple-indent-presets): Support null as
a value for NODE-TYPE in the 'match' matcher.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Point-min isn't necessarily at column 0, using line-beginning-position
is better. column-0 is also more intuitive.
* doc/lispref/modes.texi (Parser-based Indentation): Update manual.
* lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles):
* lisp/progmodes/java-ts-mode.el (java-ts-mode--indent-rules):
* lisp/progmodes/rust-ts-mode.el (rust-ts-mode--indent-rules):
* lisp/progmodes/typescript-ts-mode.el:
(typescript-ts-mode--indent-rules): Change point-min to column-0.
* lisp/treesit.el (treesit-simple-indent-presets): Change point-min to
column-0.
|
|
|
|
|
|
| |
* lisp/font-lock.el (font-lock-variable-use-face)
(font-lock-property-use-face): Rename from font-lock-variable-ref-face
and font-lock-property-ref-face. Update all references (bug#61655).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When writing c-ts-mode Theo used parent-bol which works well except
one case:
1 for (int i=0;
2 i < 5;
3 i++) {
4 func(i);
5 }
In this case, when indenting "func(i)", parent-bol returns the start
of "i++" on line 3, instead of the "correct" anchor, the start of
"for" on line 1. parent-bol would have worked if the "for (...) {"
part is in one line.
To support this case I tried numerous things and added a bunch of
stuff, culminating in c-ts-common-statement-offset. It's complicated,
requires extra setup, and slow.
Not anymore! I think the new anchor standalone-parent really captures
the logic behind how people expect indentation to work. It's simple
and fast, and requires no setup.
* doc/lispref/modes.texi (Parser-based Indentation): Update manual.
* lisp/progmodes/c-ts-mode.el:
(c-ts-mode--standalone-grandparent): New anchor.
(c-ts-mode--indent-styles): Replace c-ts-common-statement-offset with
standalone-parent.
(c-ts-base-mode): Add comment.
* lisp/treesit.el:
(treesit-simple-indent-presets): New anchor standalone-parent.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* doc/lispref/modes.texi (Faces for Font Lock):
Update the list of faces (bug#61655).
* etc/NEWS: Update the list of new faces.
* lisp/cus-theme.el (custom-theme--listed-faces): Update.
* lisp/font-lock.el (font-lock-function-call-face)
(font-lock-variable-ref-face, font-lock-property-ref-face):
New faces.
(font-lock-property-name-face):
Rename from 'font-lock-property-face'.
* lisp/progmodes/c-ts-mode.el (c-ts-mode--font-lock-settings):
Use new faces. More 'enumerator' query to 'definition' feature.
(c-ts-mode--fontify-declarator, c-ts-mode--fontify-variable):
Use new faces.
* lisp/progmodes/cmake-ts-mode.el
(cmake-ts-mode--font-lock-settings): Use new faces.
* lisp/progmodes/csharp-mode.el
(csharp-ts-mode--font-lock-settings): Use new faces.
* lisp/progmodes/go-ts-mode.el (go-ts-mode--font-lock-settings):
Use new faces.
* lisp/progmodes/java-ts-mode.el
(java-ts-mode--font-lock-settings): Use new faces.
* lisp/progmodes/js.el (js--treesit-fontify-assignment-lhs)
(js--treesit-font-lock-settings): Use new faces. Highlight
variable definitions inside array and object destructuring
patterns.
* lisp/progmodes/python.el (python--treesit-variable-p):
Exclude identifiers in parameters.
(python--treesit-settings): Use new faces. Highlight function
parameters. Move 'keyword' up to still highlight 'self' as
keyword.
* lisp/progmodes/ruby-ts-mode.el (ruby-ts--font-lock-settings):
Use new faces.
* lisp/progmodes/rust-ts-mode.el
(rust-ts-mode--font-lock-settings): Use new faces.
* lisp/progmodes/typescript-ts-mode.el
(typescript-ts-mode--font-lock-settings): Use new faces.
* lisp/textmodes/css-mode.el (css--treesit-settings):
Use font-lock-property-ref-face.
* lisp/textmodes/toml-ts-mode.el
(toml-ts-mode--font-lock-settings):
Use font-lock-property-ref-face.
* lisp/textmodes/yaml-ts-mode.el
(yaml-ts-mode--font-lock-settings): Same.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Now prev-adaptive-prefix looks at the current line and checks if it
begins with a prefix itself. If it does, prev-adaptive-prefix tries
to place the anchor before the prefix on the previous line, rather
than after it.
- prev line
- this line -> This line starts with a "-", i.e., begins with a
prefix, so we place the anchor at the beginning of the
"-" of the previous line, rather than after it
- prev line
this line -> This line doesn't start with a prefix, so the anchor
is placed after the previous line's "-".
* doc/lispref/modes.texi (Parser-based Indentation): Update manual.
* lisp/treesit.el:
(treesit-simple-indent-presets): Add local variable
this-line-has-prefix, base what anchor to return on the value of
this-line-has-prefix and whether the prev line has a prefix.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* doc/lispref/modes.texi (Header Lines): Rewrite the documentation
of 'header-line-indent-mode' and its two variables. Fix the
example.
* doc/lispref/display.texi (Pixel Specification): More accurate
description of what happens with :align-to in header-lines.
Improve indexing. (Bug#61239)
* src/buffer.c (syms_of_buffer) <header-line-format>:
* lisp/display-line-numbers.el (header-line-indent)
(header-line-indent-width, header-line-indent-mode): Doc fixes.
* etc/NEWS: Enhance the announcement of 'header-line-indent-mode'.
|
|
|
|
|
|
|
|
| |
This is needed for fixing C indentation. See next comment.
* doc/lispref/modes.texi (Parser-based Indentation): Update manual.
* lisp/treesit.el (treesit-simple-indent): Try evaluating OFFSET as a
function if it's not integer nor variable.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are two possible ways to solve the problem raised in the bug
report: either make sure NODE is never the root (so that parent is
never nil), or allow parent to be nil.
If we go with the latter, a lot of matcher and anchor functions need
change (they need to guard against a null parent). I tried it, and
needing to check for null parent is pretty annoying. In comparison,
if NODE is never the root, it is very convenient for the user, and it
doesn't complicate the rule that much (and it's rather intuitive,
people usually don't think of the case where NODE is the root node).
So that's what I choose.
* doc/lispref/modes.texi (Parser-based Indentation): Update manual.
* lisp/treesit.el (treesit-indent-function): Update docstring.
(treesit--indent-1): Make sure NODE is not the root.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* doc/lispref/modes.texi (Parser-based Font Lock):
Replace :lang with :language.
* doc/lispref/parsing.texi (Language Grammar): Replace
treesit-load-suffixes with dynamic-library-suffixes.
(Retrieving Nodes): Fix function names.
(Tree-sitter Major Modes): Fix treesit-ready-p args.
Fix pxref to Parser-based Indentation.
(Tree-sitter C API): Fix function names.
* lisp/treesit.el (treesit--simple-indent-eval): Remove cond BODY
duplicated from CONDITION.
(treesit)<define-short-documentation-group>: Fix function names.
|
|
|
|
|
|
| |
* doc/lispref/elisp.texi:
* doc/lispref/modes.texi:
* doc/lispref/parsing.texi: Change to title case.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
"Language grammar" is apparently the more widely used term among
people talking about tree-sitter. To avoid confusion, I think it's
good to use that rather than "language definition", which is a term
that I made up :-)
Feel free to revert this if it is too much change.
* doc/lispref/elisp.texi:
* doc/lispref/modes.texi:
* doc/lispref/parsing.texi:
* lisp/treesit.el: Change "language definition" to "language grammar".
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We didn't add an integration for Imenu because we aren't sure what
should it look like. Now we have a pretty good idea. All the major
modes copy-paste the two Imenu functions and tweaks them in a standard
way. With the addition of treesit-defun-type-regexp and
treesit-defun-name-function, now is a good time to standardize Imenu
integration.
In the next commit we update all the major modes to use this
integration.
* doc/lispref/modes.texi (Imenu): Add manual.
* doc/lispref/parsing.texi (Tree-sitter major modes): Update manual.
* lisp/treesit.el (treesit-simple-imenu-settings): New varaible.
(treesit--simple-imenu-1)
(treesit-simple-imenu): New functions.
(treesit-major-mode-setup): Setup Imenu.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Now indent and filling works like in c-mode. The only noticeable
missing piece is that the "*/" is not attached to the last sentence
when filling. c-mode does it by replacing whitespaces between the
"*/" and the end of the last sentence with xxx, fill it, then change
the xxx back. I don't know if we should do that in c-ts-mode's filling.
* doc/lispref/modes.texi (Parser-based Indentation): Add new preset.
* lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): Add new
indent rule.
(c-ts-mode--fill-paragraph): New function.
(c-ts-base-mode): Setup paragraph-start, adaptive-fill, etc.
* lisp/treesit.el (treesit-simple-indent-presets): Add new preset.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Comment indentation should use a adaptive-fill-based indent, rather
than comment-start-skip.
Also remove manual description of removed variables in treesit.el and
add documentation for n-p-gp upon request.
* doc/lispref/modes.texi (Parser-based Indentation)
* lisp/treesit.el (treesit-simple-indent-presets): Add n-p-gp, remove
treesit-comment-start/end, remove comment-start-skip.
* doc/lispref/parsing.texi (Tree-sitter major modes): Remove
treesit-comment-start/end.
|
| |
|
| |
|
|\ |
|
| | |
|
| |\
| | |
| | |
| | | |
4b2c83eeaf ; * doc/lispref/modes.texi (Defining Minor Modes): Explain...
|
| | | |
|
| |\|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
067361f3a2 ; Improve documentation of 'C-M-i'
fdb6f7cf26 ; Fix documentation of 'comp-enable-subr-trampolines'
be30369e01 ; Avoid incorrect indentation in an @example.
4bd3dd505e Document how to control where the *.eln files are written
b7d7c2d9e9 Add cross-reference to alternative syntaxes for Unicode
# Conflicts:
# doc/emacs/custom.texi
|
| | |
| | |
| | |
| | |
| | |
| | | |
* doc/lispref/modes.texi (Search-based Fontification): Avoid
incorrect indentation in an @example. Reported by Akib Azmain
Turja <akib@disroot.org>.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
* lisp/progmodes/python.el (python-base-mode)
(python--treesit-fontify-string):
* lisp/textmodes/css-mode.el (css-base-mode):
* lisp/treesit.el (treesit-ready-p, treesit-comment-end)
(treesit-simple-indent-presets): Fix typos and wording in doc strings.
* doc/lispref/parsing.texi (Tree-sitter major modes):
* doc/lispref/modes.texi (Parser-based Indentation): Fix wording
and add cross-references.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The goal is to indent like this:
/* comment
comment --> This line aligns with the beginning of the first line
*/ --> This line aligns with the opening comment token
* lisp/treesit.el (treesit-comment-start)
(treesit-comment-end): New variables.
(treesit-simple-indent-presets): New preset comment-end,
comment-start, comment-start-skip
* lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles)
(c-ts-mode)
* lisp/progmodes/java-ts-mode.el (java-ts-mode--indent-rules)
(java-ts-mode)
* lisp/progmodes/js.el (js--treesit-indent-rules)
(js-ts-mode)
* lisp/progmodes/ts-mode.el (ts-mode--indent-rules)
(ts-mode): Add identical indent rules to each mode, and set identical
treesit-comment-start/end's.
* doc/lispref/modes.texi (Parser-based Indentation)
* doc/lispref/parsing.texi (Tree-sitter major modes): Update manual.
|
| | |
| | |
| | |
| | |
| | |
| | | |
* doc/lispref/modes.texi (Parser-based Font Lock)
* lisp/treesit.el (treesit-font-lock-feature-list): Explain in more
detail, and change some features.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
We now have a better facility that can replace the contextual
hack. The C part is in the previous commit, and the Lisp part work
will be in the next commit.
* doc/lispref/modes.texi (Parser-based Font Lock): Update manual.
* lisp/progmodes/js.el (js--treesit-font-lock-settings)
* lisp/progmodes/python.el (python--treesit-settings)
* lisp/progmodes/ts-mode.el (ts-mode--font-lock-settings): Stop marking
contextual nodes.
* lisp/treesit.el (treesit-font-lock-contextual-post-process): Remove
function.
(treesit-font-lock-fontify-region): Remove code processing contextual
nodes.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
* lisp/font-lock.el (font-lock-bracket-face, font-lock-delimiter-face,
font-lock-escape-face, font-lock-number-face,
font-lock-misc-punctuation-face, font-lock-operator-face,
font-lock-property-face, font-lock-punctuation-face): Define new
faces.
* lisp/cus-theme.el (custom-theme--listed-faces): Add them to the
list.
* doc/lispref/modes.texi (Faces for Font Lock): Document them.
* etc/NEWS: Mention them.
|
| | |
| | |
| | |
| | |
| | |
| | | |
* doc/lispref/parsing.texi (Multiple Languages):
* doc/lispref/modes.texi (Parser-based Font Lock): Improve
wording.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
* doc/lispref/modes.texi (Parser-based Font Lock)
* doc/lispref/parsing.texi (Multiple Languages)
* lisp/treesit.el (treesit-range-rules)
(treesit-font-lock-rules): Improve phrasing around queries and keyword
and values.
|
| | |
| | |
| | |
| | |
| | |
| | | |
* doc/lispref/modes.texi (Parser-based Indentation): Update manual.
* lisp/treesit.el (treesit-simple-indent-presets): Add preset. Update
docstring.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
* lisp/treesit.el (treesit-language-at, treesit-range-rules)
(treesit-font-lock-rules): Doc fixes.
* doc/lispref/parsing.texi (Multiple Languages):
* doc/lispref/modes.texi (Parser-based Font Lock): Fix wording.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
* doc/lispref/modes.texi (Parser-based Indentation): Update manual.
* lisp/progmodes/js.el (js--treesit-indent-rules): Change all
occurance of ,js-indent-level to js-indent-level.
* lisp/progmodes/ts-mode.el (ts-mode--indent-rules): Change all
occurance of ,ts-mode-indent-offset to ts-mode-indent-offset.
* lisp/treesit.el (treesit-simple-indent-rules): Change docstring.
(treesit-simple-indent): Allow offset to be a variable.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
* doc/lispref/modes.texi (Parser-based Font Lock): Fix the signature
style.
* doc/lispref/parsing.texi (Language Definitions): Rephrase the
section, remove documentation for deleted functions, fix signature
style.
* lisp/treesit.el (treesit-range-rules)
(treesit-font-lock-rules): Change ARGS to QUERY-SPECS, fix docstring.
* lisp/treesit.el (treesit-inspect-mode): Fix docstring.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
* lisp/treesit.el (treesit-ready-p, treesit-inspect-mode)
(treesit-range-settings, treesit-range-rules)
(treesit--merge-ranges, treesit-update-ranges)
(treesit-font-lock-rules, treesit-font-lock-feature-list)
(treesit-font-lock-contextual-post-process)
(treesit-font-lock-recompute-features): Doc fixes.
* lisp/progmodes/js.el (js--fontify-template-string): Doc fix.
* doc/lispref/modes.texi (Parser-based Indentation):
* doc/lispref/positions.texi (List Motion):
* doc/lispref/parsing.texi (Tree-sitter major modes):
* doc/lispref/parsing.texi (Multiple Languages): Fix wording and
markup.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
* doc/lispref/modes.texi (Parser-based Font Lock): Update manual.
* lisp/progmodes/js.el (js--fontify-template-string)
* lisp/progmodes/python.el (python--treesit-fontify-string): Update
function to only fontify within the region.
* lisp/treesit.el (treesit-font-lock-rules): Update docstring.
(treesit-font-lock-fontify-region): Pass START and END to
fontification functions.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
* lisp/progmodes/python.el: Remove function.
(python--treesit-settings): Capture contextual node.
* lisp/treesit.el (treesit--set-nonsticky):
(treesit-font-lock-contextual-post-process): New functions.
(treesit-font-lock-fontify-region): Change local variable START and
END to NODE-START and NODE-END, handle special capture name
"contextual".
* doc/lispref/modes.texi (Parser-based Font Lock): Update manual.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Change from
(START END NODE OVERRIDE &rest _)
to
(NODE OVERRIDE &rest _)
START and END aren't used frequently enough to justify. If a
fontification function needs them, it can get them from NODE.
* doc/lispref/modes.texi (Parser-based Font Lock): Update manual.
* lisp/progmodes/js.el (js--fontify-template-string)
* lisp/progmodes/python.el (python--treesit-fontify-string)
(python--treesit-fontify-string-end): Change signature.
* lisp/treesit.el (treesit-font-lock-rules): Update docstring.
(treesit-font-lock-fontify-region): Remove START and END arguments.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
* doc/lispref/modes.texi (Parser-based Font Lock): Reflect this change
in manual.
* lisp/progmodes/js.el (js--fontify-template-string): Add _OVERRIDE
argument.
* lisp/progmodes/python.el (python--treesit-fontify-string): Add
_OVERRIDE argument.
* lisp/treesit.el (treesit-font-lock-rules): Update docstring.
(treesit-fontify-with-override): New function.
(treesit-font-lock-fontify-region): Extract out into
treesit-fontify-with-override.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Before this change, we rebind font-lock-fontify-region-function and
call font-lock's function in tree-sitter's function, and the order of
fontification is tree-sitter, font-lock syntax, font-lock regexp.
Now we make font-lock's syntax function customizable and replace it
with tree-sitter's function, and the order of fontification is
tree-sitter, font-lock regexp.
* doc/lispref/modes.texi (Parser-based Font Lock): Reflect the change
in manual.
* lisp/font-lock.el (font-lock-fontify-syntactically-function): New
varaible.
(font-lock-default-fontify-region): Call
font-lock-fontify-syntactically-function rather.
(font-lock-fontify-syntactically-region): Rename to
font-lock-default-fontify-syntactically
(font-lock-default-fontify-syntactically): Rename to this.
* lisp/treesit.el (treesit-font-lock-fontify-region): Don't call
font-lock functions.
(treesit-font-lock-enable): Remove this function. It is not used even
before this change.
(treesit-major-mode-setup): Instead of binding
font-lock-fontify-region-function, now bind to
font-lock-fontify-syntactically-function. And we can let font-lock do
it's thing.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
* doc/lispref/modes.texi (Parser-based Font Lock):
treesit-font-lock-enable is replaced by treesit-major-mode-setup.
* doc/lispref/modes.texi (Parser-based Indentation): Mention
treesit-major-mode-setup,
* doc/lispref/parsing.texi (Tree-sitter major modes): Remove
treesit-mode and global-treesit-mode, explain setup guideline.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
* doc/lispref/modes.texi (Parser-based Indentation): Document the
semantic clearly.
* lisp/treesit.el (treesit-simple-indent-presets): Replace with
current-indentation.
(treesit--indent-1): Now NODE always starts at BOL, and parent is
always the smallest node above NODE that spans BOL.
(treesit-indent): Don't use save-excurtion, no one else does.
|
| | |
| | |
| | |
| | |
| | | |
* doc/lispref/modes.texi (Parser-based Indentation): String
equivalence checks are changed to regexp matching.
|