Commit graph

50208 commits

Author SHA1 Message Date
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
Paul Eggert
c0d83876f1 Avoid undefined behavior with botched pgtk menu
* src/pgtkmenu.c (pgtk_menu_show): Do not dereference save_wv if
null.  Problem found by gcc 20250110 (Red Hat 14.2.1-7)
-Wanalyzer-null-dereference.
2025-01-26 23:05:53 -08:00
Paul Eggert
06fd3f4e98 Use gtk_disable_setlocale
* src/pgtkterm.c (pgtk_term_init):
* src/xterm.c (x_term_init):
Use gtk_disable_setlocale rather than fixup_locale.
2025-01-26 23:05:52 -08:00
Paul Eggert
a1e4f6a35c 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.
2025-01-26 23:05:52 -08:00
Paul Eggert
6ff06ff738 Beware large stack growth in pgtk_menu_show
* src/pgtkmenu.c (pgtk_menu_show): USE_SAFE_ALLOCA instead of alloca.
Problem found with --enable-gcc-warnings.
2025-01-26 23:05:52 -08:00
Paul Eggert
17a8bf53f3 Fix x-show-tip bignum crash
* src/pgtkfns.c (compute_tip_xy): Fix crash if user specifies
bignums.  Bug found with --enable-gcc-warnings.
2025-01-26 23:05:51 -08:00
Paul Eggert
c50e8c2424 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.
2025-01-26 23:05:51 -08:00
Paul Eggert
028fae9661 Simplify building of color names in image.c
* src/image.c (make_color_name): New function.
(image_background, image_build_heuristic_mask, png_load_body): Use it.
2025-01-26 23:05:51 -08:00
Paul Eggert
f885806fdf 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.
2025-01-26 23:05:50 -08:00
Paul Eggert
bcfd4d21b0 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.
2025-01-26 23:05:50 -08:00
Po Lu
8d11871c63 Fix the Android port
* src/term.c (tty_frame_at) [HAVE_ANDROID]: Always return nil.

* src/terminal.c (cursor_to, raw_cursor_to) [HAVE_ANDROID]:
Don't call root_xy.
2025-01-27 09:11:21 +08:00
Stefan Kangas
aec9e66178 Fix compilation warnings in pdumper with !HAVE_NATIVECOMP
* src/pdumper.c [!HAVE_NATIVECOMP] (cold_op, dump_subr): Fix
compilation warnings.
Ref: https://lists.gnu.org/r/emacs-devel/2025-01/msg01003.html
2025-01-26 21:17:31 +01:00
Stefan Kangas
6e2e7265a0 Prefer static switch-case checking in pdumper
* src/pdumper.c (dump_fwd, dump_symbol, dump_drain_cold_data)
(dump_do_fixup, dump_anonymous_allocate_w32)
(dump_anonymous_allocate_posix, dump_map_file_w32, dump_map_file_posix)
(dump_do_emacs_relocation): Remove default clauses to allow static
checking using -Wswitch.
2025-01-26 20:09:08 +01:00
Pip Cet
b07c12ce59 Avoid crashes in Fdocumentation caused by incorrect data types
Note that this can only change things when function-documentation is
defined or overloaded incorrectly.

* src/doc.c (Fdocumentation): Check that the cdr of a docstring cons
is a fixnum.
2025-01-26 17:02:42 +00:00
Gerd Möllmann
4e78a3e117 Display separators on tty menus with display table entries
* src/xdisp.c (display_tty_menu_separator): Lookup separator char in
standard-display-table, make a string, and display that using
display_string.
* src/xdisp.c (display_tty_menu_separator_char): New function.
(display_tty_menu_separator): Use it.
* lisp/disp-table.el (display-table): Increase from 12 to 18.
(box-double-vertical, box-double-horizontal, box-double-down-right)
(box-double-down-left, box-double-up-right, box-double-up-left): New
symbols for extra slots.
(display-table-slot, set-display-table-slot): Change doc string.
(describe-display-table): Describe new slots.
(standard-display-unicode-special-glyphs): Define new slots.
* src/disptab.h (DISP_TABLE_P): Add enumerators.
(DISP_TABLE_EXTRA_SLOTS): Define based on enum box.
* src/dispnew.c (produce_box_glyphs): Add new enumerators to switch to
make it exhaustive.
* src/xdisp.c (display_tty_menu_separator): Use BOX_DOUBLE_HORIZONTAL
for '=' if present.
* doc/lispref/display.texi: Add documentation.
* etc/NEWS: Mention in NEWS.
2025-01-26 16:41:01 +01:00
Gerd Möllmann
35d3927859 Change doc string of frame-visible-p
* src/frame.c (Fframe_visible_p): Don't say it always returns t for tty
frames.
2025-01-25 21:20:55 +01:00
Gerd Möllmann
85aec497c7 Replace is_frame_ancestor with frame_ancestor_p
* src/dispnew.c (is_frame_ancestor): Removed.
(frame_z_order_cmp): Use frame_ancestor_p.
(copy_child_glyphs): Ditto.
* src/dispextern.h: Declaration removed.
* src/term.c (mouse_get_xy): Use frame_ancestor_p.
2025-01-25 20:00:56 +01:00
Juri Linkov
63df216490 Add 'treesit-forward-comment' with 'forward-comment-function'
* lisp/treesit.el (treesit-forward-comment): New function.
(treesit-major-mode-setup): Set 'forward-comment-function' to
'treesit-forward-comment' if the 'comment' thing is defined.

