1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-04-11 16:52:40 -07:00
Commit graph

190079 commits

Author SHA1 Message Date
Helmut Eller
dabb7ee8ed Revert "Refactor SAFE_NALLOCA and SAFE_ALLOCA_LISP"
This reverts commit 7bb24524a2.
2026-03-30 17:57:22 +02:00
Helmut Eller
7bb24524a2 Refactor SAFE_NALLOCA and SAFE_ALLOCA_LISP
* src/lisp.h (SAFE_NALLOCA_NOPRO, SAFE_NALLOCA_AMBIG): New helpers.
(SAFE_NALLOCA): [MPS] Use SAFE_NALLOCA_AMBIG.
(SAFE_ALLOCA_LISP): [MPS] Use igc_xalloc_lisp_objs_exact instead of
igc_alloc_lisp_obj_vec.
(safe_free): Avoid SAFE_ALLOCA_XFREE.
(SAFE_ALLOCA_XFREE, SAFE_ALLOCA_XZALLOC): Deleted.
* src/igc.h (igc_xalloc_lisp_objs_exact): Moved to lisp.h.
* src/edit.c (do_one_unbind): Avoid SAFE_ALLOCA_XFREE.
2026-03-30 16:22:02 +02:00
Helmut Eller
2cef20de1c Refactor SAVE_ALLOCA
* src/lisp.h (SAFE_ALLOCA_NOPRO, SAFE_ALLOCA_AMBIG): New helpers.
(SAFE_ALLOCA): [MPS] Use SAFE_ALLOCA_AMBIG.
* src/igc.c (igc_record_xmalloc_ambig): New helper.
* src/editfns.c (styled_format): Avoid negative values for sa_avail.
2026-03-30 15:37:13 +02:00
Pip Cet
62cfc1d293 * src/nsterm.m (initFrame, initFrameFromEmacs): Add labels. 2026-03-29 15:23:39 +00:00
Eli Zaretskii
77324bb2d3 ; Fix code formatting in igc.c and lread.c
* src/igc.c (scan_specpdl, fix_terminal, fix_xwidget_view)
(igc_realloc_ambig, igc_xpalloc_exact):
* src/lread.c (mark_lread): Fix whitespace and comment format.
2026-03-29 09:01:00 +03:00
Helmut Eller
1285f68233 Add labels for igc_xalloc_raw_exact
* src/igc.h (igc_xalloc_raw_exact): Add label parameter.
* src/igc.c (igc_xalloc_raw_exact): Add label parameter and pass it
* src/image.c (make_image_cache): [MPS] Use __func__ as label.
* src/itree.c (itree_stack_create): [MPS] Use __func__ as label.
* src/xfaces.c (make_face_cache): [MPS] Use __func__ as label.
2026-03-25 17:32:54 +01:00
Helmut Eller
18406e3acc Add labels for igc_xnmalloc_ambig
* src/igc.c (igc_xnmalloc_ambig): Add label parameter and pass it
to igc_xzalloc_ambig.
* src/lisp.h (SAFE_NALLOCA) [MPS]: Use __func__ as label.
2026-03-25 17:14:19 +01:00
Helmut Eller
a4eb23205a Fix igc_header for Mingw64
* src/igc-types.h (union igc_header): Use uint32_t instead for size_t.
Apparently needed for Mingw64; with size_t the header grows to 16 bytes.
* src/igc.c: Move static assert to igc-types.h.
2026-03-24 09:54:30 +01:00
Helmut Eller
6a321be685 Continue fixing menus in no-X-toolkit config
* src/xmenu.c (x_menu_show): [!USE_X_TOOLKIT] Also stack allocate
pane_string, as suggested by Pip Cet.
2026-03-23 18:26:47 +01:00
Helmut Eller
4329a024a9 Simplify last change.
* src/xmenu.c (x_menu_show): [!USE_X_TOOLKIT] Use SAFE_ALLOCA_STRING as
suggested by Pip Cet.
2026-03-23 17:28:05 +01:00
Helmut Eller
9d308ac32e More fixes for menus in no-X-toolkit config
* src/xmenu.c (x_menu_show): [!USE_X_TOOLKIT] Stack allocate
help_string.
2026-03-23 13:50:21 +01:00
Helmut Eller
54f4ed928f Fix menus for no-X-toolkit config
* src/xmenu.c (x_menu_show) [!USE_X_TOOLKIT]: Always stack allocate
item_data.
2026-03-23 13:42:45 +01:00
Helmut Eller
e04ec09707 * src/igc.c (igc_xzalloc_ambig): Require non-NULL labels. 2026-03-23 09:54:37 +01:00
Helmut Eller
3c09ebb64b Expand uses IGC_XZALLOC_AMBIG
* src/igc.h (IGC_XZALLOC_AMBIG): Removed.
* src/androidterm.c:
* src/bidi.c:
* src/buffer.c:
* src/composite.c:
* src/dbusbind.c:
* src/dispnew.c:
* src/gnutls.c:
* src/igc.c:
* src/igc.h:
* src/json.c:
* src/macfont.m:
* src/menu.c:
* src/pgtkfns.c:
* src/pgtkterm.c:
* src/process.c:
* src/profiler.c:
* src/sfntfont.c:
* src/sort.c:
* src/xfns.c:
* src/xterm.c: Expand IGC_XZALLOC_AMBIG manually.
2026-03-23 09:44:24 +01:00
Helmut Eller
ff9f5db283 Replace more uses of igc_xzalloc_ambig with IGC_XZALLOC_AMBIG.
* src/androidterm.c:
* src/gnutls.c:
* src/macfont.m
* src/pgtkfns.c:
* src/pgtkterm.c:
* src/sfntfont.c:
* src/xfns.c: Use IGC_XZALLOC_AMBIG instead of igc_xzalloc_ambig.
2026-03-23 08:43:13 +01:00
Pip Cet
b46129b647 * src/nsterm.m (ns_term_init): Use label for 'igc_xzalloc_ambig'. 2026-03-23 07:09:23 +00:00
Helmut Eller
737bc23663 Use __func__ as default label for igc_xzalloc_ambig
* src/igc.h (IGC_XZALLOC_AMBIG): New macro.
(igc_xzalloc_ambig): Add label parameter.
(igc_xzalloc_ambig_with_label): Deleted.
* src/igc.c (igc_xzalloc_ambig, igc_xzalloc_ambig_with_label):
igc_xzalloc_ambig now does what igc_xzalloc_ambig_with_label used to do.
* src/atimer.c:
* src/bidi.c:
* src/buffer.c:
* src/composite.c:
* src/dbusbind.c:
* src/dispnew.c:
* src/fns.c:
* src/json.c:
* src/menu.c:
* src/process.c:
* src/profiler.c:
* src/sort.c:
* src/thread.c:
* src/xterm.c: Replace uses of igc_xzalloc_ambig with IGC_XZALLOC_AMBIG.
2026-03-22 18:27:25 +01:00
Helmut Eller
d8d526fa2f * src/itree.c (itree_stack_ensure_space): Use xpalloc properly. 2026-03-22 17:51:13 +01:00
Helmut Eller
4deaff20e4 Merge branch 'master' into feature/igc3 2026-03-22 16:14:32 +01:00
Helmut Eller
55bf30e017 Staticpro executing_kbd_macro
* src/macros.c (syms_of_macros): Staticpro executing_kbd_macro.
(executing_kbd_macro): Update comment.
* src/macros.h (executing_kbd_macro): Remove redundant comment.
2026-03-22 15:29:37 +01:00
Basil L. Contovounesios
5f3689d77f Fix no-focus-on-map on X without GTK
* src/xterm.c [!USE_GTK] (x_update_frame_user_time_window): When
replacing _NET_WM_USER_TIME with a new _NET_WM_USER_TIME_WINDOW and
the frame has requested no-focus-on-map, ensure _NET_WM_USER_TIME is
zero also on the new _NET_WM_USER_TIME_WINDOW.
(x_make_frame_visible) [!USE_GTK]: Don't overwrite _NET_WM_USER_TIME
before mapping a frame that has requested no-focus-on-map, and whose
_NET_WM_USER_TIME should thus remain zero (bug#80525).
2026-03-22 12:18:03 +01:00
Guilherme de Almeida Suckevicz
8dcbf4fafc Fix wrong type argument error in 'find-file-read-only-other-tab' (Bug#80630)
* lisp/tab-bar.el (find-file-read-only-other-tab): Pass the
function 'find-file-other-tab' directly to
'find-file--read-only' (Bug#80630).

Copyright-paperwork-exempt: yes
2026-03-22 09:27:41 +01:00
Stefan Monnier
a7d0520721 (dabbrev-capf): Fix bug#80645.
* lisp/dabbrev.el (dabbrev-capf): Return an empty table rather than
signaling an error when there are no completions.
The completion UI already takes care of emitting a message like
"No match".
2026-03-21 22:53:13 -04:00
Helmut Eller
cb338ddf0b Require labels for igc_xpalloc_ambig
* src/igc.h (igc_xpalloc_ambig): Add label parameter.
* src/igc.c (igc_xpalloc_ambig): Add label parameter.
(ensure_free_pin): Add label argument.
* src/bidi.c (bidi_cache_ensure_space): Add label argument.
* src/buffer.c (overlays_in, record_overlay_string): Add label argument.
* src/term.c (tty_menu_make_room): Add label argument.
2026-03-21 20:54:22 +01:00
Helmut Eller
e427d55284 * test/src/charset-tests.el (charset-tests-define-charset): New. 2026-03-21 18:42:01 +01:00
Helmut Eller
b06a1f85c6 Use signed ints in struct charset_table
* src/charset.h (struct charset_table): Make the slots size and used
signed.
(charset_attributes_getter): Fix spacing.
2026-03-21 18:42:01 +01:00
Helmut Eller
b0d38e2934 * src/charset.c (Fdefine_charset_internal): Fix memory leak. 2026-03-21 18:42:01 +01:00
Helmut Eller
497fd657cd * src/charset.c (shrink_charset_table): Simplify. 2026-03-21 18:42:00 +01:00
Helmut Eller
32f9e21098 Introduce a struct charset_table
The fields of the new struct are what the global variables
charset_table, charset_table_size, charset_table_used, and
charset_attributes_table used to be.  The struct should make it clearer
that those fields must be kept in sync.

* src/charset.h (struct charset_table): New struct.
(charset_attributes_getter): Adjust accordingly.
* src/charset.c (charset_table): Change type to struct charset_table.
(charset_table_size, charset_table_used, charset_attributes_table):
Moved to the struct.
(Fdefine_charset_internal, Ffind_charset_region, Ffind_charset_string)
(shrink_charset_table, syms_of_charset): Adjust to struct charset_table.
* src/pdumper.c (dump_charset, dump_charset_table): Adjust to struct
charset_table.
2026-03-21 18:42:00 +01:00
Helmut Eller
bbb4fc26e7 * src/charset.h (charset_attributes_getter): Add assertion. 2026-03-21 18:42:00 +01:00
Helmut Eller
186af8e934 Remove the charset_table_init array
Determining the best size for a static array seems difficult; so
allocate it dynamically.

* src/charset.c (CHARSET_TABLE_INIT_SIZE): New constant.
(syms_of_charset): Malloc charset_table here.
(charset_table_init): Removed.
(shrink_charset_table): New function.
(Fclear_charset_maps): Call it.
* src/charset.h (charset_table_init): Removed.
(charset_attributes_getter): Add an assertion.
* src/pdumper.c (dump_charset_table): Assert that charset_table_size ==
charset_table_used.
2026-03-21 18:41:20 +01:00
Helmut Eller
96eacb2c09 Move the attribute field of charsets to a separate vector
This simplifies the GC code, as this was the only field in the charset
struct that referenced the GC heap.  Without it, we no longer need to
trace the charset_table.

* src/charset.h (struct charset.attributes): Removed.
(charset_attributes_getter): New helper.
(CHARSET_ATTRIBUTES): Use it.
* src/charset.c (charset_attributes_table): New.
(Fdefine_charset_internal): Place attrs in charset_attributes_table.
(syms_of_charset): Initialize charset_attributes_table.
(mark_charset): Deleted.
* src/pdumper.c (dump_charset): Skip attributes field.
* src/lisp.h (mark_charset): Deleted.
* src/alloc.c (garbage_collect): mark_charset no longer needed.
2026-03-21 18:20:42 +01:00
Basil L. Contovounesios
fac42338bb Make member-if compiler-macro hygienic
* lisp/subr.el (member-if): Use uninterned symbol in
compiler-macro (bug#80647).
2026-03-21 13:51:27 +01:00
Eli Zaretskii
9adc553ab9 ; * doc/lispintro/emacs-lisp-intro.texi: Fix parens (bug#80646). 2026-03-21 13:27:56 +02:00
Pip Cet
9da485befc Avoid dumping uninitialized stack data in pdumper.c
* src/pdumper.c (START_DUMP_PVEC): Clear memory that is about to be
dumped.
2026-03-21 11:25:12 +00:00
Pip Cet
d34600e549 Dump weak hash tables the same way other pvecs are dumped
* src/pdumper.c (dump_weak_hash_table): Dump the copied object rather
than the original.
2026-03-21 11:23:02 +00:00
Pip Cet
0a13316a99 [MPS] Add --checking=igc_debug_alloc option
This option checks xmalloc'd memory for words that look
like (untraced) MPS pointers.  It is very slow and leaks memory, but
was good enough to find some untraced pointers.

* configure.ac (IGC_DEBUG_ALLOC): New option.
* src/alloc.c (xmalloc):
(xzalloc):
(xrealloc): Call 'register_xmalloc_allocation'.
(xfree): Call 'unregister_xmalloc_allocation'.
e* src/lisp.h (register_xmalloc_allocation)
(unregister_xmalloc_allocation): New.
* src/igc.c (root_find_containing): New.
(igc_destroy_root_with_start): Call 'protect_xmalloc_allocation'.
(scan_xmalloc_allocations):
(unregister_xmalloc_allocation):
(register_xmalloc_allocation):
(protect_xmalloc_allocation):
(staticvec_contains):
(check_pointer):
(igc_scan_for_untraced_objects): New.
2026-03-21 11:23:02 +00:00
Stéphane Marks
48d65afa32 vtable truncate-string-pixelwise, ellipsis can be a string (bug#80026)
Eliminate 'vtable--limit-string' in favor of the more efficient
'truncate-string-pixelwise'.  Remove extraneous pre-measurement
calls to 'string-pixel-width' and ellipsis concatenation as
'truncate-string-pixelwise' does both.
The 'make-vtable' 'ellipsis' keyword can be a string to override
the default returned by 'truncate-string-ellipsis'.

* lisp/emacs-lisp/vtable.el (vtable--ellipsis): New defun.
(vtable-insert-object, vtable--insert): Use 'vtable--ellipsis'.
(vtable--insert-line, vtable--insert-header-line): Call
'truncate-string-pixelwise' instead of 'vtable--limit-string'.
(vtable--limit-string): Remove function.

* test/lisp/emacs-lisp/vtable-tests.el
(test-vtable--limit-string-with-face-remapped-buffer): Remove
test, obsoleted by misc-test-truncate-string-pixelwise.

* doc/misc/vtable.texi: Document that :ellipsis can be a string.
2026-03-21 12:50:04 +02:00
Jeff Valk
eca93f40d1 Ensure correct expansion in 'find-sibling-file-search'
* lisp/files.el (find-sibling-file-search): Following expansion
of each EXPANSION, advance the search start position to reflect
the actual length of the expanded text (the updated string), not
the length of the "\\([&0-9]+\\)" (the string before expansion).
(Bug#80636)

Copyright-paperwork-exempt: yes
2026-03-21 12:31:21 +02:00
Eli Zaretskii
531f45551a ; * src/fns.c (internal_equal_cycle) <use-short-answers>: Doc fix. 2026-03-21 10:12:03 +02:00
Eli Zaretskii
aefa854d01 ; * etc/NEWS: Fix wording. 2026-03-21 09:07:25 +02:00
Eli Zaretskii
4901015055 ; * doc/lispref/variables.texi (Void Variables): Add cross-reference. 2026-03-21 09:05:59 +02:00
Tassilo Horn
8ae0877416 Fix wrong-type-argument error in package-upgrade
* lisp/emacs-lisp/package.el (package-upgrade): Fix wrong-type-argument
error when upgrading a builtin package (bug#80633).
2026-03-21 07:15:35 +01:00
Stefan Monnier
3ed7868f6e simple-tests.el: Use kmacro function
* test/lisp/simple-tests.el (undo-test-kill-c-a-then-undo)
(undo-test-point-after-forward-kill): Use `kmacro` function.
2026-03-20 23:19:43 -04:00
Stefan Monnier
f986e5a897 cursor-sensor.el: Partial fix for bug#80255
This provides limited support for window-specific overlay properties.
To complete it, we still need to add support for it to
`next/previous-single-char-property-change`.

* lisp/emacs-lisp/cursor-sensor.el (cursor-sensor--intangible-p):
Add `window` argument.
(cursor-sensor-tangible-pos, cursor-sensor--detect):
Pass `window` argument to the functions
looking for overlay properties.
2026-03-20 23:18:29 -04:00
Stefan Monnier
378cfb8660 (Fmakunbound): Break aliasing, if present (bug#80538)
* src/data.c (Fmakunbound): Break aliasing, if present.
* doc/lispref/variables.texi (Void Variables): Document it.
2026-03-20 17:21:05 -04:00
Stefan Monnier
89b40650da diff-mode.el: Don't recompute the position of Git preamble/footer
On some profiles (after disabling syntax and refined
fontification), this was taking >90% of the time to fontify a buffer.

* lisp/vc/diff-mode.el (diff--git-preamble-overlay)
(diff--git-footer-overlay): New variables.
(diff--git-preamble-end, diff--git-footer-start): Use them to cache
the result.
2026-03-20 16:53:42 -04:00
Pip Cet
1bf5417bed [MPS] Staticpro safe_terminal_coding.src_object, .dst_object
* src/coding.c (syms_of_coding): Staticpro
safe_terminal_coding.src_object and safe_terminal-coding.dst_object.
2026-03-20 19:32:17 +00:00
Helmut Eller
91d636093b * src/profiler.c (syms_of_profiler): Staticpro profiler_cpu_interval. 2026-03-20 16:35:35 +01:00
Helmut Eller
8cef3e064d * src/xfns.c (x_create_tip_frame): [MPS] Protect output_data.x->font. 2026-03-20 16:32:20 +01:00