]> git.eshelyaron.com Git - emacs.git/log
emacs.git
9 months agoUse forward-line instead of next-line in noninteractive test
Mattias Engdegård [Sun, 14 Jan 2024 12:37:44 +0000 (13:37 +0100)]
Use forward-line instead of next-line in noninteractive test

* test/lisp/textmodes/page-tests.el (page-tests-what-page):
Silence byte-compiler warning; forward-line works nicely here.

9 months agoMake object-intervals linear instead of quadratic
Mattias Engdegård [Sun, 14 Jan 2024 11:50:36 +0000 (12:50 +0100)]
Make object-intervals linear instead of quadratic

* src/fns.c (collect_interval, Fobject_intervals):
Build the returned list in reverse instead of appending single
elements.

9 months agoSpeed up sxhash-equal-including-properties
Mattias Engdegård [Sun, 14 Jan 2024 11:33:12 +0000 (12:33 +0100)]
Speed up sxhash-equal-including-properties

This function now no longer conses at all.  Previously, it constructed
a list structure of all string intervals for the sole purpose of
hashing.

* src/fns.c (hash_interval): New.
(Fsxhash_equal_including_properties):
Use it instead of collect_interval.

9 months agoRetype traverse_interval arg type from Lisp_Object to void *
Mattias Engdegård [Sun, 14 Jan 2024 10:58:33 +0000 (11:58 +0100)]
Retype traverse_interval arg type from Lisp_Object to void *

This is a refactoring.  It eliminates a few unnecessary conses and
allows for further improvements.

* src/intervals.c (traverse_intervals):
Change argument type.  All callers adapted.
* src/fns.c (collect_interval, Fsxhash_equal_including_properties)
(Fobject_intervals):
* src/print.c (print_check_string_charset_prop)
(print_prune_string_charset, print_object, print_interval):
Pass a pointer to a Lisp_Object instead of a Lisp_Object.

9 months agoCorrect implementations of FLIPRGON and FLIPRGOFF
Po Lu [Sun, 14 Jan 2024 13:06:10 +0000 (21:06 +0800)]
Correct implementations of FLIPRGON and FLIPRGOFF

* src/sfnt.c (sfnt_interpret_fliprgoff)
(sfnt_interpret_fliprgon): Reorder arguments to match
the order in which arguments are popped by macro wrappers.
Fix sundry typos.

9 months agoFix bug#65116
Po Lu [Sun, 14 Jan 2024 00:26:27 +0000 (08:26 +0800)]
Fix bug#65116

