1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-30 20:32:00 -08:00
Commit graph

50757 commits

Author SHA1 Message Date
Martin Rudalics
2c4e7a99cc Handle resizing of fullscreen frames more consistently (Bug#79704)
* src/frame.c (adjust_frame_size): Honor new option
'alter-fullscreen-frames'.
(syms_of_frame) <alter-fullscreen-frames>: New option to
maintain consistent state when attempting to resize fullscreen
frames.  Default to 'inhibit' for NS builds because these
resized the frame while leaving the 'fullscreen' parameter alone
(Bug#79704).
(syms_of_frame) <Qinhibit>: Define symbol.
* lisp/cus-start.el (standard): Add customization options for
'alter-fullscreen-frames'
* doc/lispref/frames.texi (Frame Size): Describe new option
'alter-fullscreen-frames'.
* etc/NEWS: Call out new option 'alter-fullscreen-frames'.
2025-11-02 09:24:05 +01:00
Ahmed Khanzada
dd9d1df4fa Automatically toggle between dark and light mode PGTK widgets
* src/gtkutil.h: Declare 'xg_set_gtk_theme_dark_mode',
'xg_update_dark_mode_for_all_displays',
'xg_set_initial_dark_mode'.
* src/gtkutil.c (xg_set_gtk_theme_dark_mode): Toggle PGTK dark mode.
(xg_update_dark_mode_for_all_displays): Toggle PGTK dark mode for all
displays.
(xg_set_initial_dark_mode): Determine PGTK dark mode preference and set.
(xg_create_frame_widgets): Set PGTK dark mode preference for widgets.
(xg_create_frame_outer_widgets): Set PGTK dark mode preference for outer
widgets.
* src/xsettings.h: Declare 'xg_get_system_dark_mode'.
* src/xsettings.c (something_changed_gsettingsCB): Update PGTK dark mode
setting.
(xg_get_system_dark_mode): Determine PGTK dark mode preference.
GSETTINGS_COLOR_SCHEME: Defined and set to "color-scheme".
* etc/NEWS: Document automatic dark mode toggling.
(Bug#79689)
2025-11-02 08:01:41 +02:00
Eli Zaretskii
1930598225 Avoid infinite recursion in 'face_inheritance_cycle'
* src/xfaces.c (face_inheritance_cycle)
(Finternal_set_lisp_face_attribute): Prevent infinite recursion if
a face is defined to inherit from itself (whaaat? how??!).
2025-10-31 17:24:58 +02:00
Martin Rudalics
7da7b246cf Fix a bug in Fcombine_windows
* src/window.c (window_set_parent_and_normal_sizes): New function.
(Fcombine_windows): Improve doc-string.  Use wset_... functions.
Call window_set_parent_and_normal_sizes to fix a bug where it
failed to assign new normal sizes.
(Funcombine_window): Call window_set_parent_and_normal_sizes.
2025-10-31 09:17:38 +01:00
Eli Zaretskii
55d4596dd0 ; * src/lisp.h (MAX_ALLOCA): Comment on enlarging the value. 2025-10-31 08:39:36 +02:00
Eli Zaretskii
1472f8241d ; * src/xfaces.c (face_inheritance_cycle): More defensive code. 2025-10-29 19:26:40 +02:00
Eli Zaretskii
23d8633579 Avoid face inheritance cycles
* src/xfaces.c (face_inheritance_cycle): New function.
(Finternal_set_lisp_face_attribute): Signal an error if the
':inherit' attribute of a face is modified in a way that will
cause it to inherit from itself.  (Bug#79672)

* test/src/xfaces-tests.el (xfaces-test-circular-inheritance): New
test.

* etc/NEWS: Announce the incompatible change.
2025-10-27 15:54:10 +02:00
Eli Zaretskii
42ac31133e ; Remove unintended hunks from last changeset. 2025-10-25 13:06:42 +03:00
Eli Zaretskii
f20eed46f9 ; Fix last change (bug#79629)
* lisp/calendar/holidays.el (holiday-general-holidays)
(holiday-oriental-holidays, holiday-local-holidays)
(holiday-other-holidays, holiday-hebrew-holidays)
(holiday-christian-holidays, holiday-islamic-holidays)
(holiday-bahai-holidays, holiday-solar-holidays): Doc fixes.
2025-10-25 10:38:07 +03:00
João Távora
f47824106a Prevent shorthand inheritance when loading .elc files (bug#79485)
Loading .elc files doesn't go through 'load-with-code-conversion' as
usual, but since these files are still 'read', we must still take care
to bind read-symbol-shorthands to nil around that.  The process is
simpler than in 'load-with-code-conversion' because .elc files cannot
have read-symbol-shorthands cookies, so the binding is always to nil.
If we don't do this, the symbols in the .elc will be subject to
shorthand manipulation if there's an active binding in the recursive
load stack.

* src/lread.c (readevalloop): Bind read-symbol-shorthands to nil.
(syms_of_lread): Add Qread_symbol_shorthands.
2025-10-23 22:35:32 +01:00
Pranshu Sharma
db6ac3c5f4 New commands to split and merge frames
* lisp/window-x.el (merge-frames, split-frame): New commands.
2025-10-23 10:04:39 +02:00
Eli Zaretskii
100963b492 ; * src/frame.c (frame_get): Fix a thinko. 2025-10-22 19:03:53 +03:00
Alan Mackenzie
1a75481932 Allow renaming of frames to F<num> on text terminals
This fixes bug#79649.  Creating duplicate names F<num> is
prevented, ensuring that select-frame-by-name is still
effective on text terminals.

* src/frame.c (frame_get, frame_next_F_name): New functions.
(make_terminal_frame): Use frame_next_F_name.
(set_term_frame_name): In place of disallowing F<num>, check
that the requested F<num> doesn't already exist.

* etc/NEWS (Frames): Add an entry for this amendment.
2025-10-22 12:44:34 +00:00
Mattias Engdegård
6a3d22f3a0 ; * src/lisp.h (struct Lisp_String): mention terminating NUL 2025-10-22 09:03:38 +02:00
Mattias Engdegård
498f89af2a Don't feed the stack overflow detector bad data
* src/lisp.h (record_in_backtrace): Don't record the argument address as
stack_top because most of the time it won't be on the C stack at all.
* src/eval.c (eval_sub): Do it here instead using an address guaranteed
to be on the C stack and we are just in the Lisp interpreter anyway.
2025-10-20 17:53:48 +02:00
Mattias Engdegård
04cb852c13 ; * src/bytecode.c (exec_byte_code): editing mistake (thanks Pip!) 2025-10-19 15:14:20 +02:00
Mattias Engdegård
346213f883 Disable -Wclobbered for GCC in exec_byte_code (bug#79610)
* src/bytecode.c (exec_byte_code):
Disable the -Wclobbered warning for GCC locally as the old work-around
doesn't appear to be effective for variables with explicitly assigned
registers.  This also allows us to remove that work-around which
improves the code somewhat.
2025-10-19 15:09:01 +02:00
Mattias Engdegård
076307b163 ; exec_byte_code: refactor branch case 2025-10-19 14:57:34 +02:00
Mattias Engdegård
ae673ce20c exec_byte_code: use fixed registers for top and pc (bug#79610)
GCC seems to have difficulty allocating important global interpreter
variables in registers; telling it which ones to use for 'top' and 'pc'
makes a big difference and seems to ease pressure enough for it to
deal with other variables as well.

We do it for AMD64 and ARM64.  Clang doesn't seem to need these directives.
It does result in -Wclobbered warnings that seem difficult to silence.

* src/bytecode.c (BC_REG_TOP, BC_REG_PC): New.
(exec_byte_code): Use them.
2025-10-19 14:57:34 +02:00
Mattias Engdegård
fbc68bbc36 ; exec_byte_code: don't re-use op in FETCH2 2025-10-19 14:57:34 +02:00
Mattias Engdegård
b72e352cb4 exec_byte_code: reduce use of semi-global 'op' (bug#79610)
* src/bytecode.c (exec_byte_code):
Re-type op from int to ptrdiff_t, which avoids some useless conversions.
Reduce its use by using local variables for intra-block use,
and another variable (arg) where it doesn't need to be alive across
instruction dispatch.  We also eliminate it where performance doesn't
matter by re-fetching it from the instruction stream.

All this should help the register allocator.
2025-10-19 14:57:34 +02:00
Spencer Baugh
bea16dfe69 Respect keymaps in buffer text for clicks on displayed strings
When clicking on a string displayed by a display property, also
look at the text properties of the underlying buffer text for
keymaps, not just the displayed string.  The displayed string
takes precedence over the buffer text, but it doesn't replace
it.

Also, we should use the buffer's local map even for clicks on
the mode line.  (Otherwise, what's the point of the <mode-line>
event?)

* src/keymap.c (Fcurrent_active_maps): Consider displayed
string, then buffer text, then fall back to local
map.  (Bug#79505)

* test/src/keymap-tests.el
(keymap-test-keymaps-for-non-buffer-positions): Add more tests.
2025-10-18 12:48:41 +03:00
Eli Zaretskii
0d8a31423a ; Fix documentation of a recent commit
* src/window.c (Fcombine_windows, Funcombine_window): Doc fixes.

* doc/lispref/windows.texi (Recombining Windows): Fix markup and
wording.
2025-10-18 12:26:28 +03:00
Martin Rudalics
ef2b032567 Add functions 'combine-windows' and 'uncombine-window'
* src/window.c (make_parent_window, Fcombine_windows)
(Funcombine_window): New functions.
(Fsplit_window_internal): Use make_parent_window.
* doc/lispref/windows.texi (Recombining Windows): Describe new
functions 'combine-windows' and 'uncombine-window'.
(Window Configurations): Explain "window clones".
* etc/NEWS: Mention new functions 'combine-windows' and
'uncombine-window'.
2025-10-18 10:33:10 +02:00
Przemysław Alexander Kamiński
7de5a6d1f7 Release NS objects (bug#79023)
* src/nsterm.m (ns_free_frame_resources): Release the NSView.
([EmacsView dealloc]): Release the EmacsLayer and menu.
([EmacsWindow dealloc]): Fix the toolbar release.

Co-authored-by: Rudolf Adamkovič <rudolf@adamkovic.org>
2025-10-17 19:53:38 +01:00
Eli Zaretskii
d587ce8c65 Support Tree-sitter version 0.26 and later
* src/treesit.c (init_treesit_functions)
[TREE_SITTER_LANGUAGE_VERSION >= 15]: Define prototype for, and
load 'ts_language_abi_version' instead of the deprecated (and
removed in tree-sitter 0.26) 'ts_language_version'.
(ts_language_abi_version) [TREE_SITTER_LANGUAGE_VERSION >= 15]:
Define on WINDOWSNT, instead of 'ts_language_version'.
(treesit_language_abi_version): New compatibility function.
(treesit_load_language, Ftreesit_language_abi_version): Use
'treesit_language_abi_version' instead of 'ts_language_version'.
(Bug#79627)
2025-10-17 14:15:41 +03:00
Spencer Baugh
17ac50ea9e Return case common to all completions in try-completion
When completion-ignore-case is non-nil, if all completions share
a common prefix ignoring case, try-completion has always
returned that.  Now, if all completions also share a common
prefix including case, try-completion includes that common
prefix in its return value (bug#79377).

* lisp/minibuffer.el (completion-pcm--merge-completions): Always
use return value from try-completion, which may change case.
* src/minibuf.c (Ftry_completion): Return the common prefix
which changes case.
* test/lisp/minibuffer-tests.el (completion-pcm-bug4219)
(completion-substring-test-5): New tests.
2025-10-16 20:18:23 +03:00
Eli Zaretskii
dcea973c04 Fix MS-Windows tray notifications from different Emacs frames
* src/w32fns.c (EMACS_TRAY_NOTIFICATION_ID_INIT): Rename from
EMACS_TRAY_NOTIFICATION_ID; all users adjusted.
(last_tray_notification_id): New static variable.
(add_tray_notification): Advance 'last_tray_notification_id' for
each new notification; wrap around to the fixed initial value when
reached the maximum.  This allows Lisp programs track notifications
and remove them from the same frame from which they were created.
(Fw32_notification_notify, Fw32_notification_close): Doc fixes.

* doc/lispref/os.texi (Desktop Notifications): Update the
documentation of 'w32-notification-notify' and
'w32-notification-close'.

Bug#79400
2025-10-11 14:00:09 +03:00
Eli Zaretskii
c723760f28 Merge from origin/emacs-30
1895ba3ba3 ; Document %i format
85db0ac0d6 ; * doc/lispref/nonascii.texi (Explicit Encoding): Fix a ...
c119a3600e ; * doc/lispref/tips.texi (Documentation Tips): Document ...

Also fix trailing whitespace in test files.
2025-10-11 06:02:56 -04:00
Eli Zaretskii
f8b4ce6843 Fix last change
At least on MS-Windows, the last change caused the
process-tests/fd-setsize-no-crash/make-process test to hang.
* src/process.c (wait_reading_process_output) [WINDOWSNT]: Do
not stop monitoring the process descriptor when zero bytes are
read.  The EOF indication from subprocesses on MS-Windows is
detected via an error condition (see w32.c), while zero-size
reads are not to be taken as such.  (Bug#79436)
2025-10-11 12:22:58 +03:00
Spencer Baugh
c172b6dded Stop monitoring fds after receiving EOF
When a subprocess closes its stdout/stderr pipe, that causes
pselect to always indicate that fd is readable, and read to
always return with EOF on that fd.  Therefore when we receive an
EOF we need to stop monitoring the fd.  Otherwise Emacs will
spin at 100% CPU, repeatedly reading that same EOF off the fd.

* src/process.c (wait_reading_process_output): When
'read_process_output' returns EOF indication, stop monitoring
the descriptor.  (Bug#79436)
2025-10-11 12:22:17 +03:00
Spencer Baugh
443af6fe1d Allow creating a pipe process without a buffer
Previously, even passing :buffer nil to make-pipe-process would
create a buffer.  Now, if you explicitly call (make-pipe-process
:buffer nil), it will create a pipe process without a buffer,
just like all the other process creation functions.

* src/process.c (Fmake_pipe_process): Check for explicit :buffer
nil and don't make a buffer. (bug#79596)
* doc/lispref/processes.texi (Asynchronous Processes): Update.
* test/src/process-tests.el
(process-test-make-pipe-process-no-buffer): Add test.
2025-10-11 12:14:10 +03:00
Eli Zaretskii
1895ba3ba3 ; Document %i format
* src/editfns.c (Fformat): Doc fix.

* doc/lispref/strings.texi (Formatting Strings): Document %i.
2025-10-11 12:08:48 +03:00
Sahil Kang
dc2650faa9 * src/pdumper.c (dump_queue_dequeue): Avoid -Wgnu-folding-constant.
Fixes bug#79581
Copyright-paperwork-exempt: yes
2025-10-11 11:58:58 +03:00
Eli Zaretskii
854690a9e3 * src/w32console.c: Fix last change (bug#79298). 2025-10-09 15:21:38 +03:00
Eli Zaretskii
5a70f5096e Fix text-terminal output with UTF-8 encoding on MS-Windows
* src/w32console.c (w32con_write_glyphs)
(w32con_write_glyphs_with_face): Support UTF-8 encoded text
better, by counting characters and using display columns, not
bytes, to move the cursor after writing the text.  (Bug#79298)
2025-10-09 12:07:57 +03:00
Martin Rudalics
1434bc97dc Run buffer-local window change functions in their buffers now
The buffer-local-versions of 'window-buffer-change-functions',
'window-size-change-functions',
'window-selection-change-functions' and
'window-state-change-functions' are now run with the respective
buffer temporarily current.  Also, the local version of
'window-buffer-change-functions' is run for the buffer removed
from the window too.

* src/window.c (run_window_change_functions_locally)
(run_window_change_functions_globally): New functions replacing
'run_window_change_functions_1'.
(run_window_change_functions): Run the buffer local versions of
these hooks in their respective buffers.  Run
'window-buffer-change-functions' for the buffer removed from the
window too.
(Vwindow_buffer_change_functions, Vwindow_size_change_functions)
(Vwindow_selection_change_functions)
(Vwindow_state_change_functions): Mention that the buffer-local
versions are run with their buffer temporarily current.
* doc/lispref/windows.texi (Window Hooks): Mention that
buffer-local-versions of window change functions are run with
their buffer temporarily current.  Also say that
'window-buffer-change-functions' will be run for removed buffer
too.
* etc/NEWS: Advertise changes for the buffer-local versions of
window change functions.
2025-10-06 10:27:27 +02:00
Eli Zaretskii
2c0cf894f4 Fix 'restart-emacs' on MS-Windows
* src/w32.c (w32_reexec_emacs): Reset undocumented bits in
STARTUPINFO flags.  Suggested by yhr0x43 <yhr0x43@gmail.com>.
(Bug#79554)
2025-10-02 10:22:37 +03:00
Paul Eggert
50ab62ad75 Use up-to-date time in wait_reading_process_output
In “Avoid duplicate calls to current_timespec” (2015-07-05)
we started caching current_timespec results in NOW.
However, this was buggy: we updated NOW only when the timeout was
nonzero, but the timeout can be set temporarily to zero in several
places in wait_reading_process_output (such as when checking for
process status changes), which would cause us to never update NOW
and therefore never detect that a timeout happened.

Also, this caching was wrong even in principle: since we call
Lisp code from wait_reading_process_output, substantial amounts
of time can pass, and we can be left using an outdated NOW and
incorrectly not time out.  Also, nowadays we can use
monotonic_coarse_timespec which is fast, and which is better
anyway because it’s immune to manual clock changes.

Co-authored-by: Spencer Baugh <sbaugh@janestreet.com>
* src/process.c (wait_reading_process_output):
Stop caching the current realtime.
Instead, use the coarse monotonic clock without caching.
2025-09-27 12:26:24 -07:00
Paul Eggert
5e06aa209b Prefer coarse timestamps when using X sync
They are good enough for this purpose, and are cheaper to get.
* src/timefns.c (monotonic_coarse_timespec): New function.
* src/xterm.c [HAVE_XSYNC && !USE_GTK && HAVE_CLOCK_GETTIME]:
(x_sync_current_monotonic_time): Use it.
(CLOCK_MONOTONIC): Remove; no longer uneeded here.
2025-09-27 12:26:24 -07:00
Andrea Corallo
0b9e96ce5e Make native lisp code reflect EQ C implementation
* src/comp.c (ABI_VERSION): Bump new version
	(comp_t): add 'eq'.
	(helper_link_table): add 'slow_eq'.
	(emit_slow_eq): New function.
	(emit_EQ): Rework to reflect EQ implementation.
	(declare_runtime_imported_funcs): Import 'slow_eq'.
	(Fcomp__init_ctxt): Register emitter 'emit_eq' for op code Qeq.

This and the previous 2 commits increase elisp-benchmarks performance by
3.6% on my test machine. Also a (small) reduction in eln size comes with
it.
2025-09-22 10:28:40 +02:00
Andrea Corallo
e7380934d0 * Make sure the compiler optimizes for symbols_with_pos_enabled 0 in EQ
* src/lisp.h (EQ): Make use '__builtin_expect'.
2025-09-22 10:28:40 +02:00
Pip Cet
020e2f5ddb Change EQ to move slow code path into a separate function
* src/data.c (slow_eq): New function.
    * src/lisp.h (EQ): Call it.
2025-09-22 10:28:40 +02:00
Eli Zaretskii
40adabe2ef Improve documentation of 'accept-process-output'
* doc/lispref/processes.texi (Accepting Output):
* src/process.c (Faccept_process_output): Document better the
meaning of the timeout of 'accept-process-output' a,d the fact
that it doesn't always return as soon as some output is available.
See https://lists.gnu.org/archive/html/emacs-devel/2025-08/msg00750.html
for more details.
2025-09-20 12:32:21 +03:00
Po Lu
2457934323 Fix reference leak in displaying successive dashes of distinct styles on Android
* src/android.c (android_set_dashes): Always release local
reference to dash array even when it was returned by
GetObjectField.
2025-09-20 10:08:05 +08:00
Mattias Engdegård
9f174f08d8 ; * src/bytecode.c (exec_byte_code): Revert gratuituous style change 2025-09-19 10:31:54 +02:00
Po Lu
fb15f86248 ; * src/bytecode.c (exec_byte_code): Fix coding style. 2025-09-19 09:28:17 +08:00
Mattias Engdegård
7d5633d0f4 * src/bytecode.c (exec_byte_code): Better quitcounter reset value.
This value forces a quit check at the next backward branch, to avoid
rare situations being hard to interrupt.
Suggested by Pip Cet.
2025-09-18 22:13:38 +02:00
Mattias Engdegård
0767f1818a Don't save quitcounter across longjmp in exec_byte_code
* src/bytecode.c (exec_byte_code): Reset quitcounter to 1 after longjmp;
the exact value isn't important.  This may reduce register pressure a
tiny bit or at least remove a useless stack slot.
2025-09-18 17:05:29 +02:00
Mattias Engdegård
de4ca2bdb1 Turn some checking macros into functions in the GC marker code
This rids us of a bunch of unhygienic macros with free variables and
makes the marking code actually readable again.  Even better, it is all
processed by the compiler even when the checks are disabled.

* src/alloc.c (CHECK_ALLOCATED, CHECK_LIVE, CHECK_ALLOCATED_AND_LIVE)
(CHECK_ALLOCATED_AND_LIVE_SYMBOL): Transform macros into...
(check_live, check_allocated_and_live, check_allocated_and_live_symbol)
(check_allocated_and_live_vectorlike): ...functions.  Callers adapted.
2025-09-17 12:49:14 +02:00