1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-02-03 14:10:47 -08:00
Commit graph

50682 commits

Author SHA1 Message Date
Stefan Monnier
888dc2a0b5 Reject invalid error symbols (Bug#76447)
* src/eval.c (signal_or_quit): Signal an error if 'signal' gets called
with an invalid error symbol.
2025-08-17 17:26:09 +02:00
Eli Zaretskii
034d755f2f ; * src/process.c (set_proc_thread): Fix assertion. 2025-08-16 13:28:52 +03:00
Eli Zaretskii
c93be71e45 Make sure 'make-process' locks the process to the current thread
* src/process.c (set_proc_thread): New function.
(Fset_process_thread, create_process): Use it.
2025-08-16 13:01:01 +03:00
Spencer Baugh
37325ed5a9 Zero fd_callback_info when deleting an fd
.waiting_thread and .thread could be left set to non-NULL values
in a deleted fd_callback_info entry.  These would never be
cleared by e.g. clear_waiting_thread_info since that only clears
fd_callback_info entries up to max_desc.  Clear fd_callback_info
entirely when deleting an entry.

* src/process.c (clear_fd_callback_data): Add.
(delete_write_fd, delete_keyboard_wait_descriptor): Call
clear_fd_callback_data. (bug#79201)
(delete_read_fd): Remove duplicated clearing code.
(deactivate_process): Remove duplicate recompute_max_desc.
2025-08-16 12:51:35 +03:00
Juri Linkov
0ac3a1f26c New user option 'treesit-enabled-modes' (bug#79180)
* lisp/treesit.el (treesit-enabled-modes): New user option.
* src/treesit.c (treesit-major-mode-remap-alist): New variable.

* lisp/progmodes/c-ts-mode.el:
* lisp/progmodes/csharp-mode.el:
* lisp/progmodes/java-ts-mode.el:
* lisp/progmodes/js.el:
* lisp/progmodes/json-ts-mode.el:
* lisp/progmodes/ruby-ts-mode.el:
* lisp/progmodes/sh-script.el:
* lisp/textmodes/css-mode.el:
* lisp/textmodes/mhtml-ts-mode.el:
* lisp/textmodes/toml-ts-mode.el:
Add ts-mode mapping to 'treesit-major-mode-remap-alist'
for ts-modes that already have the corresponding non-ts mode
association in 'auto-mode-alist'.

* lisp/progmodes/cmake-ts-mode.el (cmake-ts-mode-maybe):
* lisp/progmodes/dockerfile-ts-mode.el (dockerfile-ts-mode-maybe):
* lisp/progmodes/elixir-ts-mode.el (elixir-ts-mode-maybe):
* lisp/progmodes/go-ts-mode.el (go-ts-mode-maybe)
(go-mod-ts-mode-maybe, go-work-ts-mode-maybe):
* lisp/progmodes/heex-ts-mode.el (heex-ts-mode-maybe):
* lisp/progmodes/lua-ts-mode.el (lua-ts-mode-maybe):
* lisp/progmodes/php-ts-mode.el (php-ts-mode-maybe):
* lisp/progmodes/rust-ts-mode.el (rust-ts-mode-maybe):
* lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode-maybe)
(tsx-ts-mode-maybe):
* lisp/textmodes/markdown-ts-mode.el (markdown-ts-mode-maybe):
* lisp/textmodes/yaml-ts-mode.el (yaml-ts-mode-maybe):
Add a wrapper function to 'auto-mode-alist'
for ts-modes that have no corresponding non-ts mode.
Also add a mapping to 'treesit-major-mode-remap-alist'
for the case when a non-ts mode is installed from an external
source to be able to customize it with 'treesit-enabled-modes'.
2025-08-14 19:40:08 +03:00
Michael Albinus
40e4394f87 Fix file notification problem on Windows.
* src/inotify.c (inotify_callback): Set event.frame_or_window to Qnil.

* src/keyboard.c (make_lispy_event): Make a better check for the
HAVE_W32NOTIFY case when creating a Qfile_notify event.
2025-08-12 22:05:44 +02:00
Dr.Sc.KAWAMOTO,Takuji
5b9f4ee76e Fix NS frame position update after resize/move
Fixes bug#74074, bug#79164.

* src/nsterm.m ([EmacsView windowDidEndLiveResize:]):
([EmacsView updateFramePosition]): New functions.
([EmacsView windowDidMove:]): Move contents of this function into
updateFramePosition and call it.

Copyright-paperwork-exempt: yes
2025-08-11 21:54:58 +01:00
Dmitry Gutov
fd5866cae4 ; Coding style fix 2025-08-11 02:33:53 +03:00
Dmitry Gutov
07eb39f113 Allow thread's buffer to be killed, by default
* src/thread.c (Fmake_thread): Add new argument (bug#76969).
(thread_set_error): New function, extracted from thread-signal.
(Fthread_buffer_disposition): Add getter.
(Fthread_set_buffer_disposition): And setter.
(thread_check_current_buffer): Check the values of threads'
buffer_disposition.
(thread_all_before_buffer_killed): New function.
(init_threads): Set buffer_disposition to nil for the main thread.
(syms_of_threads): Add new symbols and define the error.

* src/thread.h (thread_state): New field buffer_disposition.
(thread_all_before_buffer_killed): Declare.

* src/buffer.c (Fkill_buffer): Call thread_check_current_buffer
one more time after all hooks and after that call
thread_all_before_buffer_killed.

* src/comp.c (ABI_VERSION): Increase the value.

* test/src/thread-tests.el (thread-buffer-disposition-t)
(thread-buffer-disposition-nil)
(thread-buffer-disposition-silently)
(thread-set-buffer-disposition)
(thread-set-buffer-disposition-main-thread): New tests.

* doc/lispref/threads.texi (Basic Thread Functions): Document
buffer-disposition in make-thread and its getter and setter.

* etc/NEWS: Add entry.
2025-08-09 22:40:07 +03:00
Eli Zaretskii
9748c13208 ; Fix last change
* src/print.c (print_create_variable_mapping): Add back the wrong
spelling as compatibility measure (bug#75784).
2025-08-09 15:38:13 +03:00
Zach Shaftel
581447cd25 Improve Vprint_variable_mapping
* src/print.c (print_create_variable_mapping): Fix a typo,
`unreadeable-function' to `unreadable-function'. Add `symbols-bare'
as an override for `print-symbols-bare'.  (Bug#79161)
2025-08-09 15:34:51 +03:00
Manuel Giraud
4c9ac95cb0 Variable to control overshoot and backup for TTY cursor motion
* src/term.c (syms_of_term): New variable.
* src/cm.c (calccost): Control overshooting with new variable.
* etc/NEWS: Document new variable.
* lisp/term/rxvt.el (terminal-init-rxvt): Force no TAB+BS for
rxvt.  (Bug#78474)
2025-08-09 15:27:00 +03:00
Po Lu
533da29545 ; * src/android.c (android_url_encode): Typo in comment. 2025-08-09 09:28:00 +08:00
Eli Zaretskii
e9fe0ebae0 ; Fix last change
* src/eval.c (Fdebugger_trap): Minor wording changes in doc
string.

* etc/DEBUG: Some copyedits of a recently-added text.
2025-08-07 16:38:02 +03:00
Jeremy Bryant
caa6bc95c1 New debugger-trap function to break to GDB
* src/eval.c: new primitive debugger-trap
* src/.gdbinit: set breakpoint to Fdebugger_trap
* etc/DEBUG: document it.
Remove suggestion to use Fredraw_display.

This do-nothing primitive gives control to GDB, and for debugging
convenience a breakpoint is set by default in .gdbinit.
2025-08-07 16:26:17 +03:00
Martin Rudalics
2d2755c3d7 Handle inhibiting implied resizing for frames without initial tool bar
* src/xfns.c (x_set_tool_bar_lines, x_change_tool_bar_height)
* src/pgtkfns.c (x_change_tool_bar_height)
(pgtk_set_tool_bar_lines): Set f->tool_bar_resized to true so
inhibiting implied resizing works for frames without initial
tool bar too.  See the thread
https://lists.gnu.org/archive/html/emacs-devel/2025-08/msg00034.html.
2025-08-05 11:08:38 +02:00
Paul Eggert
c935b68bed Port better to Linux with 1 MiB pages
* src/lisp.h: Include <sys-limits.h>.
(MAX_RW_COUNT): Remove, as it is the same thing as sys-limits.h’s
SYS_BUFSIZE_MAX.  All uses replaced by SYS_BUFSIZE_MAX.
2025-08-02 11:19:24 -07:00
Rudolf Adamkovič
6e1054a40b NS: Correct the accessibility role of Emacs windows (bug#77062)
Make the accessibility role of Emacs windows to be "standard
window" (AXWindow) instead of "text field" (AXTextField).  This matches
other applications on NS, as can be verified with any accessibility
inspector.  All widely used NS ports, such as Emacs Plus, have this
patch already applied. As for practical impact, this change makes Emacs,
for example, work with tiling window managers, such as Yabai, where many
users report problems with Emacs specifically, and are instructed to
simply avoid the official NS port of GNU Emacs due to this problem.

* src/nsterm.m: ([EmacsWindow accessibilityAttributeValue:]): Make the
accessibility role of Emacs windows to be "standard window" (AXWindow)
instead of "text field" (AXTextField).
2025-07-31 22:14:39 +01:00
Mattias Engdegård
95be144994 Refactor reader to use readbuf_t in more places
Simplify the code by using the already existing dynamic string buffer
type.  This is a refactoring; performance isn't measurably affected.

* src/lread.c (grow_read_buffer): Dissolve into...
(readbuf_grow): ...here, simplifying the code.
(add_char_to_buffer): Check for growth before adding char, not after.
(read_integer, read_string_literal): Use readbuf_t.
2025-07-30 11:04:12 +02:00
Mattias Engdegård
2d18878b96 Move keyboard input functions from lread.c to keyboard.c
These have nothing to do with the Lisp reader at all.

Suggested by Lynn Winebarger (bug#79035).

* src/lread.c (read_filtered_event, Fread_char, Fread_event)
(Fread_char_exclusive, Qascii_character): Move...
* src/keyboard.c: ...here.
* test/src/lread-tests.el (test-inhibit-interaction): Move...
* test/src/keyboard-tests.el (keyboard-inhibit-interaction): ...here.
2025-07-30 11:04:11 +02:00
Mattias Engdegård
5a9cbf24ec ; * src/bytecode.c: remove unneeded includes 2025-07-30 11:04:11 +02:00
Paul Eggert
354f9ba754 Disable Gnulib’s non-Gregorian calendars
Prepare for the next Gnulib merge by disabling the optional
support for non-Gregorian calendars recently added to Gnulib’s
nstrftime module.  This would be tricky to integrate with Emacs,
as Emacs has its own (much fancier) calendar system, one that at
least for the Persian calendar sometimes disagrees with Gnulib’s,
and it’s likely not worth the trouble of reconciling the conflicts.
* src/conf_post.h (SUPPORT_NON_GREG_CALENDARS_IN_STRFTIME):
New macro, defined to false.
* admin/merge-gnulib (GNULIB_MODULES): nstrftime → nstrftime-limited.
(AVOIDED_MODULES): Add localcharset.
Near the end, also remove the files lib/calendar-ethiopian.h,
lib/calendar-persian.h, lib/calendar-thai.h, lib/calendars.h.
2025-07-29 15:06:13 -07:00
Eli Zaretskii
4035bfa542 ; * src/pdumper.c (dump_buffer): Update HASH_buffer. 2025-07-28 19:51:06 +03:00
Eli Zaretskii
aef2d807e7 ; * src/emacs.c (default_PATH) [DOS_NT]: Add commentary. 2025-07-27 18:45:03 +03:00
Paul Eggert
64c93e188e Better default PATH on MS-Windows
* src/emacs.c (default_PATH): Use a more-reasonable default
for MS-Windows and DOS.  Problem reported by Eli Zaretskii in:
https://lists.gnu.org/r/emacs-devel/2025-07/msg00384.html
2025-07-27 08:17:25 -07:00
Po Lu
9d2c7bed66 Update Android frame param handlers
* src/androidfns.c (android_frame_parm_handlers): Add
gui_set_borders_respect_alpha_background for consistency with X.
2025-07-27 09:36:10 +08:00
Paul Eggert
547525176f Add readlink, realpath startup comments
This does not change behavior.
* src/emacs.c (follow_if_symlink): New static function, as a
vehicle for commentary explaining the deal with readlink and realpath.
(find_emacs_executable): Use it.
2025-07-26 12:52:55 -07:00
Eli Zaretskii
05dca1f51f ; * src/w32fns.c (Fx_create_frame): Fix copy/paste errors in last change. 2025-07-26 18:08:37 +03:00
Garklein
1bc338075d Add frame parameter which allows border transparency
The new 'borders-respect-alpha-background' frame parameter, when
set to 't', will make window dividers and internal borders
respect the 'alpha-background' frame parameter. This allows
transparent gaps between windows.
* doc/lispref/frames.texi (Font and Color Parameters):
Document the change.
* src/frame.c (frame_parm_table, syms_of_frame)
(gui_set_borders_respect_alpha_background):
* src/frame.h (struct frame): Add frame parameter.
* src/androidfns.c (x_create_frame, android_create_tip_frame)
(android_frame_parm_handlers):
* src/haikufns.c (haiku_create_frame, haiku_create_tip_frame)
(haiku_frame_parm_handlers):
* src/nsfns.m (ns_frame_parm_handlers, x_create_frame):
* src/w32fns.c (x_create_frame, w32_create_tip_frame)
(w32_frame_parm_handlers): Add dummy parameters for backends
that don't support opacity.
* src/pgtkfns.c (pgtk_frame_parm_handlers, x_create_frame)
(pgtk_create_tip_frame):
* src/pgtkterm.c (pgtk_draw_window_divider):
* src/xfns.c (x_create_frame, x_create_tip_frame)
(x_frame_parm_handlers)
* src/xterm.c (x_draw_window_divider)
(x_clear_under_internal_border): Implement parameter on backends
that support opacity.
2025-07-26 18:02:18 +03:00
Po Lu
aa2a83d783 ; * src/nsterm.m (ns_define_fringe_bitmap): Stylistic corrections. 2025-07-26 22:03:37 +08:00
Alan Third
5bc75585d5 Fix last commit
* src/nsterm.m (ns_draw_fringe_bitmap): Rename clearRect to bmpRect
where missed previously.
2025-07-26 12:59:10 +01:00
Alan Third
e3380669ed Fix incorrectly nested ns_focus/ns_unfocus calls
* src/nsterm.m (ns_draw_fringe_bitmap): Move the call to ns_focus out of
the if for overlay_p and rename the rect from clearRect to bmpRect to
make it's purpose clearer.
2025-07-26 12:00:02 +01:00
Alan Third
8c5378b2c2 Simplify NS fringe vectors (bug#73563)
* src/nsterm.m (ns_define_fringe_bitmap): Replace the fringe bitmap
"tracing" method to a true tracing method.  This should make the
resulting vector simpler and therefore faster to draw.
2025-07-26 12:00:02 +01:00
Alvaro Ramirez
6e64e0bd26 Enabled macOS dictation post NSTextInputClient migration in v30
* src/nsterm.m (selectedRange): Implement to fix dictation.
* etc/NEWS: Announce regression fix.
* etc/PROBLEMS: Help users recover from rejected permission.
2025-07-26 12:09:56 +02:00
Mattias Engdegård
33161e51e5 Check for end-of-file when reading character escapes (bug#79097)
* src/lread.c (read_char_escape): Add check.
* test/src/lread-tests.el (lread-char-escape-eof): New test.
2025-07-25 21:54:59 +02:00
Paul Eggert
c403bc4d51 Streamline init_callproc a bit
* src/callproc.c (init_callproc): Don’t bother testing for the
existence of ../src/ and NEWS if installation-directory is
non-nil, because in that case we will test for ../etc/NEWS anyway.
Simplify by using AUTO_STR.
2025-07-24 22:13:47 -07:00
Paul Eggert
d7e8186080 Refactor to allow nameless auto strings
* src/lisp.h (AUTO_STR, AUTO_STR_WITH_LEN): New macros.
Long ago this sort of thing would have been a no-no
because we needed to GCPRO the strings.
However, GCPRO went away a decade ago.
2025-07-24 22:13:47 -07:00
Paul Eggert
eb9ec79c13 PATH defaults now act more like GNU and POSIX
When PATH is unset or empty, use the system default,
to be consistent with GNU/Linux and with POSIX.
If there is no system default do not default to "."
as that can be dangerous.
* src/callproc.c (init_callproc_1, init_callproc):
Default PATH to the null pointer, not the empty string.
* src/emacs.c (default_PATH): New function.
(find_emacs_executable, decode_env_path): Be consistent with POSIX
and with glibc about what to do when PATH is unset or empty.
2025-07-24 22:13:47 -07:00
Paul Eggert
d59fe6dad5 Treat ‘.../emacs’ like ‘emacs’ in realpath startup
* src/emacs.c (find_emacs_executable): If the executable name
contains a slash, use the same optimization for symlink resolution
that we already use when the executable name has no slash.
2025-07-24 22:13:47 -07:00
Paul Eggert
67ea9485a6 Prefer readlink to lstat in find_emacs_executable
* src/emacs.c (find_emacs_executable): Prefer readlink to lstat
when testing whether a file is a symlink.  This avoids EOVERFLOW
issues.
2025-07-24 22:13:47 -07:00
Paul Eggert
670603533c Fix minor memory leak in find_emacs_executable
* src/emacs.c (find_emacs_executable): Free candidate if unused.
2025-07-24 22:13:47 -07:00
Paul Eggert
e026b57f07 Don’t read before BEG in insert-file-contents
* src/fileio.c (Finsert_file_contents): Don’t sample bytes before BEG.
Give up optimizing if the file size shrinks to less than BEG.
2025-07-23 17:55:15 -07:00
Paul Eggert
4c79154949 Simplify file end finding in insert-file-contents
* src/fileio.c (Finsert_file_contents): Don’t give up finding the
file’s end merely because SEEK_END fails.  Try a small test read
anyway.  This might work in non-POSIX file systems where SEEK_END
is not allowed, and trying is easy and simplifies the code.
2025-07-23 17:55:15 -07:00
Gerd Möllmann
2d1d1f31df NS: Fix build with NSTRACE_ENABLED
* src/nsterm.h (NSTRACE_MSG_NO_DASHES): Use
nstrace_enabled_global.
* src/nsterm.m: ([EmacsView performDragOperation:]): Don't use
an NSString.
2025-07-23 11:59:23 +02:00
Gerd Möllmann
f177537f70 NS: Use different window collection behavior for tooltips (bug#73037)
* src/nsterm.m ([EmacsView updateCollectionBehavior]):
Use NSWindowCollectionBehaviorFullScreenAuxiliary for non-native
tooltips which are not child frames.
2025-07-23 06:26:45 +02:00
Paul Eggert
eb488e1bba insert-file-contents respect END better
This fixes some longstanding bugs, along with bugs recently
introduced as part of fixes for Bug#77315.
* src/fileio.c (Finsert_file_contents): Arrange for END_OFFSET
to never be less than BEG_OFFSET, to simplify the code.
Do not go past END_OFFSET when sampling or optimizing reading.
Avoid a few unnecessary lseeks.
2025-07-21 16:23:18 -07:00
Paul Eggert
8393e469e7 insert-file-contents shrinking Solaris file fix
This is related to recent fixes for Bug#77315.
* src/fileio.c (Finsert_file_contents): Defend against
a file shrinking to be smaller than its initial offset.
This can happen only on platforms like Solaris where
the initial offset can be positive.
2025-07-21 16:23:18 -07:00
Paul Eggert
e879533f4b Refactor insert-file-contents overlap check
* src/fileio.c (Finsert_file_contents):
Simplify and clarify file overlap check.
2025-07-21 16:23:18 -07:00
Paul Eggert
adbae4f92f insert-file-contents refactor xlseek
* src/fileio.c (xlseek): New arg WHENCE.  All uses changed.
This generalizes xlseek and should simplify future changes.
2025-07-21 16:23:18 -07:00
Paul Eggert
d04182d52a Say why quit is captured in insert-file-contents
* src/fileio.c (Finsert_file_contents): Add comment.
2025-07-21 16:23:18 -07:00