1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00
Commit graph

189117 commits

Author SHA1 Message Date
Helmut Eller
43a000c31b Tally GMP allocations
Without this, bignum allocations in the pidigits don't properly trigger
GC.  This patch changes the peak memory usage for the pidigits benchmark
by a factor of 6.  The benchmark also begins to spend much more time in
GC, as it should be:

|        | max rss   | elapsed time |
|--------+-----------+--------------|
| before | 392472 KB | 6.7 s        |
| after  | 58512 KB  | 32.93 s      |

* src/bignum.h (init_gmp_memory_functions): Declare new function.
* src/alloc.c (init_gmp_memory_functions): Implement it.
(xmalloc_for_gmp): New helper.
(xrealloc_for_gmp, xfree_for_gmp): Moved here from bignum.c.
* src/bignum.c (init_bignum): Call init_gmp_memory_functions.
2025-12-01 15:58:11 +01:00
Helmut Eller
b01c6b2849 Abort if EMACS_IGC_ARENA_SIZE can't be parsed
* src/igc.c (parse_error): New helper.
(read_gens, read_arena_size): Use it.
2025-11-29 20:52:56 +01:00
Helmut Eller
845b93cb12 * src/igc.c (process_one_message): Format timestamps as floats. 2025-11-29 20:52:56 +01:00
Eli Zaretskii
00ad86045f ; * lisp/emacs-lisp/igc.el (igc-collect): Doc fix. 2025-11-29 19:57:36 +02:00
Eli Zaretskii
b1d360a77b ; * src/igc.c (Figc__collect): Doc fix. 2025-11-29 11:39:22 +02:00
Helmut Eller
4e446b2e60 Read the MPS_KEY_ARENA_SIZE parameter from environment
The initial arena size can be set with EMACS_IGC_ARENA_SIZE=<bytes>.

* src/igc.c (read_arena_size): New function.
(make_arena): Use it.
2025-11-28 20:17:39 +01:00
Helmut Eller
8897e0e629 Make it easier to start an incremental collection
* src/igc.h (igc_collect): Add incremental argument.
* src/igc.c (igc_collect): Depending on the argument, either call
mps_arena_collect or mps_arena_start_collect.
(Figc__collect): Add optional argument.
2025-11-28 20:14:18 +01:00
Helmut Eller
81186602f2 Process mps_message_type_gc messages
This makes the output look like:
[81338818] GC start: Generation 0 of a chain has reached capacity: start
 a minor collection.
[81344807] GC: condemned: 16802688 live: 417424 not_condemned: 58871808

The "[81338818]" part is the time when the message was posted.

* src/igc.c (enable_messages): Include mps_message_type_gc.
(process_one_message): Handler mps_message_type_gc and include the
timestamp.
2025-11-28 10:54:47 +01:00
Helmut Eller
12667bf909 Remove the oldgen_ap field from struct igc_thread
This allocation point is only needed for the dump.  It's simpler to
create and destroy this allocation point in igc_alloc_dump than to do it
for each thread.

* src/igc.c (struct igc_thread): Remove oldgen_ap.
(create_thread_aps): Delete code for oldgen_ap.
(igc_on_pdump_loaded): Create and destroy the allocation point here.
2025-11-26 17:47:57 +01:00
Helmut Eller
7dfa9e76eb * mps/code/global.c (GlobalsDescribe): Include tracedTime. 2025-11-26 10:41:34 +01:00
Helmut Eller
842c659b0b Revert "Add "flat" representation for bignums"
This reverts commit 1a339d54ea.
2025-11-26 09:34:00 +01:00
Helmut Eller
1a339d54ea Add "flat" representation for bignums
If FLAT_BIGNUMS is defined, Lisp_Bignums are a vector of GMP limbs
instead of a mpz_t (i.e. pointer to limb array).

The primary difficulty was the changed return type of the bignum_val
function.  The idiom "*bignum_val (foo)" was used all over the place.
For the flat representation, it seems impossible to define bignum_val
such that it returns a pointer.  I changed the return type to a struct,
but that made it necessary to change the idiom to "bignum_val (foo).z".

