Suggested by Stefan Monnier.
* lisp/emacs-lisp/pcase.el (pcase--macroexpand): Simplify.
* test/lisp/emacs-lisp/pcase-tests.el (pcase-pred-equiv): New test.
* lisp/net/rcirc.el (rcirc-update-prompt): Don't track undo info.
(rcirc-send-input): Clear undo list after message is sent.
(rcirc-update-undo-list): Add new function (copied from erc.el).
(rcirc-print): Update (shift) undo list instead of clearing it.
'select-frame-by-id' will also undelete a deleted frame ID.
* lisp/frame.el (select-frame-by-id, undelete-frame-by-id): New
commands.
(make-frame-ids-alist, frame-by-id, frame-id-live-p)
(undelete-frame-id-index): New defuns.
* etc/NEWS: Announce the commands.
* 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.
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.
* 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.
* 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)
* 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)
* 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>
* 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)
* 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.
* 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.
* 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.
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
* 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.
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.
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.
* 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.
* lisp/progmodes/eglot.el (eglot--format-server-message): New helper.
(eglot-handle-notification<window/showMessage>)
(eglot-handle-request<window/showMessageRequest>): Use it.
* 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.
* 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.
* 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).
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)