* src/xdisp.c (handle_tab_bar_click): Use the variable 'close_p'
to show mouse face as sunken/raised only when clicked
on the close button. Clicking elsewhere on the tab should not
change the close button's appearance using DRAW_MOUSE_FACE.
* src/pgtkselect.c (pgtk_display_selection_waiting_message):
(pgtk_cancel_atimer):
(pgtk_get_foreign_selection):
* src/xselect.c (x_display_selection_waiting_message):
(x_cancel_atimer):
(x_get_foreign_selection): Use a pointer to a timer variable, which is
cleared when the timer runs or is otherwise cancelled. Don't cancel
the timer twice.
* src/eval.c (with_delayed_message_display):
(with_delayed_message_cancel):
(Ffuncall_with_delayed_message): Use new temporary data
structure. Cancel timer at most once.
On the NS port, -[EmacsWindow setParentChildRelationships] reattaches
every child frame to its parent via -addChildWindow:ordered:, which also
orders the child window onto the screen. This runs whenever the
parent/child relationships are rebuilt, e.g., when entering non-native
fullscreen, which allocates a fresh EmacsWindow whose initializer
rebuilds the relationships. A child frame that Emacs had made invisible
(e.g. a corfu/company completion popup) was thereby brought back as a
stale, non-responsive child frame. Emacs never repaints to clear it
because frame_redisplay_p trusts FRAME_VISIBLE_P on the NS port and
avoids dealing with the child frame when it is marked as invisible.
Native fullscreen does not trigger this: -toggleFullScreen: hands off to
AppKit without allocating a new window, so the rebuild never runs.
A hidden child frame is normally detached from its parent already: Emacs
hides it with -orderOut: (ns_make_frame_invisible), which per Apple's
documentation removes a child window from its parent before ordering it
out. The fix is therefore not to re-attach a child while it is
invisible; ns_make_frame_visible already reinstates the parent/child link
when the frame is shown again.
* src/nsterm.m ([EmacsWindow setParentChildRelationships]): Only
re-attach a child window when the frame is marked visible.
(ns_make_frame_visible): Explain, with a reference to Apple's
documentation, why the parent/child link must be reinstated on show.
* src/process.c (glib_installs_sigchld_handler): New variable.
(init_process_emacs): Set it when GLib overrides Emacs's SIGCHLD
handler.
* src/process.h (glib_installs_sigchld_handler): Declare.
* src/xwidget.c (Fmake_xwidget): Skip the "about:blank"
workaround when glib_installs_sigchld_handler is false.
* src/gtkutil.c (xg_frame_set_char_size)
(xg_frame_set_size_and_position): Round WIDTH and HEIGHT to
multiples of SCALE without adding toolbar/menubar (bug#80662).
* msdos/sedlibmk.inp (GL_GNULIB_MEMEQ, GL_GNULIB_STREQ)
(GL_GNULIB_STRNUL): New substitutions, replacing that of
GL_GNULIB_STRINGEQ.
* src/term.c (init_tty) [MSDOS]: Assign appropriate value to
tty->TN_max_colors.
Do not merge to master.
The 'completion-regexp-list' optimization in
completion--flex-all-completions-1, a cheap pre-filter via a trivial
regexp, performs very poorly for longer patterns and strings, so drop
it. That alone recovers fairly decent performance for the flex
completion when compared to the 'hotfuzz' point of reference.
We then recover the cheap rejection with an O(N+M) pre-check in the
Fcompletion__flex_cost_gotoh C scorer. This kicks in the common case
(completion-ignore-case is nil) and pays off especially when the table
is already a list and 'all-completions' needn't cons.
See:
https://lists.gnu.org/archive/html/emacs-devel/2026-04/msg01081.htmlhttps://lists.gnu.org/archive/html/emacs-devel/2026-05/msg00519.html
* lisp/minibuffer.el (completion--flex-all-completions-1): Remove
regexp pre-filter.
* src/minibuf.c (Fcompletion__flex_cost_gotoh): Add subsequence
pre-check.
With Emacs 31 the old_buffer slot of a window gets overwritten
with the buffer unshown in that window when that window is
deleted. Fset_window_configuration triggers that when calling
delete_all_child_windows. If a window configuration gets saved
and restored in one and the same redisplay cycle, the change
time stamps of the window and its frame will be equal and
'window-buffer-change-functions' may wrongly decide that the
window's buffer has not changed because its buffer and
old_buffer slots refer to the same buffer (Bug#81097). Fix that
by saving and restoring the old_buffer slot.
* src/window.c (struct saved_window): Add 'old_buffer' slot.
(Fset_window_configuration): Restore old_buffer slot.
(save_window_save): Save old_buffer slot.
* src/gtkutil.c (xg_frame_set_size_and_position): Remove a
gtk_window_resize call which used a wrong value type
(GdkX11Window instead of GtkWindow). The original motivation
for that line seems to be fixed by later changes (bug#80662).
* src/xdisp.c (display_line): Remove the unnecessary condition that
row->used of the margin areas is zero, for when we call
'extend_face_to_end_of_line'. (Bug#80693)
* src/xterm.c (handle_one_xevent): Move the
x_clear_under_internal_border call before expose_frame, for less
chance of implicit flush to screen in between (bug#80662).
'data-directory' needs to be established in advance of 'ns_init_colors'
to ensure the file "etc/rgb.txt" is read. This was encountered on an
out-of-tree Nix build.
* src/emacs.c (main): Move the 'ns_init_colors' after 'init_callproc'.
Copyright-paperwork-exempt: yes
* src/xterm.c (x_make_frame_visible): Move XMoveWindow call before
gtk_widget_show_all, so that the move happens before the frame
become visible (bug#80662).
* src/gtkutil.c (xg_frame_set_char_size)
(xg_frame_set_size_and_position): Call gtk_window_resize for
child frames too, to record _GtkWindowGeometryInfo#resize_width
and resize_height. They are later looked up by
gtk_widget_show_all in x_make_frame_visible (bug#80662).
Without this the widgets go back and forth between the
remembered and actual sizes after make-visible.
* src/nsterm.m (cancel_ns_deferred_UAZoomChangeFocus_timer): New function.
([EmacsView windowWillClose:]): New method. Cancel the timer if the window
closes before it runs.
([EmacsView deferredhandler:]): Guard against emacsframe being deleted before
the timer runs.
A new basic face 'margin' is used for text displayed in the left and
right margin areas, i.e., the areas typically used by VCS and LSP
packages for per-line annotations. Its background defaults to the
frame default, preserving existing behavior for users who do not
customize it.
* etc/NEWS: Document the new 'margin' face.
* lisp/faces.el (margin): Add 'margin' face, inheriting from 'default'.
* src/dispextern.h (face_id): Add MARGIN_FACE_ID.
* src/xdisp.c (face_at_pos): Use 'margin' as the base face for
strings displayed in margin areas so that they inherit the gutter
background by default.
(extend_face_to_end_of_line): Compute 'margin_fill_face_id' from the
'margin' face. Use while loops to explicitly fill all empty character
slots in both left and right margins for both GUI and TTY branches.
(display_line): Call 'extend_face_to_end_of_line' for beyond-EOB rows
when the window has margins. Also extend the existing condition for
text rows with empty margins to trigger when the 'margin' face
background differs from the frame default, not only when the default
face is remapped.
* src/xfaces.c (realize_basic_faces): Realize 'margin' as a basic
face to support face-remapping and efficient lookup.
(Bug#80693)
In terminal sessions, SIGINT is turned into a `quit` ELisp signal,
but in batch it has traditionally killed Emacs. It can be very
useful to cause a `quit` from outside the process when running
in batch (e.g. for "batch" sessions that provide a REPL via stdin/out),
so add a new var 'kill-emacs-on-sigint' to control that behavior.
(bug#80942)
* src/keyboard.c (handle_interrupt_signal): Obey `kill_emacs_on_sigint`.
(init_keyboard): Use `deliver_interrupt_signal` for SIGINT also for
batch sessions.
(syms_of_keyboard): New variable `kill_emacs_on_sigint`.
* test/src/keyboard-tests.el (keyboard-sigint-to-quit): New test.
* doc/emacs/cmdargs.texi (Initial Options): Mention the effect of
`kill-emacs-on-sigint` in batch mode.
* src/xdisp.c (clear_garbaged_frames): Re-add the call to
clear_under_internal_border, reverting that part of commit
a6a3b32208 as not essential to the fix (bug#80662).
* src/gtkutil.c (xg_frame_set_char_size): Resize child frame and
its GTK widget hierarchy immediately. Update the "desired" Cairo
surface dimensions. Skip waiting for events. (bug#80662)
Remove the unnecessary call to clear_under_internal_border.
* src/gtkutil.c (xg_frame_set_char_size): Simplify. Use the
fullscreen value check to alter the values of outer_width and
outer_height rather than have several larger branches (bug#80662).
* src/gtkutil.c (xg_frame_set_char_size): Remove the effect of
x_gtk_resize_child_frames, effectively reverting that part of
c49d379f17 (bug#80662).
* src/pgtkfns.c (syms_of_pgtkfns): Remove defsyms Qhide and
Qresize_mode, never used with PGTK.
* src/xfns.c (x-gtk-resize-child-frames): Update docstring.
* src/xterm.c (x_wait_for_event): If f->wait_event_type has been
cleared (in handle_one_xevent), don't go into pselect wait.
* src/androidterm.c (android_wait_for_event): Likewise.
This pertains to X11 toolkit builds. Other ports (including
PGTK) seem to have mostly atomic window updates already.
* src/xterm.c (x_set_window_size_1): Resize the Xt widget eagerly,
so the next redraw is not clipped. Update the "desired" Cairo
surface dimensions. Skip waiting for next XEvent. Do all that
for child frames only. Update old comments (bug#80662).
(x_set_window_size_and_position_1): Same. Also clear the widget's
cached position coordinates (we don't keep them up to date).
(x_set_window_size, x_set_window_size_and_position): Skip
redrawing the border on child frames, it will happen during
redisplay anyway.
* src/gtkutil.c (xg_frame_set_size_and_position): On child
frames, resize the GTK widget hierarchy immediately. Update the
"desired" Cairo surface dimensions. Skip waiting for events.
* src/widget.c (EmacsFrameResize):
When resize should be a no-op, exit early (minor optimization).
(EmacsFrameExpose): Redraw the border on the last Expose event.
* src/xdisp.c (clear_garbaged_frames): Don't redraw borders here.
* src/xfns.c (x_window): Undo the previous change in bit_gravity
in the no-toolkit build. StaticGravity works the best for it
thanks to no nesting in window configuration.
* src/xdisp.c (glyph_string_containing_background_width):
Although it’s not immediately obvious whether the GCC 16 warning
is valid, adding an eassume here shouldn’t hurt.
This enables features unrelated to native image APIs, such as
'w32-export-frame' and 'yank-media', which need to call GDI+
functions.
* configure.ac (HAVE_W32) [!CYGWIN]: Always include w32image.o in
W32_OBJ.
* etc/NEWS: Drop 'yank-media' '--without-native-image-api' caveat.
* src/emacs.c (main):
* src/w32select.c (convert_dibv5_to_png):
* src/w32term.c (w32_draw_image_foreground): Replace
HAVE_NATIVE_IMAGE_API with WINDOWSNT.
* src/w32.c (term_ntproc): Remove redundant HAVE_NATIVE_IMAGE_API guard.
* src/w32fns.c (Fw32_export_frame) [!WINDOWSNT]: Return nil on Cygwin.
* src/coding.c: Remove file wide ignore pragma for
-Wunused-but-set-variable.
(detect_coding_XXX) <consumed_chars>: Mention that this variable might
need to be declared with the MAYBE_UNUSED attribute.
(detect_coding_utf_8, detect_coding_emacs_mule, detect_coding_iso_2022)
(encode_designation_at_bol, detect_coding_sjis, detect_coding_big5)
(detect_coding_ccl, detect_coding_charset) <consumed_chars>: Use the
MAYBE_UNUSED attribute.
A reparse will make the TSTreeCursor or TSNode to possibly point
to freed memory (because the TSTree they point to is freed.)
* src/treesit.c (treesit_pred_with_guard): New function.
(treesit_predicate_pred):
(treesit_eval_predicates):
(Ftreesit_query_capture):
(treesit_traverse_match_predicate):
(treesit_build_sparse_tree): Add guard that signals if buffer is
changed when calling predicate function.
(Qtreesit_buffer_changed): New symbol.
This is the one case out of 1902 where the C name didn't match the subr
name.
* src/xfns.c (Fx_display_last_user_time): renamed to Fx_display_set_last_user_time