Commit graph

50399 commits

Author SHA1 Message Date
Po Lu
5176eeb300 ; Correct typos in commentary and error messages
* src/lisp.h (USE_LSB_TAG):

* src/pdumper.c (pdumper_load): Correct typos in commentary and
error messages.
2025-03-10 09:43:13 +08:00
Mauro Aranda
0861da138b Provide better completion for customizing frame parameters
* lisp/frame.el (frame--special-parameters): New const.
(frame--complete-parameter-value): New function.
(initial-frame-alist, minibuffer-frame-alist): Use them in
:type.  (Bug#39143)
* lisp/cus-start.el (default-frame-alist): Use them here as well.
* src/frame.c (frame_parms): Add comment to try to keep
frame--special-parameters updated.
2025-03-09 19:07:40 -03:00
Po Lu
a5f8ce9f1e Re-port to 32-bit systems without alignment primitives
* configure.ac (ALIGNOF_INT, ALIGNOF_LONG, ALIGNOF_LONG_LONG):
New variables.
(emacs_cv_alignas_unavailable): Define if alignas and structure
alignment primitives are unavailable.  In such an environment,
the MSB tagging scheme must be enabled, as must the GNU malloc.

* msdos/sed2v2.inp: Adjust correspondingly.

* src/alloc.c (union emacs_align_type): Remove types which
contain flexible array members.  The address of a field
subsequent to an aggregate with flexible array members cannot
validly be taken.
(mark_memory) [!USE_LSB_TAG && !WIDE_EMACS_INT]: Strip type bits
before scanning memory.

* src/emacs.c (main):

* src/eval.c (Fautoload_do_load):

* src/fns.c (Frequire): Rename a number of illogically named
fields.

* src/lisp.h (ALIGNOF_EMACS_INT): Define to the natural
alignment of EMACS_INT.
(IDEAL_GCALIGNMENT): New macro.
(USE_LSB_TAG): Disable if no alignment specifiers are available,
WIDE_EMACS_INT is undefined, and the natural alignment of
EMACS_INT falls short of LSB tagging's requirements.
(gflags): Rename illogically named fields and don't define them
as bitfields, which runs afoul of certain compiler issues.
(will_dump_p, will_bootstrap_p, will_dump_with_pdumper_p)
(dumped_with_pdumper_p): Adjust accordingly.

* src/pdumper.c (VM_SUPPORTED): Define to 0 when !USE_LSB_TAG.
It is better to read dump files into the heap by hand than to be
supplied with an address that is not representable.
(_dump_object_start_pseudovector): Rename to
dump_object_start_pseudovector, to avoid encroaching on reserved
names.
(START_DUMP_PVEC): Adjust correspondingly.
(dump_mmap_contiguous_vm): Preserve errno around failure
cleanup.
(dump_bitset_bit_set_p): Work around certain compiler issues.
(pdumper_load) [!USE_LSB_TAG]: Reject dump file allocations
that are not representable as Lisp_Objects.

Tested on i386-unknown-solaris2.10, sparc-sun-solaris2.10.
2025-03-09 23:07:33 +08:00
Eli Zaretskii
bcfa9692f0 Merge from origin/emacs-30
af8017b23f Explicitly document read-string return value
cf03c2b609 Improve docstrings of python.el import management
01bcc6961a ; Improve doc strings of Speedbar
bd9c76ab17 Avoid warnings about 'image-scaling-factor' in builds --w...
2025-03-09 07:33:13 -04:00
Gerd Möllmann
6fb68f4310 Fix drawing to the bottom-right corner of terminals
* src/term.c (tty_write_glyphs_1): Renamed from tty_write_glyphs. Don't
check if writing the bottom-right corner.
(tty_write_glyphs): New function handling case of writing to the
bottom-right corner, and otherwise calling tty_write_glyphs_1.
2025-03-09 12:21:00 +01:00
Gerd Möllmann
ba20f73d8e macOS: Don't constrainFrameRect for child frames
* src/nsterm.m ([EmacsWindow constrainFrameRect:toScreen:]): Don't do
anything for child frames.
2025-03-09 11:49:27 +01:00
Po Lu
1e289586fc Avoid reserved names in sfnt.c
* src/sfnt.c (_MIN, _MAX): Rename to INS_MIN and INS_MAX.
(sfnt_interpret_run): Adjust accordingly.
2025-03-09 13:20:02 +08:00
Po Lu
b36abc76ae ; Enable pdumper on some buggy versions of Sun C
* src/pdumper.c (dump_sort_copied_objects, drain_reloc_list)
(dump_do_fixups, dump_do_dump_relocation): Do not expand
Fnreverse multiple times in CALLN.  Sun C 5.12 evaluates the
arguments to array initializers to which it expands, which
clobbers the lists being reversed.
2025-03-08 21:58:19 +08:00
Po Lu
b0b7ad24e6 Don't lose drag-and-drop data intended for XTerm-like programs
* src/xselect.c (x_own_selection): If special values exist for
drag-and-drop to unsupported programs, retain them till the
selection is cleared.
2025-03-08 20:42:49 +08:00
Eli Zaretskii
d2445c8c23 Fix crash in daemon when "C-x C-c" while a client frame shows tooltip
* src/frame.c (delete_frame): Ignore tooltip frames when looking
for other frames on the same terminal.  (Bug#76842)
2025-03-08 11:31:22 +02:00
Gerd Möllmann
9277b03793 Fix tty underline capability check (bug#75024)
* src/dispextern.h (TTY_CAP_UNDERLINE_STYLED): Fix. Also make this an
enum.
2025-03-07 21:30:11 +01:00
Stefan Kangas
af8017b23f Explicitly document read-string return value
* src/minibuf.c (Fread_string): Document return value explicitly.
Better document PROMPT argument, and reflow docstring.  (Bug#76797)
2025-03-07 18:13:52 +01:00
Stefan Monnier
06af71fbde * src/eval.c (signal_or_quit): Reduce scope of debugger_called 2025-03-06 23:18:31 -05:00
shipmints
efd483cf0e mouse-face properties on tab-bar tab captions (bug#76394)
* etc/NEWS: Announce 'tab-bar' 'mouse-face' support.

* src/xdisp.c (note_tab_bar_highlight): Handle mouse-face property.

* lisp/tab-bar.el
(tab-bar-tab-highlight): New face.
(tab-bar-tab-name-format-mouse-face): New function adds the 'mouse-face'
'tab-bar-tab-highlight' to the tab name.
(tab-bar-tab-name-format-functions): Add
'tab-bar-tab-name-format-mouse-face'.
2025-03-06 20:37:44 +02:00
Stefan Monnier
1133c081d6 (replace_range): Delete argument markers
* src/lisp.h (replace_range):
* src/insdel.c (replace_range): Delete argument `markers`, always true.
* src/editfns.c (Ftranslate_region_internal):
* src/cmds.c (internal_self_insert):
* src/search.c (Freplace_match): Adjust callers accordingly.
2025-03-06 11:21:42 -05:00
Eli Zaretskii
cd051ef78e Fix images on the mode line under 'mode-line-compact'
* src/xdisp.c (display_mode_line): When 'mode-line-compact'
is in effect, don't remove spaces that have a 'display'
property on them.  (Bug#76761)
2025-03-06 16:27:00 +02:00
Kazuhiro Ito
64b3ad5c76 Avoid defining unneeded variables on Cygw32
lisp/term/w32-win.el contained definitions of variables which
were not used on Cygw32.  It is now to split into two files,
common part and Windows native build specific part. The latter
is a new file, lisp/term/w32-nt.el.
* src/image.c (Qlibpng_version, Qlibgif_version)
(Qlibjpeg_version): Don't define on Cygw32 build.
* src/treesit.c (Qtree_sitter__library_abi): Ditto.

* lisp/term/w32-win.el (dynamic-library-alist, libpng-version)
(libgif-version, libjpeg-version, libgnutls-version)
(tree-sitter--library-abi, gui-backend-set-selection)
(gui-backend-get-selection, gui-backend-selection-owner-p)
(gui-selection-exists-p): Moved to lisp/term/w32-nt.el.
* lisp/term/w32-nt.el: New file, separated Windows native build
specific part from lisp/term/w32-win.el.
* lisp/loadup.el: Load term/w32-nt.el on Windows native build.
(Bug#75926)
2025-03-06 16:04:51 +02:00
Po Lu
2250dafff9 Merge from savannah/emacs-30
9065423e70 ; Improve documentation of 2 symbol-related functions
2025-03-06 21:55:41 +08:00
Eli Zaretskii
9065423e70 ; Improve documentation of 2 symbol-related functions
* src/data.c (Fremove_pos_from_symbol, Fbare_symbol): Doc fixes.
(Bug#75290)
2025-03-06 12:52:05 +02:00
Eli Zaretskii
bf027eb6ff Fix redisplay of tab bar when its text properties change
* src/xdisp.c (update_tab_bar): Use 'equal-including-properties'
to compare previous with the current tab-bar items.  (Bug#76760)
2025-03-06 10:51:45 +02:00
Po Lu
3d7cc22d25 Permit executing programs with >1024 args on Android
* src/android.c (MAXARGS): Delete enumerator.
(android_rewrite_spawn_argv): Don't mandate a maximum number of
arguments.
2025-03-05 15:00:14 +08:00
Po Lu
336cc32f2a ; * src/nsterm.m (syms_of_nsterm): Fix typo in comment. 2025-03-05 15:00:14 +08:00
Philipp Stephani
e978737f57 Make Emacs buildable with -std=c11.
With -std=c11, GCC doesn't recognize 'asm' as a keyword, see
https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html and
https://gcc.gnu.org/onlinedocs/gcc/Alternate-Keywords.html.  Use __asm__
instead.

* src/lisp.h (flush_stack_call_func): Use __asm__ instead of asm.
2025-03-04 20:52:16 +01:00
Daniel Colascione
3a8ce5ac9c Add ns-click-through option to control activation click handling
* src/nsterm.m (acceptsFirstMouse):
Use ns_click_through variable instead of always returning YES.
(syms_of_nsterm): Define ns-click-through variable.

* lisp/cus-start.el: Add customization definition for ns-click-through.

* etc/NEWS: Document the new option.
2025-03-04 08:14:59 -08:00
Eli Zaretskii
a382bfdfa4 Fix 'etc/DOC' for a few functions/variables
* src/term.c (Ftty_frame_at):
* src/menu.c (syms_of_menu) <x-popup-menu-function>:
* src/dispnew.c (Fredisplay): Fix "doc:".  The extra blank was
preventing 'make-docfile' from recognizing the functions and
variables and extracting their documentation to 'etc/DOC'.
(Bug#76722)
2025-03-04 15:45:33 +02:00
Po Lu
25e2656dd9 ; * src/nsterm.m (ns_draw_stretch_glyph_string): One more spelling fix. 2025-03-04 21:10:36 +08:00
Po Lu
cd0a8c00a7 ; Fix style and language in src/nsterm.m
* src/nsterm.m (ns_maybe_dumpglyphs_background)
(ns_draw_stretch_glyph_string): Fix coding style.  Use American
English spelling.
2025-03-04 21:09:47 +08:00
Ben Simms
9cbbdcee13 Support colored stipples on Cocoa NS (Bug#73384)
On Cocoa builds of NS Emacs, stipples are now rendered
using masked CGImages instead of patterned NSColors so that
stipples now render with color.
* src/nsimage.m ([EmacsImage stippleMask:]): Use a CGImageMask to
store the stipple mask when building for Cocoa.
* src/nsterm.m (ns_maybe_dumpglyphs_background): Perform a masked
fill to draw stipples when building for Cocoa.
(ns_draw_stretch_glyph_string): Perform a masked fill to draw
stipples when building for Cocoa.
2025-03-04 14:31:35 +02:00
Paul Eggert
9415941a9c Revert “Avoid some union buffered_input_event uses”
Revert my commit 29a9fd4f4b
and the following commit 1ec0889e7b.
This fixes a bug where ‘emacs -nw’ would sometimes freeze when Emacs is
configured with ‘--with-pgtk --enable-link-time-optimization
--disable-gc-mark-trace’ on GNU/Linux x86-64 (Bug#76729).
As it is not yet clear whether this freeze is due to an Emacs bug that
I introduced, or due to GCC bug 117423
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117423>,
play it safe for now and revert to the previous state.
2025-03-03 22:28:59 -08:00
Philipp Stephani
3e39b2418b ; * src/eval.c (Fdefvar_1, Fdefconst_1): Properly quote apostrophe. 2025-03-04 06:13:22 +01:00
Po Lu
144b268a84 Render Android hourglass cursor mechanics more consistent with X
* src/androidterm.c (android_show_hourglass): Always define the
hourglass cursor, but...
(android_hide_hourglass): ... restore the invisible cursor
subsequently, if need be.
(android_toggle_visible_pointer): Do not hide the current cursor
if it is an hourglass.
2025-03-04 09:47:30 +08:00
Eli Zaretskii
c116dad608 Avoid crashes on MS-Windows on repeated client connections
* src/w32uniscribe.c (uniscribe_close): Zero out dwrite cache.
Suggested by Richard Copley <rcopley@gmail.com>.  (Bug#76121)
2025-03-03 21:29:45 +02:00
Eli Zaretskii
1ec0889e7b Fix MS-Windows build broken by buffered_input_event changes
* src/keyboard.c (kbd_buffer_store_selection_event_hold):
* src/keyboard.h (kbd_buffer_store_selection_event_hold): Declare
and define only for (HAVE_X11 || HAVE_PGTK).
2025-03-03 21:08:35 +02:00
Paul Eggert
29a9fd4f4b Avoid some union buffered_input_event uses
Simplify by using separate local vars for struct input_event and
struct selection_input_event, rather than a single local var that
is the union of the two.  This makes the code easier to follow by
the human reader, and should help avoid GCC bug 117423
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117423> and
therefore work around Emacs bug 76559 <https://bugs.gnu.org/76559>.
* src/androidterm.c (handle_one_android_event):
* src/gtkutil.c (xg_widget_key_press_event_cb):
* src/pgtkterm.c (evq_flush):
* src/xterm.c (handle_one_xevent): Use struct input_event and
kbd_buffer_store_event_hold, or struct selection_input_event and
kbd_buffer_store_selection_event_hold, rather than union
buffered_input_event and union buffered_input_event.
* src/keyboard.c (beware_long_paste, maybe_quit_while_no_input):
New functions, broken out from kbd_buffer_store_buffered_event.
(kbd_buffer_store_event_hold): Define here, with a simplified
version of the body of the old kbd_buffer_store_buffered_event,
rather than defining in keyboard.h.  Specialize to struct
input_event.
(kbd_buffer_store_selection_event_hold): New function; it is
a simplified version of the old kbd_buffer_store_buffered_event,
specialized to struct selection_input_event.
(is_ignored_event_kind): Accept enum event_kind instead of
union buffered_input_event.  All callers changed.
* src/keyboard.h (kbd_buffer_store_event_hold):
Remove definition, as keyboard.c now defines it.
* src/pgtkterm.c (evq_grow_if_needed): New function.
(evq_enqueue, evq_selection_enqueue): Two functions now,
not one.  Args are now struct input_event const * or
struct selection_input_event const *, not
union buffered_input_event *.  All callers changed.
This lets us simplify the callers so that they need
not use the union.
2025-03-03 09:44:42 -08:00
Paul Eggert
76342efe9d Pacify GCC in pgtkselect malloc alignment
This is a better fix for Bug#76414.
* src/pgtkselect.c (pgtk_nalloc): New function.
(pgtk_get_window_property, lisp_data_to_selection_data): Use it.
2025-03-02 15:58:04 -08:00
Daniel Colascione
3545988740 Make Emacs respond to NS activation clicks
* src/nsterm.m (acceptsFirstMouse): Opt into receiving mouse events that
activate the window. (bug#76629)
2025-03-01 12:55:15 -05:00
Eli Zaretskii
a242d9a48f Merge from origin/emacs-30
6f5c322f59 Recommend secure-hash in md5 docstring
1352b184f3 Improve docstring of add-hook and remove-hook
2025-03-01 10:01:53 -05:00
Eli Zaretskii
6c411de542 Merge from origin/emacs-30
f88dc0f2f9 ; Fix documentation of 'buffer-text-pixel-size'
734986349f ; Minor Android documentation improvements
a90da89903 ; Fix up emacs-lisp-mode docstring
58c7acb555 ; Fix completion-fail-discreetly docstring typo.
02c830ba22 Fix ert-font-lock macro signatures
0c6b8643ae Fix a typo in 'window_text_pixel_size'
8a8c25eacc ; Add Rudolf Schlatte to authors.el
94c0ea39a5 * doc/misc/efaq.texi (New in Emacs 30): Fix typo.  (Bug#7...
0be5f9115e ; * etc/images/README (Files): Add an entry for last-page...
63adf9dcf5 ; Reflow some cl-lib docstrings
99253f7970 ; * etc/TODO: New section "Make it easier to contribute".

# Conflicts:
#	lisp/emacs-lisp/cl-macs.el
2025-03-01 10:01:09 -05:00
Eli Zaretskii
30cbeaba31 Merge from origin/emacs-30
2dbf7d0b1b Use character position for ranges in treesit_sync_visible...
2025-03-01 09:59:06 -05:00
Stefan Monnier
1cfbbcfaf6 * test/src/editfns-tests.el (editfns--replace-region): New test
This test fails, sadly, because `replace-buffer-contents` is not
careful enough to something like `replace_range`.
2025-02-28 17:10:56 -05:00
Stefan Kangas
678fdcc165 ; Grammar fixes for "native-compiled"
1. Prefer "native-compiled" to "native compiled".
The adjective "native-compiled" with the hyphen is generally more
consistent with the typical pattern in English, especially when the
compound modifies a noun (e.g., "native-compiled code").

2. Prefer "natively compiled" to "natively-compiled".
The adverb "natively" modifies "compiled", and it is standard not
to hyphenate an adverb + adjective combination when the adverb ends
in -ly (e.g., "code that is natively compiled").

For example, note that we say "high-speed internet" but "highly
performant code".

* Makefile.in (dest):
* configure.ac (HAVE_NATIVE_COMP):
* doc/emacs/building.texi (Lisp Libraries):
* doc/lispref/compile.texi (Native Compilation)
(Native-Compilation Functions, Native-Compilation Variables):
* doc/lispref/functions.texi (What Is a Function, Declare Form):
* doc/lispref/loading.texi (How Programs Do Loading, Library Search):
* etc/NEWS:
* etc/NEWS.28:
* etc/NEWS.29:
* etc/NEWS.30:
* lisp/emacs-lisp/comp-common.el (native-comp-never-optimize-functions)
(comp-function-type-spec):
* lisp/emacs-lisp/comp-cstr.el:
* lisp/subr.el (locate-eln-file):
* src/comp.c (SETJMP_NAME, syms_of_comp):
* src/data.c (Fsubrp, Fnative_comp_function_p, Fsubr_native_lambda_list):
* src/lread.c (Fload):
* src/pdumper.c (dump_do_dump_relocation):
* test/src/comp-tests.el (lambda-return2): Avoid grammatically incorrect
variations on "natively compiled" and "native-compiled".  (Bug#56727)
2025-02-28 20:20:55 +01:00
Stefan Kangas
8b659313b8 Lift widget functions from C to Lisp
In the mid-1990s, these functions were moved from Lisp to C to
"improve performance".  However, Moore's Law, and perhaps other
improvements too, has made this rationale irrelevant.

On this machine, with --native-compilation=no, I observed only a
slight ~4% performance difference.  For example, displaying a buffer
full of widgets (e.g., 'M-x customize RET browse-url RET') takes 4ms
here, meaning the performance gap is under 0.1ms.  Even on less
powerful machines, this difference would remain imperceptible.  Given
this, let's lift these functions back to to Lisp, which offers the
usual benefits.

We already have solid test coverage, but let's add a more focused test
for 'widget-get' and 'widget-put' to be thorough.

* lisp/wid-edit.el (widget-put, widget-get, widget-apply): Move to
Lisp from...
* src/fns.c (Fwidget_put, Fwidget_get, Fwidget_apply): ...here.
(syms_of_fns): Remove defsubrs for the above functions.
* test/lisp/wid-edit-tests.el
(widget-test-editable-field-widget-get/put): New test.
2025-02-28 18:32:28 +01:00
Po Lu
c8cec840d7 Prevent rare freeze on Android 4.2 through 4.4
* src/android.c (android_run_select_thread, android_init_events)
(android_select): Enable self-pipes on all Android versions <= 21.
The Android C library provides a functioning pselect on these
systems, but it does not apply the signal mask atomically.
(android_run_select_thread): Correct typo.  This never produced
any adverse consequences, as the relevant signals would already
have been blocked by `setupSystemThread'.

Do not merge to master.
2025-02-28 22:40:14 +08:00
Eli Zaretskii
68a37760de Fix the values and documentation of 'printable-chars' table
* src/character.c (syms_of_character) <printable-chars>: Doc fix.

* lisp/international/characters.el (printable-chars): Fix values
for non-ASCII characters.

* doc/lispref/nonascii.texi (Character Properties): Add
cross-reference for what is a printable character.
* doc/lispref/display.texi (Usual Display):
* doc/lispref/searching.texi (Char Classes): Add indexing.
(Bug#76611)
2025-02-28 16:22:30 +02:00
Po Lu
18c8c44bef Adapt process-tests to Android
* src/android.c (android_init_thread_events)
(android_run_select_thread): Guarantee that the select thread is
initialized before returning.

* test/src/process-tests.el
(process-tests/fd-setsize-no-crash/make-process)
(process-tests/fd-setsize-no-crash/make-pipe-process)
(process-tests/fd-setsize-no-crash/make-network-process)
(process-tests/fd-setsize-no-crash/make-serial-process): Skip on
Android.
2025-02-28 21:06:48 +08:00
Po Lu
8df582a468 Fully support Lisp threads on Android
* src/android.c (struct android_thread_event_queue): New
structure.  Move global pselect arguments, mutexes, and
semaphores, and pipes here.
(struct android_event_queue) <select_mutex, select_thread>:
Remove to the above-named struct.
(android_init_thread_events, android_finalize_thread_events)
(android_get_poll_thread): New functions.
(android_run_select_thread): Accept a set of mutexes and
thread-local data as the first argument, and operate with them
rather than globals.
(android_handle_sigusr1): Rename to
`android_handle_poll_signal'.  Set thread-specific cancellation
indicator.
(android_init_events): Properly abort after a fatal condition.
Enable interruptible polling on Android 5.1 and later, not 4.2.
(android_select): Never check for queries here, but in
thread_select, if threads are enabled.  Adapt to per-thread
polling threads and only enable interruptible polling on Android
5.1 and later.
(android_before_select): New function.

* src/android.h (android_before_select): New declaration.

* src/thread.c (thread_select): Call `android_before_select'
before the global lock is released.
2025-02-28 19:54:46 +08:00
Eli Zaretskii
0d89aa6b6c ; * src/keymap.c: Fix last change (bug#75219).
(cherry picked from commit 412c1a4f0e)
2025-02-28 09:54:10 +02:00
Eli Zaretskii
b3181a8071 Fix mouse-2 clicks on mode line and header line
* src/keymap.c (Fcurrent_active_maps): For clicks on mode-line and
header-line, always override the keymaps at buffer position.
(Bug#75219)

(cherry picked from commit c41ea047a4)
2025-02-28 09:53:42 +02:00
Eli Zaretskii
6ed119d305 ; Fix documentation of recent treesit changes
* src/treesit.c (Ftreesit_query_capture)
(Ftreesit_parser_embed_level, Ftreesit_parser_set_embed_level)
(Ftreesit_parser_set_parent_node):
* lisp/treesit.el (treesit-query-range)
(treesit-query-range-by-language, treesit-range-settings)
(treesit-range-rules, treesit--parser-at-level)
(treesit--update-ranges-non-local, treesit--update-ranges-local)
(treesit--update-range-1): Fix wording and typos in doc strings.

* doc/lispref/parsing.texi (Pattern Matching): Fix wording.
2025-02-28 09:12:05 +02:00
Stefan Kangas
6f5c322f59 Recommend secure-hash in md5 docstring
* src/fns.c (Fmd5): Repeat explanation from manual about md5 being
"semi-obsolete", and recommend using secure-hash instead.
2025-02-28 05:22:53 +01:00