* src/bignum.h (FLAT_BIGNUMS): Define if HAVE_MPS.
(struct Lisp_Bignums): Define alternative representation.
(struct bignum_val): New helper struct.
(bignum_val): Change return type and define different version for flat
bignums.
(bignum_integer): Define a separate version for flat bignums.
(BIGNUM_VAL): New macro.
(init_gmp_memory_functions): New.  Define the prototype here for a
function that is implemented in alloc.c.
(mpz_set_integer): Update for changed xbignum_val.
* src/bignum.c (init_bignum): Call init_gmp_memory_functions.
(make_bignum_from_mpz): New helper.
(make_bignum_bits, make_bignum_str): Adapted for flat bignums.
(bignum_to_double, bignum_to_uintmax, bignum_bufsize, bignum_to_c_string)
(get_random_bignum): Adapt to changed bignum_val.
* src/alloc.c (xmalloc_for_gmp): New.
(xrealloc_for_gmp, xfree_for_gmp): Moved here from bignum.c.  Call
tally_consing.
(init_gmp_memory_functions): New.
(cleanup_vector): Adapt to flat bignums.
* src/data.c (Fnatnump, arithcompare, Fminus, integer_remainder)
(Flogcount, Fash, expt_integer, Fadd1, Fsub1, Flognot): Adapt to changed
bignum_val.
* src/emacs-module.c (module_extract_big_integer): Adapt to changed
bignum_val.
* src/floatfns.c (Fabs, Flogb): Adapt to changed bignum_val.
* src/fns.c (Frandom, Ftake, Fntake, Fnthcdr, Fmemql, Feql)
(internal_equal_1, value_cmp, sxhash_bignum): Adapt to changed
bignum_val.
* src/igc.c (finalize_bignum, finalize_vector, maybe_finalize): Adapt to
flat bignums.
* src/pdumper.c (dump_bignum): Define separate version for flat bignums.
(dump_cold_bignum, dump_do_dump_relocation): Adapt to changed
bignum_val.
* src/timefns.c (ztrillion, ticks_hz_to_timespec, ticks_hz_hz_ticks)
(lispint_arith): Adapt to changed bignum_val.
2025-11-25 20:21:28 +01:00
Helmut Eller
937aa5afe0 Merge branch 'master' into feature/igc 2025-11-25 20:19:43 +01:00
Sean Whitton
449e15de5b ; * lisp/vc/diff-mode.el (diff-goto-source): Revise docstring again. 2025-11-25 15:53:15 +00:00
Sean Whitton
59e8b7267f Make diff-apply-hunk consider an active region
* lisp/vc/diff-mode.el (diff-apply-buffer): New 'no-save'
meaning for fourth optional argument.  Reserve other non-nil
values for this argument.  Use ngettext for one message.
(diff-apply-hunk): If the region is active, apply all hunks that
the region overlaps, like diff-apply-buffer.
* doc/emacs/files.texi (Diff Mode):
* etc/NEWS: Document the change to diff-apply-hunk.
2025-11-25 14:53:19 +00:00
Sean Whitton
1844ce4a0f * lisp/emacs-lisp/cond-star.el (pcase*): New dummy definition. 2025-11-25 14:22:58 +00:00
Sean Whitton
3f6c7d1bfb ; diff-mode-el: Improve docstrings re diff-jump-to-old-file. 2025-11-25 14:06:29 +00:00
Alan Mackenzie
9b505dd8d4 CC Mode: update Version: header. Add a comment about it
* lisp/progmodes/cc-defs.el (c-version): Add a comment
encouraging maintainers to keep cc-mode.el's Version: header
the same.

* lisp/progmodes/cc-mode.el (top level): Update the Version:
  header to 5.35.2.
2025-11-25 12:00:55 +00:00
Michael Albinus
6d600f492a Add etc/NEWS style rules
* CONTRIBUTE (Documenting your changes):
Refer to admin/notes/documentation.

