1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-02-09 17:24:04 -08:00
Commit graph

170483 commits

Author SHA1 Message Date
Mattias Engdegård
d3cefd3e98 Leaner hash table dumping and thawing
Only dump the actual data, and the test encoded as an enum.  This
simplifies dumping, makes dump files smaller and saves space at run
time.

* src/lisp.h (hash_table_std_test_t): New enum.
(struct Lisp_Hash_Table): Add frozen_test member, consuming no extra space.
* src/fns.c (hashfn_user_defined): Now static.
(hash_table_test_from_std): New.
(hash_table_rehash): Rename to...
(hash_table_thaw): ...this and rewrite.
* src/pdumper.c (hash_table_contents): Only include actual data, not
unused space.
(hash_table_std_test): New.
(hash_table_freeze): Set frozen_test from test.
(dump_hash_table): Dump frozen_test, not the whole test struct.
Don't bother other dumping fields that can be derived.
2024-01-13 20:50:37 +01:00
Mattias Engdegård
c3d0cc50fa Remove rehash-threshold and rehash-size struct members
These parameters have no visible semantics and are hardly ever used,
so just use the default values for all hash tables.  This saves
memory, shrinks the external representation, and will improve
performance.

* src/fns.c (std_rehash_size, std_rehash_threshold): New.
(hash_index_size): Use std_rehash_threshold.  Remove table argument.
All callers updated.
(make_hash_table): Remove rehash_size and rehash_threshold args.
All callers updated.
(maybe_resize_hash_table)
(Fhash_table_rehash_size, Fhash_table_rehash_threshold):
Use std_rehash_size and std_rehash_threshold.
(Fmake_hash_table): Ignore :rehash-size and :rehash-threshold args.
* src/lisp.h (struct Lisp_Hash_Table):
Remove rehash_size and rehash_threshold fields.
(DEFAULT_REHASH_THRESHOLD, DEFAULT_REHASH_SIZE): Remove.
* src/lread.c (hash_table_from_plist): Don't read rehash-size or
rehash-threshold.
(syms_of_lread): Remove unused symbols.
* src/print.c (print_object): Don't print rehash-size or rehash-threshold.
* src/pdumper.c (dump_hash_table): Don't dump removed fields.
2024-01-13 20:50:37 +01:00
Mattias Engdegård
c6bdc1ea1d Represent hash table weakness as an enum internally
This takes less space (saves an entire word) and is more type-safe.
No change in behaviour.

* src/lisp.h (hash_table_weakness_t): New.
(struct Lisp_Hash_Table): Replace Lisp object `weak` with enum
`weakness`.
* src/fns.c
(keep_entry_p, hash_table_weakness_symbol): New.
(make_hash_table): Retype argument.  All callers updated.
(sweep_weak_table, Fmake_hash_table, Fhash_table_weakness):
* src/alloc.c (purecopy_hash_table, purecopy, process_mark_stack):
* src/pdumper.c (dump_hash_table):
* src/print.c (print_object): Use retyped field.
2024-01-13 20:50:37 +01:00
Mattias Engdegård
3f9c81a87f Don't print or read the hash table size parameter
It's not a meaningful part of the external representation.
This allows for faster printing and reading, smaller
external representation, and less memory consumption.

