* src/sysdep.c (serial_open): On failure, simply return -1
and set errno; do not call report_file_error, as the
caller is supposed to do that if needed.
Problem discovered on Fedora 44 x86-64 when using GCC 16.1.1 with
-fsanitize=address, with test/src/process-tests.el tests that use
process-tests--with-raised-rlimit. This function overrides the
default of 1024 for the maximum number of open files, which causes
undefined behavior (subscript errors) in src/process.c.
* src/process.c (inrange_fd, inrange_pipe): New functions.
(allocate_pty, create_process, create_pty, Fmake_pipe_process)
(Fmake_serial_process, connect_network_socket)
(network_interface_info, server_accept_connection)
(Fprocess_send_eof, child_signal_init):
Check that all newly allocated file descriptors are less than
FD_SETSIZE; close them and fail otherwise.
(create_pty, Fmake_pipe_process, Fmake_serial_process)
(connect_network_socket, server_accept_connection)
(child_signal_init): Remove no-longer-needed comparisons
to FD_SETSIZE, now that inrange_fd and inrange_pipe
do the checking for us.
* src/regex-emacs.c (forall_firstchar):
Avoid undefined behavior in the 2nd eassert when !bufp && !pend.
This pacifies GCC 16.1.1 20260501 (Red Hat 16.1.1-1) x86-64
when Emacs is configured with --enable-gcc-warnings.
Problem discovered with GCC 16.1.1 -fsanitize=undefined.
* src/fns.c (maybe_resize_hash_table): Avoid undefined
behavior when h->key_and_value or h->hash are null pointers,
in which case we call memcpy (destination, NULL, 0)
which has undefined behavior in C89 through C23.
* src/emacs-module.c (module_bignum_count_max):
Now of type ptrdiff_t, instead of likely being of type size_t.
(module_extract_big_integer): Omit now-unnecessary prefix +, a
now-unnecessary eassert against PTRDIFF_MAX, and and an
unnecessary cast to ptrdiff_t.
* src/comp.c (emit_static_object): Avoid an malloc/free of
a 1 KiB buffer; just put it on the stack. Use strnlen+mempcpy
instead of strncpy as there is no need to zero-fill buff.
Use int for values that must fit in int since we are
passing them to gcc_jit_context_new_rvalue_from_int.
Problem discovered with GCC 16.1.1 -fsanitize=undefined.
* src/data.c (Fash): Don’t left-shift a negative number;
behavior is undefined (ISO C23 § 6.5.8 ¶ 4).
This ensures that if the child process closed its stdin and Emacs tries
to write to it, the process can still do any remaining work and exit
normally. In practice, this can occur with commands like "head(1)"
(bug#79079).
* src/fileio.c (file_for_stream): New function, extracted from...
(Fset_binary_mode): ... here.
(Ffile__close_stream): New function.
* src/process.c (send_process): When encountering EPIPE, only close the
fd for the pipe to the child process's stdin.
* lisp/eshell/esh-io.el (eshell-output-object-to-target): Don't check
for process liveness anymore.
* test/src/process-tests.el (process-tests/broken-pipe): New function.
(process-tests/broken-pipe/pipe, process-tests/broken-pipe/pty)
(process-tests/broken-pipe/pipe-stdin)
(process-tests/broken-pipe/pty-stdin): New tests.
* etc/NEWS: Announce this change.
* src/lisp.h (SAFE_ALLOCA_LISP_EXTRA): Remove. It is no longer
used, it makes life more difficult in the feature/igc3 branch,
and having it around tempted me to start using it again.
* src/editfns.c (styled_format): Don’t call SAFE_ALLOCA_LISP_EXTRA,
as this makes life more difficult in the feature/igc3 branch.
Also, allocate another byte for the format string trailing '\0',
so that we don’t rely in the str2num trick with trailing '\1'.
Problems reported by Pip Cet (Bug#81057#32).
Also, check alloca size more exactly. Ameliorate the extra
conditional branches by doing all the internal size calculations
before a conditional branch on overflow.
Problem reported by Helmut Eller (Bug#81057).
On x86-64 this patch shrinks USEFUL_PRECISION_MAX
from 16382 to 1074, SPRINTF_BUFSIZE from 21318 to 1386,
and sizeof initial_buffer from 22318 to 2386.
This also fixes a problem reported privately by Pip Cet:
exactly formatting the smallest positive IEEE double 2**-1074
with %f needs %.1074f and 1074 is DBL_MANT_DIG - DBL_MIN_EXP,
not merely 1 - DBL_MIN_EXP.
* src/editfns.c (USEFUL_PRECISION_MAX, SPRINTF_BUFSIZE):
Base these on double, not long double, since long double
is not the worst case (it is used only for converted u?intmax_t).
(USEFUL_PRECISION_MAX): Add DBL_MANT_DIG - 1 as per Pip Cet.
* src/editfns.c (styled_format): Streamline allocation of
auxiliary tables, by allocating them all in one go
rather than via separate alloca / mallocs.
cf96e9cb5a ; Fix byte-compilation warnings in non-Tree-Sitter builds
23575adc7b ; * doc/lispref/variables.texi (Local Variables): Fix typ...
8b6fb2f646 ; * doc/lispref/variables.texi (Local Variables): Fix 'na...
d3c72b8389 ; * src/xdisp.c (display_line): Fix commentary (bug#80693).
a981517b72 Fill margins with 'margin' face on truncated screen lines
8e37499035 ; * doc/lispref/os.texi (Init File): Fix markup (bug#81049).
f4c326c378 ; * src/sfnt.c (sfnt_read_cmap_format_12): Assert there's...
bf89ee6d07 ; * etc/PROBLEMS: Cursor not shown on Windows with system...
20500d6200 ; htmlfontify: Handle 'reset' face attribute value (bug#8...
d0d657fa90 ; Minor Tramp cleanup
93ea0d7d28 ; Improve documentation of VC commands in Dired
318084829c Eglot: adjust reference to completion frontends in manual
2a166c2dbd Eldoc: display documentation in visual-line-mode
aba60ad0c5 Eglot: prefer markdown-ts-view-mode for markup rendering ...
689c3bd508 Use 'read-multiple-choice' in 'markdown-ts-mode' (bug#81027)
71809ee5df Fix 'markdown-ts-code-span' face (bug#81026)
286833e401 Add read-only 'markdown-ts-view-mode' (bug#81023)
b39c123490 Fix strikethrough in 'markdown-ts-mode' (bug#80991)
0be998d4bc Fix code-span in headings in 'markdown-ts-mode' (bug#80979)
a00beb3a31 Make 'markdown-ts-inline-images' buffer local and test fo...
a0c05029fd * etc/NEWS: Mention new user option tramp-propagate-emacs...
2e71d2c709 Propagate EMACSCLIENT_TRAMP to remote hosts with Tramp
ff96db93f2 keyboard-tests.el: Try and fix the failure on EMBA
ce3098752c doc: Remove long obsolete references to `package-initialize`
9bc04b001a vc-next-action: Call vc-delete-file on FILESET-ONLY-FILES
13039e3442 ; touch-up last commit: copyright and comments
c2a24dcec8 ; update msys2 build helper for Emacs 31 & UCRT
3630baae72 hideshow: Support new 'margin' face for margin indicators...
20d17df3f4 Use the new 'margin' face in Flymake (bug#80693)
07f2bbc905 vc-dir-resynch-file: Pass down non-truename'd FILE
* 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.