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.
Juri Linkov [Thu, 12 Jun 2025 17:22:42 +0000 (20:22 +0300)]
Add 'treesit-sexp-thing' to use instead of 'treesit-sexp-type-regexp'.
* lisp/treesit.el (treesit-sexp-thing): New variable to use
instead of 'treesit-sexp-type-regexp'.
(treesit-sexp-thing-down-list): Rename from 'treesit-sexp-type-down-list'.
(treesit-sexp-thing-up-list): Rename from 'treesit-sexp-type-up-list'.
(treesit-forward-sexp, treesit--forward-list-with-default)
(treesit-down-list, treesit-up-list): Update references to the
above variables.
(treesit-cycle-sexp-thing): Rename from 'treesit-cycle-sexp-type'.
* lisp/progmodes/elixir-ts-mode.el (elixir-ts-mode): Update same variables.
* lisp/progmodes/heex-ts-mode.el (heex-ts-mode): Set these variables
instead of calling the function that sets them.
* lisp/progmodes/python.el (python-ts-mode): Check if variables
'treesit-sentence-type-regexp' and 'treesit-sexp-type-regexp' are bound.
Handlers can be registered to term-osc-handler, which by defaults,
supports OSC 0, 2, 7 and 8, using handlers defined in ansi-osc.
Unknown OSC sequences are ignored.
* lisp/term.el (term-emulate-terminal): Handle OSC sequences.
(term-osc-handler): New configuration variable.
(term-control-seq-regexp): Extended regexp.
(term--osc-max-bytes): New private constant.
* lisp/ansi-osc.el (ansi-osc-handler): Handle OSC 0 like OSC 2.
* test/lisp/term-tests.el (term-ignore-osc, term-handle-osc)
(term-call-ansi-osc-handlers): New tests.
Paul Nelson [Tue, 10 Jun 2025 09:33:05 +0000 (11:33 +0200)]
Add simpler binds for calendar month/year navigation
* lisp/calendar/calendar.el (calendar-mode-map): Add keybindings
'{' and '}' for month navigation, '[' and ']' for year
navigation (bug#78753).
* doc/emacs/calendar.texi (Calendar Unit Motion): Document
them.
Alan Mackenzie [Wed, 11 Jun 2025 13:43:50 +0000 (13:43 +0000)]
Amend CC Mode so that the test suite in XEmacs runs error free
* lisp/progmodes/cc-awk.el (awk-font-lock-keywords):
Reformulate this using backquote and ,@. Only include the
entry for _" in Emacs.
* lisp/progmodes/cc-defs.el (c--mapcan, c--set-difference)
c--intersection, c--macroexpand-all, c--delete-duplicates): No
longer use the existence of cl-lib.el as the criterion for
what to expand to.
(c-min-property-position): Use c-next-single-property-change
rather than next-single-property-change. This now works in
XEmacs.
* lisp/progmodes/cc-engine.el
(c-invalidate-sws-region-after-del)
(c-invalidate-sws-region-after-ins, c-forward-sws)
(c-backward-sws, c-find-decl-spots): Replace
next/previous-single-property-change by
c-next/previous-single-property-change to ensure functionality
in XEmacs.
(c-forward-sws, c-backward-sws): Handle NO-BREAKING-SPACE as
whitespace. This corrects the error in hardspace.c in the test
suite.
* lisp/progmodes/cc-fonts.el (c-font-lock-ml-strings): Refactor
some nested `if's into a cond form. Don't fontify multiline
string delimiters in XEmacs, in keeping with its string
conventions.
* lisp/progmodes/cc-langs.el (c-populate-syntax-table): Set the
syntax of NO-BREAKING-SPACE to whitespace rather than
punctuation.
* lisp/progmodes/cc-mode.el (c-before-change): Use
c-previous-single-property-change rather than
previous-single-property-change to ensure functionality in
XEmacs.
Juri Linkov [Wed, 11 Jun 2025 06:43:45 +0000 (09:43 +0300)]
* test/lisp/repeat-tests.el: Add a command for global continue.
(repeat-tests-call-g): New command (bug#78742).
Put 'repeat-continue' with t on this symbol.
(repeat-tests-global-map): Bind it to 'C-M-g'.
(repeat-tests-continue-another): Add 'C-M-g' that should continue.
Paul Nelson [Tue, 10 Jun 2025 07:21:52 +0000 (09:21 +0200)]
Improve repeat-continue property handling
* lisp/repeat.el (repeat-get-map-sym): Support 'repeat-continue'
property value of t to continue any active repeat map (suggested
by Karthik Chikmagalur <karthikchikmagalur@gmail.com>).
Simplify logic so that repeat-continue does not interfere with
repeat-map activation.
(repeat-check-map): Allow commands with 'repeat-continue'
property value of t to continue without checking the key.
(repeat-mode): Update and tweak docstring.
* lisp/bind-key.el (bind-keys-form): Update handling of
':continue-only' keyword: only add keymap to 'repeat-continue'
if current value is a list.
(bind-keys): Update documentation, mirroring bind-keys-form.
* lisp/keymap.el (defvar-keymap): Update handling of ':continue'
keyword: only add keymap to 'repeat-continue' if current value
is a list.
* test/lisp/repeat-tests.el (repeat-tests-continue)
(repeat-tests-continue-another): Enable previously commented
tests that now work correctly.
* etc/NEWS: Update announcement of 'repeat-continue' (bug#78742).
Jim Porter [Wed, 28 May 2025 16:44:34 +0000 (09:44 -0700)]
Clean up text properties in 'visual-wrap-prefix-mode'
Before refontifying a region, remove any text properties we care about
so that we don't end up with stray properties. Additionally, make sure
to remove all the properties when deactivating the mode.
* lisp/emacs-lisp/subr-x.el (add-remove--display-text-property): New
function, extracted from...
(add-display-text-property): ... here.
(remove-display-text-property): New function.
* lisp/visual-wrap.el (visual-wrap--remove-properties): New function...
(visual-wrap-prefix-function, visual-wrap-prefix-mode): ... call it.
* test/lisp/emacs-lisp/subr-x-tests.el
(subr-x-test-remove-display-text-property): New test.
* test/lisp/visual-wrap-tests.el
(visual-wrap-tests/wrap-prefix-stickiness, visual-wrap-tests/cleanup):
New tests.
Jim Porter [Sat, 31 May 2025 19:11:01 +0000 (12:11 -0700)]
Improve documentation for display property functions
Specifically, use the term "display specification" more consistently to
distinguish from "display property", which is the full value of the
'display' text property.
* src/xdisp.c (find_display_property): Rename PROP to SPEC.
(Fget_display_property): Rename PROP to SPEC and improve docstring.
* lisp/emacs-lisp/subr-x.el (add-display-text-property): Rename PROP to
SPEC and improve docstring.
* doc/lispref/display.texi (Display Property): Reword documentation to
more-consistently refer to display specifications.