* admin/notes/documentation: Add etc/NEWS style rules.  (Bug#79851)
2025-11-25 09:33:17 +01:00
Po Lu
0d1bb23d8c Fix mouse dragging on touch screens
* lisp/mouse.el (mouse-position-for-drag-line): New function;
return position of active touch screen tool if a sequence is
being translated into mouse movement events, and the last mouse
position otherwise.
(mouse-drag-line): Invoke `mouse-position-for-drag-line' rather
than reading the mouse position manually.

* lisp/touch-screen.el (touch-screen-current-tool): New 10th
field holding the frame-relative last attested position of this
tool.
(touch-screen-relative-xy): Clarify doc string.
(touch-screen-handle-point-update): Update the said field with
POSN's position relative to its frame.
(touch-screen-handle-touch): Initialize the 10th field of new
tool lists with such a position.
(touch-screen-last-drag-position): New function.
2025-11-25 10:48:56 +08:00
Pip Cet
35652226f7 Avoid fixing the same reference twice in 'fix_window'
These references are already fixed by 'fix_vectorlike'.  Fixing them a
second time is possibly unsafe because the forwarded pointers may have
a different summary.

* src/igc.c (fix_window): Remove explicit 'IGC_FIX12_OBJ' calls.
2025-11-25 02:17:31 +00:00
Philip Kaludercic
c767928997
Only search for package descriptors in package root
See the following thread for a background on this change:
https://mail.gnu.org/archive/html/emacs-devel/2025-08/msg00332.html.
This change reverts b81f937e.

* lisp/emacs-lisp/package.el (package-dir-info): Do not
recursively try to find all Lisp files that might have package
metadata.  (Bug#79742)
2025-11-24 20:53:22 +01:00
Philip Kaludercic
c3604c3224
; Fix issue when installing packages from Dired
* lisp/emacs-lisp/package.el (package-dir-info, package-unpack):
Force Dired to return list of packages explicitly marked for
installation.  Without the optional argument, Dired will return
the file under the current point if no files are selected.
2025-11-24 20:53:22 +01:00
Philip Kaludercic
4ea81f359c
Replace underscores in bind-and* with fresh symbols
* lisp/emacs-lisp/cond-star.el (cond*-convert-condition): Bind
unused values to fresh symbols, to avoid the compiler warning
that a symbol starting with an underscore is accessed later on.
This mirrors the behaviour of `if-let*' and family.
2025-11-24 20:53:22 +01:00
Juri Linkov
33d813c63b Fix query-replace-regexp for using '^' with calculated replacement '\,'
* lisp/replace.el (replace--push-stack): Add new args
'next-replacement' and 'match-again' and push them to the stack.
(perform-replace): Restore the previous already calculated values
of 'next-replacement' and 'match-again' from the stack for the
'backup' ('^') key (bug#79811).

* test/lisp/replace-tests.el (query-replace-tests): Add tests.
2025-11-24 20:14:15 +02:00
Stefan Monnier
b852555401 Don't apply EditorConfig files to themselves
* lisp/international/mule.el (auto-coding-alist): Add entry for
`.editorconfig` files.
2025-11-24 11:42:27 -05:00
Sean Whitton
4cc42911ed Persist Log View mode marks across buffer revert
* lisp/vc/log-view.el (vc-exec-after): Autoload.
(log-view--restore-marks): New function.
(log-view-mode): Add it to revert-buffer-restore-functions.
2025-11-24 16:04:42 +00:00
Stefan Monnier
e233513d28 editorconfig-core-handle.el: Fix silent misparse
See https://github.com/editorconfig/editorconfig-emacs/issues/380

* lisp/editorconfig-core-handle.el (editorconfig-core-handle--parse-file):
Fix regexp to not inadvertently match LF.  Remove an O(N²) complexity.
Use `line-number-at-pos`.

* lisp/editorconfig.el (editorconfig--get-coding-system): Don't let
errors propagate.
2025-11-24 10:26:21 -05:00
Sean Whitton
188ad4f909 ; * src/keyboard.c (read_key_sequence): Style tweaks. 2025-11-24 10:57:54 +00:00
Stephen Gildea
1f2a161f93 ; * lisp/time-stamp.el: Reformat some doc strings. 2025-11-23 18:32:41 -08:00
Po Lu
860996afb0 ; * src/gtkutil.c (xg_update_dark_mode_for_all_displays): Typo. 2025-11-24 10:19:56 +08:00
Po Lu
7550791287 Support `toolkit-theme-set-functions' on Android and execute hooks safely
* java/org/gnu/emacs/EmacsNative.java (setEmacsParams): New arg
UIMODE.
(sendConfigurationChanged): New args DETAIL and UI_MODE.

* java/org/gnu/emacs/EmacsNoninteractive.java (main1): Provide
an undefined UI mode.

* java/org/gnu/emacs/EmacsService.java (EmacsService): New field
uiMode.
(onCreate): Initialize this field at start-up and provide the
same to setEmacsParams.
(onConfigurationChanged): If the UI mode has been altered,
generate a configuration changed event to match.

* src/android.c (android_ui_mode): New variable.
(setEmacsParams): New argument UI_MODE.  Initialize the same
from this variable.

* src/androidgui.h (enum android_configuration_changed): New
enum.
(struct android_configuration_changed_event): New field
`DETAIL'.  Convert fields providing specifics into a union of
display density information and a UI mode integer.

* src/androidterm.c (handle_one_android_event): Handle both
manners of configuration change events.
(android_term_init): Initialize Vtoolkit_theme from UI mode
provided at start-up.

* src/frame.c (syms_of_frame): Always define Vtoolkit_theme.
Define Qtoolkit_theme_set_functions.

* src/gtkutil.c (xg_update_dark_mode_for_all_displays):

* src/w32term.c (w32_read_socket): Generate special toolkit
theme events, rather than executing hooks directly within the
read_socket callback.

* src/keyboard.c (kbd_buffer_get_event)
<TOOLKIT_THEME_CHANGED_EVENT>: Run Qtoolkit_theme_set_functions
and set Vtoolkit_theme from event->ie.arg.

* src/termhooks.h (enum event_kind): New event
TOOLKIT_THEME_CHANGED_EVENT.
2025-11-24 10:16:49 +08:00
Stephen Gildea
435c3948a4 ; * lisp/time-stamp.el: Minor code changes
autoloads: quote function names with #'
(time-stamp-filtered-buffer-file-name): 'member' -> 'memq'
(time-stamp-conv-warn): don't call the formats "forms".
2025-11-23 18:11:18 -08:00
Sean Whitton
11b68c6223 New commands to rewind decentralized VCS branches
* lisp/vc/vc.el (vc--remove-revisions-from-end): New function.
(vc-uncommit-revisions-from-end, vc-delete-revisions-from-end):
* lisp/vc/log-view.el (log-view-uncommit-revisions-from-end)
(log-view-delete-revisions-from-end): New commands (bug#79408).
(log-view-mode-map): Bind them.
* doc/emacs/maintaining.texi (VC Change Log):
* doc/emacs/vc1-xtra.texi (VC Auto-Reverting):
* etc/NEWS: Document them.
2025-11-23 18:36:22 +00:00
Ulf Jasper
dcc909917b Add 'newsticker--treeview-handle-url' (Bug#79849)
* lisp/net/newst-treeview.el (newsticker--treeview-url-keymap)
(newsticker--treeview-handle-url): Add 'newsticker--treeview-handle-url'
to replace 'newsticker-handle-url' in newsticker-treeview (Bug#79849).
2025-11-23 13:58:43 +01:00
Eli Zaretskii
b89fec7998 ; * doc/emacs/package.texi (Package Installation): Minor clarification. 2025-11-23 10:41:12 +02:00
Eli Zaretskii
bb1f70c901 Fix 'd' command in 'query-replace' in buffers not visiting files
* lisp/vc/diff.el (diff-file-local-copy): Use proper coding-system
when writing a local copy of a non-file visiting buffer.

* lisp/misearch.el (coding-system--for-buffer-diff): New variable.
(multi-file-replace-as-diff): Bind it to 'utf-8-emacs'.
(multi-file-diff-no-select): Use proper coding-system when reading
output of Diff.  (Bug#79761)
2025-11-23 10:33:49 +02:00
Elías Gabriel Pérez
6c30c6c87d ; hideshow: Rename 'hs--discard-overlay-after-change'.
* lisp/progmodes/hideshow.el (hs--discard-overlay-after-change):
Rename function and update docstring.
(hs-make-overlay): Update.
2025-11-23 09:48:27 +02:00
Sean Whitton
cd86307f26 vc-resynch-window: Restore always using vc-revert-buffer-internal
* lisp/vc/vc-dispatcher.el (auto-revert-buffers): Delete.
(vc-resynch-window): Always call vc-revert-buffer-internal.
Calling auto-revert-buffers will not necessarily revert the
current buffer, but we want it to happen synchronously.
2025-11-22 13:50:22 +00:00
Stefan Monnier
24c09c68dd lisp/ldefs-boot.el: Update generated presumably by lisp/Makefile.in (?) 2025-11-22 08:44:40 -05:00
Sean Whitton
75c09b03ed Default split-window-preferred-direction to 'longest'
* lisp/window.el (split-window-preferred-direction): Change
default value to 'longest'.
2025-11-22 13:20:05 +00:00
Sean Whitton
54775983ac vc-git-revision-published-p: Resolve REV
* lisp/vc/vc-git.el (vc-git-revision-published-p): Resolve REV
before using it, using vc-git--rev-parse.
2025-11-22 12:46:16 +00:00
Sean Whitton
748c3b2645 New command alias vc-restore
* lisp/vc/vc.el (vc-restore): New alias.
* etc/NEWS: Announce it.
2025-11-22 12:45:55 +00:00
Stefan Monnier
46d0f1fef1 (loaddefs-generate--make-autoload): Fix bug#79852
As JD Smith <jdtsmith@gmail.com> said we had 3 paths:

1. macro has `autoload-macro expand` and is already loaded: expand
2. macro has `autoload-macro expand` but is /not/ yet loaded: shortcut
3. macro does not have `autoload-macro expand`: shortcut

and the co-existence of 1 and 2 is a problem because it means
that same macro is sometimes handled one way and sometimes
another, with different results.
Remove number 2 by removing from the shortcut all the remaining
macros that have `autoload-macro expand`.

The immediate effect is that `make autoloads` now (auto)loads three
more files:

    [...]
    loaddefs-gen: loading file frameset (for cl-defun)
    Loading frameset...
      INFO     Scraping 1547 files for loaddefs...10%
      INFO     Scraping 1547 files for loaddefs...20%
    loaddefs-gen: loading file semantic/analyze (for define-overloadable-function)
    Loading semantic/analyze...
      INFO     Scraping 1547 files for loaddefs...30%
      INFO     Scraping 1547 files for loaddefs...40%
      INFO     Scraping 1547 files for loaddefs...50%
      INFO     Scraping 1547 files for loaddefs...60%
      INFO     Scraping 1547 files for loaddefs...70%
    loaddefs-gen: loading file tramp-adb (for tramp--with-startup)
    Loading tramp-adb...
      INFO     Scraping 1547 files for loaddefs...80%
    loaddefs-gen: loading file grep (for define-compilation-mode)
    Loading grep...
    [...]

* lisp/emacs-lisp/loaddefs-gen.el (loaddefs--defining-macros):
Remove macros that are marked `autoload-macro expand`, even if they are
not predefined.
(loaddefs-generate--make-autoload): Simplify accordingly.
2025-11-22 06:56:46 -05:00
Stefan Monnier
b193a78a6f (loaddefs--defining-macros): Weed out a few more entries
* lisp/emacs-lisp/loaddefs-gen.el (loaddefs--defining-macros):
Remove `define-skeleton`, `define-derived-mode`, and
`define-generic-mode` since their `autoload-macro expand` property is
now preloaded.
2025-11-22 06:56:46 -05:00
Stefan Monnier
10961728dc : Update ldefs-boot.el 2025-11-22 06:56:46 -05:00
Stefan Monnier
74087e252f loaddefs-gen: Weed out some elements from the shortcut path
The predefined macros marked as `autoload-macro expand` can't
get to the shortcul path, so simplify it accordingly.
Mark a few more macros from the shortcut path as `autoload-macro expand`
but don't remove them yet from the shortcut path (need to update
`ldefs-boot.el`).

* lisp/progmodes/compile.el (define-compilation-mode):
* lisp/emacs-lisp/generic.el (define-generic-mode):
* lisp/emacs-lisp/derived.el (define-derived-mode):
* lisp/cedet/mode-local.el (define-overloadable-function):
* lisp/skeleton.el (define-skeleton): Mark as `autoload-macro expand`
so as to make the "shortcut" path in `loaddefs-gen.el` redundant.

* lisp/emacs-lisp/loaddefs-gen.el (loaddefs--defining-macros):
Remove the easy-mmode.el macros since they are already marked as
`autoload-macro expand` and they are always defined, so we never check
them against that list.
(loaddefs-generate--make-autoload): Remove handling of the
`easy-mmode.el` macros as well as `defun` and `defmacro` from the
shortcut path since we can never get there with them anyway.
2025-11-22 06:56:46 -05:00
Michael Albinus
dbd2cd2516 Adapt etc/NEWS
* etc/NEWS: Shrink Zone entry.
Presentational fixes and improvements.
2025-11-22 12:42:46 +01:00
Eli Zaretskii
2fcf431c67 Merge from origin/emacs-30
e262ed18f9 ; * admin/notes/spelling: Copy note on possessive from CO...
2025-11-22 06:36:45 -05:00
Reuben Thomas
e1f851e840 Fix ispell’s handling of comment-end when adding local words
* lisp/textmodes/ispell.el (ispell-add-per-file-word-list): Deal
with `comment-end' in a way that works for comments that don’t
nest.

We proceed as follows: when `comment-end' is non-empty, we only
ever insert one start and one end comment, the first time we add
a local word.  This works with both C-style (which don’t nest)
and Rust-style comments (which do).

If we’re using line comments (i.e. comments that only have a
`comment-start'), then continue to insert one on each line.

* test/lisp/textmodes/ispell-tests/ispell-tests.el
(ispell/ispell-add-per-file-word-list/nxml): Adjust test.

Bug#79871
2025-11-22 13:15:45 +02:00