* src/dispnew.c (write_matrix): Don't set the cursor here. Parameter to
set the cursor or not removed.
(combine_updates_for_frame): Call tty_set_cursor here, depending on
whether or not the selected frame is related to the updated frame.
(update_frame_with_menu): Adapt to change of write_matrix.
* src/dispnew.c (WINDOW_TO_FRAME_VPOS, WINDOW_TO_FRAME_VPOS): Macros
removed.
(window_to_frame_vpos, window_to_frame_vpos): Always define, and use
them instead of the removed macros.
Parentheses in macros were getting incorrectly propertized with
the '(1) (punctuation) syntax-table text property. This was
due to a typo in the patch "CC Mode: Rationalize and optimize
cache invalidation (1)" from 2024-10-06. Correct this.
* lisp/progmodes/cc-mode.el (c-depropertize-CPP): Move the
first c-clear-syntax-table-with-value-trim-caches invocation
from inside the enclosing `when' form to after it.
When eglot-autoshutdown is t and the only reason we're
considering it is because of a revert (which tears down Eglot's
minor mode as if by killing), detect that situation and
purposedly cancel the shutdown.
* lisp/progmodes/eglot.el (eglot--managed-mode): Tweak.
Didn't know it was possible, thanks to Ergus <spacibba@aol.com> for the
tip about binding [left-margin mouse-2] in the keymap.
The technique adopted in 'eglot-mouse-call' possibly still doesn't work
very well if the margin thing we're clicking on is not on the line point
is currently on. But we don't have that problem (yet?) because LSP
action suggestions function mostly on a "at point" basis.
* lisp/progmodes/eglot.el (eglot-code-action-indications): Adjust docstring.
(eglot--mouse-call): Don't go anywhere except in text area.
(eglot-diagnostics-map): Bind eglot-mouse-actions to left-margin.
* lisp/progmodes/hideshow.el (hs-inside-comment-p-func):
New buffer-local variable.
(hs-hide-block-at-point): Check if 'hs-block-end-regexp' is
a string or a function.
(hs-inside-comment-p): Move body to 'hs-inside-comment-p--default'.
Call 'hs-inside-comment-p-func' if it's a function.
(hs-inside-comment-p--default): New function with body from
'hs-inside-comment-p'.
(hs-hide-all): Don't use 'hs-block-start-regexp' when it's not a string.
(hs-minor-mode): Don't call 'hs-grok-mode-type' when
'hs-inside-comment-p-func' already has a buffer-local value.
* lisp/treesit.el (treesit-hs-block-end)
(treesit-hs-find-block-beginning, treesit-hs-find-next-block)
(treesit-hs-looking-at-block-start-p)
(treesit-hs-inside-comment-p): New functions.
(treesit-major-mode-setup): Set hs-minor-mode buffer-local variables.
* src/frame.c (make_frame): Handle 'expose-hidden-buffer'.
(expose-hidden-buffer): New variable to handle hidden buffers.
* src/buffer.c (Fother_buffer): Mention that it does not return
a hidden buffer.
* lisp/frame.el (make-frame): In doc-string describe handling
of hidden buffers.
* doc/lispref/frames.texi (Creating Frames): Explain handling
of hidden buffers in description of 'make-frame'.
Setting this variable to true causes Eglot to send special
cancellation notification for certain stale client request.
This may help some LSP servers avoid doing costly but ultimately useless
work on behalf of the client, improving overall performance.
Request cancellation is described in
https://microsoft.github.io/language-server-protocol/
specifications/lsp/3.17/specification/#cancelRequest
* lisp/jsonrpc.el (jsonrpc-request): Accept function as value for
CANCEL-ON-INPUT.
* lisp/progmodes/eglot.el (eglot--request): Rework.
* doc/misc/eglot.texi (Customizing Eglot): Mention
eglot-advertise-cancellation.
* doc/misc/eglot.texi (Starting Eglot): Tweak.
(Using Eglot): Remove link to 'Eglot Variables'.
(Eglot Features): Rework.
(Eglot and Buffers): Rework.
(Eglot Commands): Rework.
(Customizing Eglot): New chapter.
(Customization Variables): Now contains what 'Eglot Variables'
used to contain.
(Other Variables): New section.
(More Customization): New section.
(...elsewhere...): Apply 'fill-paragraph'.
Even though highlighting the thing at point isn't really producing
documentation at point, theory and practice have shown that using
eldoc-documentation-functions for this is a feasible way to avoid
reimplementing all the idle timer logic for such functionality.
In fact, we were already using ElDoc for this purpose, but this commit
makes it so the new eglot-highlight-eldoc-function is a first class
citizen in eldoc-documentation-functions, so users can manipulate it if
so desired.
* lisp/progmodes/eglot.el (eglot--managed-mode): Use
eglot-highlight-eldoc-function
(eglot-hover-eldoc-function): Don't mix highlighting with hover.
(eglot-highlight-eldoc-function): Rename and rework from
eglot--highlight-piggyback
* src/xdisp.c (vmessage): Avoid undefined behavior if
FRAME_MESSAGE_BUF_SIZE (f) is zero, or if doprnt generates output
containing only encoding errors. Although it’s not clear whether
either is possible, it is better to be safe. Also, clarify via a
new local message_bufsize.
* src/xdisp.c (vmessage): Increase buffer size to fit an extra
multibyte character. On buffer overflow, drop the last multibyte
character to determine an accurate byte length.
* test/lisp/time-stamp-tests.el (define-formatz-tests): Use
'find-function-update-type-alist' to make defined tests findable.
(formatz-find-test-def-function): New test-finding function.
* doc/lispref/windows.texi (Changing Window Layouts): New section
to document the new functions for changing window layouts.
* doc/lispref/elisp.texi (Top): Add entry for new section.
With ‘configure --enable-gcc-warnings’,
gcc (GCC) 14.2.1 20250110 (Red Hat 14.2.1-7) on x86-64
complained, as it apparently did not want to assume that enum
variables have one of the listed values.
Work around the problem by using tables rather than
switch statements. This gives up a little static
checking but I don’t see any other easy way to pacify
GCC without disabling the warnings entirely.
* src/pdumper.c (dump_fwd_int, dump_fwd_bool, dump_fwd_obj)
(dump_fwd_buffer_obj, dump_fwd_kboard_obj):
Last arg is now void const * so that these functions’ addresses
can all be put into the same array.
(dump_fwd, dump_anonymous_allocate_posix, dump_map_file_posix):
Use an array rather than a switch.
(mem_prot_posix_table): New static constant table.
* src/pgtkterm.c (pgtk_enumerate_devices): Prefer
make_formatted_string to snprintf + build_string + eassert, as
it’s simpler and won’t crash Emacs if the eassert fails.
* src/comp.c (format_string): Prefer strcpy to doing things by hand
in a place where strcpy is easier to read, generates
more-efficient code, and similar parts of Emacs do strcpy.
* src/pgtkterm.c: Ignore -Wanalyzer-null-dereference.
I don’t have time to look into all the diagnostics,
but the ones I checked seemed to be false alarms with
gcc -std=gnu23 on x86-64, and we are ignoring this
diagnostic in other modules. This is GCC 14.2.1
20250110 (Red Hat 14.2.1-7).
* src/window.c (last_mouse_window): New global var. All static
instances removed, and all their uses replaced with this global
var. This fixes a very unlikely bug where last_mouse_window was
GC’ed and a new window created in its place. It also fixes several
places that assumed NIL_IS_ZERO without static_asserting it.
(init_window_once): Initialize the new var.
* src/pgtkselect.c (pgtk_size_for_format): Remove.
(pgtk_get_window_property): Third arg is now void **, not unsigned
char **. Omit last arg. All callers changed. Simplify
allocation to pacify GCC 14.2.1 complaint about malloc size
mismatching size of array: there’s no need for an extra byte when
converting from ldata to idata.
(selection_data_to_lisp_data): Third arg is now void const *,
not unsigned char const *. All callers changed.
Omit unnecessary casts. Make some locals more local.
* src/pgtkterm.c (pgtk_term_init):
* src/xterm.c (x_term_init):
Use a bool, not an int that keeps incrementing,
to record whether initialization has occurred.
* src/image.c (svg_load_image): Prefer make_formatted_string to
snprintf, as this simplifies the code and does not truncate the
resulting string arbitrarily.