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).
Paul Eggert [Wed, 18 Jun 2025 00:07:30 +0000 (17:07 -0700)]
process-attributes uses CLOCK_BOOTTIME for uptime
* src/sysdep.c (get_host_uptime) [GNU_LINUX || CYGWIN || __ANDROID__]:
New function, replacing get_host_boot_time.
Use CLOCK_BOOTTIME instead of inspecting /proc/stat.
All callers changed. This should be an even better way to fix Bug#63496.
Paul Eggert [Tue, 17 Jun 2025 19:23:41 +0000 (12:23 -0700)]
process-attributes uses /proc/stat for boot time
With a Linux kernel, use /proc/stat rather than get_boot_time
to get boot time, since when Emacs is running in a container
we want the underlying host boot time, not the container boot time.
This should be a better way to fix Bug#63496.
* src/sysdep.c: Do not include boot-time.h.
(get_host_boot_time) [GNU_LINUX || CYGWIN || __ANDROID__]:
New function.
(system_process_attributes) [GNU_LINUX || CYGWIN || __ANDROID__]:
Use it instead of get_boot_time.
Fix function arity check for noncompiled callees (bug#78685)
This fixes a regression from Emacs 29, and is the second attempt after
the later reverted 8b0f5b0597.
* lisp/emacs-lisp/bytecomp.el (byte-compile-fdefinition):
Make it work for functions that aren't compiled.
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--f):
(bytecomp-tests--warn-arity-noncompiled-callee): Add test.
Stephen Berman [Tue, 17 Jun 2025 14:08:32 +0000 (16:08 +0200)]
Fix regression in 'kill-this-buffer' (bug#78809)
This restores the ability to use 'kill-this-buffer' when a
keyboard event pops up the Global Menu. Instead of raising an
error if the command was not called by a mouse event, an error is
now raised if it was not called from a menu or a tool bar.
* lisp/menu-bar.el (kill-this-buffer): Remove optional EVENT from
argument list and "e" code from interactive spec. Adjust doc
string. Use 'last-command-event' to determine if command was
called from a menu or a tool bar. Use 'event--posn-at-point' in
test for frame.
* lisp/net/eudc-hotlist.el (eudc-hotlist-quit-edit):
* lisp/net/eudc.el (eudc-display-records, eudc-query-form):
* lisp/vc/pcvs.el (cvs-mode-map): Replace uses of
'kill-this-buffer' by 'kill-current-buffer'.
Eli Zaretskii [Tue, 17 Jun 2025 13:00:04 +0000 (16:00 +0300)]
Prevent redisplay slowdown with non-zero vscroll
* src/xdisp.c (try_scrolling): Don't loop when the
partially-visible cursor line is at the top of the window. This
looping are pointless, and just makes redisplay slow for no reason.
(Bug#78766)
Andrea Corallo [Tue, 17 Jun 2025 07:06:45 +0000 (09:06 +0200)]
Make nativecomp don't error when encountering undeclared types (bug#6573)
* test/src/comp-resources/comp-test-funcs.el (comp-test-76573-1-f): New
function.
* lisp/emacs-lisp/comp-cstr.el (comp-supertypes): Don't error if 'type'
is unknown.
Paul Eggert [Sun, 15 Jun 2025 22:02:07 +0000 (15:02 -0700)]
process-attributes now uses get_boot_time
I noticed this issue while looking into Bug#63496.
GNU Emacs does not infer the boot time consistently on GNU/Linux
and similar platforms: android_notifications_notify_1 and
get_boot_sec use Gnulib’s boot-time module, but process-attributes
has idiosyncratic code that evidently predates that module.
The idiosyncratic code returns an unstable etime, which is a minor bug.
Simplify process-attributes by just using Gnulib.
This returns a stable etime.
It may also fix Bug#63496; if not, we can fix Gnulib later.
* src/sysdep.c: Include <boot-time.h>.
(get_up_time) [GNU_LINUX || CYGWIN || __ANDROID__]: Remove.
(system_process_attributes) [GNU_LINUX || CYGWIN || __ANDROID__]:
Use get_boot_time instead of get_up_time.
Steven Allen [Fri, 13 Jun 2025 14:51:37 +0000 (07:51 -0700)]
Improve documentation of the internal Lisp_Process->status field
Contrary to the existing documentation here, the value of this
field cannot be the symbols open or closed. Furthermore, this
field is never set to "stop" for network connections.
* src/process.h (Lisp_Process): Improve/fix documentation of the
'status' field. (Bug#78784)
Zach Shaftel [Wed, 11 Jun 2025 19:37:31 +0000 (15:37 -0400)]
Fix segfault in profiler-cpu-log and profiler-memory-log (bug#78763)
* src/profiler.c (export_log): Check if a log has been allocated first,
and return nil if it hasn't.
(Fprofiler_cpu_log, Fprofiler_memory_log): Doc fix.
* test/src/profiler-tests.el (profiler-tests-cpu-profiler)
(profiler-tests-memory-profiler): New tests.
Steven Allen [Wed, 11 Jun 2025 21:55:43 +0000 (14:55 -0700)]
mailcap: Treat .ics files as text/calendar
This ensures iCalendar attachments are always displayed correctly
(via `gnus-icalendar-mm-inline'), even when they have an incorrect
MIME type (looking at you Google Calendar).
* lisp/net/mailcap.el (mailcap-mime-extensions): Add a mapping from ".ics"
to "text/calendar". (Bug#78764)
Jacob S. Gordon [Tue, 3 Jun 2025 01:06:37 +0000 (21:06 -0400)]
world-clock: Add user option to control order of entries
* lisp/time.el (world-clock-sort-order): Add user option.
(world-clock--sort-entries): Add auxiliary sorting function.
(world-clock-display): Sort entries based on the new user option.
(Bug#78678)
Jacob S. Gordon [Mon, 19 May 2025 19:05:37 +0000 (15:05 -0400)]
calc: Allow strings with character codes above Latin-1
The current behavior of the functions 'calc-display-strings',
'strings', and 'bstrings' is to skip any vector containing
integers outside the Latin-1 range (0x00-0xFF). We introduce a
custom variable 'calc-string-maximum-character' to replace this
hard-coded maximum, and to allow vectors containing higher
character codes to be displayed as strings. The default value
of 0xFF preserves the existing behavior.
* lisp/calc/calc.el (calc-string-maximum-character): Add custom
variable 'calc-string-maximum-character'.
* lisp/calc/calccomp.el (math-vector-is-string): Replace hard-coded
maximum with 'calc-string-maximum-character', and the 'natnump'
assertion with 'characterp'. The latter guards against the
maximum being larger than '(max-char)', but not on invalid types of
the maximum such as strings.
* test/lisp/calc/calc-tests.el (calc-math-vector-is-string): Add
tests for 'math-vector-is-string' using different values of
'calc-string-maximum-character'.
* doc/misc/calc.texi (Quick Calculator, Strings, Customizing Calc):
Add variable definition for 'calc-string-maximum-character' and
reference thereof when discussing 'calc-display-strings'.
Generalize a comment about string display and availability of 8-bit
fonts.
(Bug#78528)
Roi Martin [Fri, 21 Mar 2025 13:22:46 +0000 (14:22 +0100)]
Add semantic linefeed support for paragraph filling
* lisp/textmodes/fill.el (fill-region-as-paragraph-semlf): Add function
to fill a region using semantic linefeeds as if it were a single
paragraph.
(fill-paragraph-semlf): Add function to fill paragraph using semantic
linefeeds.
* test/lisp/textmodes/fill-tests.el
(fill-test-fill-region-as-paragraph-semlf)
(fill-test-fill-paragraph-semlf)
(fill-test-fill-paragraph-semlf-fill-paragraph-function)
(fill-test-fill-paragraph-semlf-justify)
(fill-test-fill-paragraph-semlf-sentence-end-double-space)
(fill-test-fill-paragraph-semlf-fill-column)
(fill-test-fill-paragraph-semlf-punctuation-marks)
(fill-test-fill-paragraph-semlf-twice)
(fill-test-fill-paragraph-semlf-fill-prefix)
(fill-test-fill-paragraph-semlf-indented-block)
(fill-test-fill-paragraph-semlf-revert)
(fill-test-fill-paragraph-semlf-emacs-lisp-mode)
(fill-test-fill-paragraph-semlf-c-mode)
(fill-test-fill-paragraph-semlf-org-mode)
(fill-test-fill-paragraph-semlf-markdown-mode): Add tests.
* test/lisp/textmodes/fill-resources/semlf-c-mode.erts:
* test/lisp/textmodes/fill-resources/semlf-emacs-lisp-mode.erts:
* test/lisp/textmodes/fill-resources/semlf-fill-column.erts:
* test/lisp/textmodes/fill-resources/semlf-fill-paragraph-function.erts:
* test/lisp/textmodes/fill-resources/semlf-fill-prefix.erts:
* test/lisp/textmodes/fill-resources/semlf-fill-region-as-paragraph.erts:
* test/lisp/textmodes/fill-resources/semlf-indented-block.erts:
* test/lisp/textmodes/fill-resources/semlf-justify.erts:
* test/lisp/textmodes/fill-resources/semlf-markdown-mode.erts:
* test/lisp/textmodes/fill-resources/semlf-org-mode.erts:
* test/lisp/textmodes/fill-resources/semlf-punctuation-marks.erts:
* test/lisp/textmodes/fill-resources/semlf-revert.erts:
* test/lisp/textmodes/fill-resources/semlf-sentence-end-double-space.erts:
* test/lisp/textmodes/fill-resources/semlf-twice.erts:
* test/lisp/textmodes/fill-resources/semlf.erts: Add test data. (Bug#78561)
Dmitry Gutov [Fri, 13 Jun 2025 03:00:17 +0000 (06:00 +0300)]
New user option: vc-allow-async-diff
Centralize the control for whether 'vc-diff' is asynchronous
across the backends, while also allowing 'vc-BACKEND-diff' to be
called asynchronously when needed. Previously in bug#21969.
* lisp/vc/vc.el (vc-allow-async-diff): New user option.
* lisp/vc/vc.el (vc-version-diff, vc-diff, vc-diff-mergebase)
(vc-root-diff): Obey it.