Commit graph

180963 commits

Author SHA1 Message Date
Basil L. Contovounesios
2092516a74 Clarify libwebp configuration checks
* configure.ac [HAVE_WEBP]: Explicitly check for both libwebpdemux
and libwebp (where the former depends on the latter), since we use
both (bug#57420, bug#61988, bug#66221).  Check for WebPDecodeRGBA as
a representative of libwebp and libwebpdecoder now that we no longer
use WebPGetInfo elsewhere.  Prepend WEBP_LIBS to LIBS as per
AC_CHECK_LIB.  Clarify commentary.
2026-01-24 19:37:30 +01:00
Basil L. Contovounesios
72c53dcb13 Improve (WebP) image animation
This adds support for animations with heterogeneous frame durations
without sacrificing CPU (bug#47895), and plugs a memory leak in and
speeds up WebP animations (bug#66221).

* lisp/image.el (image-animate): No need to stash
image-multi-frame-p data here, as image-animate-timeout now
refetches it for each animation frame.
(image-show-frame): Fetch image-multi-frame-p anew when checking
bounds; a cached value risks going stale.  This is not on the hot
path for animations, and is mainly used when framewise stepping
through an animation interactively.
(image-animate-timeout): Fetch current frame duration anew but do so
before image-show-frame to ensure an image cache hit (bug#47895,
bug#66221).  Include time taken by local arithmetic in
'time-to-load-image'.  Update commentary.

* src/image.c (parse_image_spec): Simplify using FIXNATP.
(filter_image_spec): Remove check for :animate-multi-frame-data as
it is no longer used by image.el.
[HAVE_ANIMATION && HAVE_GIF] (struct gif_anim_handle):
[HAVE_ANIMATION && HAVE_WEBP] (struct webp_anim_handle): New
structures formalizing animation cache handles, and allowing for
more than two custom fields per image type.
(struct anim_cache): Replace generic handle and temp pointers with a
union of gif_anim_handle and webp_anim_handle.  All uses updated.
Update destructor signature accordingly.
(anim_create_cache): Use xzalloc to zero-initialize both integer and
pointer fields.  Initialize frames, width, height to -1 for
consistency with index.  Mark as ATTRIBUTE_MALLOC.
(anim_prune_animation_cache): Check whether destructor (not handle)
is null before calling it.
(gif_clear_image): Note in commentary that WebP also uses it.
(gif_destroy): Free pixmap here now that prune_anim_cache no longer
does it automatically.  Remove unused gif_err variable.
(gif_load): Avoid UB from casting destructor to a different type.
Don't redundantly check for null before xfree.  Change default frame
delay from 15fps to t, which image-multi-frame-p will translate into
image-default-frame-delay, which the user can control.
[HAVE_WEBP && WINDOWSNT] (init_webp_functions): Reconcile library
definitions with current webp_load implementation.
(webp_destroy): Free owned copy of input WebP bitstream contents.
(webp_load): Ownership of both input and decoded memory is a
function of :data vs :file and animated vs still.  Make this and
transfers of ownership to animation cache clearer by using distinct
copy/view variables.  Also make resource freeing clearer by using a
single unconditional cleanup and exit path.  Check animation cache
early to avoid rereading bitstream and reparsing headers on each
call.  Remove redundant call to WebPGetInfo since WebPGetFeatures
does the same thing.  Check more libwebpdemux return values for
failure and fix file name reported in error messages.  Remove unset
local variable 'file'.  If requested :index is ahead, fast-forward
instead of restarting from first frame.  If requested :index is
behind, reset animation decoder to first frame instead of deleting
and recreating it.  Reuse animation decoder's own WebPAnimInfo and
WebPDemuxer instance instead of creating and deleting a separate
WebPDemuxer.  Fix leak when copying :data to animation cache.  Fix
frame duration calculation, and return each frame's own duration now
that image.el supports it.  Return t as a default frame duration, as
per gif_load.  Consistently use WebPBitstreamFeatures to simplify
control flow.  Don't pollute lisp_data image-metadata for still
images with animation-related properties.
(image_types) [HAVE_WEBP]: Use gif_clear_image to clear lisp_data
for consistency with GIF code.
(syms_of_image): Remove QCanimate_multi_frame_data; no longer used.
2026-01-24 19:37:30 +01:00
Basil L. Contovounesios
db413c9da7 Improve animation cache documentation
* doc/lispref/display.texi (Image Cache): Document animation cache
argument that clear-image-cache gained in Emacs 29 (bug#56546,
bug#66221).

* lisp/image.el (image-animate-timeout): Note limitation of
clear-image-cache with ImageMagick.

* src/image.c (Fclear_image_cache): Rename animation-cache argument
to animation-filter and expand its description for clarity.
(struct anim_cache, anim_create_cache, image_prune_animation_caches):
Improve commentary.
(mark_image_cache): Replace stale commentary that referred to
forall_images_in_image_cache with description of mark_image_cache.
[HAVE_IMAGEMAGICK] (struct animation_cache): Mention lack of
clear-image-cache support in commentary.
2026-01-24 19:37:30 +01:00
Eli Zaretskii
f800f2300b Fix support of listing switches with whitespace in Dired
* lisp/dired.el (dired-sort-by-date-regexp)
(dired-sort-by-name-regexp): Allow quoted arguments with embedded
whitespace, per the doc string of 'dired-listing-switches'.
(Bug#80200)
2026-01-24 15:39:11 +02:00
Liu Hui
e1d65b3c22 Fix inconsistent definition and usage of 'calendar-buffer'
* lisp/calendar/calendar.el (calendar-buffer): Define it as a
variable.
* lisp/calendar/diary-lib.el (diary-mark-entries): Set
'calendar-buffer' as a string.  (bug#79994)
2026-01-24 14:09:59 +02:00
Manuel Giraud
dea8f11c09 Document 'C-u M-x compile' (bug#80156)
* doc/emacs/building.texi (Compilation): Document 'C-u M-x
compile'.
2026-01-24 13:46:39 +02:00
Eli Zaretskii
3ce57b05a2 ; Fix last change. 2026-01-24 13:39:23 +02:00
Daniel Mendler
e8f26d554b Support cons cell for 'line-spacing'
* etc/NEWS: Announce the change.
* src/dispextern.h (struct glyph_row): Add
'extra_line_spacing_above' member.
(struct it): Add 'extra_line_spacing_above' member.
* src/frame.h (struct frame): Add 'extra_line_spacing_above'
member.  Update comment for 'extra_line_spacing.'
* src/buffer.c (syms_of_buffer): Update the docstring of
'line-spacing' to describe the cons cell usage.
* src/buffer.h (struct buffer): Update comment for
'extra_line_spacing'.
* src/frame.c (gui_set_line_spacing): Handle cons cell value for
'line-spacing'.  Calculate and set 'extra_line_spacing_above'
for both integer and float pairs.
* src/xdisp.c (init_iterator): Initialize 'extra_line_spacing_above'
from buffer or frame 'line-spacing', handling cons cells for both
integer and float values.
(gui_produce_glyphs): Use 'extra_line_spacing_above' to distribute
spacing between ascent and descent.  Update 'max_extra_line_spacing'
calculation.
(resize_mini_window): Take line spacing into account when resizing the
mini window.  Pass height of a single line to 'grow_mini_window' and
'shrink_mini_window'.
* src/window.c (grow_mini_window, shrink_mini_window): Add unit
argument which defines height of a single line.
* src/window.h (grow_mini_window, shrink_mini_window): Adjust function
prototypes accordingly with unit argument.
* lisp/subr.el (total-line-spacing): New function to calculate total
spacing from a number or cons cell.
(posn-col-row): Use total-line-spacing.
* lisp/simple.el (default-line-height): Use 'total-line-spacing'.
* lisp/textmodes/picture.el (picture-mouse-set-point): Use
'total-line-spacing'.
* lisp/window.el (window-default-line-height): Use
'total-line-spacing'.
(window--resize-mini-window): Take 'line-spacing' into account.
* test/lisp/subr-tests.el (total-line-spacing): New test.
* test/src/buffer-tests.el (test-line-spacing): New test.
* doc/emacs/display.texi (Display Custom): Document that
'line-spacing' can be a cons cell.
(Line Height): Document the new cons cell format for 'line-spacing'
to allow vertical centering.

Co-authored-by: Przemysław Alexander Kamiński <alexander@kaminski.se>
Co-authored-by: Daniel Mendler <mail@daniel-mendler.de>
2026-01-24 13:32:44 +02:00
Jacob S. Gordon
2145519734 ; calendar-bahai: Move tests and convert to ERT
* lisp/calendar/cal-bahai.el (calendar-bahai--nawruz-reference-dates)
(calendar-bahai--twin-birthdays-reference-dates): Move to test file.
(calendar-bahai--verify-nawruz)
(calendar-bahai--verify-twin-birthdays): Remove and adapt contents in
test file.
(calendar-bahai-verify-calculations, calendar-bahai-run-tests): Remove.
* test/lisp/calendar/cal-bahai-tests.el: Add file.
(calendar-bahai--nawruz-reference-dates)
(calendar-bahai--twin-birthdays-reference-dates): Add test data.
(calendar-bahai-verify-nawruz, calendar-bahai-verify-twin-birthdays):
Create ERT tests.  (Bug#80207)
2026-01-24 13:25:14 +02:00
Eli Zaretskii
f1b3343e3d ; Safer 'x-display-monitor-attributes-list'
* src/xfns.c (Fx_display_monitor_attributes_list): Don't access
more elements in monitor_frames than there are monitors reported
by 'gdk_display_get_n_monitors' or 'gdk_screen_get_n_monitors'.
(Bug#79941)
2026-01-24 12:54:30 +02:00
Eli Zaretskii
aa352804af Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs 2026-01-24 12:45:14 +02:00
Leo C. Stein
92072c887f Backslashify all open/close punctuation so we don't confuse indenter
* lisp/leim/quail/latin-ltx.el: Quote characters with general-category
Ps and Pe (Punctuation, Open and Punctuation, Close) with backslash,
otherwise lisp indentation code gets confused.
2026-01-24 12:44:37 +02:00
Leo C. Stein
11d26dccde Add a few missing mathematical brackets to TeX input method
* lisp/leim/quail/latin-ltx.el: Add a few more left/right brackets,
especially the ones whose names in ucs-names start with MATHEMATICAL.
The macro names are taken from unimath-symbols.pdf, available at
http://mirrors.ctan.org/macros/unicodetex/latex/unicode-math/unimath-symbols.pdf
2026-01-24 12:43:57 +02:00
Leo C. Stein
4de7ddc837 Add unicode's mathematical alphabets to TeX input method
* lisp/leim/quail/latin-ltx.el: Add math "alphabets" that can be matched
with simple regexps; a few others are added by hand.  There are 13
variants: bf, it, bfit, bb, scr, bfscr, frak, bffrak, sf, bfsf, sfit,
bfsfit, and tt.
2026-01-24 12:43:18 +02:00
Leo C. Stein
b1f7d6254a Add some missing LaTeX macros to TeX input method
* lisp/leim/quail/latin-ltx.el (latin-ltx--define-rules): Add standard
TeX names that were missing; some already had other aliases.  Add a few
other non-systematic additions.
2026-01-24 12:42:25 +02:00
Josh Berdine
0ca00d9a98 Use math symbols instead of CJK punctuation in TeX input method
This seems more appropriate given the context, and additionally
the CJK symbols often render wider, as a full width CJK glyph,
while the math symbols render narrower.  There was some related
discussion in bug#12948, where an analogous change was made
for \langle and \rangle.
* lisp/leim/quail/latin-ltx.el (latin-ltx--define-rules):
Change rules for \llbracket, \rrbracket and \ldata, \rdata to
generate Unicode code points in the Miscellaneous Mathematical
Symbols-A block (U+27E6, U+27E7 and U+27EA, U+27EB) instead of
the CJK Symbols and Punctuation block (U+301A, U+301B and
U+300A , U+300B).

Copyright-paperwork-exempt: yes
2026-01-24 12:40:29 +02:00
Michael Albinus
17c78c9920 ; Tramp code cleanup
* lisp/net/tramp-cache.el (tramp-cache-unload-hook):
* lisp/net/tramp-cmds.el (tramp-enable-method, tramp-bug):
* lisp/net/tramp-compat.el:
* test/lisp/net/tramp-tests.el
(tramp-test26-interactive-file-name-completion):
Simplify retrieving proper function symbols.
2026-01-24 10:15:29 +01:00
Michael Albinus
6762394734 Improve handling of not-parallel test runs
* test/Makefile.in: Distinguish between parallel and not-parallel
tests.  Mark lisp/autorevert-tests.log, lisp/filenotify-tests.log
and lisp/net/tramp-tests.log to run not-parrallel.  (Bug#80164)

* test/README: Some of the tests do not run parallel when
expensive tests are activated.

* test/infra/gitlab-ci.yml (.job-template): Use "make -j".
Makefile knows how to handle parallel runs properly.
2026-01-24 09:07:46 +01:00
Dmitry Gutov
3573116d3e ; Fix indentation in project.el 2026-01-24 06:48:29 +02:00
Dmitry Gutov
b7d4681908 Stop project-query-replace-regexp failing on directory symlinks
* lisp/progmodes/project.el (project--files-safe): New function.
(project-search, project-query-replace-regexp): Use it (bug#78209).
2026-01-24 06:45:32 +02:00
Mattias Engdegård
3b547e4f5d * lisp/emacs-lisp/pcase.el (pcase--macroexpand): Normalise atom etc.
Transform (pred P) for P in {atom, nlistp, identity, not} into
predicates that pcase already understands in type terms.
This doesn't affect the behaviour but generates better code.
2026-01-23 16:46:34 +01:00
Mattias Engdegård
cd8c85c4fd * test/Makefile.in (SLOW_TESTS): add package-vc-tests (bug#80235) 2026-01-23 16:46:34 +01:00
Sean Whitton
29bdba37f2 New bindings for vc-revert
* lisp/vc/vc-dir.el (vc-dir-mode-map): Bind vc-revert to '@'.
* lisp/vc/vc-hooks.el (vc-prefix-map): Additionally bind
vc-revert to 'C-x v @'.
* doc/emacs/maintaining.texi (VC Undo, VC Directory Commands):
* etc/NEWS: Document the change.
2026-01-23 14:11:27 +00:00
Sean Whitton
644caa944d ; Autoload pixel-scroll-interpolate- commands.
It is useful to bind these to [remap scroll-up-command] and
[remap scroll-down-command] even if you don't want to enable
pixel-scroll-precision-mode because of how it sets
make-cursor-line-fully-visible.
2026-01-23 13:40:31 +00:00
Juri Linkov
b4a5948d33 ; Remove "--" from the name of autoloaded 'window--get-split-combination'
* lisp/window-x.el (window-get-split-combination, split-frame):
* lisp/tab-bar.el (tab-bar-split-tab):
Rename 'window--get-split-combination' to 'window-get-split-combination'.
2026-01-22 20:09:47 +02:00
Stefan Monnier
8ccab6bf06 lisp/simple.el (goto-line): Minor optimization 2026-01-22 12:58:53 -05:00
Eli Zaretskii
7b9d3e90ce Fix MS-Windows build broken by recent updates in MinGW64 headers
* nt/inc/ms-w32.h (strerror): Redirect to sys_strerror after
including <string.h>, to prevent the linker from thinking it
should be imported from some DLL.  Reported by Richard Copley
<rcopley@gmail.com>.

* src/w32.c: Remove now unneeded prototype of sys_strerror.
2026-01-22 19:36:54 +02:00
Eli Zaretskii
5290b5dddb ; Fix :type of 'yaml-ts-mode-yamllint-options'
* lisp/textmodes/yaml-ts-mode.el (yaml-ts-mode-yamllint-options):
Fix :type and doc string.
2026-01-22 14:52:12 +02:00
Mattias Engdegård
45089f9588 * lisp/emacs-lisp/macroexp.el (macroexp--expand-all): Speed up.
Manicure pcase patterns to avoid performance-sapping internal functions
and switch-breaking gaps, resulting in smaller code and less allocation.
2026-01-22 10:56:59 +01:00
Michael Albinus
2696eff451 ; * test/lisp/net/dbus-tests.el: Fix typos. 2026-01-22 09:58:37 +01:00
Juri Linkov
a0197aef96 Restrict the 'buffer' arg of 'goto-line' only to interactive uses
* lisp/simple.el (goto-line): Use 'buffer' arg only when
'interactive' is non-nil (bug#80150).  Update docstring.
2026-01-22 09:37:14 +02:00
João Távora
f2250ba244 Eglot: simplify Imenu setup again
See https://github.com/joaotavora/eglot/issues/1569.

* lisp/progmodes/eglot.el (eglot--managed-mode): Tweak.

* etc/EGLOT-NEWS: Tweak.
2026-01-21 23:09:19 +00:00
João Távora
10b132006e Eglot: display more readable server-originated messages
* lisp/progmodes/eglot.el (eglot--format-server-message): New helper.
(eglot-handle-notification<window/showMessage>)
(eglot-handle-request<window/showMessageRequest>): Use it.
2026-01-21 23:08:39 +00:00
Juri Linkov
41c0d254d5 ; * lisp/textmodes/yaml-ts-mode.el: Fix docstring wider than 80 characters. 2026-01-21 20:08:14 +02:00
Juri Linkov
8063921808 Fix down-list navigation in python-ts-mode
* lisp/progmodes/python.el (python-ts-mode):
Set 'treesit-sexp-thing-down-list' to 'list' to override
sexp navigation with list navigation (bug#72478).

* lisp/emacs-lisp/lisp.el (up-list): Mention 'up-list-function' in docstring.
2026-01-21 20:02:56 +02:00
Vincenzo Pupillo
15d3cc3f65 Flymake support for yaml-ts-mode.
* etc/NEWS: Announce the new customization option (bug#80215).
* lisp/textmodes/yaml-ts-mode.el (yaml-ts-mode): New customization group.
(yaml-ts-mode-yamllint-options): New customization option.
(yaml-ts-mode--flymake-process): New variable that stores the reference
to the flymake process.
(yaml-ts-mode-flymake): New function that implements support for Flymake.
2026-01-21 19:41:40 +02:00
Binbin Ye
8ea6f6da77 Add JSON path utility command to json-ts-mode
* lisp/progmodes/json-ts-mode.el (json-ts--get-path-at-node)
(json-ts--path-to-jq, json-ts--path-to-python): New functions.
(json-ts-jq-path-at-point): New command for getting JSON path at point.

* test/lisp/progmodes/json-ts-mode-tests.el: New file.
Add tests for the utility command.

* etc/NEWS: Announce new command 'json-ts-jq-path-at-point' (bug#80190).
2026-01-21 19:27:03 +02:00
Eli Zaretskii
d4dbce74a7 Fix updating buffer menu after invoking "M-x term"
The doc string of 'frame-or-buffer-changed-p' says not to call it
with the nil argument, but term.el did.  Since "M-x term" puts
'term--update-term-menu' on the 'menu-bar-update-hook' ahead of
'menu-bar-update-buffers', it caused the latter decide that there
was no change in buffers, because the internal state variable
used by 'frame-or-buffer-changed-p' when called with the nil
argument was reset by 'term--update-term-menu'.  Fix that by using
a non-nil state variable.
* lisp/term.el (term--buffers-changed): New variable.
(term--update-term-menu): Use it when calling
'frame-or-buffer-changed-p'.  (Bug#80231)
2026-01-21 17:37:33 +02:00
Mattias Engdegård
fe2469c1c1 ; * test/lisp/net/dbus-tests.el: hush warnings on no-dbus platforms 2026-01-21 16:22:05 +01:00
João Távora
9d8e1af6f4 Eglot: fix textDocument/prepareRename support
Can't send prepareRename requests willy-nilly.

See https://github.com/joaotavora/eglot/issues/1554.

* lisp/progmodes/eglot.el (eglot--rename-interactive): Fix.
(eglot-client-capabilities): Advertise "prepareSupport".

* etc/EGLOT-NEWS: Mention change.
2026-01-21 12:26:24 +00:00
João Távora
f643ad53c7 Eglot: set imenu-create-index-function without advice
See https://github.com/joaotavora/eglot/issues/1569.

* lisp/progmodes/eglot.el (eglot--managed-mode): Stomp on
imenu-create-index-function conditionally.
(eglot-imenu): Don't check eglot-server-capable here.

* etc/EGLOT-NEWS: Mention change.
2026-01-21 12:26:24 +00:00
João Távora
d3548aea96 Eglot: limit the number of file watches
Some language servers request file watching for a very large number of
directories (e.g. Python virtualenvs), which can exhaust system
resources and cause slow startup.

https://github.com/joaotavora/eglot/issues/1568

* lisp/progmodes/eglot.el (eglot-max-file-watches): New variable.
(eglot--count-file-watches): New function.
(eglot--watch-globs): Use them to limit watches.  Signal jsonrpc-error
when limit is reached.
(eglot-watch-files-outside-project-root): Fix docstring punctuation.

* etc/EGLOT-NEWS: Mention change.
2026-01-21 12:26:24 +00:00
João Távora
a3ea65a984 Eglot: support more complex workspace edits (create/rename/delete)
Advertise support for file resource operations in workspace edits.
Implement create, rename, and delete file operations.  Rework
confirmation UI to handle mixed operation types.

* lisp/progmodes/eglot.el (eglot--lsp-interface-alist): Add
CreateFile, RenameFile, DeleteFile interfaces.
(eglot-client-capabilities): Advertise resourceOperations and
failureHandling.
(eglot-handle-request<workspace/applyEdit>): Return failureReason.
(eglot--apply-text-edits): Tweak error message.
(eglot--propose-changes-as-diff): Adjust for new prepared format.
Return buffer.
(eglot--apply-workspace-edit): Rework.  Handle file operations.

* etc/EGLOT-NEWS: Mention change.
2026-01-21 12:26:24 +00:00
João Távora
f02a120f18 Eglot: overhaul eglot-confirm-server-edits defcustom
Now also accepts file operation kinds as keys in the alist form.

* lisp/progmodes/eglot.el (eglot-confirm-server-edits): Rework
default value, docstring and defcustom type.
(eglot--confirm-server-edits): Also check for operation-kind-based
entries.
2026-01-21 12:26:24 +00:00
João Távora
b40e89e523 Eglot: default eglot-advertise-cancellation to t
The current 2026 landscape suggests servers (especially gopls
and ocamllsp) take advantage of this, so let's give it to them
by default.

* lisp/progmodes/eglot.el (eglot-advertise-cancellation):
Default to t.

* etc/EGLOT-NEWS: Mention change.
2026-01-21 12:26:24 +00:00
João Távora
155f524f03 Eglot: handle user quits when applying server-initiated edits
If the user simply C-g's signal a 'jsonrpc-error' with code 32000 to
mean "no error", provide an LSP :failureReason and keep server chill.

* lisp/progmodes/eglot.el (eglot-handle-request<workspace/applyEdit>>):
2026-01-21 12:26:24 +00:00
João Távora
7216d7ff87 Eglot: ensure no timeout on remote command executions
Else, if the server asks us a question, the user has just 10
seconds to ponder, which is a bit silly.

* lisp/progmodes/eglot.el (eglot-execute): Pass timeout=nil to
eglot--request.
2026-01-21 12:26:24 +00:00
João Távora
0917169782 Eglot: slightly friendlier UI for server window/showMessageRequest
Previously, the default answer pre-filled in the minibuffer was
obscuring the other possible answers.

* lisp/progmodes/eglot.el
(eglot-handle-request<window/showMessageRequest>): Rework.
2026-01-21 12:26:24 +00:00
João Távora
ff5bab9552 Eglot: advertise cancellation on eglot--request quits
* lisp/progmodes/eglot.el (eglot--request): Pass CANCEL-ON-QUIT
to jsonrpc-request.
2026-01-21 12:26:24 +00:00
João Távora
81b7e8e927 Eglot: fix async request cancellation
It was completely broken, with a cancel being set for every sent (and
probably already received) async request, and no actual discarding
of the response of a cancelled request.

* lisp/progmodes/eglot.el (eglot--async-request): Fix cancellation
of async requests.
(eglot--semtok-request): Don't need 'buf' &aux anymore.
2026-01-21 12:26:24 +00:00