1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-22 12:33:53 -08:00
Commit graph

50843 commits

Author SHA1 Message Date
Juri Linkov
464e1a5a81 * src/term.c (append_glyph): Fix wide character handling in margins columns.
Use 'it->pixel_width' for 'it->margin_column' and 'nglyphs'.
Also fix 'glyph->padding_p' (bug#80025).
2025-12-31 09:44:17 +02:00
Juri Linkov
3ff8f30f83 Make variables 'left-margin-columns' and 'right-margin-columns' buffer-local
* src/xdisp.c (handle_single_display_spec): Use FIXNATP for margin column.
Also use 'Vleft_margin_columns' instead of 'Fsymbol_value' (bug#80025).
(left-margin-columns, right-margin-columns): Use Fmake_variable_buffer_local.
2025-12-30 20:08:07 +02:00
Juri Linkov
996b2304e5 Fix term.c:append_glyph for wide character margin column indicators
* src/term.c (append_glyph): Add 'handled_column' variable
and use it on existing code instead of immediately returning
after adding margin column glyph (bug#80025).
2025-12-30 20:01:40 +02:00
Juri Linkov
9522f4c79e Support multi-character margin indicators (bug#80025)
* src/term.c (append_glyph):
* src/xdisp.c (append_glyph, produce_image_glyph):
Increment it->margin_column to handle multi-char margin indicators.
2025-12-29 19:25:12 +02:00
Juri Linkov
ea3d05394c Add new variables 'left-margin-columns' and 'right-margin-columns' (bug#80025)
* src/xdisp.c (left-margin-columns, right-margin-columns): New variables.
(handle_single_display_spec): Find the column number that
corresponds to the position of the column symbol in these variables.

* lisp/outline.el (outline--create-button-icons):
Add the symbol 'outline' to margin column spec.
(outline-minor-mode): Add/remove the symbol 'outline' to/from
'left-margin-columns' and 'right-margin-columns'.

* lisp/progmodes/flymake.el (flymake--bs-display):
Add the symbol 'flymake' to margin column spec.
(flymake--restore-margins): Remove the symbol 'outline' from
'left-margin-columns' and 'right-margin-columns'.
(flymake--resize-margins): Add the symbol 'outline' to
'left-margin-columns' and 'right-margin-columns'.

* lisp/progmodes/hideshow.el (hs--make-indicators-overlays):
Add the symbol 'hideshow' to margin column spec.
(hs-minor-mode): Add/remove the symbol 'outline' to/from
'left-margin-columns'.
2025-12-29 19:19:45 +02:00
Juri Linkov
7dd94923ef Add the same margin-column handling for term and image glyphs (bug#80025)
* src/term.c (append_glyph):
* src/xdisp.c (produce_image_glyph):
Copy the margin-column random-access indexing with space-padding
from 'append_glyph' in xdisp.c.  Also copy code from the end of these
functions before return after handling the margin column.
2025-12-22 09:27:34 +02:00
Juri Linkov
1c55ea07fa Initial implementation of column-based margin indicators (bug#80025)
* src/dispextern.h (it): Add 'margin_column' field.

* src/xdisp.c (handle_single_display_spec): Parse margin column
specification '(margin left-margin COLUMN)' and set the column
to 'it->margin_column'.
(append_glyph): Support random-access indexing of margin column,
padding with spaces when the required column is beyond the used area.
2025-12-21 09:32:32 +02:00
Eli Zaretskii
040374be2d ; Avoid compilation warnings in xwidget.c on macOS
* src/xwidget.c (Fxwidget_perform_lispy_event): Avoid compiler
warnings about set but not used variables.  (Bug#80044)
2025-12-21 08:15:55 +02:00
Jens Schmidt
0aabe62b64 Improve handling of non-ASCII characters in 'transpose-regions'
* src/editfns.c (Ftranspose_regions): Separate code related to character
semantics from that related to byte semantics and in that way leverage
optimizations for regions of equal length with respect to both
semantics.  Move and update comments dating back to the initial
implementation.
* test/src/editfns-tests.el (editfns-tests--transpose-regions-tests)
(editfns-tests--transpose-regions-markups)
(editfns-tests--transpose-regions): New test and accompanying variables.
2025-12-20 13:23:29 -05:00
Jens Schmidt
875e42d501 Fix byte-vs-char length issue in 'transpose-regions'
* src/editfns.c (Ftranspose_regions): Calculate length of range between
regions both in units of bytes and characters and use these values as
appropriate.
2025-12-20 13:23:21 -05:00
Martin Rudalics
cf2e676eca Don't change visibility of tty root frames (Bug#80032)
* src/frame.c (Fmake_frame_visible, Fmake_frame_invisible):
* doc/lispref/frames.texi (Visibility of Frames): Don't change
visibility of tty root frames.  (Bug#80032)
2025-12-20 15:12:39 +01:00
Paul Eggert
4d11449c96 Revert to simpler (and we hope faster) TAGGEDP
Suggested by Mattias Engdegård (bug#80021#17).
* src/lisp.h (lisp_h_FIXNUMP, lisp_h_TAGGEDP):
Go back to the simpler (X&7) == TAG approach for checking object tags.
This reverses my commit ccdb08ef4e
“Improve performance of CONSP, FIXNUMP, etc.”
dated 2018-08-25 13:39:18 -0700,
though it keeps the TAGGEDP function the older commit introduced.
Although the older commit improved performance on its circa 2010
platform, when I ran today’s ‘make -C lisp compile-always’
benchmark on Ubuntu 25.10 which uses gcc (Ubuntu 15.2.0-4ubuntu4)
on an circa-2021 Intel Xeon W-1350, this patch makes the
‘make -C lisp compile-always’ benchmark 3.1% faster.  Although the
patch unfortunately also makes the Emacs text segment 0.6% larger,
in this case speed and simplicity beat text size in importance.
2025-12-19 09:10:31 -08:00
Gerd Möllmann
a6c2ae3a3f Don't make tty child frames visible when selected (bug#80020)
* src/frame.c (do_switch_frame): Don't change visibility of tty
child frames.
(Fraise_frame): Doc string fix.
2025-12-19 14:12:33 +01:00
Paul Eggert
bc65fb7486 Remove no-longer needed MALLOC_0_IS_NONNULL macro.
* src/conf_post.h (MALLOC_0_IS_NONNULL): Remove.
Gnulib no longer needs this.
2025-12-09 13:27:28 -08:00
Paul Eggert
47073fa12d Port back to GTK2
Problem reported by Sven Joachim in:
https://lists.gnu.org/r/emacs-devel/2025-12/msg00225.html
* src/xterm.c (xi_frame_selected_for):
Also define if !(defined USE_GTK && defined HAVE_GTK3).
2025-12-09 09:11:27 -08:00
Paul Eggert
05c1f34036 ; Fix confusing comment in xmenu.c. 2025-12-09 09:11:26 -08:00
Eli Zaretskii
c5bc4082b5 ; Fix a typo in xterm.[ch]. 2025-12-09 14:31:14 +02:00
Paul Eggert
d10a649e1b Pacify -Wunused-function re get_conversion_field
* src/textconv.c (get_conversion_field): Define only if HAVE_ANDROID,
since it is unused on non-Android.
2025-12-08 18:32:01 -08:00
Po Lu
238c2dc3b6 ; * src/keyboard.c (make_lispy_event): Remove unused variable. 2025-12-09 09:49:23 +08:00
Po Lu
a9018ee498 Fix builds without toolkit menu bars
* src/keyboard.c (make_lispy_event): Call x_y_to_column_row when
building internal menu bar events.

* src/xdisp.c (x_y_to_column_row): Provide DX and DY parameters
to x_y_to_column_row.
2025-12-09 09:48:53 +08:00
Paul Eggert
1c43511dbc Fix xmenu.c USE_X_TOOLKIT duplication
* src/xmenu.c (Fx_menu_bar_open_internal):
Don’t say ‘#ifdef USE_X_TOOLKIT’ inside an #if where
it is already known that USE_X_TOOLKIT is defined.
2025-12-08 10:41:50 -08:00
Paul Eggert
855ad6d870 Fix some C symbol extern visibility
Make some C symbols static if they don’t need to be extern.
Also, remove a couple of functions that were discovered to be
unused as a result of this process, and mark two extern
functions intended to be usable from GDB.
* src/buffer.c (previous_overlay_change):
* src/composite.c (composition_lisp_table):
* src/fileio.c (file_name_directory):
* src/frame.c (check_tty):
* src/insdel.c (adjust_markers_for_insert):
* src/keyboard.c (unread_switch_frame, read_char)
(requeued_events_pending_p):
* src/sysdep.c (renameat_noreplace) [!HAVE_ANDROID]:
* src/textconv.c (get_conversion_field) [!HAVE_ANDROID]:
* src/treesit.c (TREESIT_BOB_LINECOL, TREESIT_TS_POINT_1_0)
(treesit_buf_tracks_linecol_p, make_treesit_parser)
(make_treesit_node):
* src/xdisp.c (x_y_to_hpos_vpos):
* src/xfaces.c (load_color) [!MSDOS]:
* src/xfns.c (x_real_pos_and_offsets):
* src/xterm.c (x_dnd_do_unsupported_drop):
Now static.  Move up if necessary.
* src/coding.c (utf8_string_p):
* src/keyboard.c (detect_input_pending_ignore_squeezables):
Remove; unused.
* src/frame.c (gui_set_alpha):
* src/textconv.c (start_batch_edit, end_batch_edit, commit_text)
(finish_composing_text, set_composing_text)
(set_composing_region, textconv_set_point_and_mark)
(delete_surrounding_text, request_point_update)
(textconv_barrier, replace_text, get_extracted_text)
(get_surrounding_text):
* src/xdisp.c (gui_union_rectangles):
* src/xterm.c (xi_frame_selected_for):
Define only if needed.
* src/treesit.c (treesit_debug_print_parser_list)
(treesit_debug_print_linecol): Declare EXTERNALLY_VISIBLE.
* src/xdisp.c (x_y_to_column_row): New function, defined
only if needed.  All external callers to x_y_to_hpos_vpos changed.
2025-12-08 10:41:50 -08:00
Sean Whitton
44d47caa86 New 'R' code letter for 'interactive' forms
* src/callint.c (callint_argfuns): Add use-region-beginning and
use-region-end.
(syms_of_callint): Protect use-region-beginning and
use-region-end.  Add DEFSYM for Quse_region_p.
(Fcall_interactively): New 'R' code letter.
* lisp/textmodes/paragraphs.el (repunctuate-sentences):
* lisp/vc/diff-mode.el (diff-delete-other-hunks, diff-apply-hunk)
(diff-revert-and-kill-hunk, diff-apply-buffer):
* lisp/vc/log-view.el (log-view-mark-entry)
(log-view-unmark-entry): Use it.
* doc/lispref/commands.texi (Interactive Codes):
* doc/lispref/markers.texi (The Region):
* etc/NEWS:
* lisp/simple.el (use-region-beginning, use-region-end)
(use-region-p):
* src/callint.c (Finteractive): Document it.
2025-12-08 15:01:50 +00:00
David Caldwell
15d9af4f5e NS: Fix compilation on pre macOS 11 macs
* src/nsterm.m ([EmacsWindow initWithEmacsFrame:fullscreen:screen:]):
Add a compile check around setToolbarStyle since it is not available
until macOS 11.0 and a run-time check in case it was compiled on
macOS >= 11.0 but run on an earlier version.  (Bug#79951)
2025-12-08 16:22:42 +02:00
Eli Zaretskii
d50fde57ba ; Fix commentary in xfaces.c
* src/xfaces.c (face_at_buffer_position)
(face_at_string_position): Fix commentary.
2025-12-08 16:19:59 +02:00
Jeremy Bryant
22bf7158a5 ; * src/.gdbinit: Improve comments of .gdbinit helper functions (bug#79932)
xgetptr: Improve comment describing helper function.
xgetint: Add comment describing helper function.
xgettype: Add comment describing helper function.
xgetsym: Add comment describing helper function.
xprintstr: Add comment describing helper function.

Co-authored-by: Eli Zaretskii <eliz@gnu.org>
2025-12-08 16:11:50 +02:00
Paul Eggert
24297f6d9a Simplify conv_sockaddr_to_lisp via strnlen
* src/process.c (conv_sockaddr_to_lisp):
Use strnlen rather than a circumlocution.
2025-12-07 23:40:12 -08:00
Po Lu
15f9050ce5 Fix the DJGPP port
* msdos/sed2v2.inp (ALIGNOF_EMACS_INT): Define to 4.

* msdos/sedlibmk.inp (OMIT_GNULIB_MODULE_fchmodat)
(OMIT_GNULIB_MODULE_issymlinkat, OMIT_GNULIB_MODULE_issymlink)
(OMIT_GNULIB_MODULE_lchmod): Define to true.

* src/gmalloc.c (__morecore, __after_morecore_hook)
(__malloc_initialize_hook): Don't declare till stddef.h has been
included for `ptrdiff_t'.
2025-12-08 10:06:29 +08:00
Paul Eggert
0d43f2a562 Align config.h better to src/lisp.h
This is mostly a cleanup patch to fix growing discrepancies
between src/lisp.h and configure.ac in terms of how they deduce
how EMACS_INT aligns.  The patch includes a static check that the
two methods now agree.  It also speeds up ‘configure’ a bit.
* configure.ac (ALIGNOF_INT, ALIGNOF_LONG, ALIGNOF_LONG_LONG):
Remove; no longer used.
(ALIGNOF_EMACS_INT): New macro.
(system_malloc): Set to 'no' more consistently with what’s
in src/lisp.h.
* src/lisp.h (ALIGNOF_EMACS_INT): Do not define here, as config.h
defines it now.  Check that config.h’s definition equals the
actual alignof (EMACS_INT).
(USE_USB_TAG): Set more consistently with what’s in configure.ac.
(alignas): Don’t second-guess Gnulib.
2025-12-07 15:45:20 -08:00
Paul Eggert
f766e8a36b Work around GCC bug 123042
* src/ccl.c: The bug occurs in GCC versions after GCC 13.
2025-12-07 15:45:20 -08:00
Paul Eggert
2b7261d7f5 Include malloc.h early in alloc.c
* src/alloc.c, src/gmalloc.c: Include <malloc.h> before <stdlib.h>.
This mimics include patterns elsewhere, and avoids a problem if
malloc.h declares realloc (i.e., rpl_realloc) early as extern,
whereas Gnulib stdlib.h declares it later as inline which means it
is extern inline, which clashes with gmalloc’s definition of
rpl_realloc when gmalloc.o is used.  Problem discovered when
building Emacs on Ubuntu 25.10 with "./configure CC='gcc -m32'
emacs_cv_struct_alignment=no gl_cv_header_working_stdalign_h=no".
2025-12-07 15:45:20 -08:00
Paul Eggert
caf0941e56 Pacify -Werror=null-dereference in ralloc.c
* src/ralloc.c (find_heap, update_heap_bloc_correspondence):
Omit unnecessary comparisons to NULL that cause GCC to warn.
2025-12-07 15:45:19 -08:00
Eli Zaretskii
300c6dc2f9 Allow volume control of system audio device on MS-Windows
* src/sound.c (Fw32_sound_volume): New function.

* etc/NEWS: Announce it.
2025-12-07 11:31:40 +02:00
Gerd Möllmann
2d459d8377 * src/comp.c (emit_EQ): Make a declaration an assignment (bug#79722) 2025-12-07 03:43:51 +01:00
Eli Zaretskii
3945654f05 Merge from origin/emacs-30
998d45d5d1 ; * lisp/calc/calc-units.el: Better reference for CODATA ...
fae83f1eb8 ; Improve documentation of 'char-script-table'
3e489ed804 ; * src/font.c (Flist_fonts): Doc fix.
4c292b6f70 ; vc-dir-clean-files: Improve docstring and message (bug#...
8a6b84dbcb Fix doc string of 'display-buffer'
2025-12-06 08:58:57 -05:00
Eli Zaretskii
8f5c26cec2 ; * src/eval.c (Ffunc_arity): Doc fix (bug#79880). 2025-12-06 12:33:44 +02:00
Jeremy Bryant
ddcbab2809 ; * src/.gdbinit: Document xfmt, a user-defined function.
Proposed in (bug#79932).

Co-authored-by: Eli Zaretskii <eliz@gnu.org>
2025-12-06 11:15:11 +02:00
Martin Rudalics
da45a474d3 Fix root frame check in store_frame_param (Bug#79947)
* src/frame.c (store_frame_param): Make sure 'minibuffer',
'parent-frame' and 'delete-before' parameters reference frame on
same terminal.  Spare GUI frames when checking root frames of
tty frames and their surrogate minibuffer frames (Bug#79947).
2025-12-06 08:54:51 +01:00
Mattias Engdegård
5e7a71d0f4 Don't emit print-circle refs for empty string and vector
The empty vector and string(s) are immutable, contain no references and
always read as the same objects.

* src/print.c (PRINT_CIRCLE_CANDIDATE_P): Turn macro into...
(print_circle_candidate_p): ...a function, and exclude [] and "".
* test/src/print-tests.el (print-circle): Add test case.
2025-12-04 17:52:14 +01:00
Andrea Corallo
d52bf63de2 * Have comp do not use builtin_expect with libgccjit < 14 (bug#79722)
* src/comp.c (emit_EQ): Do not use '__builtin_expect' with
libgccjit < 14.
2025-12-04 17:05:23 +01:00
Rudolf Adamkovič
cbf9c58730 NS: Fix toolbar style and position
* src/nsterm.m ([EmacsWindow initWithEmacsFrame:fullscreen:screen:]):
Always show the toolbar below the window title.  This is needed on
Mac OS 11+ where the toolbar style is decided by the system (which
is unpredictable) and the newfangled "compact" toolbar may be chosen
(which is undesirable).  (Bug#79900)
2025-12-04 14:16:35 +02:00
Eli Zaretskii
3e489ed804 ; * src/font.c (Flist_fonts): Doc fix. 2025-12-04 10:27:29 +02:00
Eli Zaretskii
6a4ca5e59b ; Avoid assertion violations in 'font-match-p'
* src/font.c (font_match_p): Avoid assertion violations in
'font_encode_char' if FONT is not a font-object.
2025-12-04 10:11:09 +02:00
Paul Eggert
335f1a11f0 Waste 4 fewer bytes in GNU/Linux 32-bit HPPA
Also, add more commentary about the situation.
* src/systhread.h (SYSTHREAD_ALIGN_ROOM): Use alignof (double),
not alignof (int), to align the room.  This means we have
only 8 (not 12) bytes of slop on 32-bit HPPA GNU/Linux.
2025-12-03 13:10:35 -08:00
Paul Eggert
1b2b433fc0 Port to GNU/Linux HPPA malloc
On this platform, you cannot reliably malloc objects containing
values of type pthread_mutex_t or pthread_cond_t, since malloc
guarantees only 8-byte alignment but these two types require
16-byte alignment.  See GCC bug 115750
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115750> reported by
Sam James and Emacs bug 79936 <https://bugs.gnu.org/79936>
reported by John Paul Adrian Glaubitz.
* configure.ac (ALIGNOF_MAX_ALIGN_T, ALIGNOF_PTHREAD_COND_T)
(ALIGNOF_PTHREAD_MUTEX_T) [HAVE_PTHREAD]: New C macros.
* src/systhread.c (sys_mutex_init, sys_mutex_lock)
(sys_mutex_unlock, sys_cond_init, sys_cond_wait)
(sys_cond_signal, sys_cond_broadcast, sys_cond_destroy):
Use SYTHREAD_ALIGN_PTR to convert sys_mutex_t and sys_cond_t to
pthread_mutex_t and pthread_cond_t, since runtime conversion is
needed on GNU/Linux HPPA.
* src/systhread.h (SYSTHREAD_ALIGN_ROOM, SYSTHREAD_ALIGN_PTR):
New macros, which affect the generated code only on
unusual platforms like GNU/Linux HPPA.
(sys_mutex_t, sys_cond_t) [HAVE_PTHREAD]: Use them.
2025-12-02 17:46:56 -08:00
Paul Eggert
3930d12e4d Pacify gcc -Wdangling-else in dbusbind.c
* src/dbusbind.c (XD_DBUS_VALIDATE_BUS_NAME)
(XD_DBUS_VALIDATE_PATH, XD_DBUS_VALIDATE_INTERFACE)
(XD_DBUS_VALIDATE_MEMBER): Make these expand to single statements
when they are followed by ‘;’.  All uses changed.
2025-12-02 17:46:56 -08:00
Sean Whitton
5167989b2a Cache VC incoming revisions
* lisp/vc/vc-hooks.el (vc-file-setprop): Use cl-pushnew.
(vc--repo-setprop, vc--repo-getprop, vc--repo-clearprops): New
functions.
* lisp/vc/vc.el (vc--incoming-revision): Cache incoming
revisions.
* src/fns.c (Fput): State that VALUE is returned.
2025-11-30 18:20:50 +00:00
Juri Linkov
9174bc811a Use treesit-extra-load-path for more values of treesit-auto-install-grammar
* lisp/treesit.el (treesit-auto-install-grammar): Use the first
writable directory from 'treesit-extra-load-path' for values
'always', 'ask', 'ask-dir' (bug#79862).

* src/treesit.c (syms_of_treesit): Extend docstring.
2025-11-30 20:14:19 +02:00
Juri Linkov
a1ab5f429d * lisp/cus-start.el: Make 'treesit-extra-load-path' customizable.
* lisp/treesit.el (treesit-auto-install-grammar): Add the value 'ask-dir'.
(treesit-ensure-installed): When 'treesit-auto-install-grammar' is
'ask' or 'ask-dir', ask for the directory to install the grammar library
using the first writable directory of 'treesit-extra-load-path' as default.
Also add the provided directory to 'treesit-extra-load-path' afterwards.

* src/treesit.c (treesit-extra-load-path): In the docstring
mention the fact that the first directory is special (bug#79862).
2025-11-28 09:23:57 +02:00
Paul Eggert
9b4d9bb01e Fix recently-introduced ash bug
Problem reported by John Paul Adrian Glaubitz (bug#79876).
* src/data.c (Fash): Don’t assume stdc_leading_zeros, which
returns an unsigned integer of unspecified width, returns
a value narrower than EMACS_INT.  Also, don’t munge the code to
worry about stdc_leading_zeros (0); unlike GCC’s __builtin_clz,
stdc_leading_zeros works fine on 0.  And use a temporary to
avoid a cast.
2025-11-27 10:47:56 -08:00