Stefan Kangas [Tue, 10 Dec 2024 22:35:31 +0000 (23:35 +0100)]
Delete variable pure-space-overflow
* lisp/startup.el (pure-space-overflow): Make variable obsolete.
* lisp/loadup.el (pure-space-overflow): Do not set. Remove call to
`garbage-collect', as that is done by `dump-emacs-portable'.
Stefan Kangas [Tue, 10 Dec 2024 18:39:03 +0000 (19:39 +0100)]
Make 'purecopy' an obsolete function alias for 'identity'
* lisp/subr.el (purecopy): New obsolete function alias for 'identity'.
* src/alloc.c (purecopy): Remove function.
(Fpurecopy): Remove DEFUN.
(syms_of_alloc): Remove defsubr for above DEFUN.
* lisp/loadup.el (purify-flag): Don't set to hash table.
Stefan Kangas [Tue, 10 Dec 2024 10:07:01 +0000 (11:07 +0100)]
Remove check for working malloc_set_state
This check was added to 'malloc_initialize_hook' in order to "insulate
Emacs better from configuration screwups" (commit b4788b9394f3). With
unexec gone, we no longer use 'malloc_set_state', and thus don't need
this check.
Note that this patch removes the last uses of the deprecated glibc
functions 'malloc_set_state' and 'malloc_get_state' from our code.
* src/alloc.c (malloc_initialize_hook) [DOUG_LEA_MALLOC]:
Remove check for working 'malloc_set_state'.
(alloc_unexec_pre) [DOUG_LEA_MALLOC]: Delete unused function.
(alloc_unexec_post) [DOUG_LEA_MALLOC]: Delete function.
(malloc_state_ptr) [DOUG_LEA_MALLOC]: Delete variable.
* configure.ac (emacs_cv_var_doug_lea_malloc): Don't check for
malloc_set_state and malloc_get_state.
Stefan Kangas [Wed, 21 Aug 2024 22:09:51 +0000 (00:09 +0200)]
Make bindings--define-key obsolete
It used to be like 'define-key', but was used for making pure copies of
as much of a menu's data as possible. With purespace now gone, it can
be replaced by 'define-key'.
* lisp/bindings.el (bindings--define-key): Make into obsolete
alias for 'define-key'. Update all callers.
Pip Cet [Wed, 21 Aug 2024 19:13:23 +0000 (19:13 +0000)]
Purecopy removal: Lisp code
* lisp/emacs-lisp/bytecomp.el (byte-compile-cond-jump-table): Don't
request our hash tables be purecopied. Adjust comment.
* lisp/progmodes/elisp-mode.el (elisp--local-variables-completion-table):
Use 'defconst' rather than 'defvar' now the purespace problem is gone
* lisp/rfn-eshadow.el (file-name-shadow-properties): Remove obsolete
comment.
Michael Albinus [Thu, 30 Jan 2025 07:40:34 +0000 (08:40 +0100)]
Tramp cleanup
* doc/misc/tramp.texi (Predefined connection information):
Mention also "androidsu" as special case of "tmpdir".
(Remote processes): Signals are not delivered to remote direct
async processes. Say, that there are restrictions for transfer of
binary data to remote direct async processes.
Yuan Fu [Thu, 30 Jan 2025 07:20:38 +0000 (23:20 -0800)]
Fix tree-sitter language remapping
* src/treesit.c (resolve_language_symbol): Move forward.
(treesit_ensure_query_compiled): Resolve language remapping
here.
(Ftreesit_parser_list): Don't resolve language remaping here,
because there's no need: parsers now carries the remapped
language.
(Ftreesit_query_compile): Don't resolve language remapping here,
because we resolve language remapping when actually compiling
the query. Also we want the query to carry the unmapped
language.
Gerd Möllmann [Wed, 29 Jan 2025 12:42:40 +0000 (13:42 +0100)]
Further fixes for cursor positioning (bug#75056)
* 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.
Gerd Möllmann [Wed, 29 Jan 2025 07:34:43 +0000 (08:34 +0100)]
Replace two macros with functions in dispnew.c (bug#75056)
* 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.
Alan Mackenzie [Wed, 29 Jan 2025 18:35:31 +0000 (18:35 +0000)]
CC Mode: Don't propertize parens in macros incorrectly
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.
João Távora [Wed, 29 Jan 2025 08:37:37 +0000 (08:37 +0000)]
Eglot: don't auto-shutdown when reverting of single managed buffer
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.
João Távora [Wed, 29 Jan 2025 08:33:54 +0000 (08:33 +0000)]
Eglot: in eglot-code-action-indications, make 'margin' interactive
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.
Juri Linkov [Tue, 28 Jan 2025 19:07:16 +0000 (21:07 +0200)]
Hideshow support for tree-sitter in hs-minor-mode (bug#75609)
* 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.
Martin Rudalics [Tue, 28 Jan 2025 15:59:45 +0000 (16:59 +0100)]
New variable 'expose-hidden-buffer' (Bug#75828)
* 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'.
João Távora [Tue, 28 Jan 2025 10:37:41 +0000 (10:37 +0000)]
Eglot: restructure and overhaul documentation
* 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'.
João Távora [Fri, 24 Jan 2025 22:51:54 +0000 (22:51 +0000)]
Eglot: symbol highlighting now done in eldoc-documentation-functions
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
Paul Eggert [Tue, 28 Jan 2025 01:13:02 +0000 (17:13 -0800)]
Make vmessage a bit safer
* 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.
Pip Cet [Mon, 27 Jan 2025 21:06:27 +0000 (13:06 -0800)]
Avoid printing NUL characters in 'message' (bug#75900)
* 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.
Martin Rudalics [Mon, 27 Jan 2025 09:06:51 +0000 (10:06 +0100)]
In Elisp manual document new functions for changing window layouts
* 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.
Paul Eggert [Mon, 27 Jan 2025 07:04:21 +0000 (23:04 -0800)]
Pacify -Wanalyzer-use-of-uninitialized-value
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.
Paul Eggert [Mon, 27 Jan 2025 06:15:50 +0000 (22:15 -0800)]
Fix unlikely eassert failure in pgtk_enumerate_devices
* 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.
Paul Eggert [Mon, 27 Jan 2025 06:15:50 +0000 (22:15 -0800)]
Minor format_string tuneup
* 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.
Paul Eggert [Mon, 27 Jan 2025 06:15:49 +0000 (22:15 -0800)]
Ignore -fanalyzer-null-argument in pgtkterm.c
* 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).
Paul Eggert [Mon, 27 Jan 2025 06:15:49 +0000 (22:15 -0800)]
Protect against GCing of last_mouse_window
* 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.
Paul Eggert [Mon, 27 Jan 2025 06:15:49 +0000 (22:15 -0800)]
Pacify GCC in pgtkselect malloc alignment
* 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.
Paul Eggert [Mon, 27 Jan 2025 06:15:49 +0000 (22:15 -0800)]
Avoid unlikely int overflow.
* 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.
Paul Eggert [Mon, 27 Jan 2025 06:15:49 +0000 (22:15 -0800)]
Prefer make_formatted_string in svg_load_image
* 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.
Paul Eggert [Mon, 27 Jan 2025 06:15:48 +0000 (22:15 -0800)]
Simplify make_formatted_string API
From a suggestion by Pip Cet.
* src/alloc.c (make_formatted_string): Omit first argument,
to simplify the calling convention. All callers changed.
* src/doprnt.c (doprnt): Also support %u. Update doc.
Paul Eggert [Mon, 27 Jan 2025 06:15:48 +0000 (22:15 -0800)]
Fix unlikely time zone abbreviation bug
* src/timefns.c (Fcurrent_time_zone): Fix double-"-" bug when time
zone name is not known and time zone offset is -3600 or less.
Also, stop assuming that make_formatted_string works with "*"
precisions; this might ease future changes.