Align the js-ts-mode entry with the javascript-mode entries in the
default auto-mode-alist value in lisp/files.el. Otherwise, js-ts-mode is
not associated with .js files.
* lisp/progmodes/js.el (js-ts-mode): Fix auto-mode-alist regexp.
Fixes: 2023-01-20 6b2f85caa6 "Make tree-sitter based modes optional"
* lisp/progmodes/peg.el (peg-parse): Be more careful when
testing if a symbol is the name of an existing rule. Improve docstring.
test/lisp/progmodes/peg-tests.el (peg-tests--peg-parse): New test.
* lisp/progmodes/python.el (python--thing-settings):
For the 'sexp' thing use all nodes except top-level
grouping nodes, comments and parens. Add the 'list' thing.
(python-ts-mode): Use setq-local for treesit-thing-settings.
Modify 'forward-sexp-function' and 'treesit-sexp-thing'
after calling 'treesit-major-mode-setup'.
* etc/NEWS: Announce changes.
* lisp/progmodes/project.el (project-prune-zombie-projects): New
user option.
(project-prune-zombies-default): New function.
(project-forget-zombie-projects): Rework.
(project--ensure-read-project-list, project-prompt-project-dir)
(project-prompt-project-name): Call
'project-forget-zombie-projects' but inhibit its message.
Also start using `symbols' as the PAREN argument to regexp-opt.
lisp/progmodes/cc-defs.el (c-make-keywords-re): Simplify,
remove the redundant `appendable' value of the ADORN parameter,
use the `symbols' value of the PAREN argument to regexp.
(c-emacs-features): Test that "\_<" and "\_>" work in regexps
before allowing CC Mode to start.
lisp/progmodes/cc-engine.el (c-looking-at-decl-block): When
GOTO-START is set, leave point at the _last_ Java annotation,
if any. Clarify this in the doc string.
(c-guess-basic-syntax CASE 5G): Replace a not needed t
GOTO-START argument to c-looking-at-decl-block with nil.
lisp/progmodes/cc-langs.el (c-make-mode-syntax-table): Make the
syntax of ?@ in Java Mode symbol for processing annotations.
(c-opt-identifier-concat-key, c-opt-identifier-prefix-key)
(c-opt-after-id-concat-key, c-identifier-key)
(c-cpp-message-directives-re, c-cpp-include-key, c-pack-key)
(c-brace-stack-thing-key, c-brace-stack-no-semi-key): Replace
the `appendable' value of the ADORN argument to
c-make-keywords-re with t.
(c-annotation-re): New lang const and lang var.
(c-keywords-obarray): Replace an explicit (apply 'nconc (mapcar
... )) with c--mapcan, now that the obscure bug with mapcan in
Emacs has been resolved.
lisp/progmodes/cc-align.el (c-lineup-gnu-DEFUN-intro-cont)
(c-lineup-java-throws, c-snug-do-while)
lisp/progmodes/cc-awk.el (c-awk-pre-exp-alphanum-kwd-re)
(c-awk-after-if-for-while-condition-p)
(c-awk-after-function-decl-param-list)
(c-awk-after-continue-token)
(c-awk-after-rbrace-or-statement-semicolon)
(awk-font-lock-keywords)
lisp/progmodes/cc-cmds.el (c-defun-name-1)
lisp/progmodes/cc-engine.el (c-beginning-of-statement-1)
(c-forward-<>-arglist, c-forward-label, c-skip-conditional)
(c-looking-at-c++-lambda-expression, c-add-stmt-syntax)
(c-guess-basic-syntax CASE 11, CASE 12, CASE 13, CASE 15)
(CASE 5C.3, CASE 5D.4, CASE 7D)
lisp/progmodes/cc-fonts.el (c-cpp-matchers)
(c-basic-matchers-before, c-font-lock-declarations)
(c-font-lock-c++-modules, c-simple-decl-matchers)
(c-complex-decl-matchers, c-basic-matchers-after)
lisp/progmodes/cc-langs.el (c-paragraph-start)
(c-stmt-block-only-keywords-regexp)
(c-type-decl-prefix-keywords-key, c-type-decl-prefix-key)
(c-type-decl-suffix-key, c-known-type-key)
(c-enum-clause-introduction-re)
lisp/progmodes/cc-menus.el (cc-imenu-c++-generic-expression)
lisp/progmodes/cc-vars.el (c-make-noise-macro-regexps)
(c-make-macro-with-semi-re): Replace explicit "\<" and "\>"
with "\_<" and "\_>". Replace explicit specification of
non-'_' character after word end with "\_>". Replace
concatenation of "\<" and "\>" with regexps with (regexp-opt
... 'symbols). Use (regexp-opt ... 'symbols) in general.
python--treesit-settings: Fontification based on selectors & code-conventions
- Constructor: Fontified as type, not function-call.
- Typed default parameters
- Fontify kwargs in function calls as property-use. Differentiate from
variable-use (passed in arguments)
* lisp/treesit.el (treesit-language-source-alist):
Document the format that uses keywords.
(treesit--install-language-grammar-1): Remove args
'revision', 'source-dir', 'cc', 'c++', 'commit'.
Use 'args' to process the keywords, and use the remaining
list as the previous list of arguments.
(treesit--install-language-grammar-1): Let-bind
'treesit--install-language-grammar-full-clone' and
'treesit--install-language-grammar-blobless' to t
when 'commit' is non-nil (bug#78542).
* lisp/progmodes/c-ts-mode.el:
* lisp/progmodes/cmake-ts-mode.el:
* lisp/progmodes/csharp-mode.el:
* lisp/progmodes/dockerfile-ts-mode.el:
* lisp/progmodes/elixir-ts-mode.el:
* lisp/progmodes/go-ts-mode.el:
* lisp/progmodes/heex-ts-mode.el:
* lisp/progmodes/java-ts-mode.el:
* lisp/progmodes/js.el:
* lisp/progmodes/json-ts-mode.el:
* lisp/progmodes/php-ts-mode.el:
* lisp/progmodes/python.el:
* lisp/progmodes/ruby-ts-mode.el:
* lisp/progmodes/rust-ts-mode.el:
* lisp/progmodes/sh-script.el:
* lisp/progmodes/typescript-ts-mode.el:
* lisp/textmodes/css-mode.el:
* lisp/textmodes/html-ts-mode.el:
* lisp/textmodes/markdown-ts-mode.el:
* lisp/textmodes/toml-ts-mode.el:
* lisp/textmodes/yaml-ts-mode.el:
Use the keyword :commit with full hashes instead of tags
in 'treesit-language-source-alist'.
* lisp/treesit-x.el (define-treesit-generic-mode):
Simplify the keyword :copy-queries.
(gitattributes-generic-ts-mode, liquid-generic-ts-mode):
Add keywords :commit and :copy-queries to :source.
* admin/tree-sitter/treesit-admin.el
(treesit-admin--unversioned-treesit-language-source-alist):
Handle :revision and :commit as well.
(treesit-admin--find-latest-compatible-revision):
Process the keywords in the recipe.
* lisp/treesit.el (treesit-sexp-thing): New variable to use
instead of 'treesit-sexp-type-regexp'.
(treesit-sexp-thing-down-list): Rename from 'treesit-sexp-type-down-list'.
(treesit-sexp-thing-up-list): Rename from 'treesit-sexp-type-up-list'.
(treesit-forward-sexp, treesit--forward-list-with-default)
(treesit-down-list, treesit-up-list): Update references to the
above variables.
(treesit-cycle-sexp-thing): Rename from 'treesit-cycle-sexp-type'.
* lisp/progmodes/elixir-ts-mode.el (elixir-ts-mode): Update same variables.
* lisp/progmodes/heex-ts-mode.el (heex-ts-mode): Set these variables
instead of calling the function that sets them.
* lisp/progmodes/python.el (python-ts-mode): Check if variables
'treesit-sentence-type-regexp' and 'treesit-sexp-type-regexp' are bound.
https://lists.gnu.org/archive/html/emacs-devel/2025-06/msg00182.html
* lisp/progmodes/cc-awk.el (awk-font-lock-keywords):
Reformulate this using backquote and ,@. Only include the
entry for _" in Emacs.
* lisp/progmodes/cc-defs.el (c--mapcan, c--set-difference)
c--intersection, c--macroexpand-all, c--delete-duplicates): No
longer use the existence of cl-lib.el as the criterion for
what to expand to.
(c-min-property-position): Use c-next-single-property-change
rather than next-single-property-change. This now works in
XEmacs.
* lisp/progmodes/cc-engine.el
(c-invalidate-sws-region-after-del)
(c-invalidate-sws-region-after-ins, c-forward-sws)
(c-backward-sws, c-find-decl-spots): Replace
next/previous-single-property-change by
c-next/previous-single-property-change to ensure functionality
in XEmacs.
(c-forward-sws, c-backward-sws): Handle NO-BREAKING-SPACE as
whitespace. This corrects the error in hardspace.c in the test
suite.
* lisp/progmodes/cc-fonts.el (c-font-lock-ml-strings): Refactor
some nested `if's into a cond form. Don't fontify multiline
string delimiters in XEmacs, in keeping with its string
conventions.
* lisp/progmodes/cc-langs.el (c-populate-syntax-table): Set the
syntax of NO-BREAKING-SPACE to whitespace rather than
punctuation.
* lisp/progmodes/cc-mode.el (c-before-change): Use
c-previous-single-property-change rather than
previous-single-property-change to ensure functionality in
XEmacs.
Add a tree-sitter version of prog-fill-reindent-defun that
indents the defun that encloses point, rather than the sibling
defun after point when there is one.
* lisp/progmodes/prog-mode.el:
(prog-fill-reindent-defun): Turns into a wrapper function.
(prog-fill-reindent-defun-function): New variable.
(prog-fill-reindent-defun-default): Old prog-fill-reindent-defun
becomes this function.
* lisp/treesit.el (treesit-fill-reindent-defun): New function.
(treesit-major-mode-setup): Setup
prog-fill-reindent-defun-function.
* lisp/progmodes/project.el (project--read-project-buffer):
Use the new function from 'uniquify' to generate buffer names that
are just unique to the current project, not globally (bug#77312).
* lisp/progmodes/js.el (js-ts-mode):
* lisp/progmodes/typescript-ts-mode.el (typescript-ts-base-mode):
Add 'c-ts-common-comment-setup' back removed in 8bccccedb6
since it does more than setting comment variables (bug#78680).
- Fontify type-names for static function calls directly on types.
- Special-case "document" and "console" and constants/builtins.
- Fontify variable-use in string-interpolation expressions.
- Fontify variable-use in function-calls.
- Fontify variable-use in member-access expressions.
- Fontify variable-use in JSX-expressions.
- Fontify variable-use when using explicit nullability override.
* lisp/progmodes/typescript-ts-mode.el:
(tsx-ts-mode--font-lock-compatibility-bb1f97b):
(typescript-ts-mode--font-lock-settings): Improve font-lock settings.
This adds keybindings for C-o and C-m, and changes the bindings
for n and m, in `flymake-diagnostics-buffer-mode' and
`flymake-project-diagnostics-mode' buffers.
Previously, `flymake-project-diagnostics-mode' did not use the
keybindings for `flymake-diagnostics-buffer-mode'. RET and SPC
were never bound in `flymake-project-diagnostics-mode' buffers.
This seems to have been an oversight: since the filename and
message are buttons which call `flymake-goto-diagnostic',
pressing RET still brought users to the diagnostic at point
most of the time. This change adds a
`flymake-project-diagnostics-mode-map' which inherits from
`flymake-diagnostics-buffer-mode-map'.
C-o and C-m now show and jump to the diagnostic currently at point,
similar to how `compilation-mode' works.
n and p now show the diagnostic newly under point after moving up or
down a line, which is also intended to make behavior more similar to
`compilation-mode'.
In order that other next-error buffers do not interfere with
navigation in the diagnostics buffers, this change introduces and
uses new functions, `next-error-this-buffer-no-select' and
`previous-error-this-buffer-no-select'. If we instead used
`next-error-no-select' and `previous-error-no-select', then a user
who runs `flymake-show-diagnostics-buffer', then e.g. `compile',
then returns to the diagnostics buffer and presses 'n', would be
navigated to the next error in the compilation buffer.
* lisp/progmodes/flymake.el (flymake-diagnostics-buffer-mode-map): Add
bindings.
(flymake-project-diagnostics-mode-map): Inherit bindings from
`flymake-diagnostics-buffer-mode'
* lisp/simple.el (next-error-this-buffer-no-select):
(previous-error-this-buffer-no-select): Add new commands.
(Bug#78619)
Copyright-paperwork-exempt: yes
* lisp/progmodes/sh-script.el (sh-indent-comment)
(sh-first-lines-indent, sh-indent-for-else): Remove variables that
are no longer obeyed.
(sh-var-list): Likewise. (Bug#78592)
* lisp/progmodes/project.el (project-remember-project):
Support interactive invocation (bug#78099) and react with
appropriate messages when called so, depending on the blacklist.
Older code was calculating body indentation depending on function
parameters alignment. This is incorrect, because if parameters are
misaligned, so will the function body. Instead, use offset of the
previous standalone parent.
* lisp/progmodes/typescript-ts-mode.el:
(typescript-ts-mode--indent-rules): Stop depending on function
parameters indentation for calculating body content and the closing
`}'.
* test/lisp/progmodes/typescript-ts-mode-resources/indent.erts:
(Function body with params misindented (bug#78121)): Add new test.
Some minor modes adds their own eldoc display function to
'eldoc-display-functions' hook buffer-locally. So when eldoc
uses 'eldoc-display-functions' to display docs, it should use
the buffer-local value of the hook.
But that's not always the case. In 'eldoc--invoke-strategy', the
code that runs 'eldoc-display-functions' hook is wrapped in a
callback function that eventually gets passed to each
documentation function in 'eldoc-documentation-functions'. So
now it's the documentation functions' responsibility to call the
eldoc callback in the original buffer.
All the eglot documentation functions indeed do that, using
'eglot--when-buffer-window' to switch to the original buffer
when calling the eldoc callback. But
'eglot-code-action-suggestion' is the exception, the callback is
called outside of the 'eglot--when-buffer-window' form.
This patch fixes that.
This bug was originally reported on eldoc-box [1]. The user
found that eldoc-box's display function are rarely called, even
though the minor mode is turned on. This patch fixes the issue.
[1] https://github.com/casouri/eldoc-box/issues/126#issuecomment-2896611278
* lisp/progmodes/eglot.el (eglot-code-action-suggestion): Move
the funcall form into the eglot--when-buffer-window form.
(treesit-sexp-type-down-list, treesit-sexp-type-up-list):
New buffer-local variables.
(treesit-down-list): Use 'treesit-sexp-type-down-list'.
(treesit-up-list): Use 'treesit-sexp-type-up-list'.
* lisp/progmodes/elixir-ts-mode.el (elixir-ts-mode):
Set 'treesit-sexp-type-down-list' and
'treesit-sexp-type-up-list' to 'list'.
Buttonize the ellipsis and optionally display in the ellipsis
the total number of hidden lines.
* lisp/progmodes/hideshow.el (hs-display-lines-hidden): New
user option.
(hs-ellipsis): New face.
(hs-make-overlay): Tweak.
(hs--get-ellipsis): New function.
* doc/emacs/programs.texi (Hideshow): Update documentation.
* etc/NEWS: Announce changes.
* lisp/progmodes/typescript-ts-mode.el:
(typescript-ts-mode--indent-rules): Make sure each new ternary
branch is aligned with the previous one.
* test/lisp/progmodes/typescript-ts-mode-resources/indent.erts:
(Chained ternary expressions): New test.
* lisp/progmodes/js.el (js--treesit-comment-jsx): New internal variable.
(js--treesit-comment-setup): New function.
(js-ts-mode): Set buffer-local 'comment-setup-function' to
'js--treesit-comment-setup'.
* lisp/progmodes/typescript-ts-mode.el (typescript-ts-base-mode):
Set buffer-local 'comment-setup-function' to 'js--treesit-comment-setup'.
* lisp/progmodes/eglot.el (eglot-uri-to-path): Remove the leading
slash in MS-Windows file names only if they begin with a slash.
This adjusts the function to the recent fix for bug#76982 in
'url-generic-parse-url', which previously would produce file names
that begin with an extra slash. (Bug#78392)
* lisp/progmodes/cc-fonts.el (c-font-lock-cpp-messages): Use
c-put-font-lock-face rather than c-put-font-lock-string-face
since we don't have the double quote marks here that the latter
function corrects for.
(c-complex-decl-matchers): Replace cl-delete-duplicates with
the macro c--delete-duplicates.