* src/print.c (print_object): Omit size.
* src/lread.c (hash_table_from_plist): Take size from the data.
2024-01-13 20:50:37 +01:00
Mattias Engdegård
a09619f259 * src/print.c (print_object): Don't print empty hash-table data
Since no data is the default, this preserves bidirectional compatibility.
2024-01-13 20:50:37 +01:00
Mattias Engdegård
4ba6954e69 * src/print.c (print_object): Don't print hash table test if eql.
Since `eql` is the default, this ensures bidirectional compatibility
while reducing the size of the external representation.
2024-01-13 20:50:37 +01:00
Juri Linkov
76904626b3 * lisp/window.el (window-prefix-map): Bind C-x w q to quit-window (bug#13167) 2024-01-13 20:16:42 +02:00
Xiyue Deng
aaf3b63397 Fix typo in lispref "Creating Strings" section
* doc/lispref/strings.texi (String Basics): Fix typo (bug#68375).
2024-01-13 18:08:49 +01:00
Eli Zaretskii
106cd9aafe ; * lisp/textmodes/page.el (page--what-page): Fix last change. 2024-01-13 12:45:10 +02:00
Eli Zaretskii
91b1765cd4 Merge from origin/emacs-29
c494a6e879 Improve documentation of 'emacs_function' in modules
a08e6423cc ; * doc/emacs/fixit.texi (Spelling): Fix last change.
418547162d Improve documentation of Ispell commands
c4b4948845 Don't recommend inverse-video for debugging
2024-01-13 05:36:16 -05:00
Eli Zaretskii
fe7d2bb62f ; Merge from origin/emacs-29
The following commit was skipped:

26eb9d3a8a Fix typo in lispref "Creating Strings" section
2024-01-13 05:36:16 -05:00
Eli Zaretskii
f1736571fa Merge from origin/emacs-29
99efe5c80f Fix count of no-op functions (bug#68375)
0c01f97b73 Wrap @pxref of Abbrevs in parentheses (bug#68375)
70a09325d6 ; Fix last change in widget.texi
63411709a8 ; Fix typos
824cf54951 ; * etc/TODO: Add item to make play-sound non-blocking.
4fadbfe300 Add examples to the Widget manual
1bbb610821 Implement missing functions for custom-icon widget
29af214a75 Fix fontification of cgroup2 in fstab (bug#68367)
2024-01-13 05:36:16 -05:00
Eli Zaretskii
ccc28245c0 ; Merge from origin/emacs-29
The following commit was skipped:

5567ce1a9f Handle package versions that are not version strings
2024-01-13 05:36:15 -05:00
Eli Zaretskii
79a150ffa4 Merge from origin/emacs-29
d58d0fa52f Introduce 'let' using lexical binding in the Lisp Introdu...
1b12397263 ; Don't record multiple versions of use-package
8729a2a10d Fix 'rmail-summary-by-thread'
2a8c00bfc0 * doc/emacs/back.texi: Fix a typo.
2024-01-13 05:36:15 -05:00
Lars Brinkhoff
740953d1a2 Fix 'what-page'
* lisp/textmodes/page.el (page--what-page): Adjust for 1st
line on page, and use 'count-lines' again.  (Bug#68215)

* test/lisp/textmodes/page-tests.el (page-tests-what-page):
Update test.
2024-01-13 12:07:34 +02:00
Eli Zaretskii
c494a6e879 Improve documentation of 'emacs_function' in modules
* doc/lispref/internals.texi (Module Functions): Warn about
accessing the ARGS array in module functions.
2024-01-13 12:01:47 +02:00
Steven Allen
9b8b352ebc Set the 'name' prop in 'define-advice'
In addition to naming the advice function `symbol@name', set
the 'name' property to NAME.
* lisp/emacs-lisp/nadvice.el (define-advice): set the 'name'
property to NAME (requested in Bug#68114).  Fixes Bug#68294.

* doc/lispref/functions.texi (Advising Named Functions): Document
that 'define-advice' installs the advice with the specified name.
2024-01-13 11:43:01 +02:00
kobarity
f2cc8ee2a1 Fix 'python-info-docstring-p' bug in the 2nd line of a buffer
* lisp/progmodes/python.el (python-info-docstring-p): Add
'looking-at-p' check when bobp.
* test/lisp/progmodes/python-tests.el (python-font-lock-operator-1)
(python-font-lock-operator-2): Restoration of ERTs deleted by
mistake.
(python-font-lock-escape-sequence-bytes-newline)
(python-font-lock-escape-sequence-hex-octal)
(python-font-lock-escape-sequence-unicode)
(python-font-lock-raw-escape-sequence): Change 'font-lock-doc-face'
to 'font-lock-string-face' and remove :expected-result :failed.
(python-info-docstring-p-8): New test.  (Bug#68284)
2024-01-13 11:33:19 +02:00
Eli Zaretskii
a08e6423cc ; * doc/emacs/fixit.texi (Spelling): Fix last change. 2024-01-13 11:23:43 +02:00
Stefan Kangas
893829021b Fix NULL dereference in w32notify.c
* src/w32notify.c (start_watching): Return NULL instead of freed
pointer.
(add_watch): Fix NULL dereference.
2024-01-13 10:21:41 +01:00
Stefan Kangas
1bfc7fd33d Prefer AREF in GET_TRANSLATION_TABLE
* src/ccl.c (GET_TRANSLATION_TABLE): Prefer using AREF to depending on
vector internals.
2024-01-13 10:18:03 +01:00
Eli Zaretskii
ec16b69e7f * src/fns.c (maybe_resize_hash_table): Fix EMACS_INT format specifier. 2024-01-13 08:30:50 +02:00
Po Lu
4edb77132d Properly sort results for partial font specs
* src/sfntfont.c (sfntfont_compare_font_entities): New function.
(sfntfont_list): Sort matching font entities by the number of
fields set, and mention why.
2024-01-13 09:51:59 +08:00
Mattias Engdegård
8b7a6d7b6d ; * src/lisp.h (struct Lisp_Hash_Table): Add ASCII art. 2024-01-12 18:03:05 +01:00
Mattias Engdegård
4b7985db11 ; * src/fns.c (Fmake_hash_table): ensure test is a bare symbol 2024-01-12 18:03:05 +01:00
Mattias Engdegård
29e3d1c56f Abstract predicate and constant for unused hash keys
Qunbound is used for many things; using a predicate and constant for
the specific purpose of unused hash entry keys allows us to locate
them and make changes much more easily.

* src/lisp.h (HASH_UNUSED_ENTRY_KEY, hash_unused_entry_key_p):
New constant and function.
* src/comp.c (compile_function, Fcomp__compile_ctxt_to_file):
* src/composite.c (composition_gstring_cache_clear_font):
* src/emacs-module.c (module_global_reference_p):
* src/fns.c (make_hash_table, maybe_resize_hash_table, hash_put)
(hash_remove_from_table, hash_clear, sweep_weak_table, Fmaphash):
* src/json.c (lisp_to_json_nonscalar_1):
* src/minibuf.c (Ftry_completion, Fall_completions, Ftest_completion):
* src/print.c (print, print_object):
Use them.
2024-01-12 18:03:02 +01:00
Mattias Engdegård
484e04efa4 ; * src/alloc.c (purecopy_hash_table): Simplify
Copy the entire struct, then take care of fields needing special
treatment.
2024-01-12 18:02:15 +01:00
Mattias Engdegård
43127e5ec1 Refactor hash table vector reallocation
* src/fns.c (larger_vecalloc): Remove.
(larger_vector): Simplify.
(alloc_larger_vector): New.
(maybe_resize_hash_table): Use alloc_larger_vector as a simpler and
faster replacement for larger_vecalloc.
2024-01-12 18:02:15 +01:00
Mattias Engdegård
462b3e6ae4 Refactor: extract hash and index computations to functions
* src/lisp.h (hash_from_key):
* src/fns.c (hash_index_index): New.
(hash_table_rehash, hash_lookup, hash_remove_from_table):
(maybe_resize_hash_table, hash_put):
* src/composite.c (composition_gstring_put_cache): Use them.
2024-01-12 18:02:15 +01:00
Mattias Engdegård
0bc13945ac ; * src/fns.c (collect_interval): Move misplaced function. 2024-01-12 18:02:14 +01:00
Mattias Engdegård
3da324fbd3 Refactor: less layering violation in composite.h
Avoid using hash table internals directly.

* src/composite.h (COMPOSITION_KEY): New.
(COMPOSITION_GLYPH, COMPOSITION_RULE): Use COMPOSITION_KEY.
2024-01-12 18:02:14 +01:00
Mattias Engdegård
22201dde77 Decouple profiler from Lisp hash table internals
The profiler stored data being collected in Lisp hash tables but
relied heavily on their exact internal representation, which made it
difficult and error-prone to change the hash table implementation.

In particular, the profiler has special run-time requirements that are
not easily met using standard Lisp data structures: accesses and
updates are made from async signal handlers in almost any messy
context you can think of and are therefore very constrained in what
they can do.

The new profiler tables are designed specifically for their purpose
and are more efficient and, by not being coupled to Lisp hash tables,
easier to keep safe.

The old profiler morphed internal hash tables to ones usable from Lisp
and thereby made them impossible to use internally; now export_log
just makes new hash table objects for Lisp.  The Lisp part of the
profiler remains entirely unchanged.

* src/alloc.c (garbage_collect): Mark profiler tables.
* src/eval.c (get_backtrace): Fill an array of Lisp values instead of
a Lisp vector.
* src/profiler.c (log_t): No longer a Lisp hash table but a custom
data structure: a fully associative fixed-sized cache that maps
fixed-size arrays of Lisp objects to counts.
(make_log): Build new struct.
(mark_log, free_log, get_log_count, set_log_count, get_key_vector)
(log_hash_index, remove_log_entry, trace_equal, trace_hash)
(make_profiler_log, free_profiler_log, mark_profiler): New.
(cmpfn_profiler, hashtest_profiler, hashfn_profiler)
(syms_of_profiler_for_pdumper): Remove.
(approximate_median, evict_lower_half, record_backtrace, export_log)
(Fprofiler_cpu_log, Fprofiler_memory_log, syms_of_profiler):
Adapt to the new data structure.
2024-01-12 18:02:14 +01:00
Mattias Engdegård
8acd89e955 ; * src/pdumper.c (dump_hash_table): Remove unused argument. 2024-01-12 18:02:14 +01:00
Mattias Engdegård
228e900018 Add internal hash-table debug functions
These are useful for measuring hashing and collisions.

* src/fns.c (Finternal__hash_table_histogram)
(Finternal__hash_table_buckets, Finternal__hash_table_index_size):
New.
2024-01-12 18:02:14 +01:00
Michael Albinus
10cfbda884 * src/nsfont.m (nsfont_open): Fix Ffont_xlfd_name args. 2024-01-12 16:19:42 +01:00
Eli Zaretskii
418547162d Improve documentation of Ispell commands
* doc/emacs/fixit.texi (Spelling): Document "C-u M-$" and warn
against modifications in recursive-edit.  (Bug#14192)
2024-01-12 10:03:08 +02:00
Stefan Monnier
eac3f2a807 sh-script.el: Add support for case FOO {...} (bug#55764)
* lisp/progmodes/sh-script.el (sh-font-lock-paren): Also recognize
`FOO)` after `{`.
(sh-smie-sh-rules): Make `for` rule apply to `case FOO { ...}` as well.

* test/manual/indent/shell.sh: Add new test case.
2024-01-11 22:12:34 -05:00
Slava Akhmechet
bfb486d802 Eglot: Simplify overlay handling in manual example
* doc/misc/eglot.texi (Extending Eglot): Simplify.

Copyright-paperwork-exempt: yes
2024-01-11 15:50:08 -06:00
Stefan Kangas
c4b4948845 Don't recommend inverse-video for debugging
* etc/DEBUG: Don't recommend 'inverse-video', which has been broken
for 20 years, give or take.  (Bug#11430)
2024-01-11 22:43:21 +01:00
Alyssa Ross
e4e89e2cb6 Add autoload cookie to vc-git-grep
* lisp/vc/vc-git.el (vc-git-grep): Add autoload cookie.  (Bug#67018)
2024-01-11 22:16:31 +01:00
john muhl
a66069c50c Support indented continuation lines in lua-ts-mode
* lisp/progmodes/lua-ts-mode.el (lua-ts--simple-indent-rules):
Add a rule to indent multi-line assignments and if statements.
(lua-ts-indent-continuation-lines): New user option.
* test/lisp/progmodes/lua-ts-mode-resources/indent.erts: Add
tests.  (Bug#68279)
2024-01-11 21:51:23 +01:00
Alan Mackenzie
07bb8dc0af Bind cross-buffer buffer-local variable correctly.
This fixes bug#68200.

* lisp/emacs-lisp/bytecomp.el (byte-compile-output-docform):
Note that let-binding a buffer local variable leaves it buffer
local, hence to transfer the binding of
byte-compile-dynamic-docstrings to the output buffer, an
intermediate variable is needed.  Implement this.
2024-01-11 17:54:47 +00:00
Eli Zaretskii
fbc4a3c7de Fix man-tests.el
* test/lisp/man-tests.el (man-tests-Man-translate-references): Fix
test for MS-Windows and MS-DOS.
2024-01-11 17:27:04 +02:00
Xiyue Deng
26eb9d3a8a Fix typo in lispref "Creating Strings" section
* doc/lispref/strings.texi (String Basics): Fix typo (bug#68375).
2024-01-11 15:18:37 +01:00
Stephen Berman
aa26852f31 Revert "Fix typo in lispref 'Creating Strings' section"
This reverts commit b825962ea8
which was mistakenly installed in master instead of emacs-29.
2024-01-11 15:12:00 +01:00
Xiyue Deng
b825962ea8 Fix typo in lispref "Creating Strings" section
* doc/lispref/strings.texi (String Basics): Fix typo.
2024-01-11 14:41:41 +01:00
Michael Albinus
5df57f1792 Adapt test names in auth-source-tests.el
* test/lisp/auth-source-tests.el (auth-source-test-netrc-credentials)
(auth-source-test-netrc-credentials-2)
(auth-source-test-macos-keychain-search): Adapt test names.
2024-01-11 12:45:03 +01:00
Michael Albinus
ef08f94cbe Support numeric port numbers in auth-source-macos-keychain
* lisp/auth-source.el (auth-source-macos-keychain-search):
Support numeric port numbers (bug#68376).
(auth-source-macos-keychain-search-items): Make regexp more robust.

* test/lisp/auth-source-tests.el (test-macos-keychain-search):
Extend test.
2024-01-11 12:30:05 +01:00
Jared Finder
c7aa5c6d2b Populate tool-bar bindings on text terminals
* lisp/tool-bar.el (tool-bar-make-keymap-1): Populate on text
terminals.  (Bug#68334)
2024-01-11 12:49:27 +02:00
Xiyue Deng
99efe5c80f Fix count of no-op functions (bug#68375)
It looks like there are actually three kinds of no-op functions.

* doc/lispref/functions.texi (Calling Functions): Fix count and
plural of no-op functions.

Copyright-paperwork-exempt: yes
2024-01-11 12:39:43 +02:00