Stefan Kangas [Tue, 10 Jan 2023 08:51:57 +0000 (09:51 +0100)]
Merge from origin/emacs-29
55aabfea4ac Fix c-ts-mode comment indent 8377ed5298f Highlight identifier in import statements in js-ts-mode aa9df1260c3 Don't print named tree-sitter nodes with parenthesizes (b... e385c099b8c Improve fontification for import-statements in typescript... 28dd6021384 Fix c-ts-mode indentation for 2nd line in block comment (... 8a36a0f44aa ; xref.el: Bump version f16cc7c49c7 ; project.el: Bump version ebc5263667b ; * src/callint.c (Finteractive): Doc string clarification. c1401d1c6c8 * lisp/vc/diff-mode.el (diff-font-lock-keywords): Check f... 1f8ad353d9f Minor improvement for tree-sitter explorer ef87c755660 Make sure NODE is not the root node in tree-sitter indent... 1238fa8e49b Fix label indent of GNU and Linux style in c-ts-mode (bug... dc911e4ba5c Improve go-ts-mode Imenu, navigation and electric pair (b... 20f36c8f6f9 ; ruby.rb: Fix pattern matching syntax and extend the exa... d46f7f4edcc Revert "Add c-or-c++-ts-mode (bug#59613)" 1469aac20d8 ; * src/pgtkfns.c (parse_resource_key): Use recursive sch... da96a1fd741 Add back renamed function 'font-lock-fontify-syntacticall... b1aa720671e ; * lisp/progmodes/ruby-ts-mode.el: Fix compilation warni... 5cb01ac5d78 ; * src/callint.c (Finteractive): Fix the doc string (bug... 53e64cfb852 Improve options and docs of M-x command completion fef4f18cc33 ; Fix NEWS e04b3d41bb4 Update to Org 9.6-90-ga6523f e3d806b4172 Fix string fontification on python-ts-mode (bug#60599) 800e15e3be0 Fix string-interpolation feature of python-ts-mode (bug#6... 38b63f4c3ce Add indentation rule for concatenated_string (bug#60572) 2cdd75a18ff Fix highlighting of variable-declarations in typescript-t... 73168793c01 Fix label indentation for Linux style in c-ts-mode (bug#6... 8575043f56b Remove duplicate entries in c-ts-mode's Imenu ef7f3c6388b Fix use of treesit-ready-p in c/c++-ts-mode cc1de953d4f ; * lisp/progmodes/gud.el (gud-tooltip-modes): Add ts- mo... 16f1e47ca8b ; * lisp/align.el (align-c++-modes): Add c/c++-ts-mode. 508389ad2bb Add documentation for c/c++-ts-mode (bug#60443) ee3e8d3f927 (ruby-ts--font-lock-settings): Improve highlighting in pa... 614f8c431d3 Optionally include the namespace in c-ts-mode--declarator... 7c356934fbb Support namespaces in c++-ts-mode (bug#60397) 757c2c25922 Fix c-ts-mode--looking-at-star 1df2826639c Add c-or-c++-ts-mode (bug#59613) 0cb686ffb6b Document the 'definition-name' property. 7f855b5297b ; Fix description of etc/DOC e9341119fe4 ; Fix documentation of etc/DOC 86a3462e3d2 (treesit-simple-indent-presets): Do that for 'or' as well. e0fef510b00 ; Minor rewording of tree-sitter terminology f58452e3ae7 Fix 'python-shell-buffer-substring' when START is in midd... 7f9588685a0 ; Fix last change e8b85f225d9 Rearrange the "Saving Emacs Sessions" section of the user...
Yuan Fu [Mon, 9 Jan 2023 09:44:44 +0000 (01:44 -0800)]
Fix c-ts-mode indentation for 2nd line in block comment (bug#60270)
If the first line is "/*" or "/* ", indent like this:
/*
aaa
If the first line is "/* some text", indent like this:
/* some text
aaa
* lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles):
(c-ts-mode--looking-at-star): Minor refactor.
(c-ts-mode--comment-2nd-line-matcher)
(c-ts-mode--comment-2nd-line-anchor): New functions.
* lisp/treesit.el (treesit-simple-indent-presets):
prev-adaptive-prefix doesn't handle the comment-start-skip case (i.e,
2nd line) anymore. (Handled by the new matcher.)
Add named defun for transpose-sexps-default-function (bug#60654)
* lisp/simple.el (transpose-sexps-default-function): Move the lambda
into its own function.
(transpose-sexps-function): Refer to it by name.
* etc/NEWS: Mention the change.
Yuan Fu [Mon, 9 Jan 2023 04:30:07 +0000 (20:30 -0800)]
Minor improvement for tree-sitter explorer
If you open an empty python buffer and type
1 + 2
a
b
Currently the explorer only displays the top-level node at point, ie,
only 1 + 2, only a, or only b. That's kind of awkward, so if the
buffer is small, show the entire parse tree.
* lisp/treesit.el (treesit--explorer-refresh): See above.
Yuan Fu [Mon, 9 Jan 2023 03:05:19 +0000 (19:05 -0800)]
Make sure NODE is not the root node in tree-sitter indent (bug#60602)
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.
Yuan Fu [Mon, 9 Jan 2023 00:57:29 +0000 (16:57 -0800)]
Fix label indent of GNU and Linux style in c-ts-mode (bug#60543)
The previous fix isn't correct.
* lisp/progmodes/c-ts-mode.el:
(c-ts-mode--indent-styles): New indent rule. Fix the rule for Linux
style.
(c-ts-mode--top-level-label-matcher): New function.
Tad Fisher [Wed, 4 Jan 2023 21:40:17 +0000 (13:40 -0800)]
; * src/pgtkfns.c (parse_resource_key): Use recursive schema lookup
XDG_DATA_DIRS may consist of multiple directories, and
g_settings_schema_source_get_default composes these into a recursive
schema source. One must pass TRUE to g_settings_schema_source_lookup,
otherwise only the first directory in XDG_DATA_DIRS is searched.
It follows that in the case that the directory containing the compiled
GSettings schema for Emacs is not the first in XDG_DATA_DIRS,
parse_resource_key will not accept any resource key, which causes
pgtk_get_defaults_value and pgtk_set_defaults_value to fail.
This impacts systems that compose multiple GSettings schema sources
via XDG_DATA_DIRS, such Flatpak and NixOS.
Supporting GIO documentation for g_settings_schema_source_get_default:
> The returned source may actually consist of multiple schema sources
> from different directories, depending on which directories were given
> in `XDG_DATA_DIRS` and `GSETTINGS_SCHEMA_DIR`. For this reason, all
> lookups performed against the default source should probably be done
> recursively.
Benson Chu [Sun, 1 Jan 2023 01:45:43 +0000 (19:45 -0600)]
Add back renamed function 'font-lock-fontify-syntactically-region'
A more accurate replacement for font-lock-fontify-syntactically-region
would be a function that funcalls the
font-lock-fontify-syntactically-function variable. That way, callers
of the function can inherit new behavior, if the value of that variable
changes.
* lisp/font-lock.el (font-lock-fontify-syntactically-region):
Add function back, remove its obsolete alias.
Eli Zaretskii [Sun, 8 Jan 2023 10:23:26 +0000 (12:23 +0200)]
Improve options and docs of M-x command completion
* lisp/simple.el (read-extended-command-predicate): Expand the
doc string. Add 2 more selectable values.
(command-completion-using-modes-and-keymaps-p): New function.
(execute-extended-command): Mention
'read-extended-command-predicate' in the doc string. (Bug#60645)
Yuan Fu [Sun, 8 Jan 2023 02:38:24 +0000 (18:38 -0800)]
Fix string-interpolation feature of python-ts-mode (bug#60599)
* lisp/progmodes/python.el:
(python--treesit-fontify-string-interpolation): New function.
(python--treesit-settings): Use the new function for
string-interpolation.
Fix highlighting of variable-declarations in typescript-ts-mode
(bug#60546)
- Highlight variable declarations in catch-clauses.
- Remove highlighting of variables where not declarations (improve
consistency with other *-ts-modes).
* lisp/progmodes/typescript-ts-mode.el:
(typescript-ts-mode--font-lock-settings): See above.
Yuan Fu [Sun, 8 Jan 2023 01:46:27 +0000 (17:46 -0800)]
Remove duplicate entries in c-ts-mode's Imenu
Right now the Class subindex includes top-level functions, which is
wrong. This change ensures the Class subindex only contain classes and
functions nested in those classes.
* lisp/progmodes/c-ts-mode.el:
(c-ts-mode--defun-for-class-in-imenu-p): New function.
* lisp/progmodes/c-ts-mode.el (c-ts-base-mode): Use the new function.
Dmitry Gutov [Sun, 8 Jan 2023 01:56:32 +0000 (03:56 +0200)]
(ruby-ts--font-lock-settings): Improve highlighting in patterns
* lisp/progmodes/ruby-ts-mode.el (ruby-ts--font-lock-settings):
Improve highlighting in patterns: highlight values not keys as
variable in the usual case; highlight keys when no value;
highlight the "as pattern" variable.
Yuan Fu [Sat, 7 Jan 2023 23:26:56 +0000 (15:26 -0800)]
Fix c-ts-mode--looking-at-star
Not the topic of bug#60270 but reported in one of the replies.
* lisp/progmodes/c-ts-mode.el (c-ts-mode--looking-at-star): Check not
the character after point but character after BOL. Otherwise
indentation is wrong when point is not at BOL.
Eli Zaretskii [Sat, 7 Jan 2023 17:57:30 +0000 (19:57 +0200)]
Document the 'definition-name' property.
* doc/lispref/symbols.texi (Standard Properties): Document
'definition-name'.
* doc/lispref/functions.texi (Defining Functions): Describe how to
use 'definition-name' when generating function definitions at run
time. (Bug#60568)
* lisp/net/tramp-container.el (tramp-toolbox-program): New defcustom.
(tramp-toolbox-method): New defconst.
(tramp-toolbox--completion-function): New defun. Set it for "toolbox".
(tramp-methods) <toolbox>: Add.
(tramp-default-host-alist): Add rule for "toolbox".
kobarity [Sun, 1 Jan 2023 12:09:10 +0000 (21:09 +0900)]
Fix 'python-shell-buffer-substring' when START is in middle of 1st line
* lisp/progmodes/python.el (python-shell-buffer-substring): Instead
of checking whether START is point-min, check whether START is in
the first line. (Bug#60466)
* test/lisp/progmodes/python-tests.el
(python-shell-buffer-substring-18): New test.
Stefan Kangas [Sat, 7 Jan 2023 05:30:10 +0000 (06:30 +0100)]
Merge from origin/emacs-29
9d410f8de64 (treesit-simple-indent-presets): Ensure 'and' works for a... ff66a5d324b (treesit--indent-rules-optimize): Optimize 'and' and 'or'... f2ebe43362c (treesit-simple-indent-presets): Short-circuit 'and' and ... 2ea6ee5cbfa (font-lock-regexp-face): New face 5ab03bcc433 Unify the string interpolation delimiters face across ts ... 92e8c0c091c ruby-ts-mode: Highlight more kinds of parameters 7420b6dcc37 Fix `pr-interface' 699711786ac Further generic-related improvements in csharp-ts-mode (b...
Dmitry Gutov [Sat, 7 Jan 2023 00:44:07 +0000 (02:44 +0200)]
(treesit--indent-rules-optimize): Optimize 'and' and 'or' matcher forms
* lisp/treesit.el (treesit--indent-rules-optimize):
Optimize 'and' and 'or' matcher forms. When 'and' has a 'query'
matcher inside (as is the case in ruby-ts--indent-rules, many
times over), this yields a significant performance boost.
Dmitry Gutov [Sat, 7 Jan 2023 00:02:25 +0000 (02:02 +0200)]
(treesit-simple-indent-presets): Short-circuit 'and' and 'or'
* lisp/treesit.el (treesit-simple-indent-presets):
Short-circuit the 'and' and 'or' matchers. To avoid calling all
fns after one returned nil or truthy value, respectively.
Dmitry Gutov [Fri, 6 Jan 2023 17:56:20 +0000 (19:56 +0200)]
(font-lock-regexp-face): New face
* lisp/font-lock.el (font-lock-regexp-face): New face.
* lisp/progmodes/typescript-ts-mode.el
(typescript-ts-mode--font-lock-settings):
* lisp/progmodes/ruby-ts-mode.el (ruby-ts--font-lock-settings):
* lisp/progmodes/js.el (js--treesit-font-lock-settings):
Use it for regexps.
Dmitry Gutov [Fri, 6 Jan 2023 13:38:00 +0000 (15:38 +0200)]
ruby-ts-mode: Highlight more kinds of parameters
* lisp/progmodes/ruby-ts-mode.el
(ruby-ts--font-lock-settings): Highlight destructured parameters,
lambda parameters, identifiers in pattern matching clauses
(array/hash) and exception variables.
Move the 'symbol' matchers lower to make 'hash_key_symbol' lower
priority than hash keys in match patterns.
* lisp/net/tramp-adb.el:
* lisp/net/tramp-archive.el:
* lisp/net/tramp-cache.el:
* lisp/net/tramp-cmds.el:
* lisp/net/tramp-crypt.el:
* lisp/net/tramp-fuse.el:
* lisp/net/tramp-gvfs.el:
* lisp/net/tramp-integration.el:
* lisp/net/tramp-rclone.el:
* lisp/net/tramp-sh.el:
* lisp/net/tramp-smb.el:
* lisp/net/tramp-sshfs.el:
* lisp/net/tramp-sudoedit.el:
* lisp/net/tramp.el:
* lisp/net/trampver.el: Replace the removed `tramp-compat-*' items
by their real definition. Don't use `tramp-compat-funcall' when
not needed. Remove `with-no-warnings' and `ignore-errors' where
appropriate.
* lisp/net/tramp.el (tramp-file-name-for-operation): Rearrange list.
(tramp-handle-file-newer-than-file-p): Simplify.
(tramp-get-process-attributes): Don't check for existence of
`connection-local-criteria-for-default-directory'.
(tramp-handle-shell-command): Don't check for existence of
`shell-command-save-pos-or-erase', `async-shell-command-width' and
`shell-command-set-point-after-cmd'.
(tramp-handle-start-file-process): Call `make-process' directly.
(tramp-defined-time): New defsubst.
(tramp-get-local-gid): Don't check for existence of `group-name'.
* lisp/net/tramp-adb.el (tramp-adb-handle-set-file-times):
Use `tramp-defined-time'.
(tramp-adb-get-signal-strings): Don't bind `shell-file-name' and
`shell-command-switch'.
* lisp/net/tramp-archive.el (top, tramp-archive-file-name-handler):
Don't bind `max-specpdl-size' any longer.
(tramp-archive-autoload-file-name-regexp): Remove Emacs 26
specific code.
(top): Don't call `tramp-register-archive-autoload-file-name-handler'.
* lisp/net/tramp-gvfs.el (top): Don't bind `max-specpdl-size' any longer.
(tramp-gvfs-handle-set-file-times): Use `tramp-defined-time'.
* lisp/net/tramp-sh.el (tramp-sh-handle-set-file-times):
Use `tramp-defined-time'.
* test/lisp/net/tramp-archive-tests.el (tramp-archive--test-emacs27-p):
Remove.
(all):
* test/lisp/net/tramp-tests.el (all): Don't skip for Emacs 26.
Replace the removed `tramp-compat-*' items by their real
definition. Don't use `tramp-compat-funcall' when not needed.
Remove `with-no-warnings' and `ignore-errors' where appropriate.
(with-connection-local-variables)
(shell-command-dont-erase-buffer): Don't declare.
(tramp-test10-write-region): Don't check for `make-empty-file'.
(tramp-test32-shell-command): Simplify.
(tramp-test34-explicit-shell-file-name): Don't protect
`explicit-shell-file-name' any longer.
(tramp--test-emacs27-p): Remove.
Robert Pluim [Fri, 6 Jan 2023 08:00:00 +0000 (09:00 +0100)]
Fix `pr-interface'
`pr-interface' specifies `inline' for its menu items, which is not
necessary, but it causes `widget-choice-value-create' to bug
out. (Bug#60501)
* lisp/wid-edit.el (widget-choice-value-create): Allow the value to be
a non-list.
* test/lisp/wid-edit-tests.el (widget-test-handle-spurious-inline):
Add test to ensure that unnecessary :inline is allowed.
Stefan Kangas [Fri, 6 Jan 2023 05:30:10 +0000 (06:30 +0100)]
Merge from origin/emacs-29
0f5e74f1734 ruby-ts-mode: Highlight method and block parameters f1aa306f915 ruby-ts-mode: Highlight variable assignments 089b08eb3eb ruby-ts-mode: Move 'self' and 'super' from constants to k... 7ede600273c (ruby-ts-mode): Split font-lock feature 'builtin' into two ec172d748f3 Avoid assertion violation due to fill-column indicator face 62c2963ce60 Merge branch 'emacs-29' of git.savannah.gnu.org:/srv/git/... 2e6070f16c4 ; Another review of etc/NEWS 16eca92415b ; * src/gnutls.c (Fgnutls_deinit): Fix typo in doc string... 4753b587868 * lisp/cedet/semantic/symref/grep.el: Support ts-modes (b... 8a18369afdc ; Another fix for doc strings of 2 treesit.el functions 3fc68833517 ; Fix the doc strings of 2 treesit.el functions 83ce7c861e1 Make 'toml-ts-mode' optional
Perry Smith [Fri, 6 Jan 2023 02:20:02 +0000 (04:20 +0200)]
ruby-ts-mode: Highlight variable assignments
* lisp/progmodes/ruby-ts-mode.el (ruby-ts--font-lock-settings):
Bring back the 'assignment' feature.
(ruby-ts-mode): Replace the unused 'variable' with 'assignment'. Use
the level 3 for consistency with other ts modes.
Update the Commentary as well.
Dmitry Gutov [Fri, 6 Jan 2023 01:12:20 +0000 (03:12 +0200)]
(ruby-ts-mode): Split font-lock feature 'builtin' into two
* lisp/progmodes/ruby-ts-mode.el (ruby-ts-mode):
Split the 'builtin' feature in two: 'builtin-constant' and
'builtin-variable'.
(ruby-ts-highlight-predefined-constants):
Drop the user option, the highlighting granularity can be chosen
using treesit-font-lock-recompute-features.
(ruby-ts--font-lock-settings): Update accordingly.
(ruby-ts--predefined-constants, ruby-ts--predefined-variables):
Fix docstrings.
Eli Zaretskii [Thu, 5 Jan 2023 20:33:51 +0000 (22:33 +0200)]
Avoid assertion violation due to fill-column indicator face
* src/xdisp.c (extend_face_to_end_of_line): Use the original
iterator metrics for the stretch glyph, the one unaffected by the
'fill-column-indicator' face. (Bug#60580)
Stefan Kangas [Thu, 5 Jan 2023 05:30:20 +0000 (06:30 +0100)]
Merge from origin/emacs-29
92f753dc190 ; * etc/NEWS: Fix wording in last change. cef875f6c51 ; * etc/NEWS: Instructions for builds without tree-sitter... 8d530ca6542 ; Fix documentation of y-or-n-p/yes-or-no-p c18878ee0a2 Fix bug in Tramp multi-hop 7eed8e050a9 * lisp/files.el (find-sibling-rules): Fix docstring. 6b5831c6964 Tree-sitter doc fixes (bug#60524) 651927ac391 ; Fix function reference in comment in c-ts-mode.el (bug#... c786afcbb9f Fontify C++ function definitions in c-ts-mode (bug#60529)
Juri Linkov [Wed, 4 Jan 2023 07:57:06 +0000 (09:57 +0200)]
Tree-sitter doc fixes (bug#60524)
* doc/lispref/modes.texi (Parser-based Font Lock):
Replace :lang with :language.
* doc/lispref/parsing.texi (Language Grammar): Replace
treesit-load-suffixes with dynamic-library-suffixes.
(Retrieving Nodes): Fix function names.
(Tree-sitter Major Modes): Fix treesit-ready-p args.
Fix pxref to Parser-based Indentation.
(Tree-sitter C API): Fix function names.
* lisp/treesit.el (treesit--simple-indent-eval): Remove cond BODY
duplicated from CONDITION.
(treesit)<define-short-documentation-group>: Fix function names.
Daniel Martín [Tue, 3 Jan 2023 21:08:13 +0000 (22:08 +0100)]
Fontify C++ function definitions in c-ts-mode (bug#60529)
* lisp/progmodes/c-ts-mode.el (c-ts-mode--declarator-identifier):
Teach the code how to extract the declarator of a node of type
"qualified_identifier".
(c-ts-mode--fontify-declarator): Consider the case where the
identifier in a function declarator is buried inside
"qualifier_identifier" nodes.
Dmitry Gutov [Tue, 3 Jan 2023 22:37:43 +0000 (00:37 +0200)]
(ruby-ts-add-log-current-function): Fix when between two methods
* lisp/progmodes/ruby-ts-mode.el
(ruby-ts-add-log-current-function): Fix the case when point is
between two methods. 'treesit-node-at' returs the 'def' node of
the method after point in such case, so it behaved like point was
inside the method below.
* test/lisp/progmodes/ruby-ts-mode-tests.el
(ruby-ts-add-log-current-method-outside-of-method):
Update the test case.
* test/lisp/progmodes/ruby-mode-tests.el
(ruby-add-log-current-method-outside-of-method):
Mirror that change.