* lisp/subr.el (dolist-with-progress-reporter): New macro (Bug#31697).
* lisp/cus-edit.el (custom-group-value-create): Use it.
* lisp/dabbrev.el (dabbrev--progress-reporter): Delete variable.
(dabbrev--find-expansion): Use dotimes-with-progress-reporter.
* doc/lispref/display.texi: Document the macro.
; * etc/NEWS: Announce it.
* lisp/subr.el (dotimes-with-progress-reporter): Allow 2nd arg to be
a string or a progress reporter (Bug#31696).
* doc/lispref/display.texi (node Progress): Update manual.
Theme settings now generally aren't actually applied until a call to
`enable-theme-, either one made explicitly or implicitly through
`load-theme' with NO-ENABLE nil. This change has the effect of not
applying theme changes just because we load a lisp file containing a
theme specification. The previous behavior is preserved for the
special case of the `user' theme, which is frequently used for
ad-hoc customization.
* lisp/cus-face.el (custom-theme-set-faces): Call
`custom--should-apply-setting' to decide whether to apply
a setting.
* lisp/custom.el (custom--should-apply-setting): New function.
(custom--inhibit-theme-enable): Add `apply-only-user' option;
default to it.
(custom-push-theme, custom-theme-set-variables): Call
`custom--should-apply-setting' to decide whether to apply
a setting.
* lisp/emacs-lisp/cconv.el (cconv--convert-funcbody): New function.
(cconv--convert-function): Extracted from here.
(cconv-convert): Also use it here, in the lambda lifted case, so that
mutated args are properly accounted for.
* test/lisp/emacs-lisp/cconv-tests.el: New test.
* lisp/progmodes/python.el (python-nav-end-of-statement): Don't assert
that string-start is strictly greater than last-string-end, because
the string end is a position outside of the string and may therefore
be the same as the following string's start.
* test/lisp/progmodes/python-tests.el (python-nav-end-of-statement-2):
New test.
* src/lisp.h (compile_pattern): Remove prototype of
now-internal function.
* src/regex.c (POS_AS_IN_BUFFER): Consult gl_state instead of
re_match_object: the latter can change in Lisp.
(re_match_2_internal): Switch back to UPDATE_SYNTAX_* FROM
UPDATE_SYNTAX_FAST*, allowing calls into Lisp.
* src/regex.h (re_match_object): Uncomment declaration.
* src/search.c (struct regexp_cache): Add `busy' field.
(thaw_buffer_relocation): Delete; rely on unbind.
(compile_pattern_1): Assert pattern isn't busy.
(shrink_regexp_cache): Don't shrink busy patterns.
(clear_regexp_cache): Don't nuke busy patterns.
(unfreeze_pattern, freeze_pattern): New functions.
(compile_pattern): Return a regexp_cache pointer instead of the
re_pattern_buffer, allowing callers to use `freeze_pattern' if
needed. Do not consider busy patterns as cache hit candidates;
error if we run out of non-busy cache entries.
(looking_at_1, fast_looking_at): Snapshot
Vinhibit_changing_match_data; mark pattern busy while we're
matching it; unbind.
(string_match_1, fast_string_match_internal)
(fast_c_string_match_ignore_case): Adjust for compile_pattern
return type.
(search_buffer_re): Regex code from old search_buffer moved here;
snapshot Vinhibit_changing_match_data; mark pattern busy while
we're matching it; unbind.
(search_buffer_non_re): Non-regex code from old search_buffer
moved here.
(search_buffer): Split into search_buffer_re,
search_buffer_non_re.
(syms_of_search): Staticpro re_match_object, even though we really
shouldn't have to.
* src/syntax.h (UPDATE_SYNTAX_TABLE_FORWARD_FAST):
(UPDATE_SYNTAX_TABLE_FAST): Remove.
* src/thread.h (struct thread_state): Remove m_re_match_object,
which is global again. (It never needs to be preserved across
thread switch.)
Have it return Emacs virtual memory size, not the sbrk value
which is often useless newadays.
* doc/lispref/internals.texi (Garbage Collection):
* etc/NEWS: Document this.
* lisp/subr.el (memory-limit): New implementation in Lisp,
written in terms of process-attributes, and which returns
virtual memory size.
* src/alloc.c (Fmemory_limit): Remove C implementation.
Do not use the symbol ‘default’ as a special marker.
Instead, use a value that cannot appear in the program,
improving on a patch proposed by Robert Cochran (Bug#31718#14).
* lisp/emacs-lisp/bytecomp.el (byte-compile--default-val):
New constant.
(byte-compile-cond-jump-table-info)
(byte-compile-cond-jump-table): Use it instead of 'default.
* test/lisp/emacs-lisp/bytecomp-tests.el:
(byte-opt-testsuite-arith-data): Add a test for the bug.
* src/xfaces.c (merge_face_ref): Fix a typo in the commentary.
(evaluate_face_filter, filter_face_ref): Minor copyedits in
the commentary.
* doc/lispref/display.texi (Face Remapping):
* doc/lispref/text.texi (Special Properties): Document the
':filter' face specs and their effects. Document
'face-filters-always-match'.
* doc/emacs/files.texi (Visiting): Document the new
possibility to visit large files literally in response to
question asked by Emacs.
* etc/NEWS: Mention the new possibility to visit large files
literally.
* lisp/files.el (files--ask-user-about-large-file): Use
"literally" instead of "raw", for consistency with
find-file-literally.
* doc/lispref/frames.texi (Input Focus): Tell explicitly that
focus-change events are sometimes supported on TTY frames.
* lisp/subr.el (while-no-input): Handle the case when BODY
never tests quit-flag, and runs to completion even though
input arrives while BODY executes. (Bug#31692)
Mostly, this avoids munging executables when CANNOT_DUMP = yes,
as the munging is needed only for unexec.
* configure.ac (PAXCTL_dumped, PAXCTL_notdumped) [CANNOT_DUMP]:
Leave these empty.
(LD_SWITCH_SYSTEM_TEMACS) [CANNOT_DUMP]:
Do not append -no-pie or -nopie.
* src/alloc.c (my_heap_start) [CANNOT_DUMP]: Omit; not used.
It has not been needed for many years and gets in the way of
portable dumping, address sanitization, etc. See:
https://lists.gnu.org/r/emacs-devel/2016-12/msg00147.html
* configure.ac (LDFLAGS_NOCOMBRELOC, emacs_cv_znocombreloc):
Remove. All uses removed.
* etc/PROBLEMS: Remove discussion of combreloc problems.
* src/macfont.m (macfont_set_family_cache): Restore casts
to void * that were mistakenly removed in my recent change.
The types in question are pointer-to-const. Problem
reported by Clemens Schüller.
The backend's diagnostic list must be updated too, not just cleared.
* lisp/progmodes/flymake.el (flymake--diag): Add overlay field.
(flymake--highlight-line): Return created overlay.
(flymake--handle-report): Iterate the backend's diagnostics, not
the overlays. Set diagnostic overlay.
(flymake--run-backend): Don't clean diagnostic list here.
(flymake-mode): Call delete-overlay directly.
* src/keyboard.c (make_lispy_focus_out): Compile it
unconditionally, as it is now supported on TTYs as well.
Reported by Filipp Gunbin <fgunbin@fastmail.fm>.
This is a streamlined version of Lisp_Save_Value, which contains just
a pointer, as that is all Lisp_Save_Values are used for any more.
With the previous changes, these objects are not primarily used as
save values, so just call them "Misc" rather than "Save".
* src/alloc.c (make_misc_ptr): New function.
(mark_object): Mark Lisp_Misc_Ptr too.
* src/lisp.h (Lisp_Misc_Ptr): New constant.
(struct Lisp_Misc_Ptr): New type.
(make_mint_ptr, mint_ptrp, xmint_pointer):
Use Lisp_Misc_Ptr, not Lisp_Save_Value.
(union Lisp_Misc): Add Lisp_Misc_Ptr.
* src/print.c (print_object): Print Lisp_Misc_Ptr.
* src/alloc.c (mark_maybe_objects): New function.
* src/eval.c (default_toplevel_binding)
(backtrace_eval_unrewind, Fbacktrace__locals):
Treat array unwindings like other miscellaneous pdl types.
(record_unwind_protect_array): New function.
(do_one_unbind): Free the array while unwinding.
(mark_specpdl): Mark arrays directly.
* src/lisp.h (SPECPDL_UNWIND_ARRAY): New constant.
(union specbinding): New member unwind_array.
(SAFE_ALLOCA_LISP_EXTRA): Use record_unwind_protect_array
instead of make_save_memory + record_unwind_protect.
* src/editfns.c (save_excursion_save): New arg PDL,
specifying where to save the state. All uses changed.
(save_excursion_restore): Args are now the marker and info
rather than a pointer to a Lisp_Save_Value containing them.
All uses changed.
* src/eval.c (default_toplevel_binding, Fbacktrace__locals):
Treat excursions like other miscellaneous pdl types.
(record_unwind_protect_excursion): Save data directly
into the pdl rather than creating an object on the heap.
This avoids the need to allocate and free an object.
(do_one_unbind, backtrace_eval_unrewind):
Unwind excursions directly.
(mark_specpdl): Mark excursions directly.
* src/lisp.h (SPECPDL_UNWIND_EXCURSION): New constant.
(union specbinding): New member unwind_excursion.
* src/macfont.m (macfont_descriptor_entity): Use cons instead
of make_save_ptr_int, as this avoids the need for a special
type and function for this one-off.
* src/ftfont.c (struct ftfont_cache_data): New member face_refcount.
(ftfont_lookup_cache): Clear it when initializing.
Use make_mint_ptr, since this typically avoids the need to
allocate a Lisp_Save_Value as refcount is now stored elsewhere.
(ftfont_open2, ftfont_close): Manipulate the reference
count in the struct, not in the save object.
* src/term.c (struct tty_pop_down_menu): New type.
(tty_pop_down_menu, tty_menu_show): Use it, along with
record_unwind_protect_ptr, to avoid allocating a Lisp_Misc.
* src/xmenu.c (struct pop_down_menu): New type.
(pop_down_menu, x_menu_show): Use it, likewise.
* src/xterm.c (x_cr_destroy, x_cr_export_frames):
Use record_unwind_protect_pointer to avoid possibly allocating
a Lisp_Misc.
* src/fileio.c (union read_non_regular): New type.
(read_non_regular, Finsert_file_contents):
Use it to avoid allocating a Lisp_Misc.
* src/keymap.c (union map_keymap): New type.
(map_keymap_char_table_item, map_keymap_internal):
Use it to avoid allocating a Lisp_Misc.
* src/emacs-module.c (init_module_assertions): Just use NULL
instead of allocating a dummy on the stack and then using
eassert. Practical platforms check for null pointer
dereferencing nowadays, so this is good enough.
* doc/lispref/text.texi (Parsing JSON): Describe new :null-object
and :false-object kwargs to json-parse-string and
json-parse-buffer.
* src/json.c
(struct json_configuration): New type.
(json_to_lisp): Accept a struct json_configuration* param.
(json_parse_args): Rename from json_parse_object_type.
(Fjson_parse_string): Rework docstring.
(Fjson_parse_string, Fjson_parse_buffer): Update call to
json_to_lisp.
(syms_of_json): Two new syms, QCnull_object and QCfalse_object.
* test/src/json-tests.el
(json-parse-with-custom-null-and-false-objects): New test.
* lisp/json.el (json-pretty-print): Force distinction between empty
objects and null.
(json-encode-list): Remove responsibility to print "null" as this
value is not a list.
(json-encode): Give higher precedence to lists so that an empty list
is printed as an empty object, not as "null".
* test/lisp/json-tests.el (test-json-encode): Add many tests to check
the behavior of pretty-printing.
Do not assume that 8-byte alignment suffices for all C objects,
as some platforms require 16-byte alignment for some objects,
and this will start to bite us as time goes on (e.g., if an
Emacs module ever uses an object containing a long
double, which requires 16-byte alignment on x86-64).
Conversely, on !USE_LSB_TAG platforms, do not insist on
aligning Lisp objects to a multiple of 8, as this is not
needed for high-order tag bits.
* src/alloc.c (LISP_ALIGNMENT, MALLOC_IS_LISP_ALIGNED):
New constants.
(XMALLOC_BASE_ALIGNMENT, XMALLOC_HEADER_ALIGNMENT):
Removed. All uses replaced by LISP_ALIGNMENT.
(aligned_alloc, laligned, lmalloc, lrealloc, union aligned_Lisp_Misc)
(maybe_lisp_pointer, pure_alloc):
Use LISP_ALIGNMENT rather than GCALIGNMENT.
(aligned_alloc): Do not worry about an alignment of
LISP_ALIGNMENT when MALLOC_IS_LISP_ALIGNED, as the code never
uses aligned_alloc with alignment == LISP_ALIGNMENT in that case.
(__alignof__): Remove. All uses removed.
(MALLOC_IS_GC_ALIGNED): Remove.
All uses replaced with MALLOC_IS_LISP_ALIGNED.
(vector_alignment): Remove.
All uses replaced with LISP_ALIGNMENT.
* src/alloc.c (mark_maybe_pointer):
* src/emacs-module.c (value_to_lisp_bits):
Do not assume GCALIGNMENT == 1 << GCTYPEBITS, as GCALIGNMENT
is 1 on !USE_LSB_TAG platforms now.
* src/lisp.h (GCALIGNMENT) [!USE_LSB_TAG]: Now 1.
(struct Lisp_Symbol, union vectorlike_header, struct Lisp_Cons)
(struct Lisp_String): Simplify test for verifying alignment.