Juri Linkov [Wed, 28 Dec 2022 18:09:46 +0000 (20:09 +0200)]
; * etc/NEWS: Move the paragraph with 'C-u RET' closer to the related section.
Juri Linkov [Wed, 28 Dec 2022 18:06:18 +0000 (20:06 +0200)]
* doc/emacs/display.texi (Text Scale): Improve section about repeating keys.
Mention that it's possible to use repeating keys without the modifiers
and copy an example from etc/NEWS.
Juri Linkov [Wed, 28 Dec 2022 17:58:44 +0000 (19:58 +0200)]
* lisp/repeat.el (repeat-echo-function): Suggest 'add-function' in docstring.
(bug#60353)
Juri Linkov [Wed, 28 Dec 2022 17:47:52 +0000 (19:47 +0200)]
* lisp/tab-line.el (tab-line-cache-key-default): More cache keys (bug#60340).
Move more cache keys here from 'tab-line-format' to give users more freedom.
Stefan Monnier [Wed, 28 Dec 2022 17:19:02 +0000 (12:19 -0500)]
* etc/package-keyring.gpg: Update with new key
Eli Zaretskii [Wed, 28 Dec 2022 17:08:19 +0000 (19:08 +0200)]
; Yet another declare-function to avoid treesit-related warning
Stefan Kangas [Wed, 28 Dec 2022 16:37:46 +0000 (17:37 +0100)]
; * lisp/treesit.el (treesit--simple-imenu-1): Doc fix; wording.
F. Jason Park [Mon, 26 Dec 2022 05:36:53 +0000 (21:36 -0800)]
Warn of absent networks module in ERC
* doc/misc/erc.texi: Add linkable note in Modules chapter about some
modules being required. Also tweak markup in auth-source section.
* etc/ERC-NEWS: Mention the special role of `networks'.
* lisp/erc/erc-backend.el (erc--server-post-connect-hook): Add
internal hook for core modules to perform post-network-process,
pre-protocol config validation even when they haven't been loaded.
(erc--register-connection): Run `erc--server-post-connect-hook'.
* lisp/erc/erc-networks.el (erc-networks--bouncer-targets,
erc-networks-on-MOTD-end): Fix comments and doc strings. Also change
former from constant to internal variable in case adjustment needed
between releases.
(erc-networks--warn-on-connect): New function to warn about the
`networks' module being absent from `erc-modules'. This could
probably run at any time up to and including when the logical IRC
connection is established, but doing so at the process/protocol
boundary seems ideal.
* lisp/erc/erc-sasl.el (erc--register-connection): Defer to base
method instead of calling `erc-login' explicitly.
* lisp/erc/erc.el (erc-generate-new-buffer-name): Don't reconcile
buffer names when networks module not in play.
(erc-format-target-and/or-network): Don't assume networks module
loaded.
* test/lisp/erc/erc-scenarios-base-unstable.el:
(erc-scenarios-networks-no-module): New test.
* test/lisp/erc/resources/networks/no-module/basic.eld: New test data
file. (Bug#60331.)
F. Jason Park [Wed, 28 Dec 2022 14:18:01 +0000 (06:18 -0800)]
Avoid "already compiled" warning in erc-compat
* lisp/erc/erc-compat.el (erc-compat--29-auth-source-pass-search):
Don't `byte-compile' sub-29 secrets wrapper. This was especially
noisy in tests. Ditch closed-over vars via HOF instead of suppressing
because compiling emits "unused lexical" warning on Emacs 27.
Eli Zaretskii [Wed, 28 Dec 2022 14:48:22 +0000 (16:48 +0200)]
; Fix one more treesit byte-compilation warning.
Eli Zaretskii [Wed, 28 Dec 2022 14:41:58 +0000 (16:41 +0200)]
; Avoid treesit-related byte-compiler warnings
* lisp/progmodes/json-ts-mode.el (treesit-node-child-by-field-name):
* lisp/textmodes/toml-ts-mode.el (treesit-node-child-by-field-name):
* lisp/progmodes/java-ts-mode.el (treesit-node-child-by-field-name):
* lisp/progmodes/csharp-mode.el
(treesit-node-child-by-field-name): Avoid byte-compilation
warnings about treesit-node-type.
Dmitry Gutov [Wed, 28 Dec 2022 13:12:44 +0000 (15:12 +0200)]
(python--treesit-settings): Remove duplicate matcher
* lisp/progmodes/python.el (python--treesit-settings): Remove
duplicate matcher (which found itself under 'function' in addition
to 'definition').
Eli Zaretskii [Wed, 28 Dec 2022 13:10:39 +0000 (15:10 +0200)]
Make last change of w32 GUI dialogs conditional and reversible
* src/w32term.c (syms_of_w32term) <w32-yes-no-dialog-show-cancel>:
New boolean variable.
(w32_initialize): Fix query for visible system caret: 'bool' is a
single-byte data type, whereas SystemParametersInfo wants a BOOL,
which is a 32-bit int.
* src/w32menu.c (simple_dialog_show): Show "Cancel" button only if
'w32-yes-no-dialog-show-cancel' is non-nil.
* etc/NEWS: Announce the change.
Yuan Fu [Wed, 28 Dec 2022 08:32:37 +0000 (00:32 -0800)]
Fix tree-sitter typos
* doc/lispref/parsing.texi (Tree-sitter major modes):
* lisp/progmodes/java-ts-mode.el:
* test/src/treesit-tests.el (treesit-defun-navigation-nested-4): Fix
typo.
Yuan Fu [Wed, 28 Dec 2022 04:57:12 +0000 (20:57 -0800)]
Update tree-sitter major modes to use the new Imenu facility
See previous commit for more explanation.
* lisp/progmodes/c-ts-mode.el (c-ts-mode--defun-name): Handle more
types.
(c-ts-mode--imenu-1)
(c-ts-mode--imenu): Remove functions.
(c-ts-base-mode): Setup Imenu.
* lisp/progmodes/csharp-mode.el (csharp-ts-mode--imenu-1)
(csharp-ts-mode--imenu): Remove functions.
(csharp-ts-mode): Setup Imenu.
* lisp/progmodes/java-ts-mode.el (java-ts-mode--imenu-1)
(java-ts-mode--imenu): Remove functions.
(java-ts-mode): Setup Imenu.
* lisp/progmodes/js.el (js--treesit-imenu-1)
(js--treesit-imenu): Remove functions.
(js--treesit-valid-imenu-entry): New function.
(js-ts-mode): Setup Imenu.
* lisp/progmodes/json-ts-mode.el (json-ts-mode--defun-name): Trim the
quotes.
(json-ts-mode--imenu-1)
(json-ts-mode--imenu): Remove functions.
(json-ts-mode): Setup Imenu.
* lisp/progmodes/rust-ts-mode.el (rust-ts-mode--imenu)
(rust-ts-mode--imenu-1): Remove functions.
(rust-ts-mode): Setup Imenu.
* lisp/progmodes/typescript-ts-mode.el:
(typescript-ts-base-mode): Remove treesit-defun-prefer-top-level, it's
not used anymore. Setup Imenu. Setup treesit-defun-name-function.
* lisp/textmodes/css-mode.el (css--treesit-imenu-1)
(css--treesit-imenu): Remove functions.
(css-ts-mode): Setup Imenu.
* lisp/textmodes/toml-ts-mode.el (toml-ts-mode--defun-name): Fix it
and add a fallback.
(toml-ts-mode--imenu-1)
(toml-ts-mode--imenu): Remove functions.
(toml-ts-mode): Setup Imenu.
Yuan Fu [Wed, 28 Dec 2022 04:37:29 +0000 (20:37 -0800)]
Add tree-sitter helper functions for Imenu
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.
Yuan Fu [Wed, 28 Dec 2022 01:02:03 +0000 (17:02 -0800)]
Fix treesit--things-around (bug#60355)
Current implementation of treesit--things-around only searches forward
for REGEXP and go up the tree until it finds a valid thing, if nothing
matches it gives up. This makes it sometimes miss defuns. The new
implementation tries multiple times (of search forward + go up) until
it exhausts all possible defun nodes.
* lisp/treesit.el (treesit--things-around): New implementation.
(treesit--navigate-defun): Refactor to use treesit-node-top-level to
simplify code, and add some guards in the predicate function.
* test/src/treesit-tests.el:
(treesit--ert-defun-navigation-elixir-program): New variable.
(treesit-defun-navigation-nested-4): New test.
Yuan Fu [Tue, 27 Dec 2022 23:08:07 +0000 (15:08 -0800)]
; * lisp/treesit.el (treesit-traverse-parent): Remove alias.
It was added with treesit-traverse-xxx functions, since now they are
gone, this alias doesn't make sense by itself anymore.
Yuan Fu [Tue, 27 Dec 2022 23:07:03 +0000 (15:07 -0800)]
Improve treesit-node-top-level and treesit-parent-until
* lisp/treesit.el (treesit-node-top-level): Now it can accept a
predicate function. Add an optional argument INCLUDE-NODE.
(treesit-parent-until): Add an optional argument INCLUDE-NODE.
Philip Kaludercic [Tue, 27 Dec 2022 19:28:05 +0000 (20:28 +0100)]
; Add "src" to the heuristic sub-directory heuristic
* lisp/emacs-lisp/package-vc.el (package-vc--unpack): Check for "src"
directories, next to "lisp".
Philip Kaludercic [Tue, 27 Dec 2022 12:46:40 +0000 (13:46 +0100)]
; * lisp/epa-ks.el (epa-ks-do-key-to-fetch): Fix 'when' usage
Eli Zaretskii [Tue, 27 Dec 2022 18:55:12 +0000 (20:55 +0200)]
* src/w32menu.c (simple_dialog_show): Use MB_YESNOCANCEL style.
Eli Zaretskii [Tue, 27 Dec 2022 18:23:16 +0000 (20:23 +0200)]
; Improve documentation of TAB/SPC indentation
* lisp/indent.el (tab-to-tab-stop):
* src/indent.c (Findent_to): Mention 'indent-tabs-mode' in doc
strings.
Eli Zaretskii [Tue, 27 Dec 2022 16:59:59 +0000 (18:59 +0200)]
; Improve doc strings of some new faces
* lisp/font-lock.el (font-lock-punctuation-face)
(font-lock-delimiter-face): Doc fix.
Stefan Kangas [Tue, 27 Dec 2022 16:28:08 +0000 (17:28 +0100)]
; * lisp/elide-head.el (elide-head): Doc fix to silence checkdoc.
Eli Zaretskii [Tue, 27 Dec 2022 14:10:42 +0000 (16:10 +0200)]
; * lisp/htmlfontify.el (hfy-text-p): Fix whitespace.
Xi Lu [Sat, 24 Dec 2022 08:28:54 +0000 (16:28 +0800)]
Fix htmlfontify.el command injection vulnerability.
* lisp/htmlfontify.el (hfy-text-p): Fix command injection
vulnerability. (Bug#60295)
Rudolf Adamkovič [Sat, 24 Dec 2022 00:00:32 +0000 (01:00 +0100)]
Improve support for Scheme R6RS and R7RS libraries (bug#54704)
* etc/NEWS (Scheme mode): Document improved file-type auto-detection
and Imenu support for R6RS and R7RS Scheme libraries.
* lisp/files.el (auto-mode-alist): Associate the '.sls' (R6RS Scheme
Library Source) and '.sld' (R7RS Scheme Library Definition) file name
extensions with the Scheme mode.
* lisp/progmodes/scheme.el (scheme-imenu-generic-expression): Make
Imenu recognize the members nested (and so indented) inside of
'library' (R6RS) or 'define-library' (R7RS) forms.
Mattias Engdegård [Tue, 27 Dec 2022 10:18:02 +0000 (11:18 +0100)]
; * test/src/treesit-tests.el: remove dead store (bytecomp warning)
Yuan Fu [Tue, 27 Dec 2022 01:16:59 +0000 (17:16 -0800)]
Add a new tree-sitter query predicate 'pred'
I realized that using an arbitrary function as the predicate in
queries is very helpful for some queries I'm writing for python and
javascript, and presumably most other languages[1].
Granted, we can already filter out unwanted nodes by using a function
instead of a face for the capture name, and (1) determine whether the
captured node is valid and (2) fontify that node if it's valid.
However, such approach is a bit more cumbersome and more importantly
gets in the way of another potential use of the fontification queries:
context extraction.
For example, I could use the query for the 'variable' feature to get
all the variables in a certain region. In this use-case, we want the
filtering happen before returning the captured nodes.
Besides, the change is relatively small and straightforward: most code
are already there, I just need to add some boilerplate.
[1] For a code like aa.bb(cc), we want bb to be in function face,
because obviously its a function. But for aa.bb, we want bb to be in
property face, because it's a property. In the AST, bb is always a
property, the difference between the two cases is the enclosing node:
in the first case, aa.bb is in a "call_expression" node, indicating
that bb is used as a function (a method). So we want a predicate
function that checks whether bb is used as a function or a property,
and determine whether it should be in function or property face.
* doc/lispref/parsing.texi (Pattern Matching): Update manual.
* src/treesit.c (Ftreesit_pattern_expand): Handle :pred.
(treesit_predicate_capture_name_to_node): A new function extracted
from treesit_predicate_capture_name_to_text.
(treesit_predicate_capture_name_to_text): Use the newly extracted
function.
(treesit_predicate_pred): New predicate function.
(treesit_eval_predicates): Add new predicate. Also fix a bug: we want
to AND the results of each predicate.
* test/src/treesit-tests.el (treesit--ert-pred-last-sibling): New
helper function.
(treesit-query-api): Test #pred predicate.
Yuan Fu [Tue, 27 Dec 2022 01:15:37 +0000 (17:15 -0800)]
; Fix tree-sitter defun tests
* test/src/treesit-tests.el (treesit--ert-test-defun-navigation):
Change treesit--navigate-defun to treesit--navigate-thing.
Stefan Kangas [Mon, 26 Dec 2022 20:22:42 +0000 (21:22 +0100)]
Improve gnutls-min-prime-bits docstring
* lisp/net/gnutls.el (gnutls-min-prime-bits): Doc fix: delete
out-of-date and now misleading sentence, added back when Emacs'
default minimum prime bits for a Diffie-Hellman handshake was only 256
bits. These days, the default is nil, which means to let GnuTLS
decide the value. (See also `nsm-protocol-check--dhe-prime-kx`.)
Gregory Heytings [Mon, 26 Dec 2022 00:20:59 +0000 (00:20 +0000)]
Improve handling of tab-bar height.
* src/xdisp.c (redisplay_tab_bar): When 'auto-resize-tab-bar' is
not 'grow-only', also consider the case when the tab-bar height
needs to shrink. Fixes bug#60210.
Eli Zaretskii [Mon, 26 Dec 2022 14:26:28 +0000 (16:26 +0200)]
; * nt/INSTALL.W64: More fixes and updates.
Eli Zaretskii [Mon, 26 Dec 2022 13:26:48 +0000 (15:26 +0200)]
Simplify last change (bug#60311)
* src/json.c (json_available_p): Use original code. Always return
true for !WINDOWSNT.
(ensure_json_available): Now defined only on WINDOWSNT.
(Fjson_serialize, Fjson_insert, Fjson_parse_string)
(Fjson_parse_buffer): Call ensure_json_available only on
WINDOWSNT.
* lisp/subr.el (json-available-p): Simplify.
Mattias Engdegård [Sun, 25 Dec 2022 14:32:06 +0000 (15:32 +0100)]
Fix 'json-available-p' on MS-Windows
* src/json.c (json_available_p, ensure_json_available)
(Fjson__available_p): New functions.
(Fjson_serialize, Fjson_insert, Fjson_parse_string)
(Fjson_parse_buffer): Use ensure_json_available.
(syms_of_json): Defsubr json--available-p.
* lisp/subr.el (json-available-p): Rewrite.
Kyle Meyer [Sun, 25 Dec 2022 20:31:33 +0000 (15:31 -0500)]
loaddefs-gen: Group results by absolute file name
loaddefs-generate produced an incomplete output file if 1) it
was called with a relative file name and 2) that same file was
specified via a generated-autoload-file cookie in a subset of
the input files. In that case, autoload entries were lost
because loaddefs-generate writes the same output file twice:
once for the relative name specified by the caller and once
for the absolute name that loaddefs-generate--parse-file
returns for the generated-autoload-file value.
This has been fixed. (Bug#60318)
* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate): Expand file
names when grouping loaddef files.
Yuan Fu [Mon, 26 Dec 2022 09:39:02 +0000 (01:39 -0800)]
; Fix vindexes in parsing.texi
* doc/lispref/parsing.texi (Tree-sitter major modes): Replace vindex
with cross-reference to modes.texi. Add manual entry for
treesit-defun-type-regexp.
* lisp/treesit.el (treesit-defun-type-regexp): Use pred in docstring
since we use pred everywhere else.
Yuan Fu [Mon, 26 Dec 2022 09:01:41 +0000 (01:01 -0800)]
Fix imenu for c-ts-mode (bug#60296)
* lisp/progmodes/c-ts-mode.el (c-ts-mode--imenu-1): Use
c-ts-mode--defun-valid-p to filter out nested matches.
(c-ts-mode--defun-valid-p): Handle more types of nodes.
Yuan Fu [Mon, 26 Dec 2022 08:43:42 +0000 (00:43 -0800)]
Clean up python-ts-mode font-lock features
* lisp/progmodes/python.el (python--treesit-settings): Remove
unnecessary override flags, add function and variable feature, fix
assignment feature.
(python--treesit-variable-p)
(python--treesit-fontify-variable): New functions.
(python-ts-mode): Add function and variable feature.
Yuan Fu [Sun, 25 Dec 2022 19:21:50 +0000 (11:21 -0800)]
Add comment indent and filling to other tree-sitter major modes
Extract the setup into a function, and use it in other major modes.
* lisp/progmodes/c-ts-mode.el (c-ts-mode-comment-setup): New function.
(c-ts-base-mode): Extract out.
(c-ts-mode)
(c++-ts-mode): Remove old setup.
* lisp/progmodes/csharp-mode.el (csharp-ts-mode--indent-rules): New
indent rules.
(csharp-ts-mode): Use new setup function.
* lisp/progmodes/java-ts-mode.el (java-ts-mode--indent-rules): New
indent rules.
(java-ts-mode): Use new setup function.
* lisp/progmodes/js.el (js--treesit-indent-rules): New indent rules.
(js-ts-mode): Use new setup function.
* lisp/progmodes/rust-ts-mode.el (rust-ts-mode--indent-rules): New
indent rules.
(rust-ts-mode): Use new setup function.
* lisp/progmodes/typescript-ts-mode.el:
(typescript-ts-mode--indent-rules): New indent rules.
(typescript-ts-base-mode): Use new setup function.
Yuan Fu [Sun, 25 Dec 2022 19:11:00 +0000 (11:11 -0800)]
; Remove unused function in c-ts-mode
* lisp/progmodes/c-ts-mode.el (c-ts-mode--end-of-defun): Remove.
(c-ts-mode)
(c++-ts-mode): Remove setup.
Yuan Fu [Sun, 25 Dec 2022 18:44:53 +0000 (10:44 -0800)]
; * doc/lispref/modes.texi (Parser-based Font Lock): Minor fixes.
Yuan Fu [Sun, 25 Dec 2022 18:38:05 +0000 (10:38 -0800)]
; * doc/lispref/parsing.texi (Retrieving Nodes): Add notice.
Yuan Fu [Sun, 25 Dec 2022 18:22:40 +0000 (10:22 -0800)]
Add maintainer stub for tree-sitter files
* lisp/treesit.el:
* src/treesit.c: Add maintainer.
Yuan Fu [Sun, 25 Dec 2022 18:05:06 +0000 (10:05 -0800)]
; * doc/lispref/parsing.texi (Using Parser): Remove deleted function.
Stefan Kangas [Fri, 23 Dec 2022 17:21:10 +0000 (18:21 +0100)]
; Fix typos
(cherry picked from commit
a5d39e11443fa30c8e8bc58254a1a59550dcd99e)
Gregory Heytings [Mon, 26 Dec 2022 01:21:16 +0000 (01:21 +0000)]
Remove remaining mentions of 'eval-current-buffer'
* lisp/emacs-lisp/edebug.el (edebug-all-defs):
* doc/lispref/eval.texi (Eval):
* doc/lispref/edebug.texi (Instrumenting, Edebug Options):
Remove remaining mentions of 'eval-current-buffer', obsoleted in
Emacs 22 and removed in Emacs 26.
Eli Zaretskii [Sun, 25 Dec 2022 17:43:49 +0000 (19:43 +0200)]
; * doc/lispref/text.texi (Database): Fix a typo. (Bug#60317)
Kyle Meyer [Sun, 25 Dec 2022 16:36:36 +0000 (11:36 -0500)]
Eli Zaretskii [Sun, 25 Dec 2022 12:54:33 +0000 (14:54 +0200)]
; Review and fix NEWS and related documentation
* etc/NEWS: Fix wording, punctuation, and markup.
* lisp/emacs-lisp/subr-x.el (string-glyph-split): Doc fix.
* doc/lispref/display.texi (Displaying Messages): Document
'set-message-functions'.
Juanma Barranquero [Sun, 25 Dec 2022 11:59:06 +0000 (12:59 +0100)]
; Restore ARGS argument in c-ts-mode--fontify-declarator
* lisp/progmodes/c-ts-mode.el (c-ts-mode--fontify-declarator):
Restore argument name referenced in the docstring.
Philip Kaludercic [Sun, 25 Dec 2022 10:20:30 +0000 (11:20 +0100)]
; Always consider :lisp-dir when locating main file of VC packages
* lisp/emacs-lisp/package-vc.el (package-vc--main-file): Check the
:lisp-dir entry in the "extras" of a package description to find the
directory with a main file.
Philip Kaludercic [Sun, 25 Dec 2022 10:18:51 +0000 (11:18 +0100)]
Add heuristic to locate lisp code in source packages
* lisp/emacs-lisp/package-vc.el (package-vc--unpack): Check if a
"lisp" directory exists and use that instead of PKG-DIR.
(Bug#60155)
Eli Zaretskii [Sun, 25 Dec 2022 09:34:12 +0000 (11:34 +0200)]
; * doc/lispref/parsing.texi (Tree-sitter major modes): Fix @cindex.
Eli Zaretskii [Sun, 25 Dec 2022 09:23:07 +0000 (11:23 +0200)]
; * src/process.c (Fprocess_running_child_p): Doc fix.
Yuan Fu [Sun, 25 Dec 2022 08:42:57 +0000 (00:42 -0800)]
; * doc/lispref/parsing.texi: Add a reminder.
Yuan Fu [Sun, 25 Dec 2022 08:29:15 +0000 (00:29 -0800)]
; Fix byte-copmiler warning in c-ts-mode--fontify-declarator
* lisp/progmodes/c-ts-mode.el (c-ts-mode--fontify-declarator): Ignore
the rest args.
Yuan Fu [Sun, 25 Dec 2022 07:46:19 +0000 (23:46 -0800)]
; * lisp/treesit.el: Add some comments.
Yuan Fu [Sun, 25 Dec 2022 06:08:17 +0000 (22:08 -0800)]
Further generalize treesit-defun functions
Two new functions, treesit-beginning/end-of-thing. And
treesit-thing-at-point's signature changes.
* lisp/treesit.el (treesit-block-type-regexp): New variable.
(treesit-beginning-of-thing)
(treesit-end-of-thing): Generalized from
treesit-beginning/end-of-defun.
(treesit-beginning-of-defun)
(treesit-end-of-defun): Use the new functions.
(treesit-thing-at-point): Accept PATTERN rather than REGEXP and PRED.
(treesit-defun-at-point): Adjust for the new signature of
treesit-thing-at-point.
Yuan Fu [Sun, 25 Dec 2022 04:17:08 +0000 (20:17 -0800)]
Generalize treesit-defun functions to "things"
Change the "defun" in some functions (e.g. treesit--defuns-around) to
"thing". Add a function treesit-thing-at-point.
* lisp/treesit.el (treesit--thing-unpack-pattern): New subroutine.
(treesit-beginning-of-defun)
(treesit-end-of-defun): Use new function treesit--navigate-thing.
(treesit--defuns-around): Generalize into treesit--thing-around.
(treesit--top-level-defun): Generalize into treesit--top-level-thing.
(treesit--navigate-defun): Generalize into treesit--navigate-thing.
(treesit-thing-at-point): Generalized from treesit-defun-at-point.
(treesit-defun-at-point): Use treesit-thing-at-point to do tht work.
Philip Kaludercic [Sun, 25 Dec 2022 08:53:07 +0000 (09:53 +0100)]
Reorder optional arguments to 'package-vc-install'
* lisp/emacs-lisp/package-vc.el (package-vc-install-selected-packages):
Update 'package-vc-install' invocation.
(package-vc-install): Reorder and update documentation.
Philip Kaludercic [Sun, 25 Dec 2022 08:35:36 +0000 (09:35 +0100)]
Handle missing dependencies for source packages
* lisp/emacs-lisp/package-vc.el (package-vc-install-dependencies): Add
new function.
(package-vc--unpack-1): Call 'package-vc-install-dependencies' instead
of 'package-compute-transaction' and 'package-download-transaction'.
It is unreasonable to abort the installation, since we cannot expect
all dependencies to be available in the regular archives. Instead we
note which packages couldn't be found, and warn the user that these
will be missing.
Philip Kaludercic [Mon, 19 Dec 2022 16:00:36 +0000 (17:00 +0100)]
; Partial revert of
f3e7820b
* lisp/emacs-lisp/package.el (package-install-from-archive): Check if
a package is a directory package, not a VC package
Eli Zaretskii [Sun, 25 Dec 2022 08:26:59 +0000 (10:26 +0200)]
; * nt/INSTALL.W64: Fix wording.
Eli Zaretskii [Sun, 25 Dec 2022 07:29:47 +0000 (09:29 +0200)]
; Fix recent changes in treesit documentation
* lisp/treesit.el (treesit-defun-name-function, treesit-node-at)
(treesit-node-on): Doc fixes.
* doc/lispref/parsing.texi (Tree-sitter major modes): Fix wording,
punctuation, and indexing.
(Retrieving Nodes): Fix wording and add cross-references.
Yuan Fu [Sun, 25 Dec 2022 02:59:39 +0000 (18:59 -0800)]
Fix c-ts-mode imenu defun name (bug#60296)
Extract out c-ts-mode--declarator-identifier from
c-ts-mode--fontify-declarator.
* lisp/progmodes/c-ts-mode.el (c-ts-mode--declarator-identifier): New
function.
(c-ts-mode--fontify-defun): Extract out.
(c-ts-mode--defun-name): Use the new function.
Yuan Fu [Sun, 25 Dec 2022 02:45:36 +0000 (18:45 -0800)]
Fix treesit--children-covering-range-recurse (bug#60301)
* lisp/treesit.el (treesit--children-covering-range-recurse): Always
return a list of node.
Yuan Fu [Sun, 25 Dec 2022 02:24:01 +0000 (18:24 -0800)]
Support treesit-defun-name in tree-sitter major modes
* lisp/progmodes/csharp-mode.el (csharp-ts-mode--defun-name): New
function.
(csharp-ts-mode--imenu-1): Extract into new function.
(csharp-ts-mode): Setup treesit-defun-name-function.
* lisp/progmodes/java-ts-mode.el (java-ts-mode--defun-name): New
function.
(java-ts-mode--imenu-1): Extract into new function.
(java-ts-mode): Setup treesit-defun-name-function.
* lisp/progmodes/js.el (js-treesit-current-defun): Remove function.
This function is not used (for a while already).
(js--treesit-defun-name): New function.
(js--treesit-imenu-1): Extract into new function.
(js-ts-mode): Setup treesit-defun-name-function.
* lisp/progmodes/json-ts-mode.el (json-ts-mode--defun-name): New
function.
(json-ts-mode--imenu-1): Extract into new function.
(json-ts-mode): Setup treesit-defun-name-function.
* lisp/progmodes/python.el (python--treesit-defun-name): New function.
(python--imenu-treesit-create-index-1): Extract into new function.
(python-ts-mode): Setup treesit-defun-name-function.
* lisp/progmodes/rust-ts-mode.el (rust-ts-mode--defun-name): New
function.
(rust-ts-mode--imenu-1): Extract into new function.
(rust-ts-mode): Setup treesit-defun-name-function.
* lisp/textmodes/css-mode.el (css--treesit-defun-name): New function.
(css--treesit-imenu-1): Extract into new function.
(css-ts-mode): Setup treesit-defun-name-function.
* lisp/textmodes/toml-ts-mode.el (toml-ts-mode--get-table-name):
Remove function.
(toml-ts-mode--defun-name): New function.
(toml-ts-mode--imenu-1): Extract into new function.
(toml-ts-mode): Setup treesit-defun-name-function.
Yuan Fu [Sun, 25 Dec 2022 00:40:00 +0000 (16:40 -0800)]
; * lisp/treesit.el (treesit-defun-at-point): Guard against nil.
Yuan Fu [Sun, 25 Dec 2022 00:33:35 +0000 (16:33 -0800)]
Add treesit-defun-name and friends
1. We now have treesit-defun-name, powered by
treesit-defun-name-function.
2. We now have treesit-add-log-current-defun, which powers
add-log-current-defun.
3. c-ts-mode updates its code to take advantage of these new features.
4. Manual updates.
* doc/lispref/parsing.texi (Tree-sitter major modes): Add manual for
new functions.
* lisp/progmodes/c-ts-mode.el (c-ts-mode--defun-name): New function.
(c-ts-mode--imenu-1): Extract out into c-ts-mode--defun-name.
(c-ts-base-mode): Setup treesit-defun-name-function.
* lisp/treesit.el (treesit-defun-name-function)
(treesit-add-log-defun-delimiter): New variables.
(treesit-defun-at-point)
(treesit-defun-name): New functions.
(treesit-major-mode-setup): Setup add-log-current-defun-function.
Yuan Fu [Sat, 24 Dec 2022 23:31:03 +0000 (15:31 -0800)]
Make treesit-node-at/on guess language at point
If PARSER-OR-LANG is nil, it makes more sense to guess the language at
point by treesit-language-at than to simply use the first parser in
the parser list.
* doc/lispref/parsing.texi (Retrieving Nodes): Update manual.
* lisp/treesit.el (treesit-node-at)
(treesit-node-on): Guess language at point. Update docstring.
(treesit-buffer-root-node): Update docstring.
Yuan Fu [Sat, 24 Dec 2022 22:48:50 +0000 (14:48 -0800)]
; Add treesit-no-parser error
* lisp/treesit.el (treesit-no-parser): New error.
(treesit-buffer-root-node): Use the new error.
Óscar Fuentes [Sun, 25 Dec 2022 02:18:28 +0000 (03:18 +0100)]
* nt/INSTALL.W64: update instructions for setting up W64 environment
Eli Zaretskii [Sat, 24 Dec 2022 19:39:26 +0000 (21:39 +0200)]
Revert "; Bump minimum supported Windows version for MinGW64 to Windows 10."
This reverts commit
75155e458601a3597d382660d0be863ab4d512c0.
Evidently, some MSYS2/MinGW64 folks still think Windows 8.1
is the minimum supported version, even though MinGW-w64 switched
to Windows 10 as the default target in January 2022.
Eli Zaretskii [Sat, 24 Dec 2022 18:45:08 +0000 (20:45 +0200)]
; Bump minimum supported Windows version for MinGW64 to Windows 10.
Eli Zaretskii [Sat, 24 Dec 2022 16:46:58 +0000 (18:46 +0200)]
; Update minimum requirements of MinGW-w64
* etc/PROBLEMS (Dumping):
* nt/INSTALL.W64: Update the minimum OS version supported by
MinGW-w64.
Mattias Engdegård [Sat, 24 Dec 2022 16:01:36 +0000 (17:01 +0100)]
; * lisp/progmodes/c-ts-mode.el: quote literal string in regexp
Eli Zaretskii [Sat, 24 Dec 2022 10:27:17 +0000 (12:27 +0200)]
; * src/xdisp.c (redisplay_internal): Reinstate the FRAME_LIVE_P test.
Eli Zaretskii [Sat, 24 Dec 2022 10:08:43 +0000 (12:08 +0200)]
Fix definition of CNS 11643-15 charset
* lisp/international/mule-conf.el (chinese-cns11643-15): Fix
:code-offset value. (Bug#60275)
* lisp/international/characters.el: Add chinese-cns11643-15 to
charsets whose characters have categories c and C.
Yuan Fu [Sat, 24 Dec 2022 08:16:45 +0000 (00:16 -0800)]
; * lisp/progmodes/c-ts-mode.el: Add outline section headers.
Yuan Fu [Sat, 24 Dec 2022 08:15:48 +0000 (00:15 -0800)]
Improve c-ts-mode block comment indent (bug#60270)
Now it handles stuff like
/**
* @some_func:
* @arg1:
*/
* lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): Use new
matcher and anchor.
(c-ts-mode--looking-at-star): New matcher.
(c-ts-mode--comment-start-after-first-star): New anchor.
Yuan Fu [Sat, 24 Dec 2022 01:17:25 +0000 (17:17 -0800)]
; Add treesit_recursion_limit
* src/treesit.c (treesit_recursion_limit): New constant.
(treesit_cursor_helper)
(Ftreesit_search_subtree)
(Ftreesit_induce_sparse_tree): Use the new constant.
Yuan Fu [Sat, 24 Dec 2022 01:12:32 +0000 (17:12 -0800)]
Fix block comment indent and filling for c-ts-mode (bug#59763)
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.
Yuan Fu [Fri, 23 Dec 2022 23:22:31 +0000 (15:22 -0800)]
Fix treesit_cursor_helper (bug#60267)
The cause of that bug is that in a particular parse tree, the node
treesit_cursor_helper tries to go to is a missing node, not only is it
a missing node, it is the first node of a subtree. So when
treesit_cursor_helper follows the algorithm and goes down the tree, it
goes down the previous subtree (because that subtree's end = end_pos,
because the target node has zero width).
o
|
o--+-o
| |
+-+ +-+-+
| | | | |
o x t o o
(We ended up in x when the target is t, because t has zero width.)
One way to solve it is to go back up the tree if we are at a leaf node
and still haven't matched the target node. That's too ugly and
finicky so I resorted to recursion. Now one more functions will
return give up (treesit_node_parent) if we are in a werid parse tree
that is super deep. But since we already kind of give up on this kind
of parse trees (bug#59426), it doesn't really hurt.
* src/treesit.c (treesit_cursor_helper_1): New function.
(treesit_cursor_helper): Use the new function. Change return type to
bool, and accept a cursor pointer.
(Ftreesit_node_parent)
(Ftreesit_search_subtree)
(Ftreesit_search_forward)
(Ftreesit_induce_sparse_tree): Use the new signature.
Paul Eggert [Sat, 24 Dec 2022 07:36:06 +0000 (23:36 -0800)]
Fix restart-emacs alarms (Bug#60220)
* src/emacs.c (Fkill_emacs): Turn timers off before execing,
so that the re-execed Emacs doesn’t get a timer alarm.
Florian Weimer [Fri, 23 Dec 2022 17:51:08 +0000 (18:51 +0100)]
Fix alternate stack test in configure
* configure.ac (emacs_cv_alternate_stack): Include <stdlib.h>
for 'malloc's prototype.
Xi Lu [Fri, 23 Dec 2022 15:50:39 +0000 (23:50 +0800)]
Add more functions to "string" shortdoc
* lisp/emacs-lisp/shortdoc.el: Add 'string-or-null-p',
'char-or-string-p', 'char-uppercase-p'. (Bug#60279)
Yaraslau Tamashevich [Fri, 23 Dec 2022 09:39:25 +0000 (11:39 +0200)]
Make the Contour terminal an alias of xterm-256color
* lisp/faces.el (term-file-aliases): Make the Contour terminal an
alias of xterm-256color. (Bug#60278)
Copyright-paperwork-exempt: yes
Eli Zaretskii [Sat, 24 Dec 2022 07:40:56 +0000 (09:40 +0200)]
; Fix punctuation in last change.
glacials [Thu, 22 Dec 2022 20:09:08 +0000 (12:09 -0800)]
Correct wrong info in (info)Go to node
The node (info)Go to node in the Info manual states that 'g'
does not allow the use of abbreviations, however it does.
To test this, type 'gt' from this node and see that it takes
you to (info)Top, then type 'ggo<RET>' and see that it takes
you back to (info)Go to node. Tested on emacs 28.2.
* doc/misc/info.texi (Go to node): Fix inaccurate information.
(Bug#60263)
Copyright-paperwork-exempt: yes
Eli Zaretskii [Sat, 24 Dec 2022 07:32:08 +0000 (09:32 +0200)]
Fix typo in TUTORIAL.fr (bug#60261)
* etc/tutorials/TUTORIAL.fr: Fix typo. Reported by
Clément Escude--Cotinat <clement.escudecotinat@yahoo.fr>.
Daniel Martín [Thu, 22 Dec 2022 18:10:24 +0000 (19:10 +0100)]
Add some diff-fixup-modifs tests
* test/lisp/vc/diff-mode-tests.el (diff-mode-test-fixups-added-lines):
Test that diff-mode fixes patches with added lines correctly.
* test/lisp/vc/diff-mode-tests.el (diff-mode-test-fixups-empty-hunks):
Ditto for patches with empty hunks. (Bug#60259)
Ulrich Müller [Mon, 19 Dec 2022 15:51:20 +0000 (16:51 +0100)]
Fix quoted argument in emacsclient-mail.desktop Exec key
Apparently the emacsclient-mail.desktop file doesn't conform to the
Desktop Entry Specification at
https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#exec-variables
which says about the Exec key:
| Field codes must not be used inside a quoted argument, the result of
| field code expansion inside a quoted argument is undefined.
However, the %u field code is used inside a quoted argument of the
Exec key in both the [Desktop Entry] and [Desktop Action new-window]
sections.
* etc/emacsclient-mail.desktop (Exec): The Desktop Entry
Specification does not allow field codes like %u inside a quoted
argument. Work around it by passing %u as first parameter ($1)
to the shell wrapper.
* etc/emacsclient.desktop (Exec): Use `sh` rather than `placeholder`
as the command name of the shell wrapper. (Bug#60204)
Richard Hansen [Sat, 17 Dec 2022 23:51:33 +0000 (18:51 -0500)]
ert-x: Move window selection logic to its own macro
* lisp/emacs-lisp/ert-x.el (ert-with-buffer-selected): New macro to
temporarily display a buffer in a selected window and evaluate a body.
(ert-with-test-buffer-selected): Use the new macro.
* test/lisp/whitespace-tests.el
(ert-test-with-buffer-selected/current)
(ert-test-with-buffer-selected/selected)
(ert-test-with-buffer-selected/nil-buffer)
(ert-test-with-buffer-selected/modification-hooks)
(ert-test-with-buffer-selected/read-only)
(ert-test-with-buffer-selected/return-value): Add tests.
(Bug#60189)
Richard Hansen [Sat, 17 Dec 2022 23:18:39 +0000 (18:18 -0500)]
; ert-x: Simplify `ert-with-test-buffer-selected'
* lisp/emacs-lisp/ert-x.el (ert-with-test-buffer-selected):
Simplify using 'ert-with-test-buffer'. (Bug#60189)
Richard Hansen [Sat, 17 Dec 2022 23:26:33 +0000 (18:26 -0500)]
; ert-x: Add test for buffer read-only state
This test should have been included with commit
29b7d740006fe2190a729bd1c30ccab9356cee36.
* test/lisp/emacs-lisp/ert-x-tests.el
(ert-test-with-test-buffer-selected/read-only): New test.
(Bug#60189)
Po Lu [Sat, 24 Dec 2022 06:14:51 +0000 (14:14 +0800)]
Fix crash after X error
* src/xdisp.c (redisplay_internal): Catch another crash if
gcscrollbars after an X error.
Xi Lu [Fri, 23 Dec 2022 04:52:48 +0000 (12:52 +0800)]
Fix ruby-mode.el local command injection vulnerability (bug#60268)
* lisp/progmodes/ruby-mode.el
(ruby-find-library-file): Fix local command injection vulnerability.
Michael Albinus [Fri, 23 Dec 2022 18:29:37 +0000 (19:29 +0100)]
; * etc/NEWS: Fix typos.