aboutsummaryrefslogtreecommitdiffstats
path: root/src/print.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* ; Fix last changeEli Zaretskii2025-08-091-0/+2
| | | | | * src/print.c (print_create_variable_mapping): Add back the wrong spelling as compatibility measure (bug#75784).
* Improve Vprint_variable_mappingZach Shaftel2025-08-091-1/+2
| | | | | | * src/print.c (print_create_variable_mapping): Fix a typo, `unreadeable-function' to `unreadable-function'. Add `symbols-bare' as an override for `print-symbols-bare'. (Bug#79161)
* print_error_message: Handle user-error to the echo area speciallySean Whitton2025-07-091-0/+13
| | | | | | * src/print.c (print_error_message): For a user-error that is to be printed to the echo area, use message3 in order to preserve fontification.
* Print non-ASCII chars in unibyte symbols as raw bytesMattias Engdegård2025-07-071-1/+1
| | | | | | | Previously, latin-1 was incorrectly assumed (bug#70988). * src/print.c (print_object): Call the correct function. * test/src/print-tests.el (print-unibyte-symbols): New test.
* Avoid extra output in Vprin1_to_string_buffer (bug#78842)Pip Cet2025-06-281-9/+14
| | | | | | | | | | | print_error_message can throw after producing some output, so use unwind-protect to ensure prin1-to-string-buffer is cleared. * src/print.c (erase_prin1_to_string_buffer): New. (Ferror_message_string): Use it to catch errors thrown in 'print_error_message'. * test/src/print-tests.el (error-message-string-circular): Expand test.
* Fix unsafe SDATA usage in print.c (bug#78590)Pip Cet2025-05-281-4/+10
| | | | | | | * src/print.c (print_string_1): Renamed from 'print_string', with an extra argument to disable nonascii escaping. (print_string): New function. (print_object): Use 'print_string_1', not 'strout'.
* Don't escape "." in `prin1' when followed by a letterSpencer Baugh2025-04-281-3/+6
| | | | | | | | | | | | | | | | | | | Among other users, let-alist widely uses symbols which start with a ".". Make those symbols print more nicely by tweaking the escaping rules in print_object to not escape a leading "." followed by a letter. This is a conservative change to avoid constraining future lexer changes. This is a followup to 637dde4aba921435f78d0de769ad74c4f3230aa6, which removed some unnecessary escaping of "." and "?" when printing symbols in prin1. (Actually, if we always escaped "?" (which was the case before 637dde4aba92) then "." only ever needs to be escaped when string_to_number returns non-nil. So 637dde4aba92 could have just dropped the escaping of "." with no other changes, if it didn't also remove escaping of "?") * src/print.c (print_object): Don't escape "." as the first character in a symbol if followed by a letter. (bug#77656). * test/src/print-tests.el (test-dots): Update for new behavior.
* Merge branch 'scratch/no-purespace' into 'master'Stefan Kangas2025-02-011-3/+0
|\
| * Pure storage removal: Remove purecopy hash table flagPip Cet2024-12-121-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/emacs-liqsp/comp.el (comp--jump-table-optimizable): Adjust comment. * src/category.c (hash_get_category_set): * src/emacs-module.c (syms_of_module): * src/fns.c (make_hash_table): Remove 'purecopy' flag and update docstring. (Fmake_hash_table): Ignore ':purecopy' argument. * src/frame.c (make_frame): * src/image.c (xpm_make_color_table_h): * src/lisp.h (struct Lisp_Hash_Table): Drop 'purecopy' flag. * src/pdumper.c (dump_hash_table): Don't dump 'purecopy' flag. * src/print.c (print_object): Don't print 'purecopy' flag * src/json.c (json_parse_object): * src/lread.c (readevalloop, read_internal_start): * src/pgtkterm.c (syms_of_pgtkterm): * src/profiler.c (export_log): * src/xfaces.c (syms_of_xfaces): * src/xterm.c (syms_of_xterm): Adjust calls to 'make_hash_table'.
* | Remove redundant case_Lisp_Int macroStefan Kangas2025-01-201-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The case_Lisp_Int macro was originally introduced with different definitions depending on USE_2_TAGS_FOR_INTS. However, since commit 2b5701247845, we have assumed that USE_2_TAGS_FOR_INTS is always defined, and the macro has only a single definition. As a result, the macro is now unnecessary, and replacing it with standard C case labels improves readability and understanding. * src/lisp.h (case_Lisp_Int): Delete macro. * src/alloc.c (process_mark_stack, survives_gc_p): * src/data.c (Fcl_type_of): * src/fns.c (value_cmp, sxhash_obj): * src/pdumper.c (dump_object): * src/print.c (print_object): * src/xfaces.c (face_attr_equal_p): Remove uses of above macro.
* | Replace call[1-8] with callnStefan Kangas2025-01-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since the introduction of the 'calln' macro, the 'call1', 'call2', ..., 'call8' macros are just aliases for the former. This is slightly misleading and potentially unhelpful. The number of arguments N can also easily go out-of-synch with the used alias callN. There is no reason not to replace these aliases with using 'calln' directly. To reduce the risk for mistakes, the tool Coccinelle was used to make these changes. See <https://coccinelle.gitlabpages.inria.fr/website/>. * src/alloc.c, src/androidvfs.c, src/androidfns.c, src/buffer.c: * src/callint.c, src/callproc.c, src/casefiddle.c, src/charset.c: * src/chartab.c, src/cmds.c, src/coding.c, src/composite.c: * src/data.c, src/dbusbind.c, src/dired.c, src/doc.c: * src/emacs.c, src/eval.c, src/fileio.c, src/filelock.c: * src/fns.c, src/frame.c, src/gtkutil.c, src/haikufns.c: * src/haikumenu.c, src/image.c, src/insdel.c, src/intervals.c: * src/keyboard.c, src/keymap.c, src/lisp.h, src/lread.c: * src/minibuf.c, src/nsfns.m, src/nsselect.m, src/pgtkfns.c: * src/pgtkselect.c, src/print.c, src/process.c, src/sort.c: * src/syntax.c, src/textconv.c, src/textprop.c, src/undo.c: * src/w32fns.c, src/window.c, src/xfaces.c, src/xfns.c: * src/xmenu.c, src/xselect.c, src/xterm.c: Replace all uses of 'call1', 'call2', ..., 'call8' with 'calln'.
* | Prefer calln to CALLN where applicableStefan Kangas2025-01-141-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | * src/callint.c (read_file_name): * src/comp.c (CALL0I, CALL1I, CALL2I, CALL4I, declare_imported_func): * src/data.c (Ffset, notify_variable_watchers): * src/eval.c (Ffuncall_with_delayed_message): * src/keymap.c (Fdescribe_buffer_bindings): * src/minibuf.c (Fread_buffer, Fcompleting_read): * src/pdumper.c (Fdump_emacs_portable): * src/print.c (print_vectorlike_unreadable): * src/treesit.c (treesit_traverse_match_predicate) (treesit_build_sparse_tree): Prefer calln to CALLN.
* | Update copyright year to 2025Paul Eggert2025-01-011-1/+1
|/ | | | Run "TZ=UTC0 admin/update-copyright".
* Fix buffer size problem in print_bool_vectorPaul Eggert2024-07-161-1/+1
| | | | | | * src/print.c (print_bool_vector): Don’t assume SIZE fits into ptrdiff_t, since it is an EMACS_INT. This pacifies gcc -Wformat-overflow on i686 --with-wide-int.
* * src/print.c (print_vectorlike_unreadable): Fix merge accident.Mattias Engdegård2024-06-101-1/+1
|
* Merge from origin/emacs-29Eli Zaretskii2024-06-081-0/+5
|\ | | | | | | | | | | 53e9caa23ef ; * doc/emacs/help.texi (Help, Apropos): Improve text and... 00360258cad Fix treesit-parse-string crash (bug#71012) 20af58d3a13 Check for buffer liveness when accessing tree-sitter node...
| * Check for buffer liveness when accessing tree-sitter node (bug#71012)Yuan Fu2024-06-011-0/+5
| | | | | | | | | | | | | | | | | | * src/treesit.h (treesit_node_buffer_live_p): Declare function. * src/print.c (print_vectorlike): Print node without position if buffer is killed. * src/treesit.c (treesit_node_buffer_live_p): New function. (treesit_check_node): Add buffer liveness check. (syms_of_treesit): New error treesit-node-buffer-killed.
* | Pacify gcc -Wmissing-variable-declarationsPaul Eggert2024-05-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a new warning diagnostic in GCC 14. * lib-src/etags.c (mercury_heuristics_ratio): * src/pgtkselect.c, src/xselect.c (selection_request_stack): * src/xselect.c (outstanding_transfers): * src/xterm.c (pending_selection_requests) (x_dnd_waiting_for_motif_finish_display): Now static. * lib-src/make-docfile.c (close_emacs_globals): Arrange for lispsym to be declared with extern first, when compiling lread.c. * src/alloc.c (gdb_make_enums_visible) [__GNUC__]: * src/emacs.c (RCS_Id): * src/keyboard.c (stop_character): * src/print.c (print_output_debug_flag): Now declared with extern first. * src/lisp.h (DEFINE_GDB_SYMBOL_BEGIN) [MAIN_PROGRAM]: Arrange for ID to be declared extern first. * src/lisp.h (garbage_collection_inhibited): * src/xterm.h (x_frame_parm_handlers): Declare here, so that its interface is properly checked. Other decls removed.
* | (COMPILED): Rename to CLOSUREStefan Monnier2024-04-281-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In preparation for the use of `PVEC_COMPILED` objects for interpreted functions, rename them to use a more neutral name. * src/lisp.h (enum pvec_type): Rename `PVEC_COMPILED` to `PVEC_CLOSURE`. (enum Lisp_Compiled): Use `CLOSURE_` prefix i.s.o `COMPILED_`. Also use `CODE` rather than `BYTECODE`. (CLOSUREP): Rename from `COMPILEDP`. (enum Lisp_Closure): Rename from `Lisp_Compiled`. * src/alloc.c, src/bytecode.c, src/comp.c, src/data.c, src/eval.c, * src/fns.c, src/lisp.h, src/lread.c, src/pdumper.c, src/print.c, * src/profiler.c: Rename all uses accordingly. * src/.gdbinit (xclosure): Rename from `xcompiled`. (xcompiled): New obsolete alias. (xpr): Adjust accordingly. Also adjust to new PVEC_CLOSURE tag name.
* | New JSON encoder (bug#70007)Mattias Engdegård2024-03-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is in general at least 2x faster than the old encoder and does not depend on any external library. Using our own code also gives us control over translation details: for example, we now have full bignum support and tighter float formatting. * src/json.c (json_delete, json_initialized, init_json_functions) (json_malloc, json_free, init_json, json_out_of_memory) (json_releae_object, check_string_without_embedded_nulls, json_check) (json_check_utf8, lisp_to_json_nonscalar_1, lisp_to_json_nonscalar) (lisp_to_json, json_available_p, ensure_json_available, json_insert) (json_handle_nonlocal_exit, json_insert_callback): Remove. Remaining uses updated. * src/json.c (json_out_t, symset_t, struct symset_tbl) (symset_size, make_symset_table, push_symset, pop_symset) (cleanup_symset_tables, symset_hash, symset_expand, symset_add) (json_out_grow_buf, cleanup_json_out, json_make_room, JSON_OUT_STR) (json_out_str, json_out_byte, json_out_fixnum, string_not_unicode) (json_plain_char, json_out_string, json_out_nest, json_out_unnest) (json_out_object_cons, json_out_object_hash), json_out_array) (json_out_float, json_out_bignum, json_out_something) (json_out_to_string, json_serialize): New. (Fjson_serialize, Fjson_insert): New JSON encoder implementation. * test/src/json-tests.el (json-serialize/object-with-duplicate-keys) (json-serialize/string): Update tests.
* | Add a proper type for obarraysMattias Engdegård2024-02-231-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new opaque type replaces the previous use of vectors for obarrays. `obarray-make` now returns objects of this type. Functions that take obarrays continue to accept vectors for compatibility, now just using their first slot to store an actual obarray object. obarray-size and obarray-default-size now obsolete. * lisp/obarray.el (obarray-default-size, obarray-size): Declare obsolete. (obarray-make, obarrayp, obarray-clear): Remove from here. * src/fns.c (reduce_emacs_uint_to_hash_hash): Remove from here. * src/lisp.h (struct Lisp_Obarray, OBARRAYP, XOBARRAY, CHECK_OBARRAY) (make_lisp_obarray, obarray_size, check_obarray) (obarray_iter_t, make_obarray_iter, obarray_iter_at_end) (obarray_iter_step, obarray_iter_symbol, DOOBARRAY, knuth_hash): New. (reduce_emacs_uint_to_hash_hash): Moved here. * src/lread.c (check_obarray): Renamed and reworked as... (checked_obarray_slow): ...this. (intern_sym, Funintern, oblookup, map_obarray) (Finternal__obarray_buckets): Adapt to new type. (obarray_index, allocate_obarray, make_obarray, grow_obarray) (obarray_default_bits, Fobarray_make, Fobarrayp, Fobarray_clear): New. * etc/emacs_lldb.py (Lisp_Object): * lisp/emacs-lisp/cl-macs.el (`(,type . ,pred)): * lisp/emacs-lisp/cl-preloaded.el (cl--typeof-types): * lisp/emacs-lisp/comp-common.el (comp-known-type-specifiers): * lisp/emacs-lisp/comp.el (comp-known-predicates): * src/alloc.c (cleanup_vector, process_mark_stack): * src/data.c (Ftype_of, syms_of_data): * src/minibuf.c (Ftry_completion, Fall_completions, Ftest_completion): * src/pdumper.c (dump_obarray_buckets, dump_obarray, dump_vectorlike): * src/print.c (print_vectorlike_unreadable): * test/lisp/abbrev-tests.el (abbrev-make-abbrev-table-test): * test/lisp/obarray-tests.el (obarrayp-test) (obarrayp-unchecked-content-test, obarray-make-default-test) (obarray-make-with-size-test): Adapt to new type.
* | Pacify gcc -Wpointer-signPaul Eggert2024-02-021-1/+1
| | | | | | | | * src/print.c (print_object): SDATA → SSDATA.
* | bytecomp.el: Rewrite the way we print dynamic docstringsStefan Monnier2024-02-021-8/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We used to print dynamic docstrings "manually" for two reasons: - References should look like `(#$ . POS)` but `prin1` was unable to print just `#$` for an sexp. - `make-docfile` needed to find those docstrings and the object to which they belonged. The second point is moot now that we don't use `make-docfile` on `.elc` files. So this patch lifts the first restriction, using `print-number-table`. The rest of the patch then simplifies and regularises the bytecompiler's generation of dynamic docstrings, which can now also easily be done for "inner" defvars and other places. * src/print.c (print_preprocess, print_object): Handle strings in `print-number-table`. (Vprint_number_table): Improve docstring. * lisp/emacs-lisp/bytecomp.el: (byte-compile--list-with-n): New function. (byte-compile--docstring-style-warn): Rename from `byte-compile-docstring-style-warn` and change calling convention. (byte-compile--\#$, byte-compile--docstrings): New vars. (byte-compile-close-variables): Bind them. (byte-compile--docstring): New function. (byte-compile-from-buffer): Set `byte-compile--\#$`. (byte-compile-output-file-form): Use `byte-compile--\#$` instead of special casing specific forms. (byte-compile--output-docform-recurse, byte-compile-output-docform): Delete functions. (byte-compile-file-form-autoload, byte-compile-file-form-defalias) (byte-compile-file-form-defvar-function, byte-compile-lambda): Use `byte-compile--docstring` and `byte-compile--list-with-n`. (byte-compile--declare-var): Add optional `not-toplevel` arg. (byte-compile-defvar): Add `toplevel` arg. Use `byte-compile--docstring`. (byte-compile-file-form-defvar): Delegate to `byte-compile-defvar`. (byte-compile--custom-declare-face): New function. Use it for `custom-declare-face`. (byte-compile-file-form-defmumble): Use `byte-compile-output-file-form` * src/doc.c (Fdocumentation_stringp): New function. (syms_of_doc): Defsubr it. (store_function_docstring): Remove left-over code from when we used DOC for the docstring of some Lisp files. * lisp/cus-face.el (custom-declare-face): Accept dynamic docstrings. * lisp/faces.el (face-documentation): Handle dynamic docstrings. * lisp/help-fns.el (describe-face): Simplify accordingly.
* | (DOHASH): Change calling conventionStefan Monnier2024-01-241-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This leads to simpler code in the users, and more efficient machine code because we don't repeatedly need to fetch the `table_size` and `key_and_value` fields of the hash table object. * src/lisp.h (DOHASH): Rewrite. * src/composite.c (composition_gstring_lookup_cache): Simplify. (composition_gstring_cache_clear_font): * src/print.c (print): * src/pdumper.c (hash_table_contents): * src/minibuf.c (Ftest_completion): * src/json.c (lisp_to_json_nonscalar_1): * src/emacs-module.c (module_global_reference_p): * src/comp.c (compile_function, Fcomp__compile_ctxt_to_file): * src/fns.c (Fmaphash): Adjust to new calling convention.
* | Change HASH_UNUSED_ENTRY_KEY from Qunbound to NULL floatMattias Engdegård2024-01-211-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | This removes hacks from code that had to be careful not to use Qunbound as a hash table key, at the cost of a minor hack in the GC marker. * src/lisp.h (INVALID_LISP_VALUE, HASH_UNUSED_ENTRY_KEY): Define as a null-pointer float. * src/alloc.c (process_mark_stack): Add hack to ignore that value. * src/pdumper.c (dump_object_needs_dumping_p) (pdumper_init_symbol_unbound, pdumper_load): * src/print.c (PRINT_CIRCLE_CANDIDATE_P): Remove hacks for Qunbound.
* | Add C macro for hash table iterationMattias Engdegård2024-01-211-9/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This removes some boilerplate code and further reduces dependencies on hash table implementation internals. * src/lisp.h (DOHASH): New. * 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 (Fmaphash): * src/json.c (lisp_to_json_nonscalar_1): * src/minibuf.c (Ftest_completion): * src/print.c (print): Use it instead of a hand-written loop.
* | Don't use Qunbound as hash table key when printing (bug#68244)Mattias Engdegård2024-01-181-1/+2
| | | | | | | | | | | | | | This flaw could cause an assertion failure. * src/print.c (PRINT_CIRCLE_CANDIDATE_P): Don't consider Qunbound a print-circle candidate; it should never be seen by Lisp anyway.
* | Retype traverse_interval arg type from Lisp_Object to void *Mattias Engdegård2024-01-141-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Share hash table test structsMattias Engdegård2024-01-131-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Use non-Lisp allocation for internal hash-table vectorsMattias Engdegård2024-01-131-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Remove rehash-threshold and rehash-size struct membersMattias Engdegård2024-01-131-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Represent hash table weakness as an enum internallyMattias Engdegård2024-01-131-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Don't print or read the hash table size parameterMattias Engdegård2024-01-131-5/+2
| | | | | | | | | | | | | | | | | | 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.
* | * src/print.c (print_object): Don't print empty hash-table dataMattias Engdegård2024-01-131-14/+23
| | | | | | | | Since no data is the default, this preserves bidirectional compatibility.
* | * src/print.c (print_object): Don't print hash table test if `eql`.Mattias Engdegård2024-01-131-1/+1
| | | | | | | | | | Since `eql` is the default, this ensures bidirectional compatibility while reducing the size of the external representation.
* | Abstract predicate and constant for unused hash keysMattias Engdegård2024-01-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Merge from savannah/emacs-29Po Lu2024-01-021-1/+1
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dc4e6b13296 ; Update copyright years in more files 64b37776318 ; Run set-copyright from admin.el 8e1c56ae467 ; Add 2024 to copyright years # Conflicts: # doc/misc/modus-themes.org # doc/misc/texinfo.tex # etc/NEWS # etc/refcards/ru-refcard.tex # etc/themes/modus-operandi-theme.el # etc/themes/modus-themes.el # etc/themes/modus-vivendi-theme.el # lib/alloca.in.h # lib/binary-io.h # lib/c-ctype.h # lib/c-strcasecmp.c # lib/c-strncasecmp.c # lib/careadlinkat.c # lib/cloexec.c # lib/close-stream.c # lib/diffseq.h # lib/dup2.c # lib/filemode.h # lib/fpending.c # lib/fpending.h # lib/fsusage.c # lib/getgroups.c # lib/getloadavg.c # lib/gettext.h # lib/gettime.c # lib/gettimeofday.c # lib/group-member.c # lib/malloc.c # lib/md5-stream.c # lib/md5.c # lib/md5.h # lib/memmem.c # lib/memrchr.c # lib/nanosleep.c # lib/save-cwd.h # lib/sha1.c # lib/sig2str.c # lib/stdlib.in.h # lib/strtoimax.c # lib/strtol.c # lib/strtoll.c # lib/time_r.c # lib/xalloc-oversized.h # lisp/auth-source-pass.el # lisp/emacs-lisp/lisp-mnt.el # lisp/emacs-lisp/timer.el # lisp/info-look.el # lisp/jit-lock.el # lisp/loadhist.el # lisp/mail/rmail.el # lisp/net/ntlm.el # lisp/net/webjump.el # lisp/progmodes/asm-mode.el # lisp/progmodes/project.el # lisp/progmodes/sh-script.el # lisp/textmodes/flyspell.el # lisp/textmodes/reftex-toc.el # lisp/textmodes/reftex.el # lisp/textmodes/tex-mode.el # lisp/url/url-gw.el # m4/alloca.m4 # m4/clock_time.m4 # m4/d-type.m4 # m4/dirent_h.m4 # m4/dup2.m4 # m4/euidaccess.m4 # m4/fchmodat.m4 # m4/filemode.m4 # m4/fsusage.m4 # m4/getgroups.m4 # m4/getloadavg.m4 # m4/getrandom.m4 # m4/gettime.m4 # m4/gettimeofday.m4 # m4/gnulib-common.m4 # m4/group-member.m4 # m4/inttypes.m4 # m4/malloc.m4 # m4/manywarnings.m4 # m4/mempcpy.m4 # m4/memrchr.m4 # m4/mkostemp.m4 # m4/mktime.m4 # m4/nproc.m4 # m4/nstrftime.m4 # m4/pathmax.m4 # m4/pipe2.m4 # m4/pselect.m4 # m4/pthread_sigmask.m4 # m4/readlink.m4 # m4/realloc.m4 # m4/sig2str.m4 # m4/ssize_t.m4 # m4/stat-time.m4 # m4/stddef_h.m4 # m4/stdint.m4 # m4/stdio_h.m4 # m4/stdlib_h.m4 # m4/stpcpy.m4 # m4/strnlen.m4 # m4/strtoimax.m4 # m4/strtoll.m4 # m4/time_h.m4 # m4/timegm.m4 # m4/timer_time.m4 # m4/timespec.m4 # m4/unistd_h.m4 # m4/warnings.m4 # nt/configure.bat # nt/preprep.c # test/lisp/register-tests.el
| * ; Add 2024 to copyright yearsPo Lu2024-01-021-1/+1
| |
| * Fix link to info node in prin1 docstringStefan Kangas2023-08-031-2/+1
| | | | | | | | | | | | * src/print.c (Fprin1): Fix linking to info node in docstring. (cherry picked from commit 4b73edb8d1da74fd1bda8894e982d9768fd1f18c)
* | Split safe_call between redisplay and non-redisplay versionsStefan Monnier2023-12-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `safe_call/eval` family of functions started its life in `xdisp.c` for the needs of redisplay but quickly became popular outside of it. This is not ideal because despite their name, they are somewhat specific to the needs of redisplay. So we split them into `safe_call/eval` (in `eval.c`) and `dsafe_call/eval` (in `xdisp.c`). We took this opportunity to slightly change their calling convention to be friendly to the CALLN-style macros. While at it, we introduce a new `calln` macro as well which does all that `call[1-8]` used to do. * src/eval.c (safe_eval_handler, safe_funcall, safe_eval): New functions, Copied from `xdisp.c`. Don't obey `inhibit_eval_during_redisplay` any more. Adjust error message to not claim it happened during redisplay. * src/lisp.h (calln): New macro. (call1, call2, call3, call4, call5, call6, call7, call8): Turn them into aliases of `calln`. (safe_funcall): Declare. (safe_calln): New macro. (safe_call1, safe_call2): Redefine as compatibility macros. (safe_call, safe_call1, safe_call2): Delete. Replace all callers with calls to `safe_calln`. * src/xdisp.c (dsafe_eval_handler): Rename from `safe_eval_handler`. Adjust all users. (dsafe__call): Rename from `safe_call` and change calling convention to work with something like CALLMANY. Adjust all users. (safe_call, safe__call1, safe_call2): Delete functions. (SAFE_CALLMANY, dsafe_calln): New macros. (dsafe_call1, dsafe_eval): Rename from `safe_call1` and `safe_eval`, and rewrite using them. Adjust all users. (clear_message, prepare_menu_bars, redisplay_window): Use `dsafe_calln`. (run_window_scroll_functions): Don't let-bind `Qinhibit_quit` since `safe_run_hooks_2` does it for us.
* | Silence warning in print.cStefan Kangas2023-12-171-1/+1
| | | | | | | | * src/print.c (print_bool_vector): Silence warning.
* | Refactor pseudovector printingMattias Engdegård2023-11-251-135/+134
| | | | | | | | | | | | | | | | * src/print.c (print_vectorlike): Split into... (print_bignum, print_bool_vector, print_vectorlike_unreadable): ...these functions. Exhaustive switch on pseudovector type. Remove unused return value. (print_object): Use new functions and simplify.
* | Make eln files re-dumpable (bug#45103)Andrea Corallo2023-10-241-1/+1
| | | | | | | | | | | | | | | | | | * lisp/loadup.el (load--bin-dest-dir, load--eln-dest-dir): New variable. (load--fixup-all-elns): New function. * src/pdumper.c (Fdump_emacs_portable): Update to call 'load--fixup-all-elns'. * src/print.c (print_vectorlike): Improve CU printing.
* | Merge remote-tracking branch 'origin/master' into feature/androidPo Lu2023-08-031-2/+1
|\ \
| * | Fix link to info node in prin1 docstringStefan Kangas2023-08-021-2/+1
| | | | | | | | | | | | * src/print.c (Fprin1): Fix linking to info node in docstring.
* | | Merge remote-tracking branch 'origin/master' into feature/androidPo Lu2023-05-151-2/+2
|\ \ \ | |/ /
| * | Prefer UINTMAX_WIDTH in print_objectPaul Eggert2023-05-141-1/+1
| | | | | | | | | | | | | | | * src/print.c (print_object): Prefer UINTMAX_WIDTH to rolling our own substitute.
| * | Pacify GCC 13 -Wanalyzer-out-of-boundsPaul Eggert2023-05-141-1/+1
| |/ | | | | | | | | | | | | * src/alloc.c (NEAR_STACK_TOP): Hoist from here ... * src/thread.h: ... to here. * src/print.c (print_object): Use NEAR_STACK_TOP instead of raw buffer address. This is more natural, and pacifies GCC 13.
* | Merge remote-tracking branch 'origin/master' into feature/androidPo Lu2023-01-111-2/+7
|\ \ | |/
| * Don't print named tree-sitter nodes with parenthesizes (bug#60696)Yuan Fu2023-01-091-2/+7
| | | | | | | | | | * src/print.c (print_vectorlike): Use empty string as delimiters if the node is named.