Commit graph

50283 commits

Author SHA1 Message Date
Stefan Monnier
1f4a26df86 Merge remote-tracking branch 'origin/emacs-30' 2025-02-05 20:21:03 -05:00
Stefan Monnier
4be087f1e1 (font-ccl-encoder-alist): Delete variable, unused
* src/ccl.c (syms_of_ccl): Remove `font-ccl-encoder-alist`.
* lisp/language/ethiopic.el (ccl-encode-ethio-font): Delete CCL program.
(font-ccl-encoder-alist): Don't modify it.
2025-02-05 19:43:45 -05:00
Eli Zaretskii
a1f2f5995d Revert "Improve bidi_get_time runtime checking"
This reverts commit 782ec71053.
It makes the code less readable and less future-proof, so a
net loss.  (Bug#75964)
2025-02-05 14:44:01 +02:00
Paul Eggert
4aab2f45b3 Remove no-longer-needed delete_frame UNINIT
* src/frame.c (delete_frame): Remove a local with UNINIT that is
no longer needed now that GCC bug#85563 is fixed, as we don’t
need to worry about porting --enable-gcc-warnings to older GCC.
This change reverts this part of my commit
“Port --enable-gcc-warnings to GCC 8”
8c3215e7a4
dated Sat Apr 28 16:49:24 2018 -0700.
2025-02-04 16:57:42 -08:00
Paul Eggert
782ec71053 Improve bidi_get_time runtime checking
* src/bidi.c (bidi_get_type): Improve runtime checking, by also
aborting if the bidi_type_table entry is not a bidi_type_t value.
2025-02-04 13:04:35 -08:00
Gerd Möllmann
f9a1f449d9 Fix min-width display spec handling (bug#76014)
* src/xdisp.c (display_min_width): Take into account that the output may
already be longer than the specified min-width.
2025-02-04 15:43:42 +01:00
Eli Zaretskii
5c36b41265 * src/fileio.c (Fsubstitute_in_file_name): Doc fix (bug#76023). 2025-02-04 16:06:36 +02:00
Pip Cet
14ebe4d5db Fix GC-related crashes in styled_format (bug#75754)
This approach ensures we don't use an SSDATA pointer after GC, and
that no Lisp callback code can modify the format string while we're
working on it.

* src/editfns.c (styled_format): Operate on a copy of the format
string rather than the original.  Ensure final NUL byte is copied.
2025-02-03 20:52:57 +00:00
Eli Zaretskii
a22e971a11 Fix -nw sessions on MS-Windows
* src/w32console.c (w32con_clear_end_of_line): Set the space
glyphs' frame to NULL.
(w32con_write_glyphs): Handle face_id_frame == NULL, when called
from 'w32con_clear_end_of_line'.
(tty_draw_row_with_mouse_face): Adjust to changes in term.c.
2025-02-03 18:36:11 +02:00
Gerd Möllmann
a8e8524379 Handle mouse highlighting in the presence of tty child frames
* src/term.c (tty_draw_row_with_mouse_face): Draw only parts
of the highlighted text that are not covered by other frames.
2025-02-03 06:13:16 +01:00
Paul Eggert
7ac05c33b1 Improve malloc Lisp alignment commentary
Prompted by a private email from Pip Cet.
2025-02-01 22:55:30 -08:00
Eli Zaretskii
354b2907fc Fix mouse pointer inside mouse-face on text with 'pointer' property
* src/dispnew.c (gui_update_window_end): Don't consider mouse face
overwritten.
* src/xdisp.c (show_mouse_face): Accept an additional argument;
redefine the mouse cursor only if that argument is 'true'.  All
callers changed.  (Bug#75931)
2025-02-02 08:23:02 +02:00
Gerd Möllmann
42f1318e65 Fix hiding tty cursor for overlapping children
* src/dispnew.c (is_cursor_obscured): If selected frame is in the
z-order of the root frame, use that, otherwise use the root frame.
2025-02-02 05:44:39 +01:00
Paul Eggert
c91c591f0f Omit 2 ‘volatile’s in internal_lisp_condition_case
* src/eval.c (internal_lisp_condition_case): Omit an unnecessary
‘volatile’ and an unnecessary pointer-to-volatile local var.
Perhaps these were needed in previous versions of Emacs, or to
pacify older versions of GCC when using --enable-gcc-warnings,
but they are not needed to pacify current GCC.
2025-02-01 14:17:54 -08:00
Pip Cet
5a5706f943 ; src/pdumper.c (dump_hash_table): Bump CHECK_STRUCTS hash. 2025-02-01 17:08:27 +00:00
Pip Cet
4eabfd68c9 Use #$ for lambda fixups in native compilation data vectors
The "#$" syntax is recognized by Fread, which substitutes
Vload_file_name in its place.  If Vload_file_name is bound
appropriately, no other value can produce an object EQ to the one
produced by "#$".

We use this to check the data vector for entries that we know should
have been initialized: if the value is still equal to what we bound
Vload_file_name to when it was read, it wasn't initialized, and we
abort.

* lisp/emacs-lisp/comp.el (comp--#$): New defvar.
(comp--finalize-container): Use it.
* src/comp.c (ABI_VERSION): Bump.
(emit_static_object): Ensure 'comp--#$' prints as "#$".
(load_static_obj): Ensure '#$' reads as Vcomp__hashdollar.
(check_comp_unit_relocs): Adjust assertion.
(syms_of_comp): Define 'comp--#$'.
* src/pdumper.c (dump_do_dump_relocation): Adjust assertion.
2025-02-01 17:02:50 +00:00
Po Lu
532ff6e29d Fix compilation warnings on Android
* src/alloc.c (pointer_align): Only define if
!USE_ALIGNED_ALLOC.
2025-02-01 20:59:24 +08:00
Eli Zaretskii
22ab03e155 ; Avoid compiler warnings in the MS-Windows build
* src/w32heap.c: Remove unused variables, to avoid compilation
warnings.  This removes variables that were used only in the
unexec build.
2025-02-01 12:21:51 +02:00
Stefan Kangas
bf97946d7d Merge branch 'scratch/no-purespace' into 'master' 2025-02-01 04:56:52 +01:00
Paul Eggert
3a7809f9cc Don’t use garbage after tty_frame_at returns nil
* src/term.c (handle_one_term_event): Don’t access possibly
uninitialized storage if frame is nil.  This fixes an issue introduced
in commit 5eae7f5227 dated 2025-01-26
14:43:51 -0800. Issue caught by --enable-gcc-warnings, which enables
-Wanalyzer-use-of-uninitialized-value with gcc (GCC) 14.2.1 20250110
(Red Hat 14.2.1-7).
2025-01-31 15:01:34 -08:00
Pip Cet
e8ae77e939 Revert "Prefer static switch-case checking in pdumper"
This reverts commit 6e2e7265a0.
2025-01-31 15:01:34 -08:00
Pip Cet
6cfac8e3a3 Revert "Pacify -Wanalyzer-use-of-uninitialized-value"
This reverts commit 1ed769a3cb.
2025-01-31 15:01:34 -08:00
Pip Cet
fa6eb08dc0 Revert "; * src/pdumper.c (dump_do_fixup): Pacify GCC.
This reverts commit a99ba59aa0.
2025-01-31 15:01:34 -08:00
Eli Zaretskii
f54f798588 Avoid stack overflow on MS-Windows due to 'make-temp-name'
* src/fileio.c (Fexpand_file_name) [DOS_NT]: Use 'SAFE_ALLOCA'
instead of 'alloca'.  (Bug#75938)
2025-01-31 10:41:28 +02:00
Eli Zaretskii
a99ba59aa0 ; * src/pdumper.c (dump_do_fixup): Pacify GCC. 2025-01-30 11:02:47 +02:00
Yuan Fu
3be04f3dab
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.
2025-01-29 23:20:38 -08:00
Eli Zaretskii
0b3e050c6c * src/puresize.h (BASE_PURESIZE): Increase (bug#75907). 2025-01-30 08:38:05 +02:00
Gerd Möllmann
782be196e5 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.
2025-01-30 05:41:12 +01:00
Gerd Möllmann
7aacefba6b 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.
2025-01-30 05:41:12 +01:00
Gerd Möllmann
6cf479931d Don't use selected frame in tty_set_cursor (bug#75056)
* src/dispnew.c (tty_set_cursor): Add frmae parameter.
(write_matrix): Pass to the updated frame to tty_set_cursor.
2025-01-30 05:41:12 +01:00
Eli Zaretskii
0c6aa27cde ; Fix Cygw32 build (bug#75926)
(cherry picked from commit cb62a47896)
2025-01-29 18:00:24 +02:00
Eli Zaretskii
cb62a47896 ; Fix Cygw32 build 2025-01-29 17:55:58 +02:00
Eli Zaretskii
8c4a4b4eab ; Fix last change
* src/buffer.c (Fother_buffer):
* lisp/frame.el (make-frame):
* doc/lispref/frames.texi (Creating Frames): Fix em-dash.
2025-01-28 18:18:24 +02:00
Martin Rudalics
7f01dd8906 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'.
2025-01-28 16:59:45 +01:00
Gerd Möllmann
d60198d7a4 Fix frame-visible-p for tty root frames
* src/frame.c (Fframe_visible_p): Don't unconditionally return t for tty
root frames.
2025-01-28 04:39:59 +01:00
Paul Eggert
1f1088188e Avoid some make_formatted_string mallocs
* src/alloc.c (make_formatted_string):
Grow the local buffer from 64 to MAX_ALLOCA bytes.
2025-01-27 17:16:44 -08:00
Paul Eggert
8e7588a267 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.
2025-01-27 17:16:44 -08:00
Pip Cet
8812f526cf 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.
2025-01-27 17:16:43 -08:00
Pip Cet
0ed913cf46 Fix buffer overflows in doprnt (bug#75900)
* src/doprnt.c (doprnt): Clear rest of buffer on multibyte overflow.
Always decrement bufsize when writing a byte.
2025-01-27 17:16:43 -08:00
Paul Eggert
9b2e230c06 doprnt %X support
* src/doprnt.c (doprnt): Also support %X, since callers
now use %X.
2025-01-27 17:16:43 -08:00
jared
5eae7f5227 Fix clicking in child frames with GPM
* src/term.c (handle_one_term_event): Store child frame
coordinates in event.
2025-01-27 14:09:51 +02:00
Paul Eggert
1ed769a3cb 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.
2025-01-26 23:05:55 -08:00
Paul Eggert
a5c47258ff Fix unlikely eassert failure in invalid_radix_integer
* src/lread.c (invalid_radix_integer):
Simplify by using sprintf with a big-enough buffer.
2025-01-26 23:05:55 -08:00
Paul Eggert
f809302fe5 Fix unlikely eassert failure in xg_set_widget_bg
* src/gtkutil.c (xg_set_widget_bg): Simplify by using
sprintf with a big-enough buffer.
2025-01-26 23:05:55 -08:00
Paul Eggert
901659bb70 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.
2025-01-26 23:05:54 -08:00
Paul Eggert
f8b8dddce9 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.
2025-01-26 23:05:54 -08:00
Paul Eggert
8d8272d02e 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).
2025-01-26 23:05:54 -08:00
Paul Eggert
728c7904fe Pacify -fanalyzer-null-argument on pgtk_term_init
* src/pgtkterm.c (pgtk_term_init): Use xstrdup, not g_strdup.
The value is never freed so the allocator shouldn’t matter.
2025-01-26 23:05:53 -08:00
Paul Eggert
2e8ef09104 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.
2025-01-26 23:05:53 -08:00
Paul Eggert
ff65cc9944 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.
2025-01-26 23:05:53 -08:00