* src/xterm.c (xi_focus_handle_for_device): Correct typo.
(x_focus_frame): Don't focus frames Emacs believes to be
focused if they are frames with independent minibuffer
frames.  (bug#65116)

9 months agoHash-table documentation updates (bug#68244)
Mattias Engdegård [Sat, 30 Dec 2023 15:00:28 +0000 (16:00 +0100)]
Hash-table documentation updates (bug#68244)

* doc/lispref/hash.texi (Creating Hash, Other Hash):
Manual updates for make-hash-table, hash-table-rehash-size and
hash-table-rehash-threshold.
* doc/lispref/objects.texi (Hash Table Type): Update example.
* src/fns.c (Fhash_table_rehash_size, Fhash_table_rehash_threshold):
Update doc strings.
* etc/NEWS: Announce changes.

9 months agoDon't pretend that hash-table-size is useful
Mattias Engdegård [Sat, 30 Dec 2023 14:54:32 +0000 (15:54 +0100)]
Don't pretend that hash-table-size is useful

* lisp/emacs-lisp/shortdoc.el (hash-table): Remove hash-table-size entry.
* doc/lispref/hash.texi (Other Hash):
* src/fns.c (Fhash_table_size): Make it clear that hash-table-size is
probably not worth using.

9 months agoChange hash_hash_t to uint32_t
Mattias Engdegård [Wed, 22 Nov 2023 13:54:34 +0000 (14:54 +0100)]
Change hash_hash_t to uint32_t

This saves a lot of memory and is quite sufficient.  Hash functions
are adapted to produce a hash_hash_t eventually, which eliminates some
useless and information-destroying intermediate hash reduction steps.

We still use EMACS_UINT for most of the actual hashing steps before
producing the final value; this may be slightly wasteful on 32-bit
platforms with 64-bit EMACS_UINT.

* src/lisp.h (hash_hash_t): Change to uint32_t.
* src/fns.c (reduce_emacs_uint_to_hash_hash): New.
(hashfn_eq, hashfn_equal, hashfn_user_defined): Reduce return values
to hash_hash_t.
(sxhash_string): Remove.  Caller changed to hash_string.
(sxhash_float, sxhash_list, sxhash_vector, sxhash_bool_vector)
(sxhash_bignum): Remove wasteful calls to SXHASH_REDUCE.
(hash_hash_to_fixnum): New.
(Fsxhash_eq, Fsxhash_eql, Fsxhash_equal)
(Fsxhash_equal_including_properties): Convert return values to fixnum.

9 months agoUse key Qunbound instead of hash value hash_unused for free entries
Mattias Engdegård [Tue, 21 Nov 2023 21:12:08 +0000 (22:12 +0100)]
Use key Qunbound instead of hash value hash_unused for free entries

Previously, free hash table entries were indicated by both hash value
hash_unused and key Qunbound; we now rely on the latter only.
This allows us to change the hash representation to one that does not
have an unused value.

* src/lisp.h (hash_unused): Remove.
All uses adapted to calling hash_unused_entry_key_p on the key instead.
The hash values for unused hash table entries are now undefined; all
initialisation and assignment to hash_unused has been removed.

9 months agoDon't dump Qunbound
Mattias Engdegård [Wed, 22 Nov 2023 12:47:56 +0000 (13:47 +0100)]
Don't dump Qunbound

The dumper uses a hash table to keep track of dumped objects but as
this clashes with the use of Qunbound for marking unused hash table
entries, don't dump that value at all.  The symbol name is fixed up
after loading.

An alternative solution would be to use a different unique value for
unused entries.

* src/pdumper.c (dump_object_needs_dumping_p): Skip Qunbound.
(dump_vectorlike_generic): New function.
(pdumper_load): Call it.

9 months agoChange hash_idx_t to int32_t on all platforms
Mattias Engdegård [Tue, 21 Nov 2023 18:26:23 +0000 (19:26 +0100)]
Change hash_idx_t to int32_t on all platforms

* src/lisp.h (hash_idx_t): Change to int32_t.
* src/fns.c (hash_index_size): Adapt to new index type.

9 months agoFaster hash table growth, starting at zero size
Mattias Engdegård [Sat, 4 Nov 2023 17:21:06 +0000 (18:21 +0100)]
Faster hash table growth, starting at zero size

The algorithms no longer use the rehash_threshold and rehash_size
float constants, but vary depending on size.  In particular, the table
now grows faster, especially from smaller sizes.

The default size is now 0, starting empty, which effectively postpones
allocation until the first insertion (unless make-hash-table was
called with a positive :size); this is a clear gain as long as the
table remains empty.  The first inserted item will use an initial size
of 8 because most tables are small.

* src/fns.c (std_rehash_size, std_rehash_threshold): Remove.
(hash_index_size): Integer-only computation.
(maybe_resize_hash_table): Grow more aggressively.
(Fhash_table_rehash_size, Fhash_table_rehash_threshold):
Use the constants directly.
* src/lisp.h (DEFAULT_HASH_SIZE): New value.

9 months ago; Reorder struct Lisp_Hash_Table and struct hash_table_test
Mattias Engdegård [Fri, 3 Nov 2023 15:02:56 +0000 (16:02 +0100)]
; Reorder struct Lisp_Hash_Table and struct hash_table_test

Mainly for efficiency, to keep frequently used fields together.

9 months agoShare hash table test structs
Mattias Engdegård [Thu, 2 Nov 2023 16:05:26 +0000 (17:05 +0100)]
Share hash table test structs

This saves several words in the hash table object at the cost of an
indirection at runtime.  This seems to be a gain in overall
performance.

FIXME: We cache hash test objects in a rather clumsy way. A better
solution is sought.

* src/lisp.h (struct Lisp_Hash_Table): Use a pointer to the test
struct.  All references adapted.
* src/alloc.c (garbage_collect):
* src/fns.c (struct hash_table_user_test, hash_table_user_tests)
(mark_fns, get_hash_table_user_test): New state for caching test
structs, and functions managing it.

9 months agoUse hash_idx_t for storing hash indices
Mattias Engdegård [Sun, 5 Nov 2023 11:10:34 +0000 (12:10 +0100)]
Use hash_idx_t for storing hash indices

Now hash_idx_t is a typedef for ptrdiff_t so there is no actual code
change, but this allows us to decouple the index width from the Lisp
word size.

* src/lisp.h (hash_idx_t): New typedef for ptrdiff_t.
(struct Lisp_Hash_Table): Use it for indices and sizes:
index, next, table_size, index_size, count and next_free.
All uses adapted.

9 months agoInlined and specialised hash table look-up
Mattias Engdegård [Tue, 21 Nov 2023 11:27:42 +0000 (12:27 +0100)]
Inlined and specialised hash table look-up

This improves performance in several ways.  Separate functions are
used depending on whether the caller has a hash value computed or not.

* src/fns.c (hash_lookup_with_hash, hash_lookup_get_hash): New.
(hash_lookup): Remove hash return argument.
All callers adapted.

hash_lookup_with_hash hash_hash_t arg

9 months agoStore hash values as integers instead of Lisp_Object
Mattias Engdegård [Sun, 29 Oct 2023 10:57:06 +0000 (11:57 +0100)]
Store hash values as integers instead of Lisp_Object

This improves typing, saves pointless tagging and untagging, and
prepares for further changes. The new typedef hash_hash_t is an alias
for EMACS_UINT, and hash values are still limited to the fixnum range.
We now use hash_unused instead of Qnil to mark unused entries.

* src/lisp.h (hash_hash_t): New typedef for EMACS_UINT.
(hash_unused): New constant.
(struct hash_table_test): `hashfn` now returns
hash_hash_t.  All callers and implementations changed.
(struct Lisp_Hash_Table): Retype hash vector to an array of
hash_hash_t.  All code using it changed accordingly.
(HASH_HASH, hash_from_key):
* src/fns.c (set_hash_index_slot, hash_index_index)
(hash_lookup_with_hash, hash_lookup_get_hash, hash_put):
(hash_lookup, hash_put): Retype hash value arguments
and return values.  All callers adapted.

9 months agoUse non-Lisp allocation for internal hash-table vectors
Mattias Engdegård [Fri, 27 Oct 2023 20:15:09 +0000 (22:15 +0200)]
Use non-Lisp allocation for internal hash-table vectors

Using xmalloc for allocating these arrays is much cheaper than using
Lisp vectors since they are no longer marked or swept by the GC, and
deallocated much sooner.  This makes GC faster and less frequent, and
improves temporal locality.

Zero-sized tables use NULL for their (0-length) vectors except the
index vector which has size 1 and uses a shared constant static vector
since it cannot be modified anyway.  This makes creation and
destruction of zero-sized hash tables very fast; they consume no
memory outside the base object.

* src/lisp.h (struct Lisp_Hash_Table): Retype the index, next, hash
and key_and_value vectors from Lisp_Object to appropriately typed
arrays (although hash values are still stored as Lisp fixnums).  Add
explicit table_size and index_size members.  All users updated.
* src/alloc.c (gcstat): Add total_hash_table_bytes.
(hash_table_allocated_bytes): New.
(cleanup_vector): Free hash table vectors when sweeping
the object.
(hash_table_alloc_bytes, hash_table_free_bytes): New.
(sweep_vectors): Update gcstat.total_hash_table_bytes.
(total_bytes_of_live_objects): Use it.
(purecopy_hash_table): Adapt allocation of hash table vectors.
(process_mark_stack): No more Lisp slots in the struct to trace.
* src/fns.c (empty_hash_index_vector): New.
(allocate_hash_table): Allocate without automatically GCed slots.
(alloc_larger_vector): Remove.
(make_hash_table, copy_hash_table, maybe_resize_hash_table):
Adapt vector allocation and initialisation.
* src/pdumper.c (hash_table_freeze, hash_table_thaw, dump_hash_table)
(dump_hash_table_contents):
Adapt dumping and loading to field changes.

9 months agoAllow zero hash table size
Mattias Engdegård [Sat, 4 Nov 2023 14:16:38 +0000 (15:16 +0100)]
Allow zero hash table size

This avoids any extra allocation for such vectors, including empty
tables read by the Lisp reader, and provides extra safety essentially
for free.

* src/fns.c (make_hash_table): Allow tables to be 0-sized.  The index
will always have at least one entry, to avoid extra look-up costs.
* src/alloc.c (process_mark_stack): Don't mark pure objects,
because empty vectors are pure.

9 months agoLeaner hash table dumping and thawing
Mattias Engdegård [Sat, 4 Nov 2023 15:34:09 +0000 (16:34 +0100)]
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.

9 months agoRemove rehash-threshold and rehash-size struct members
Mattias Engdegård [Thu, 26 Oct 2023 15:17:01 +0000 (17:17 +0200)]
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.

9 months agoRepresent hash table weakness as an enum internally
Mattias Engdegård [Thu, 26 Oct 2023 13:49:32 +0000 (15:49 +0200)]
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.

9 months agoDon't print or read the hash table size parameter
Mattias Engdegård [Thu, 26 Oct 2023 16:36:05 +0000 (18:36 +0200)]
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.

9 months ago* src/print.c (print_object): Don't print empty hash-table data
Mattias Engdegård [Thu, 2 Nov 2023 10:10:24 +0000 (11:10 +0100)]
* src/print.c (print_object): Don't print empty hash-table data

Since no data is the default, this preserves bidirectional compatibility.

9 months ago* src/print.c (print_object): Don't print hash table test if `eql`.
Mattias Engdegård [Thu, 26 Oct 2023 16:04:11 +0000 (18:04 +0200)]
* 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.

9 months ago* lisp/window.el (window-prefix-map): Bind C-x w q to quit-window (bug#13167)
Juri Linkov [Sat, 13 Jan 2024 18:16:42 +0000 (20:16 +0200)]
* lisp/window.el (window-prefix-map): Bind C-x w q to quit-window (bug#13167)

9 months agoFix typo in lispref "Creating Strings" section
Xiyue Deng [Sat, 13 Jan 2024 17:08:49 +0000 (18:08 +0100)]
Fix typo in lispref "Creating Strings" section

* doc/lispref/strings.texi (String Basics): Fix typo (bug#68375).

9 months ago; * lisp/textmodes/page.el (page--what-page): Fix last change.
Eli Zaretskii [Sat, 13 Jan 2024 10:45:10 +0000 (12:45 +0200)]
; * lisp/textmodes/page.el (page--what-page): Fix last change.

9 months agoMerge from origin/emacs-29
Eli Zaretskii [Sat, 13 Jan 2024 10:36:16 +0000 (05:36 -0500)]
Merge from origin/emacs-29

c494a6e879d Improve documentation of 'emacs_function' in modules
a08e6423ccc ; * doc/emacs/fixit.texi (Spelling): Fix last change.
418547162d5 Improve documentation of Ispell commands
c4b49488455 Don't recommend inverse-video for debugging

9 months ago; Merge from origin/emacs-29
Eli Zaretskii [Sat, 13 Jan 2024 10:36:16 +0000 (05:36 -0500)]
; Merge from origin/emacs-29

The following commit was skipped:

26eb9d3a8a6 Fix typo in lispref "Creating Strings" section

9 months agoMerge from origin/emacs-29
Eli Zaretskii [Sat, 13 Jan 2024 10:36:16 +0000 (05:36 -0500)]
Merge from origin/emacs-29

99efe5c80f9 Fix count of no-op functions (bug#68375)
0c01f97b73c Wrap @pxref of Abbrevs in parentheses (bug#68375)
70a09325d65 ; Fix last change in widget.texi
63411709a8d ; Fix typos
824cf54951c ; * etc/TODO: Add item to make play-sound non-blocking.
4fadbfe300a Add examples to the Widget manual
1bbb610821e Implement missing functions for custom-icon widget
29af214a75a Fix fontification of cgroup2 in fstab (bug#68367)

9 months ago; Merge from origin/emacs-29
Eli Zaretskii [Sat, 13 Jan 2024 10:36:15 +0000 (05:36 -0500)]
; Merge from origin/emacs-29

The following commit was skipped:

5567ce1a9ff Handle package versions that are not version strings

9 months agoMerge from origin/emacs-29
Eli Zaretskii [Sat, 13 Jan 2024 10:36:15 +0000 (05:36 -0500)]
Merge from origin/emacs-29

d58d0fa52ff Introduce 'let' using lexical binding in the Lisp Introdu...
1b123972636 ; Don't record multiple versions of use-package
8729a2a10d9 Fix 'rmail-summary-by-thread'
2a8c00bfc07 * doc/emacs/back.texi: Fix a typo.

9 months agoFix 'what-page'
Lars Brinkhoff [Tue, 2 Jan 2024 08:06:13 +0000 (09:06 +0100)]
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.

9 months agoImprove documentation of 'emacs_function' in modules
Eli Zaretskii [Sat, 13 Jan 2024 10:01:47 +0000 (12:01 +0200)]
Improve documentation of 'emacs_function' in modules

* doc/lispref/internals.texi (Module Functions): Warn about
accessing the ARGS array in module functions.

9 months agoSet the 'name' prop in 'define-advice'
Steven Allen [Sat, 6 Jan 2024 17:19:12 +0000 (09:19 -0800)]
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.

9 months agoFix 'python-info-docstring-p' bug in the 2nd line of a buffer
kobarity [Sat, 6 Jan 2024 13:04:42 +0000 (22:04 +0900)]
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)

9 months ago; * doc/emacs/fixit.texi (Spelling): Fix last change.
Eli Zaretskii [Sat, 13 Jan 2024 09:23:43 +0000 (11:23 +0200)]
; * doc/emacs/fixit.texi (Spelling): Fix last change.

9 months agoFix NULL dereference in w32notify.c
Stefan Kangas [Sat, 13 Jan 2024 09:20:41 +0000 (10:20 +0100)]
Fix NULL dereference in w32notify.c

* src/w32notify.c (start_watching): Return NULL instead of freed
pointer.
(add_watch): Fix NULL dereference.

9 months agoPrefer AREF in GET_TRANSLATION_TABLE
Stefan Kangas [Sat, 13 Jan 2024 09:18:03 +0000 (10:18 +0100)]
Prefer AREF in GET_TRANSLATION_TABLE

* src/ccl.c (GET_TRANSLATION_TABLE): Prefer using AREF to depending on
vector internals.

9 months ago* src/fns.c (maybe_resize_hash_table): Fix EMACS_INT format specifier.
Eli Zaretskii [Sat, 13 Jan 2024 06:30:50 +0000 (08:30 +0200)]
* src/fns.c (maybe_resize_hash_table): Fix EMACS_INT format specifier.

9 months agoProperly sort results for partial font specs
Po Lu [Sat, 13 Jan 2024 01:51:59 +0000 (09:51 +0800)]
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.

9 months ago; * src/lisp.h (struct Lisp_Hash_Table): Add ASCII art.
Mattias Engdegård [Sun, 7 Jan 2024 17:52:48 +0000 (18:52 +0100)]
; * src/lisp.h (struct Lisp_Hash_Table): Add ASCII art.

9 months ago; * src/fns.c (Fmake_hash_table): ensure `test` is a bare symbol
Mattias Engdegård [Thu, 30 Nov 2023 13:57:51 +0000 (14:57 +0100)]
; * src/fns.c (Fmake_hash_table): ensure `test` is a bare symbol

9 months agoAbstract predicate and constant for unused hash keys
Mattias Engdegård [Thu, 28 Dec 2023 18:04:43 +0000 (19:04 +0100)]
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.

9 months ago; * src/alloc.c (purecopy_hash_table): Simplify
Mattias Engdegård [Tue, 28 Nov 2023 12:54:26 +0000 (13:54 +0100)]
; * src/alloc.c (purecopy_hash_table): Simplify

Copy the entire struct, then take care of fields needing special
treatment.

9 months agoRefactor hash table vector reallocation
Mattias Engdegård [Sat, 28 Oct 2023 10:07:42 +0000 (12:07 +0200)]
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.

9 months agoRefactor: extract hash and index computations to functions
Mattias Engdegård [Sun, 29 Oct 2023 11:27:04 +0000 (12:27 +0100)]
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.

9 months ago; * src/fns.c (collect_interval): Move misplaced function.
Mattias Engdegård [Sat, 11 Nov 2023 16:42:51 +0000 (17:42 +0100)]
; * src/fns.c (collect_interval): Move misplaced function.

9 months agoRefactor: less layering violation in composite.h
Mattias Engdegård [Mon, 30 Oct 2023 11:34:26 +0000 (12:34 +0100)]
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.

9 months agoDecouple profiler from Lisp hash table internals
Mattias Engdegård [Wed, 1 Nov 2023 15:42:59 +0000 (16:42 +0100)]
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.

9 months ago; * src/pdumper.c (dump_hash_table): Remove unused argument.
Mattias Engdegård [Fri, 29 Dec 2023 14:32:18 +0000 (15:32 +0100)]
; * src/pdumper.c (dump_hash_table): Remove unused argument.

9 months agoAdd internal hash-table debug functions
Mattias Engdegård [Mon, 6 Nov 2023 12:25:07 +0000 (13:25 +0100)]
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.

9 months ago* src/nsfont.m (nsfont_open): Fix Ffont_xlfd_name args.
Michael Albinus [Fri, 12 Jan 2024 15:19:42 +0000 (16:19 +0100)]
* src/nsfont.m (nsfont_open): Fix Ffont_xlfd_name args.

9 months agoImprove documentation of Ispell commands
Eli Zaretskii [Fri, 12 Jan 2024 08:03:08 +0000 (10:03 +0200)]
Improve documentation of Ispell commands

* doc/emacs/fixit.texi (Spelling): Document "C-u M-$" and warn
against modifications in recursive-edit.  (Bug#14192)

9 months agosh-script.el: Add support for `case FOO {...}` (bug#55764)
Stefan Monnier [Fri, 12 Jan 2024 03:12:34 +0000 (22:12 -0500)]
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.

9 months agoEglot: Simplify overlay handling in manual example
Slava Akhmechet [Thu, 11 Jan 2024 21:50:08 +0000 (15:50 -0600)]
Eglot: Simplify overlay handling in manual example

* doc/misc/eglot.texi (Extending Eglot): Simplify.

Copyright-paperwork-exempt: yes

9 months agoDon't recommend inverse-video for debugging
Stefan Kangas [Thu, 11 Jan 2024 21:36:33 +0000 (22:36 +0100)]
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)

9 months agoAdd autoload cookie to vc-git-grep
Alyssa Ross [Thu, 9 Nov 2023 14:46:30 +0000 (15:46 +0100)]
Add autoload cookie to vc-git-grep

* lisp/vc/vc-git.el (vc-git-grep): Add autoload cookie.  (Bug#67018)

9 months agoSupport indented continuation lines in lua-ts-mode
john muhl [Sat, 6 Jan 2024 15:36:33 +0000 (09:36 -0600)]
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)

9 months agoBind cross-buffer buffer-local variable correctly.
Alan Mackenzie [Thu, 11 Jan 2024 17:54:47 +0000 (17:54 +0000)]
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.

9 months agoFix man-tests.el
Eli Zaretskii [Thu, 11 Jan 2024 15:27:04 +0000 (17:27 +0200)]
Fix man-tests.el

* test/lisp/man-tests.el (man-tests-Man-translate-references): Fix
test for MS-Windows and MS-DOS.

9 months agoFix typo in lispref "Creating Strings" section
Xiyue Deng [Thu, 11 Jan 2024 14:18:37 +0000 (15:18 +0100)]
Fix typo in lispref "Creating Strings" section

* doc/lispref/strings.texi (String Basics): Fix typo (bug#68375).

9 months agoRevert "Fix typo in lispref 'Creating Strings' section"
Stephen Berman [Thu, 11 Jan 2024 14:12:00 +0000 (15:12 +0100)]
Revert "Fix typo in lispref 'Creating Strings' section"

This reverts commit b825962ea840348bbde0c834ca398458a06fbb8b
which was mistakenly installed in master instead of emacs-29.

9 months agoFix typo in lispref "Creating Strings" section
Xiyue Deng [Thu, 11 Jan 2024 13:41:41 +0000 (14:41 +0100)]
Fix typo in lispref "Creating Strings" section

* doc/lispref/strings.texi (String Basics): Fix typo.

9 months agoAdapt test names in auth-source-tests.el
Michael Albinus [Thu, 11 Jan 2024 11:45:03 +0000 (12:45 +0100)]
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.

9 months agoSupport numeric port numbers in auth-source-macos-keychain
Michael Albinus [Thu, 11 Jan 2024 11:30:05 +0000 (12:30 +0100)]
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.

9 months agoPopulate tool-bar bindings on text terminals
Jared Finder [Mon, 8 Jan 2024 21:20:25 +0000 (13:20 -0800)]
Populate tool-bar bindings on text terminals

* lisp/tool-bar.el (tool-bar-make-keymap-1): Populate on text
terminals.  (Bug#68334)

9 months agoFix count of no-op functions (bug#68375)
Xiyue Deng [Wed, 3 Jan 2024 00:31:30 +0000 (16:31 -0800)]
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

9 months agoWrap @pxref of Abbrevs in parentheses (bug#68375)
Xiyue Deng [Wed, 27 Dec 2023 20:35:39 +0000 (12:35 -0800)]
Wrap @pxref of Abbrevs in parentheses (bug#68375)

* doc/lispref/symbols.texi (Shorthands): Wrap `@pxref{Abbrevs}' in
parentheses.

Copyright-paperwork-exempt: yes

9 months agoConsider outline-heading-end-regexp in outline-font-lock-keywords
Gabriel do Nascimento Ribeiro [Sat, 23 Sep 2023 07:32:02 +0000 (04:32 -0300)]
Consider outline-heading-end-regexp in outline-font-lock-keywords

* lisp/outline.el (outline-font-lock-keywords): Add
outline-heading-end-regexp to regexp (bug#66166).

9 months ago; Fix last change in widget.texi
Eli Zaretskii [Thu, 11 Jan 2024 06:22:14 +0000 (08:22 +0200)]
; Fix last change in widget.texi

* doc/misc/widget.texi (url-link, toggle, Defining New Widgets):
Divide @example's into @group's.  (Bug#66229)

9 months ago; Fix overridden erc--input-split slot definition
F. Jason Park [Tue, 9 Jan 2024 22:50:43 +0000 (14:50 -0800)]
; Fix overridden erc--input-split slot definition

* lisp/erc/erc-common.el (erc--input-split): Don't set the
default value to `:read-only'.

* test/lisp/erc/erc-tests.el (erc--channel-modes,
erc--channel-modes/graphic-p): Use `char-displayable-p' instead of
`display-graphic-p' to prevent the first test from failing on Unicode
terminal emulators.

10 months ago; Fix typos
Stefan Kangas [Wed, 10 Jan 2024 23:32:15 +0000 (00:32 +0100)]
; Fix typos

10 months ago; * etc/TODO: Add item to make play-sound non-blocking.
Stefan Kangas [Wed, 10 Jan 2024 23:25:38 +0000 (00:25 +0100)]
; * etc/TODO: Add item to make play-sound non-blocking.

10 months ago; (vc-print-log-internal): Update docstring further
Dmitry Gutov [Wed, 10 Jan 2024 23:24:17 +0000 (01:24 +0200)]
; (vc-print-log-internal): Update docstring further

10 months agovc-log-mergebase: Fix the printing of buttons at the bottom
Dmitry Gutov [Wed, 10 Jan 2024 23:21:14 +0000 (01:21 +0200)]
vc-log-mergebase: Fix the printing of buttons at the bottom

* lisp/vc/vc.el (vc-print-log-setup-buttons):
Fix when LIMIT is a string (bug#68364).
(vc-print-log-internal): Update docstring.

10 months ago; Clarify message in last change
Stefan Kangas [Wed, 10 Jan 2024 22:50:16 +0000 (23:50 +0100)]
; Clarify message in last change

* lisp/info.el (Info-goto-emacs-key-command-node): Clarify message in
last change.

10 months agoHandle anonymous commands in C-h K
Eshel Yaron [Tue, 14 Feb 2023 07:18:37 +0000 (09:18 +0200)]
Handle anonymous commands in C-h K

* lisp/info.el (Info-goto-emacs-key-command-node): Don't call
Info-goto-emacs-command-node for anonymous commands.  (Bug#61505)

10 months agoUse auth-info-mode for non-hidden authinfo and netrc files
Augusto Stoffel [Wed, 27 Sep 2023 16:35:32 +0000 (18:35 +0200)]
Use auth-info-mode for non-hidden authinfo and netrc files

* files.el (auto-mode-alist): Match non-hidden authinfo and netrc
files, since it is reasonable to store passwords in
~/.emacs.d/authinfo.gpg or a similarly named file.  (Bug#66241)

10 months agoAdd Ruby to the tree-sitter build-module script
john muhl [Mon, 4 Sep 2023 17:08:34 +0000 (12:08 -0500)]
Add Ruby to the tree-sitter build-module script

* admin/notes/tree-sitter/build-module/batch.sh (languages): Add
Ruby.  (Bug#65739)

10 months agoAdd examples to the Widget manual
Mauro Aranda [Fri, 22 Sep 2023 23:45:00 +0000 (20:45 -0300)]
Add examples to the Widget manual

* doc/misc/widget.texi (Widget Gallery, Defining New Widgets): Add
examples.  (Bug#66229)

10 months agoFix man.el shell injection vulnerability
Xi Lu [Tue, 10 Oct 2023 14:20:05 +0000 (22:20 +0800)]
Fix man.el shell injection vulnerability

* lisp/man.el (Man-translate-references): Fix shell injection
vulnerability.  (Bug#66390)
* test/lisp/man-tests.el (man-tests-Man-translate-references): New
test.

10 months agoImplement missing functions for custom-icon widget
Mauro Aranda [Sun, 5 Nov 2023 10:23:55 +0000 (07:23 -0300)]
Implement missing functions for custom-icon widget

* lisp/cus-edit.el (custom-icon-reset-saved, custom-icon-mark-to-save)
(custom-icon-state-set-and-redraw, custom-icon-reset-standard)
(custom-icon-mark-to-reset-standard): New functions.
(custom-icon, custom-icon-extended-menu): Register and add them to the
menu.  (Bug#66947)

10 months ago; Clarify detail in Start Emacs maximized FAQ
Stefan Kangas [Wed, 10 Jan 2024 17:19:03 +0000 (18:19 +0100)]
; Clarify detail in Start Emacs maximized FAQ

* doc/misc/efaq.texi (Start Emacs maximized): Explain that the sexp
should be put at the top of the file.

10 months agoEsplain how to turn off GDB display of inferior-events
Richard M. Stallman [Wed, 10 Jan 2024 17:15:36 +0000 (12:15 -0500)]
Esplain how to turn off GDB display of inferior-events

10 months agoLua compilation-mode rules adjustments (bug#60830)
Mattias Engdegård [Wed, 10 Jan 2024 15:55:14 +0000 (16:55 +0100)]
Lua compilation-mode rules adjustments (bug#60830)

* lisp/progmodes/compile.el (compilation-error-regexp-alist-alist):
Translate `lua' and `lua-stack' to rx, and change two unnecessary
non-greedy operators to greedy.

10 months agoFix window setting in register preview (bug#67882)
Thierry Volpiatto [Tue, 26 Dec 2023 16:49:34 +0000 (17:49 +0100)]
Fix window setting in register preview (bug#67882)

and allow configuring it if needed.

* lisp/register.el (register-preview-display-buffer-alist): New user
  var.
(register-preview,register-preview-1): Use it.

10 months agoFix fontification of cgroup2 in fstab (bug#68367)
Stephen Berman [Wed, 10 Jan 2024 15:24:53 +0000 (16:24 +0100)]
Fix fontification of cgroup2 in fstab (bug#68367)

* lisp/generic-x.el (etc-fstab-generic-mode): Add cgroup2.

10 months agoHandle package versions that are not version strings
Philip Kaludercic [Wed, 10 Jan 2024 08:25:41 +0000 (09:25 +0100)]
Handle package versions that are not version strings

* lisp/emacs-lisp/package.el (package-menu--version-predicate): Ignore
any errors raised by 'version-to-list', thus falling back to the
default version list.  (Bug#68317)

(cherry picked from commit eb913c7501489e1eae475cae843fccdf14cc24d8)

10 months agoMake Compilation mode recognize Lua errors
Rudolf Adamkovič [Tue, 3 Oct 2023 07:07:40 +0000 (09:07 +0200)]
Make Compilation mode recognize Lua errors

Emacs comes with built-in support for the Lua programming language in
the form of the Lua mode and now also the Lua Tree-sitter mode.  This
patch further improves Lua support in Emacs by making the Compilation
mode recognize Lua errors and stack traces.

* lisp/progmodes/compile.el (compilation-error-regexp-alist-alist):
Add regexps to aid Lua development, namely the 'lua' regexp that
matches Lua errors and the 'lua-stack' regexp that matches Lua stack
frames.  (Bug#60830)
* etc/compilation.txt (Lua): Add an example of a Lua error message
with a stack trace.
* test/lisp/progmodes/compile-tests.el (compile-tests--test-regexps-data):
(compile-test-error-regexps): Test the new 'lua' and 'lua-stack'
regexps added to the 'compilation-error-regexp-alist-alist'.

10 months agoFix use after free in androidvfs.c
Stefan Kangas [Wed, 10 Jan 2024 09:24:33 +0000 (10:24 +0100)]
Fix use after free in androidvfs.c

* src/androidvfs.c (android_afs_opendir, android_saf_tree_opendir):
Fix use after free.

10 months agoRemove redundant casts from void* with malloc functions
Stefan Kangas [Wed, 10 Jan 2024 07:18:22 +0000 (08:18 +0100)]
Remove redundant casts from void* with malloc functions

* src/msdos.c (IT_menu_make_room):
* src/pgtkterm.c (pgtk_define_fringe_bitmap):
* src/w16select.c (set_clipboard_data):
* src/w32term.c (w32_define_fringe_bitmap):
* src/w32uniscribe.c (uniscribe_shape): Remove redundant cast from
void* with xrealloc.
* admin/coccinelle/alloc_cast.cocci: New semantic patch.

10 months ago; Adapt TODO list of tramp-compat.el
Michael Albinus [Wed, 10 Jan 2024 11:49:46 +0000 (12:49 +0100)]
; Adapt TODO list of tramp-compat.el

10 months agoFix file name completion with Tramp on MS Windoes
Michael Albinus [Wed, 10 Jan 2024 11:49:08 +0000 (12:49 +0100)]
Fix file name completion with Tramp on MS Windoes

* doc/misc/trampver.texi:
* lisp/net/trampver.el (tramp-version): Adapt Tramp versions.

* lisp/net/tramp.el (tramp-build-completion-file-name-regexp):
Do not use `tramp-volume-letter-regexp'.  (Bug#68320)
(tramp-completion-handle-expand-file-name): Simplify regexp.

* test/lisp/net/tramp-tests.el (tramp-test26-file-name-completion)
(tramp-test26-interactive-file-name-completion): Run also on MS Windows.

10 months agoHandle package versions that are not version strings
Philip Kaludercic [Wed, 10 Jan 2024 08:25:41 +0000 (09:25 +0100)]
Handle package versions that are not version strings

* lisp/emacs-lisp/package.el (package-menu--version-predicate): Ignore
any errors raised by 'version-to-list', thus falling back to the
default version list.  (Bug#68317)

10 months agoSupport :category in completion-extra-properties (bug#68214)
Juri Linkov [Wed, 10 Jan 2024 07:34:47 +0000 (09:34 +0200)]
Support :category in completion-extra-properties (bug#68214)

* doc/lispref/minibuf.texi (Completion Variables): Add :category
to the table of completion-extra-properties.

* lisp/minibuffer.el (completion--metadata-get-1): New internal function.
(completion-metadata-get): Use 'completion--metadata-get-1'.
Thanks to Daniel Mendler <mail@daniel-mendler.de>.
(completion-extra-properties): Mention :category in the docstring.

* lisp/calendar/calendar.el (calendar-read-date): Use more
user-friendly let-binding of completion-extra-properties
with :category.

10 months ago; Minor edits to PROBLEMS and sfnt.c
Po Lu [Wed, 10 Jan 2024 03:38:54 +0000 (11:38 +0800)]
; Minor edits to PROBLEMS and sfnt.c

* etc/PROBLEMS: Improve description of issues with Droid Sans
Mono.

* src/sfnt.c (sfnt_poly_edges_exact): Remove extraneous undef.

10 months agoIntroduce 'let' using lexical binding in the Lisp Introduction
Jim Porter [Thu, 26 Oct 2023 03:43:57 +0000 (20:43 -0700)]
Introduce 'let' using lexical binding in the Lisp Introduction

* doc/lispintro/emacs-lisp-intro.texi (Prevent confusion): Rework the
explanation to discuss how things work under lexical binding.
(How let Binds Variables): Describe the differences between lexical
and dynamic binding (including how to configure it).
(defvar): Mention that 'defvar' declares variables as always
dynamically-bound (bug#66756).