1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-02-04 06:31:13 -08:00
Commit graph

50473 commits

Author SHA1 Message Date
Po Lu
884ede7c95 Respond to display configuration updates on Android
* java/org/gnu/emacs/EmacsNative.java
(sendConfigurationChanged): Declare function.

* java/org/gnu/emacs/EmacsSdk7FontDriver.java (Sdk7FontEntity)
(Sdk7FontObject): Do not access `metrics' field deleted from
`EmacsService'.

* java/org/gnu/emacs/EmacsService.java (EmacsService)
<metrics, resources>: Delete fields.
<dpiX, dpiY, dpiScaled>: New fields.
(onCreate): Adjust accordingly.  Record current display metrics
for subsequent comparison.
(onConfigurationChanged): New function.

* lisp/dynamic-setting.el (font-setting-change-default-font):
Enable on systems where font-get-system-font is not defined if
invoked with SET-FONT nil.

* src/android.c (sendConfigurationChanged): New function.

* src/androidgui.h (ANDROID_CONFIGURATION_CHANGED): New enumerator.
(struct android_configuration_changed): New structure.
(union android_event): Add `config' member.

* src/androidterm.c (handle_one_android_event): Handle
ANDROID_CONFIGURATION_CHANGED events.
(syms_of_androidterm): Define Qfont_render, and
Qdynamic_setting.  Provide the latter.
2025-04-10 15:25:38 +08:00
Sean Whitton
686032ddaf ; * src/minibuf.c (syms_of_minibuf): Improve some wording. 2025-04-09 10:35:38 +08:00
Po Lu
b392038560 Replace some calls to `intern' with DEFSYMs
* src/filelock.c (lock_file, unlock_file_handle_error): Call
constant symbols rather than interning them all the time.
(syms_of_filelock): New symbols Qask_user_about_lock,
Quserlock__handle_unlock_error, and
Quserlock__ask_user_about_supersession_threat.
2025-04-08 10:26:18 +08:00
Po Lu
9b7402c5fd ; * src/lread.c (get_lexical_binding): Fix coding style. 2025-04-08 09:46:16 +08:00
Stefan Monnier
9f25d46568 (Fload, Feval_buffer): Emit a warning when lexbind is unset (bug#74145)
This emits a warning at run-time rather than at compile time.

* src/lread.c (get_lexical_binding): New function.
(Fload, Feval_buffer): Use it.
(syms_of_lread): New var `internal--get-default-lexical-binding-function`.
* lisp/files.el: Set it.
(internal--get-default-lexical-binding): New function.
2025-04-07 21:41:35 -04:00
Stefan Monnier
ae5c608eca (Freplace_region_contents): Fix point preservation (bug#77607)
* src/editfns.c (Freplace_region_contents): Save excursion around
temporary restriction (bug#77607) and remove
`record_unwind_protect_excursion` made redundant by commit 40d8650d51.
2025-04-07 11:54:06 -04:00
Eli Zaretskii
d42ee9f33a Merge from origin/emacs-30
38fec86281 ; Improve the documentation of 'slice' display spec (bug#...
3f05b455f7 ; * src/editfns.c (Fmessage): Mention 'inhibit-message' (...
2025-04-05 07:07:28 -04:00
Eli Zaretskii
52e7a71e3f Teach 'current-column' to account for images
* src/indent.c (check_display_width): Handle 'image' and 'slice'
display specs, instead of using the width of the underlying text.
Accept 2 additional arguments: WINDOW and SCAN_BYTE.  (Bug#76107)
2025-04-05 13:24:22 +03:00
Eli Zaretskii
bf7b3c5ddd ; * src/xdisp.c (display_mode_line, display_mode_element): Fix comments. 2025-04-05 12:35:42 +03:00
Pengji Zhang
c94f0d3dc8 Fix mouse highlighting for compact mode lines (bug#77336)
When 'mode-line-compact' is non-nil, the mode line string is
displayed as a whole.  That confuses the computation of ranges
of mouse highlighting on the mode line because all the glyphs
have the same Lisp object source.  As such, in this commit we
instead split the mode line string by sources, and display those
elements one by one, so the boundaries of each element could be
correctly detected for the purpose of mouse highlighting.

* src/xdisp.c (display_mode_line): Display mode line elements
one by one when 'mode-line-compact' is non-nil.
(display_mode_element): Record source element number of the
stored string via a text property.
(Fformat_mode_line): Initialize 'mode_line_elt_no' to 0.
(syms_of_xdisp): New symbol for the text property.
2025-04-05 12:30:46 +03:00
Paul Eggert
5039ad24a3 Pacify gcc -Wclobbered in Freplace_region_contents
* src/editfns.c (Freplace_region_contents): Redo slightly to
pacify gcc -Wclobbered, by hoisting the eassume out of SCHARS and
into the caller later, where it’ll do more good anyway.
2025-04-02 13:53:00 -07:00
Eli Zaretskii
df82855aeb Fix display of wide characters in display margins on TTY frames
* src/xdisp.c (display_line): Remove incomplete glyph sequence of
the last multi-column character, if not all of its glyphs fit in
the marginal area.  (Bug#77452)
2025-04-02 20:25:09 +03:00
Eli Zaretskii
a9661e643b More thorough fix for image slices on mode/header-line
* src/xdisp.c (note_mode_line_or_margin_highlight): Remove
correction of DX and DY due to image slices, as this is now done
in 'mode_line_string'.
* src/dispnew.c (mode_line_string): Make DX and DY account for
image slices.  (Bug#77429)
2025-04-02 16:12:03 +03:00
Eli Zaretskii
975d58c4c8 Fix :map property on sliced images on mode line and header line
* src/xdisp.c (note_mode_line_or_margin_highlight): Fix coordinates
for image slices wrt ':map' keyword when the image is on the mode
line or header line.  (Bug#77429)
2025-04-01 18:40:59 +03:00
Eli Zaretskii
3f05b455f7 ; * src/editfns.c (Fmessage): Mention 'inhibit-message' (bug#77257). 2025-03-30 17:38:25 +03:00
Pip Cet
67e34f0ed8 Respect narrowed buffers when parsing JSON (bug#77325)
* src/json.c (Fjson_insert): Simplify 'memcpy' argument.
(Fjson_parse_buffer): Only read to ZV, not all the way to Z.
* test/src/json-tests.el (with-all-gap-positions-in-temp-buffer):
New macro.
(json-parse-buffer/restricted): New test.
2025-03-30 11:52:07 +00:00
Eli Zaretskii
209b7e7444 Fix display of overlay arrow immediately after invisible text
* src/xdisp.c (overlay_arrow_at_row): Allow the overlay arrow's
marker position to be anywhere between the row's start and end
charpos.  This keeps the overlay arrow on display even when the
preceding text is invisible.  (Bug#54843)
2025-03-30 10:29:57 +03:00
Stefan Monnier
e1b15d58b5 src/insdel.c (replace_range): Remove comment
It should have been removed in commit b16afa45bb.
2025-03-30 00:10:12 -04:00
Stefan Monnier
57da44fa70 src/insdel.c (adjust_markers_for_replace): Fix insertion case
test/src/editfns-tests.el (editfns-tests--insert-via-replace): New test
2025-03-29 17:49:49 -04:00
Stefan Monnier
7c82cc8b97 (replace-region-contents): Improve and promote (bug#76313)
Swap the role of `replace-region-contents` and `replace-buffer-contents`,
so `replace-region-contents` is the main function, implemented in C,
and `replace-buffer-contents` is a mere wrapper (marked as obsolete).
Also remove the need to rely on narrowing and on describing the
new text as a function.
Finally, allow MAX-SECS==0 to require a cheap replacement, and
add an INHERIT argument.

* src/editfns.c: Include `coding.h`.
(Freplace_region_contents): Rename from `Freplace_buffer_contents`.
Change calling convention to that of `replace-region-contents`.
Add more options for the SOURCE argument.  Add INHERIT argument.
Skip the costly algorithm if MAX-SECS is 0.
* src/insdel.c (replace_range): Allow NEW to be a buffer.

* lisp/subr.el (replace-buffer-contents): New implementation.
* lisp/emacs-lisp/subr-x.el (replace-region-contents): Delete.

* doc/lispref/text.texi (Replacing): Document new API for
`replace-region-contents`.  Remove documentation of
`replace-buffer-contents`.

* test/src/editfns-tests.el (replace-buffer-contents-1)
(replace-buffer-contents-2, replace-buffer-contents-bug31837):
Use `replace-region-contents`.
(editfns--replace-region): Delete.
(editfns-tests--replace-region): Use `replace-region-contents`.
Adds tests for new types of SOURCE args.
2025-03-29 17:49:05 -04:00
Po Lu
2b7a72b117 Do not redundantly dump constant forwarding objects
* src/pdumper.c (dump_fwd_int, dump_fwd_bool, dump_fwd_obj): Do
not redundantly dump constant forwarding descriptors; restrict
to dumping the objects being forwarded to.
(dump_fwd_buffer_obj): Copy from the dump file into bss rather
than load buffer forwarding descriptors from the dump file
itself.
(dump_fwd_kboard_obj): Delete function.
(dump_fwd): Don't return offset of dumped objects.
(dump_blv): Adjust correspondingly.
(dump_pre_dump_symbol): Improve documentation.  Record offset of
forwarding objects in relation to `emacs_basis' rather than the
dump file.
(dump_symbol): Restore forwarding descriptors to their original
values as static variables in Emacs.  This reduces the size of
dump files by an insignificant 2kb but facilitates certain kinds
of watchpoints on platforms where ASLR cannot be disabled, e.g.,
Android.
2025-03-29 14:45:38 +08:00
Po Lu
ed3d8bb298 Miscellaneous corrections
* src/buffer.h (BUF_PTR_BYTE_POS): Fix comment.

* src/profiler.c (add_sample): Use BASE_EQ.
2025-03-28 16:10:38 +08:00
Philipp Stephani
f22af15aef ; Reorder initialization of module environment functions.
* src/emacs-module.c (initialize_environment): Reorder assignments to
match declaration order in emacs-module.h.
2025-03-27 14:08:55 +01:00
Cecilio Pardo
33a46ff565 w32: fail gracefully when using invalid glyphs on DWrite
* src/w32dwrite.c (text_extents_internal): Return false instead
of crashing with bad glyph indexes.  (Bug#77196)
2025-03-27 15:01:53 +02:00
Gerd Möllmann
1883a5c717 Don't write to bottom-right cell on ttys with AutoWrap (bug#77233)
* src/term.c (tty_write_glyphs): Handle case of writing only one
character in the last column.
2025-03-27 06:10:46 +01:00
Eli Zaretskii
1e68351d56 Fix vertical cursor motion with wide images and line numbers
* src/xdisp.c (produce_image_glyph): When cropping an image that
exceeds the window's right edge, account for the screen estate
taken by line-number display.  (Bug#77217)
2025-03-26 19:04:16 +02:00
Martin Rudalics
001359ce76 Further amendments of child frame handling and documentation
* src/frame.c (frame_subsumes_p): New static function
(delete_frame): On ttys refuse to delete a frame that could be
used as surrogate minibuffer frame by surviving frames.
(store_frame_param): Make sure 'minibuffer' parameter does not
reference a deleted window.  If on a tty it references a live
window, make sure its frame has the same root frame as the frame
where the parameter shall be installed.  Also on ttys make sure
that storing the 'parent-frame' parameter does not assign a
surrogate minibuffer frame a different root frame than that of
any of its client frames.  Further on ttys assert that making a
child a new root frame gives it the dimensions of the terminal.
(Fmouse_position_in_root_frame): Don't use XFRAME before
it's clear that FRAME is a frame.
* doc/lispref/elisp.texi (Top): Add menu for Child Frames section.
* doc/lispref/frames.texi (Buffer Parameters): Mention that
value 'child-frame' is not special for 'minibuffer' parameter on
text terminals.
(Visibility of Frames): Fix description of 'iconify-frame'.
(Raising and Lowering): 'minibuffer-auto-raise' is an option.
(Child Frames): Major rewrite using subsections.  Explain new
and deviant features on text terminals - menu bar access,
reparenting, deleting, visibility and minibuffer-only child
frames.
* etc/NEWS: Remove remark that child frames cannot be
arbitrarily reparented on ttys.
2025-03-26 09:04:49 +01:00
Philipp Stephani
0b1102a704 Rename 'buffer-too-small' to 'memory-buffer-too-small'.
This clarifies that the error isn't talking about an editing buffer.

* src/emacs-module.c (module_memory_buffer_too_small): Rename from
'module_buffer_too_small'.
(module_copy_string_contents, module_extract_big_integer): Adapt
callers.
(syms_of_module): Rename symbol 'buffer-too-small' to
'memory-buffer-too-small'.
2025-03-25 14:24:04 +01:00
Po Lu
49eab999f1 Fix the DJGPP build
* msdos/emacs.djl (.bss): Guarantee that lread.o is 8-byte
aligned.

* msdos/sed2v2.inp (ALIGNOF_INT, ALIGNOF_LONG)
(ALIGNOF_LONG_LONG): Correct typos.

* src/term.c (tty_free_frame_resources): Synchronize with
non-DOS variant.
2025-03-25 10:38:43 +08:00
Philipp Stephani
8efcdcab86 Mimic behavior of 'aref' when signalling out-of-range errors.
The convention used by 'aref' and friends is that for
'args-out-of-range', the error data is a list (SEQ INDEX).  Use the same
convention for the vector-related module functions.

* src/emacs-module.c (check_vec_index): Use vector and index as error
data.
2025-03-25 02:56:01 +01:00
Philipp Stephani
96a1a07fb1 Don't use 'args-out-of-range' error for too-small buffers.
'args-out-of-range' means that some index argument isn't valid for a
given sequence/range, which isn't the case here.  Instead, define a new
error symbol to mean "user-supplied buffer is too small."  Since we
never specified nor tested which error symbol was signalled in this
case, changing it shouldn't cause severe breakages.

* src/emacs-module.c (module_buffer_too_small): New helper function.
(module_copy_string_contents, module_extract_big_integer): Use it.
(syms_of_module): Define 'buffer-too-small' error symbol.
2025-03-25 02:54:08 +01:00
Po Lu
7d14e35498 Patch bug#77128
* src/pgtkterm.c (pgtk_flash): Destroy `cr_surface_visible_bell'
if still present.  (bug#77128)
2025-03-23 19:44:46 +08:00
Eli Zaretskii
939a2a3c2d Avoid rare crashes due to "C-g C-g" on TTY frames
* src/term.c (tty_send_additional_strings): Don't use SBYTES, as
this function could be called in the middle of GC.  (Bug#77205)
2025-03-23 13:17:06 +02:00
Eli Zaretskii
467aba67db ; * src/dispnew.c (check_window_matrix_pointers): Fix last change. 2025-03-23 11:35:25 +02:00
Eli Zaretskii
e20e853861 Avoid rare segfaults in 'check_matrix_pointers'
* src/dispnew.c (check_window_matrix_pointers): No-op if the
window's frame not ready yet.  (Bug#77200)
2025-03-23 11:30:17 +02:00
Eli Zaretskii
ab25b4fca9 Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs 2025-03-23 07:45:16 +02:00
Stefan Kangas
92b373318d Reduce code duplication in ns_set_appearance
* src/nsterm.h (ns_set_appearance_1): Declare.
* src/nsterm.m (ns_set_appearance_1): Break out new function...
(ns_set_appearance): ...here.
* src/nsfns.m (Fx_create_frame): Use above new function.
2025-03-22 22:42:18 +01:00
Eli Zaretskii
62368f93a5 Avoid rare segfaults due to crazy creation of new child frames
* src/dispnew.c (combine_updates, combine_updates_for_frame): Skip
frames and child frames that were not yet completely made.
(Bug#77046)
2025-03-22 21:32:16 +02:00
Paul Eggert
25d7575358 Remove ctags program
Remove our old ctags and suggest Universal Ctags instead.
This fixes a FIXME in lib-src/Makefile.in and speeds up compilation
quite a bit on my older CPU when I compile with	--enable-gcc-warnings.
It also lessens installation and runtime footprint. (Bug#76322)
* .gitignore: Remove lib-src/ctags.
* admin/authors.el (authors-renamed-files-alist): Remove ctags.1.
* admin/check-man-pages: ctags.1 is no longer a special case.
* admin/quick-install-emacs (PUBLIC_LIBSRC_BINARIES): Remove ctags.
* cross/Makefile.in (LIBSRC_BINARIES): Remove lib-src/ctags.
* doc/man/ctags.1, lib-src/ctags.c: Remove.
* java/Makefile.in (CROSS_LIBSRC_BINS): Remove ctags.
* lib-src/Makefile.in (INSTALLABLES): Remove ctags${EXEEXT}.
(ctags${EXEEXT}): Remove.
* lib-src/etags.c (CTAGS): Remove.  All uses replaced by ...
(ctags): ... this new static var.
(STDIN): Remove macro.  All uses replaced by new STDIN_OPTION constant.
(CTAGS_OPTION, STDIN_OPTION): New contants.
(longopts): New --ctags option.
(ctags_default_C_help): New constant,
to override default_C_help at runtime.
(default_C_help): Now always the etags version.
(C_LANG_NAMES_INDEX): New macro.
(print_language_names): Do not assume etags.
(PROGRAM_NAME): Remove.  All uses removed.
(print_help): Document --ctags if PRINT_UNDOCUMENTED_OPTIONS_HELP.
(main): Support new --ctags option, and support all [ce]tags options.
* test/manual/etags/Makefile (CTAGS_PROG):
Now etags --ctags, since there is no longer a ctags.
2025-03-22 11:57:29 -07:00
Eli Zaretskii
9816c61c48 Fix usage of string data pointers in xfaces.c
* src/xfaces.c (tty_defined_color): Don't use SSDATA pointers
across calls to Lisp.  (Bug#77046)
2025-03-22 18:45:38 +02:00
Stefan Kangas
20687ab617 Delete now unused constants in nsterm.h
* src/nsterm.h (NS_DUMPGLYPH_NORMAL, NS_DUMPGLYPH_CURSOR)
(NS_DUMPGLYPH_FOREGROUND, NS_DUMPGLYPH_MOUSEFACE): Delete now unused
constants.
2025-03-22 12:47:06 +01:00
Stefan Kangas
69013ed73d ; Clean up comments in nsterm.h 2025-03-22 12:45:37 +01:00
Martin Rudalics
1ee2a921ad Fix and document frame parameters for text terminals and child frames
* src/frame.c (Fmake_frame_invisible): In doc-string describe
effect on text terminals.  Set FRAME correctly when called with
nil value.  Make frame invisible before calling mru_rooted_frame
or next_frame.
(Ficonify_frame): Make it work for child frames on text
terminals
(Fmodify_frame_parameters): Make value 'icon' for 'visibility'
work for child frames.
* src/dispnew.c (frame_ancestors_visible_p): New function.
(frames_with_root): If VISIBLE_ONLY is non-nil, return only
frames whose ancestors are all visible to avoid that redisplay
draws visibly orphaned child frames.
* doc/lispref/frames.texi (Frames): Move descriptions of top
frame and 'tty-top-frame' here.
(Frame Layout): Mention that on text terminals the outer border
can be emulated by setting the 'undecorated' frame parameter.
(Frame Position, Frame Parameters, Window Frame Parameters)
(Position Parameters, Size Parameters): Rewrite sections dealing
with the handling of frame parameters in text terminals.
(Layout Parameters): Move description of 'undecorated' parameter
here.  Clarify semantics of 'menu-bar-lines' parameter.
(Frame Interaction Parameters): Move description of 'visibility'
parameter here.  Mention which parameters are not implemented on
text terminals.
(Mouse Dragging Parameters): Describe how these work on text
terminals.
(Visibility of Frames): Rewrite section.
(Raising and Lowering): Describe for text terminals.
(Child Frames): Fix description of 'iconify-child-frame' option.
2025-03-22 09:34:53 +01:00
Eli Zaretskii
df66695780 Avoid infinite loop with images under 'display-line-numbers-mode'
* src/xdisp.c (move_it_in_display_line_to, display_line): When
considering the first glyph on a glyph row, take into
consideration the glyphs produced for line-number display.
(Bug#77065)
2025-03-21 18:20:21 +02:00
Martin Rudalics
fa1cfcada0 On tty frames restrict number of menu bar lines (Bug#77015)
* src/frame.c (set_menu_bar_lines): Make sure tty frames get
only 0 or 1 menu bar line (Bug#77015).
2025-03-19 09:36:42 +01:00
Martin Rudalics
739d18dc41 Ensure redisplay after re-parenting a tty child frame (Bug#77079)
* src/frame.c (store_frame_param): When re-parenting a tty child
frame, mark it's old and new root frames as garbaged so redisplay
will reflect the change immediately (Bug#77079).
2025-03-18 09:17:52 +01:00
Po Lu
5a4b9ca736 Fix generation of mouse position lists on the tool and tab bars
* src/keyboard.c (make_lispy_tty_position): Return whether an
internal border was hit.
(make_lispy_position): Only skip standard window and frame
detection process if so, as there are other scenarios where POSN
is nil but WINDOW_OR_FRAME is none the less expected to be
provided by the conditionals skipped.
2025-03-18 09:41:56 +08:00
Eli Zaretskii
4cfeb3697c ; * src/dispnew.c (adjust_glyph_matrix): Restore lost comment. 2025-03-17 14:19:34 +02:00
Eli Zaretskii
4008e664a8 ; * src/dispnew.c (adjust_glyph_matrix): Add comment (bug#77039). 2025-03-17 14:16:45 +02:00
Eli Zaretskii
fd88c52320 ; * etc/NEWS: Fix last change. 2025-03-17 14:12:13 +02:00