* src/syntax.c (forward-comment-function): New variable.
(Fforward_comment): Call the function from 'forward-comment-function'
when it's non-nil (bug#75609).
2025-01-25 20:14:15 +02:00
Eli Zaretskii
6016967e85 Merge from origin/emacs-30
67903f5909 Restore the old behavior of `bookmark-write-file'
062da7003f ; Improve prompts and error messages in 'info-look'
52dc01f1c8 ; * admin/admin.el (set-version): Note about Android.
fb282da2a0 Avoid double spaces around abbrevations in Texinfo
bc1ab8ac3d ; * doc/emacs/custom.texi (Init Rebinding): Fix spacing.
b41ef43af1 ; Fix previous change
5638b1d6bd Ispell: Use "personal dictionary" terminology consistently
cc791e7499 ; Check man pages for mistakes less frequently
4ed4792e3b ; * admin/release-process: Minor copy-edits.
4a867c823b Add language server "ruff server" for Python
9e687c2871 Fix go-ts-mode type declaration indentation (Bug#75785)
f751b3afa4 ; Minor improvements for doc strings in map.el
cda78edc7d ; Fix typos
ce50a1d3c1 ; * src/w32.c (w32_memory_info): Fix coding style of last...
58d3d4820a Fix bug in w32_memory_info
7738641205 Avoid crashes in redisplay due to problematic font setups
0e3687e600 Improve 'key-valid-p' docstring
9878092d2b Minor copyedits in internals.texi
4726900fdc Better document side-effect free and pure C functions
04c475a39f ; Fix documentation about faces of tool-tip text

# Conflicts:
#	admin/codespell/codespell.exclude
2025-01-25 10:06:19 -05:00
Eli Zaretskii
e8f173f0ba ; * src/term.c (handle_one_term_event): Fix last change. 2025-01-25 16:59:40 +02:00
Gerd Möllmann
1d08644116 Fix the mistake that led to the reverts
* src/terminal.c (raw_cursor_to): Fix reversed arguments.
2025-01-25 14:46:05 +01:00
Gerd Möllmann
20f2672377 Reapply "Multi-tty: selected frame can be a GUI frame"
This reverts commit d93d822285.
2025-01-25 14:46:05 +01:00
Gerd Möllmann
ccf3f8d21e Reapply "Fix mouse position handling for nested tty child frames"
This reverts commit e2cc52dbcd.
2025-01-25 14:46:05 +01:00
Gerd Möllmann
e839b83c82 Reapply "Fix tty-frame-at for nested tty child frames"
This reverts commit 9ad28959d6.
2025-01-25 14:46:05 +01:00
Gerd Möllmann
26b144f241 Reapply "Fix cursor positioning of nested tty child frames"
This reverts commit 65036323fc.
2025-01-25 14:46:05 +01:00
Gerd Möllmann
945ed044cd Reapply "Simplify absolute (x, y) computation on ttys"
This reverts commit 13fdcd730f.
2025-01-25 14:46:05 +01:00
Gerd Möllmann
13fdcd730f Revert "Simplify absolute (x, y) computation on ttys"
This reverts commit 5e132835ad.
2025-01-25 09:39:56 +01:00
Gerd Möllmann
65036323fc Revert "Fix cursor positioning of nested tty child frames"
This reverts commit 8cbb3c7335.
2025-01-25 09:39:54 +01:00
Gerd Möllmann
9ad28959d6 Revert "Fix tty-frame-at for nested tty child frames"
This reverts commit 9693f2a95a.
2025-01-25 09:39:51 +01:00
Gerd Möllmann
e2cc52dbcd Revert "Fix mouse position handling for nested tty child frames"
This reverts commit f37559a1ee.
2025-01-25 09:39:47 +01:00
Gerd Möllmann
d93d822285 Revert "Multi-tty: selected frame can be a GUI frame"
This reverts commit 57b7c07b37.
2025-01-25 09:39:11 +01:00
Gerd Möllmann
57b7c07b37 Multi-tty: selected frame can be a GUI frame
* src/dispnew.c (frame_selected_window_frame): New function.
(is_cursor_obscured): Use it.
(terminal_cursor_magic): Use the frame of the selected window of he root
frame.
(combine_updates_for_frame): Move Android conditional compilation out.
2025-01-25 07:59:45 +01:00
Gerd Möllmann
f37559a1ee Fix mouse position handling for nested tty child frames
* src/dispnew.c (child_xy): New function.
* src/dispextern.h: Declare it.
* src/term.c (tty_frame_at): Return child-relative (x, y) in output
parameters.
(Ftty_frame_at): Return a list (FRAME CHILD-X CHILD-Y).
(handle_one_term_event): Adapt use of tty_frame_at.
* lisp/xt-mouse.el (xterm-mouse-event): Use new tty-frame-at.
2025-01-25 07:35:51 +01:00
Gerd Möllmann
9693f2a95a Fix tty-frame-at for nested tty child frames
* src/term.c (tty_frame_at): Translate child frame origin to absolute
coordinates.
2025-01-25 07:35:51 +01:00
Gerd Möllmann
8cbb3c7335 Fix cursor positioning of nested tty child frames
* src/terminal.c (cursor_to, raw_cursor_to): Fix translation to root
coordinates.
2025-01-25 07:35:51 +01:00
Gerd Möllmann
5e132835ad Simplify absolute (x, y) computation on ttys
* src/dispnew.c (root_xy): New function.
(frame_pos_abs): Removed.
(frame_rect_abs, abs_cursor_pos): Use root_xy.
* src/dispextern.h: Declare root_xy.
* src/term.c (mouse_get_xy): Use it.
2025-01-25 07:35:51 +01:00
Gerd Möllmann
07a2a67e3b Disable more redisplay optimizations when child frames are visible
* src/xdisp.c (redisplay_internal): Disable more optimizations
on a tty root frame displaying a child frame.
(try_cursor_movement,(try_window_reusing_current_matrix)
(try_window_id): Don't use on tty root frames displaying a child frame.
2025-01-24 11:32:59 +01:00
Eli Zaretskii
5e657ad1fe ; * src/dispnew.c (combine_updates_for_frame): Fix whitespace. 2025-01-24 10:41:00 +02:00
Eli Zaretskii
6c633ece6e Revert "; * src/dispnew.c (combine_updates_for_frame): Fix whitespace."
This reverts commit c941b94e51.
It was pushed by mistake.
2025-01-24 10:40:14 +02:00
Eli Zaretskii
c941b94e51 ; * src/dispnew.c (combine_updates_for_frame): Fix whitespace. 2025-01-24 10:26:26 +02:00
Gerd Möllmann
15315780ae Handle update of invisible tty frames (bug#75056)
* src/dispnew.c (combine_updates_for_frame): Don't assume root frame is
visible.
2025-01-24 06:25:08 +01:00
Stefan Kangas
f14c24dbe7 Support loading dynamic docstrings from Emacs <29
* src/doc.c (get_doc_string): Take absolute value to be compatible with
bytecode from Emacs <29.
2025-01-24 00:48:17 +01:00
Stefan Kangas
c7f6da7a41 Don't use negative positions for docstrings
These were used for user-variables (doc starts with a '*'), but we don't
use that convention any more.  On my machine, there are no docstrings
starting with a '*' in etc/DOC.

* src/doc.c (Fsnarf_documentation): Never use negative positions.
(get_doc_string): Don't use eabs; position must now be positive, and all
callers are verified to do that.
2025-01-24 00:16:08 +01:00
Pip Cet
ed5067e689 Fix GC bug causing incorrect 'format' output (Bug#75754)
This fixes the correctness bug discovered in bug#75754, but not the
performance issue or excessive stack usage.

* src/editfns.c (styled_format): Split 'info' array into two arrays,
one of them allocated via SAFE_ALLOCA_LISP for GC protection.
2025-01-23 18:00:01 +00:00
Stefan Kangas
990b0811ad Simplify Fdocumentation and Fdocumentation_property
* src/doc.c (Fdocumentation, Fdocumentation_property): Simplify;
reread_doc_file always returns true so just assume that.
(reread_doc_file): Change return type to void.
2025-01-23 18:45:14 +01:00
Gerd Möllmann
d83d090de1 Handle tty menus overlapping child frames
* src/dispnew.c (frame_pos_abs, is_frame_ancestor): Make externally
visible.
* src/dispextern.h: Declare above functions.
* src/term.c (mouse_get_xy): Handle mouse movement over child frames.
2025-01-23 15:34:36 +01:00
Gerd Möllmann
076cd69fc2 Don't forget setting the top frame if not switching root frames
* src/frame.c (do_switch_frame): Make sure to set top frame in all
cases.
2025-01-23 11:09:19 +01:00