Pip Cet [Sat, 28 Jun 2025 09:33:01 +0000 (09:33 +0000)]
Avoid extra output in Vprin1_to_string_buffer (bug#78842)
print_error_message can throw after producing some output, so use
unwind-protect to ensure prin1-to-string-buffer is cleared.
* src/print.c (erase_prin1_to_string_buffer): New.
(Ferror_message_string): Use it to catch errors thrown in
'print_error_message'.
* test/src/print-tests.el (error-message-string-circular): Expand
test.
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.
Rahguzar [Sun, 22 Jun 2025 08:13:06 +0000 (13:13 +0500)]
* lisp/pcmpl-rpm.el: Generate completions for dnf5
(pcmpl-rpm-dnf-cache-file): Remove now unused variable.
(pcmpl-rpm--dnf-packages): Use dnf repoquery.
(pcomplete/dnf): Adjust regexps to allow for help format of
dnf5. New regexps works for both dnf4 and dnf5. Add
aliases for better subcommand completion. Better support
for dnf repoquery command. (Bug#78661)
Paul Eggert [Sat, 28 Jun 2025 06:53:32 +0000 (23:53 -0700)]
Port varargs macros better to C99
C99 prohibits passing zero args to macro’s ‘...’.
* lib-src/seccomp-filter.c (RULE0): New macro, which is like RULE
except with zero args. All zero-arg uses of RULE changed to RULE0.
* src/comp.c (compile_function, Fcomp__init_ctxt, syms_of_comp):
Change ‘CALLN (Fmake_hash_table)’ to ‘Fmake_hash_table (0, NULL)’,
since CALLN requires at least two args in C99.
Stefan Monnier [Sat, 28 Jun 2025 02:55:04 +0000 (22:55 -0400)]
cus-start.el: Reliably distinguish preload from nonpreload
`dump-mode` can be nil even if we're about to dump (this is
done in the Android build), so don't rely on it to distinguish
if `cus-start` is loaded from `loadup.el` vs loaded during
a "normal run".
* lisp/loadup.el (cus-start): Bind `cus-start--preload`.
* lisp/cus-start.el: <top-level>: Test it rather than `dump-mode`.
Sean Whitton [Fri, 27 Jun 2025 20:19:55 +0000 (21:19 +0100)]
vc-annotate: Fix ever-lengthening buffer names
* lisp/vc/vc-annotate.el (vc-annotate): Rewrite code to generate
the buffer name so that when switching from annotating one
revision to annotating another, we don't embed the old name of
the vc-annotate buffer directly into its new one (bug#78890).
(tab-bar--update-tab-bar-lines): Don't set the frame parameter
'tab-bar-lines' in daemon's initial frame because it messes up the
frames when 'format-mode-line' called from 'tab-bar-format-global'
on daemon's initial frame forces focus switch to daemon's initial
frame. Also don't set 'default-frame-alist' in daemon mode because
'frame-notice-user-settings' copies the frame parameter 'tab-bar-lines'
from 'default-frame-alist' to daemon's initial frame. Here updating
'default-frame-alist' is not much needed anyway since the frame
parameter 'tab-bar-lines' for new frames is set in 'make_terminal_frame'
and 'x-create-frame'. 'default-frame-alist' might be need only
to handle non-default 'tab-bar-show', but this can be handled by
'toggle-frame-tab-bar' called from 'server-after-make-frame-hook'.
(toggle-frame-tab-bar): Document a useful case of calling it
from 'server-after-make-frame-hook'.
Sean Whitton [Fri, 27 Jun 2025 13:14:36 +0000 (14:14 +0100)]
'C-u C-x .' clears the fill prefix
* lisp/textmodes/fill.el (set-fill-prefix): When called
interactively with a prefix argument, clear the fill prefix,
just like how 'C-u C-x C-n' clears the goal column.
* doc/emacs/text.texi (Fill Prefix):
* etc/NEWS: Document the change.
Jim Porter [Tue, 17 Jun 2025 16:11:55 +0000 (09:11 -0700)]
When making a readable page in EWW, include the <title> and similar tags
* lisp/net/eww.el (eww--walk-readability, eww-readable-dom): New
functions.
(eww-display-html): Call 'eww-readable-dom'.
(eww-readable): Call 'eww-readable-dom'. Don't copy over 'eww-data'
properties that our new readable page can handle on its own.
(eww-score-readability): Rewrite in terms of 'eww--walk-readability'.
Make obsolete.
(eww-highest-readability): Make obsolete.
* test/lisp/net/eww-tests.el (eww-test--lots-of-words)
(eww-test--wordy-page): New variables...
(eww-test/readable/toggle-display): ... use them.
(eww-test/readable/default-readable): Make sure that the readable page
includes the <title> and <link> tags (bug#77299).
James Cherti [Tue, 24 Jun 2025 17:25:40 +0000 (13:25 -0400)]
Fix yaml-ts-mode comment-start-skip to improve commenting/uncommenting
* lisp/textmodes/yaml-ts-mode.el (yaml-ts-mode): Fix 'comment-start-skip'
value to resolve an issue when commenting/uncommenting using the
'comment-or-uncomment-region' function. The previous 'comment-start-skip'
value left some "-" uncommented after commenting and uncommenting
multiple YAML indented blocks (bug#78892).
Juri Linkov [Wed, 25 Jun 2025 17:07:17 +0000 (20:07 +0300)]
Add alternative "ruby-lsp" to eglot-server-programs.
* lisp/progmodes/eglot.el (eglot-server-programs):
Add "ruby-lsp" to eglot-alternatives for ruby-mode and ruby-ts-mode.
https://shopify.github.io/ruby-lsp/editors.html#emacs-eglot
Juri Linkov [Wed, 25 Jun 2025 16:57:05 +0000 (19:57 +0300)]
Improve treesit settings for python-ts-mode (bug#73404).
* 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'.
Juri Linkov [Wed, 25 Jun 2025 16:45:54 +0000 (19:45 +0300)]
Fix usage of 'treesit-defun-type-regexp' in treesit-tests.
* test/src/treesit-tests.el (treesit--ert-test-defun-navigation):
Replace 'treesit-defun-type-regexp' with
'(or treesit-defun-type-regexp 'defun)' that fixes the tests
for ts-modes that set up the 'defun' thing instead of
'treesit-defun-type-regexp'.
Po Lu [Wed, 25 Jun 2025 16:02:11 +0000 (00:02 +0800)]
Attempt to fix initialization of startup variables on Android
* lisp/cus-start.el (standard): Revert last change if (featurep
'android), as Android systems perform dumping during the
initialization of the first user session.
Sean Whitton [Wed, 25 Jun 2025 15:21:49 +0000 (16:21 +0100)]
Improve discoverability of using dumb-emacs-ansi terminal type
* doc/emacs/misc.texi (Interactive Shell, Shell Options):
* lisp/comint.el (comint-terminfo-terminal): Mention setting
comint-terminfo-terminal to "dumb-emacs-ansi" when the system's
terminfo database contains a definition for that terminal type.
* 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.
Alan Mackenzie [Fri, 20 Jun 2025 21:13:45 +0000 (21:13 +0000)]
CC Mode: Remove workarounds for missing "\_<", "\_>" in XEmacs
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.
Peter Oliver [Wed, 11 Jun 2025 16:34:53 +0000 (17:34 +0100)]
Show also tagged versions on Tree-sitter compatibility report
* admin/tree-sitter/compat-template.html: Accommodate two tables.
* admin/tree-sitter/treesit-admin.el
(treesit-admin--find-latest-compatible-revision): Pass through new arg
REVISION-TYPE.
(treesit-admin--last-compatible-grammar-for-modes): Optionally iterate
over tagged rather than all commits.
(treesit-admin--generate-compatibility-report): Generate a second table,
showing only tagged commits (bug#78848).
Stefan Monnier [Mon, 16 Jun 2025 11:05:11 +0000 (07:05 -0400)]
(smerge-refine-shadow-cursor): New variable and face (bug#78806)
* lisp/vc/smerge-mode.el (smerge-refine-shadow-cursor): New variable
and face.
(smerge-refine-regions): Add 'cursor-sensor-functions' property
to the covering overlays.
(smerge--refine-at-right-margin-p, smerge--refine-shadow-cursor):
New functions.
(smerge--refine-other-pos): New function, extracted from
smerge-refine-exchange-point'.
(smerge-refine-exchange-point): Use it.
(smerge--refine-highlight-change): Add thin
highlighted space for insertion/deletion positions.
* lisp/emacs-lisp/cursor-sensor.el (cursor-sensor--detect):
Run functions for 'moved' events. Demote errors.
(cursor-sensor-mode): Adjust docstring accordingly.
* doc/lispref/text.texi (Special Properties) <cursor-sensor-functions>:
Mention the new 'moved' direction.
Jim Porter [Sat, 21 Jun 2025 19:10:59 +0000 (12:10 -0700)]
When navigating to anchor targets in EWW, retain 'eww-data' properties
Previously, navigating to an in-page anchor target would clear
'eww-data', removing many important properties like the original source
and the DOM. Among other things, this prevented enabling/disabling
readable mode.
* lisp/net/tramp-sh.el (tramp-perl-file-name-all-completions):
Cache also `file-executable-p'. Suggested by <mail@knazarov.com>.
(tramp-shell-file-name-all-completions): New script.
(tramp-bundle-read-file-names): Fix for special characters. Cache
also `file-executable-p'.
(tramp-sh-handle-file-name-all-completions): Unify different cases.
Zach Shaftel [Sun, 15 Jun 2025 00:57:21 +0000 (20:57 -0400)]
Fix byte-compilation of defalias with a constant macro cons pair
* lisp/emacs-lisp/bytecomp.el (byte-compile-file-form-defalias):
Quote the function name in '(macro . function-name), since we eval
it later.
* test/lisp/emacs-lisp/bytecomp-tests.el
(test-eager-load-macro-expand-defalias): New test.
(Bug#78792)
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)
Eli Zaretskii [Sat, 21 Jun 2025 08:08:05 +0000 (11:08 +0300)]
Fix 'split-string' when TRIM is used
* lisp/subr.el (split-string): Support the case where STRING
begins with a match for SEPARATORS, and a match for SEPARATORS
also matches TRIM. Doc fix. (Bug#78690)
* test/lisp/subr-tests.el (subr-test-split-string): New test.
Juri Linkov [Fri, 20 Jun 2025 16:56:01 +0000 (19:56 +0300)]
Use keyword :commit with full hashes for treesit-language-source-alist.
* 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.
Robert Pluim [Fri, 20 Jun 2025 10:09:14 +0000 (12:09 +0200)]
Make tls tests use random port
* test/lisp/net/network-stream-tests.el (server-process-filter):
Remove 'message' call.
(make-tls-server): Try random ports until we find one that's
unused and use it. Adjust all callers.
Pip Cet [Mon, 8 Jul 2024 19:50:16 +0000 (19:50 +0000)]
Avoid excessively large backtraces in ert-tests (bug#71988)
* test/lisp/emacs-lisp/ert-tests.el (ert-test-run-tests-batch-expensive):
Temporarily make `cl-print-object' not print out vectors while running
the test.
Martin Rudalics [Fri, 20 Jun 2025 06:51:58 +0000 (08:51 +0200)]
Have 'split-window' forget previous window height (Bug#78835)
* lisp/window.el (split-window): When WINDOW has a
'quit-restore' parameter that specifies a previous height to
restore, remove that when splitting vertically. It does more
harm than good now (Bug#78835).
Pip Cet [Fri, 20 Jun 2025 06:01:41 +0000 (06:01 +0000)]
Make cl-random behave consistently for unusual arguments (bug#75105)
The old behavior was for (cl-random -1.0e+INF) to return NaN in about
one in eight million calls, and -1.0e+INF otherwise. Other unusual
arguments were handled inconsistently as well.
* lisp/emacs-lisp/cl-extra.el (cl-random): Handle positive finite
arguments consistently, error for nonpositive or infinite arguments.
* test/lisp/emacs-lisp/cl-extra-tests.el (cl-extra-test-random): New
test.
Nowadays, each mode populates treesit-language-source-alist when the
mode is required; we do not need to duplicate the information.
* admin/tree-sitter/treesit-admin.el
(treesit-admin--builtin-language-sources)
(treesit-admin-verify-major-mode-queries)
(treesit-admin--generate-compatibility-report): Eliminate variable
treesit-admin--builtin-language-sources.
(treesit-admin--generate-compatibility-report): bash-ts-mode is “clever”
and switches back to sh-mode if it thinks the current buffer does not
contain a Bash script (bug#78747).
(treesit-admin--builtin-modes): Add missing modes.
(treesit-admin--builtin-features): New variable, telling us which
features to require to populate treesit-language-source-alist.
(treesit-admin--populated-treesit-language-source-alist): New function,
to add everything we know to treesit-language-source-alist.
(treesit-admin--unversioned-treesit-language-source-alist): Return a
copy of treesit-language-source-alist with the version requirements
removed.
* test/infra/Dockerfile.emba: Make use of
treesit-admin--populated-treesit-language-source-alist (bug#78748).