* 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.
* 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).
* 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'.
* 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.
* 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.
* 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.
* src/editfns.c (Ftranspose_regions): Calculate length of range between
regions both in units of bytes and characters and use these values as
appropriate.
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.
* 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.
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.
* 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)
* 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'.
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.
* 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".
* 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).
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.
* 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)
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.
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.
* 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.
* 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.
* 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.
* 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).
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.