summaryrefslogtreecommitdiff
path: root/src/fns.c
Commit message (Collapse)AuthorAgeFilesLines
* Prefer C23 ckd_* to Gnulib *_WRAPV macrosPaul Eggert2023-05-171-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | C23 has added ckd_add etc. macros with functionality equivalent to the older Gnulib INT_ADD_WRAPV macros, so switch to the more-standard names. * admin/merge-gnulib (GNULIB_MODULES): Add stdckdint. This merely makes the dependency explicit, as we were already using this Gnulib module indirectly. * lib-src/etags.c, src/lisp.h: Include stdckdint.h. * lib-src/etags.c (xnmalloc, xnrealloc): * src/alloc.c (xnmalloc, xnrealloc, xpalloc, Fmake_string) (mark_memory): * src/bignum.c (emacs_mpz_pow_ui): * src/buffer.c (record_overlay_string, overlay_strings): * src/bytecode.c (exec_byte_code): * src/casefiddle.c (do_casify_multibyte_string): * src/ccl.c (ccl_driver, Fccl_execute_on_string): * src/character.c (char_width, c_string_width) (lisp_string_width, count_size_as_multibyte) (string_escape_byte8): * src/cmds.c (internal_self_insert): * src/coding.c (coding_alloc_by_realloc, produce_chars): * src/data.c (arith_driver): * src/dispnew.c (realloc_glyph_pool, init_display_interactive): * src/doprnt.c (parse_format_integer): * src/editfns.c (Freplace_buffer_contents, str2num) (styled_format): * src/emacs-module.c (module_global_reference_p) (module_make_global_ref, module_funcall): * src/eval.c (max_ensure_room): * src/fileio.c (blocks_to_bytes): * src/fns.c (Ffillarray): * src/font.c (font_intern_prop): * src/frame.c (check_frame_pixels): * src/gnutls.c (gnutls_hex_string, gnutls_symmetric_aead): * src/gtkutil.c (get_utf8_string): * src/haikuterm.c (haiku_term_init): * src/image.c (xbm_scan, image_to_emacs_colors) (image_detect_edges, png_load_body): * src/keyboard.c (Frecursion_depth): * src/keymap.c (Flookup_key, Fkey_description): * src/lisp.h (modiff_incr, SAFE_ALLOCA_LISP_EXTRA): * src/lread.c (read_bool_vector): * src/pgtkterm.c (pgtk_term_init): * src/regex-emacs.c (regex_compile): * src/term.c (encode_terminal_code): * src/termcap.c (tputs): * src/textconv.c (textconv_query): * src/timefns.c (timespec_ticks, lisp_time_hz_ticks) (Fdecode_time, check_tm_member): * src/tparam.c (tparam1): * src/w32term.c (w32_initialize_display_info): * src/xdisp.c (fill_column_indicator_column, decode_mode_spec): * src/xselect.c (selection_data_size, x_property_data_to_lisp): * src/xsmfns.c (smc_save_yourself_CB): * src/xterm.c (xm_setup_dnd_targets, x_sync_get_monotonic_time) (x_sync_current_monotonic_time, x_sync_note_frame_times) (x_display_set_last_user_time, x_term_init): Prefer the C23 stdckdint macros to their Gnulib intprops.h counterparts, since C23 is standard.
* Add trailing space to PROMPT in yes-or-no-pMichael Albinus2023-05-121-1/+10
| | | | | | | | | | * doc/lispref/minibuf.texi (Yes-or-No Queries): Describe PROMPT massage for y-or-n-p and yes-or-no-p. * lisp/subr.el (y-or-n-p): Adapt docstring. * src/fns.c (Fyes_or_no_p): Add trailing space to PROMPT if needed. (Bug#63399)
* Merge from origin/emacs-29Eli Zaretskii2023-04-251-12/+23
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 524e161a536 Followup to addition of TUTORIAL.fa 76f50df1539 Add Farsi/Persian translation of the tutorial 8eacfaea6d8 Add Mongolian language environments fe8efbb8f75 Document the 'end-session' event on MS-Windows d80f959bede Update to Org 9.6.4-9-g8eb209 98c6cfcbe4a Don't support versioned grammar libraries on MS-Windows 8f71c1546df Accept versioned tree-sitter language grammar files 99add09d5e1 tab-bar-new-tab: inhibit side-window checks 087e8181947 * etc/NEWS: Fix outline level. (Bug#63042) d7f38558c4c ; Improve font selection for Traditional Mongolian 965c5e0231c Fix rendering of Traditional Mongolian script 9a0f10b5f88 Fix line-number-at-pos when POSITION is out of narrowing 4e0f4292aaf ; * etc/tutorials/TUTORIAL: Fix punctuation. dec2ac0c657 Fix exiting Emacs after saving a tutorial # Conflicts: # etc/NEWS
| * Fix line-number-at-pos when POSITION is out of narrowingEli Zaretskii2023-04-221-12/+23
| | | | | | | | | | | | | | * src/fns.c (Fline_number_at_pos): Don't signal an error when ABSOLUTE is nil and POSITION is outside of the narrowing, like the original Lisp implementation did. Minor speedup by using the byte position where it is available from the get-go. (Bug#62857)
* | ; * src/fns.c (assq_no_signal): Fix a typo in a comment.Eli Zaretskii2023-04-191-1/+1
| |
* | New helper function assq_no_signalYuan Fu2023-04-161-0/+14
| | | | | | | | | | | | | | * src/fns.c (assq_no_signal): New function. * src/lisp.h (assoc_no_signal): Declare it. * src/treesit.c (safe_assq): Remove function. (treesit_traverse_get_predicate): Change safe_assq to assq_no_signal.
* | ; * src/fns.c: Use if instead of #ifdefMattias Engdegård2023-04-011-7/+6
| | | | | | | | | | | | * src/fns.c (HAVE_FAST_UNALIGNED_ACCESS, load_unaligned_size_t): Always define these. (Fstring_lessp): Use if instead of #ifdef.
* | ; * src/fns.c (HAVE_FAST_UNALIGNED_ACCESS): Check in missing edit.Po Lu2023-04-011-2/+0
| |
* | ; * src/fns.c (Fstring_lessp): Fix coding style.Po Lu2023-04-011-2/+3
| |
* | ; * src/fns.c (Fstring_lessp): Port to RISCs.Po Lu2023-04-011-1/+2
| |
* | Make string-lessp vectorisation saferMattias Engdegård2023-03-311-18/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | Use memcpy for loading unaligned words on platforms where this can be done efficiently. This guards against problems arising from future compiler autovectorisation improvements that might cause instructions that require aligned addresses to be emitted, and should also work with an address sanitiser enabled. * src/fns.c (HAVE_FAST_UNALIGNED_ACCESS): Only define when optimising. (load_unaligned_size_t): New. (Fstring_lessp): Use load_unaligned_size_t. * src/lisp.h (UNALIGNED_LOAD_SIZE): Remove now unused macro.
* | Merge from origin/emacs-29Stefan Kangas2023-02-121-8/+9
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4da398d8b57 ; Fix typos 074008ee2d2 ; Fix doc strings in lisp/image/ directory 2d1e43436da ; Improve documentation of hash functions. 900f7e07275 ; Remove extraneous local variables from image-dired-*.el... 4f053afe8e7 bug-reference: prevent match-data clobbering (bug#61395) 10af9fbcad1 ; * admin/notes/tree-sitter/starter-guide: Typos. 9ac242ce93d ; Fix recent changes in treesit docs f5789aefc2e Rename LIMIT to DEPTH in tree-sitter functions (bug#61231) b39821fdcef ; Fix incorrect function name in treesit manual 51901736965 Add 'live' property to treesit-node-check (bug#61235) 56960a6558b Update to Transient v0.3.7-205-gb8ad0da 68a6b364d1c Fix 'rmail-summary-output' 67c6ec25590 lisp-mode: add docstring recognition for more common lisp... 417a8ed8b05 ; Improve discoverability of empty file names handling e47cf6ca15a Update to Transient v0.3.7-204-gecff8c2 b04cce02ff4 Fix Scala entry in Eglot's DB of LSP servers # Conflicts: # lisp/transient.el
| * ; Improve documentation of hash functions.Eli Zaretskii2023-02-111-8/+9
| | | | | | | | | | | | | | | | | | | | | | * src/fns.c (Fsecure_hash, Fmd5): Document the length of the return values. * lisp/subr.el (sha1): Describe the return value in more detail. * doc/lispref/text.texi (Checksum/Hash): Document 'sha1'. Document the length of the strings returned by each hashing algorithm.
* | Add `yes-or-no-prompt' user optionRobert Pluim2023-01-231-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | This implements Bug#60312 * src/fns.c (syms_of_fns): Define `yes-or-no-prompt' Lisp variable. (Fyes_or_no_p): Use `yes-or-no-prompt' instead of a hard-coded string. * lisp/cus-start.el (standard): Add custom specification for it. * doc/emacs/mini.texi (Yes or No Prompts): Document `yes-or-no-prompt' * doc/lispref/minibuf.texi (Yes-or-No Queries): And here. * etc/NEWS: Announce the new option.
* | Merge from origin/emacs-29Stefan Monnier2023-01-141-0/+9
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 861556c1339 Fix minibuffer-completion tests c0578edc8fc ; * doc/misc/eglot.texi (Troubleshooting Eglot): Fix typo... c6bbf9cc270 Add c-ts-mode tests a760364f5f3 Fix c-ts-mode--fill-paragraph 2a2b1d09ac7 Fix minor issues with 'pp' and related commands dfb38fb2ee6 ; Improve documentation of tree-sitter node comparison e8a89a18b69 ; Fix non-tree-sitter builds f27a330b99e ; Fix typo in ert-with-temp-file 956889d8ff1 Equal now recognizes tree-sitter nodes (bug#60659) 8f446c2d397 Fix c-ts-mode comment indentation (bug#60270) 083badc9c12 * lisp/subr.el (while-let): Use if-let, not if-let* (bug#... 9ecebcdded1 * lisp/simple.el (next-completion): Handle first completi... cfd2b3504ab Fix encoding with 'utf-8-auto' 53b47df8229 Report cursor correctly on PGTK when there is a margin # Conflicts: # etc/NEWS
| * ; Fix non-tree-sitter buildsEli Zaretskii2023-01-131-3/+4
| | | | | | | | | | * src/fns.c (internal_equal): Call treesit_node_eq only if tree-sitter was compiled in.
| * Equal now recognizes tree-sitter nodes (bug#60659)Yuan Fu2023-01-121-0/+8
| | | | | | | | | | | | | | | | | | | | | | Now equal uses ts_node_eq to check equality between nodes. * doc/lispref/parsing.texi: (Accessing Node Information): Update manual. * src/fns.c (internal_equal): Handle tree-sitter nodes. * src/treesit.c (treesit_node_eq): New function. (Ftreesit_node_eq): Factor out. Update docstring. * src/treesit.h (treesit_node_eq): Declare new function.
* | Merge from origin/emacs-29Stefan Kangas2023-01-051-2/+1
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | 92f753dc190 ; * etc/NEWS: Fix wording in last change. cef875f6c51 ; * etc/NEWS: Instructions for builds without tree-sitter... 8d530ca6542 ; Fix documentation of y-or-n-p/yes-or-no-p c18878ee0a2 Fix bug in Tramp multi-hop 7eed8e050a9 * lisp/files.el (find-sibling-rules): Fix docstring. 6b5831c6964 Tree-sitter doc fixes (bug#60524) 651927ac391 ; Fix function reference in comment in c-ts-mode.el (bug#... c786afcbb9f Fontify C++ function definitions in c-ts-mode (bug#60529) # Conflicts: # etc/NEWS
| * ; Fix documentation of y-or-n-p/yes-or-no-pEli Zaretskii2023-01-041-2/+1
| | | | | | | | | | * lisp/subr.el (y-or-n-p): * src/fns.c (Fyes_or_no_p): Doc fix.
* | Merge from origin/emacs-29Eli Zaretskii2023-01-011-1/+1
|\ \ | |/ | | | | | | | | | | | | | | | | | | cae528457c ; Add 2023 to copyright years. b394359261 Improve documentation of 'isearch-open-overlay-temporary' ab3210e709 Document 'use-package' in the 2 main manuals # Conflicts: # etc/refcards/ru-refcard.tex # lib/explicit_bzero.c # m4/explicit_bzero.m4
| * ; Add 2023 to copyright years.Eli Zaretskii2023-01-011-1/+1
| |
* | Add support for additional memory checks using AddressSanitizer.Vibhav Pant2022-12-191-2/+7
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When Emacs is compiled with AddressSanitizer support, enable poisoning/unpoisoning freed/unused Lisp objects and other internal memory management structures. If enabled, this will mark freed bytes that have been put on free lists for future use and initially allocated memory blocks/chunks as "poisoned", triggering an ASan error if they are accessed improperly. Structures are unpoisoned when they have been taken off their respective free lists. Additionally, add optional macros for performing unaligned loads, which when enabled by defining USE_SANITIZER_UNALIGNED_LOAD will use ASan provided functions for loading from unaligned addresses, which may help catch bugs that AddressSanitizer might otherwise miss. * configure.ac: Check for the existence of address and common sanitizer API headers. * src/lisp.h (UNALIGNED_LOAD_SIZE): New macro. If enabled, and the necessary sanitizer API is available, define it to __sanitizer_unaligned_load(64|32) depending on the word size of the architecture. * src/fns.c [HAVE_FAST_UNALIGNED_ACCESS] (Fstring_lessp): Use 'UNALIGNED_LOAD_SIZE' to perform unaligned loads from the two strings. * src/alloc.c (ASAN_POISON_ABLOCK, ASAN_UNPOISON_ABLOCK) (ASAN_POISON_INTERVAL_BLOCK, ASAN_UNPOISON_INTERVAL_BLOCK) (ASAN_POISON_INTERVAL, ASAN_UNPOISON_INTERVAL) (ASAN_PREPARE_DEAD_SDATA, ASAN_PREPARE_LIVE_SDATA) (ASAN_POISON_SBLOCK_DATA, ASAN_POISON_STRING_BLOCK) (ASAN_UNPOISON_STRING_BLOCK, ASAN_POISON_STRING) (ASAN_UNPOISON_STRING, ASAN_POISON_FLOAT_BLOCK) (ASAN_UNPOISON_FLOAT_BLOCK, ASAN_POISON_FLOAT) (ASAN_UNPOISON_FLOAT, ASAN_POISON_CONS_BLOCK) (ASAN_POISON_CONS, ASAN_UNPOISON_CONS) (ASAN_POISON_VECTOR_CONTENTS, ASAN_UNPOISON_VECTOR_CONTENTS) (ASAN_UNPOISON_VECTOR_BLOCK, ASAN_POISON_SYMBOL_BLOCK) (ASAN_UNPOISON_SYMBOL_BLOCK, ASAN_POISON_SYMBOL) (ASAN_UNPOISON_SYMBOL) [ADDRESS_SANITIZER]: New macros. When address sanitization is enabled, define them to poison/unpoison objects. (lisp_align_malloc): Poison newly allocated blocks on `free_ablock', unpoison ablocks taken from it respectively. (lisp_align_free): Poison individual ablocks when they are put on the free list, unpoison them when an entire `ablocks' chunk is being freed. (make_interval): Poison interval blocks on initial allocation, unpoison individual intervals on allocation and removal from `interval_free_list'. (sweep_intervals): Unpoison interval blocks before sweeping, poison dead/unmarked intervals. (allocate_string): Poison string blocks on initial allocation, unpoison Lisp_Strings on removal from the free list. (allocate_string_data): Poison `sblock' data on initial allocation, unpoison individual `sdata' contents on allocation or removal from the free list. Call `ASAN_PREPARE_LIVE_SDATA' on the new `sdata' struct. (sweep_strings): Unpoison string blocks before sweeping them, poisoning dead strings and their sdata afterwards. (compact_small_strings): Call `ASAN_PREPARE_LIVE_DATA' on the `sdata' to where compacted strings to moved to. (pin_string): Call `ASAN_PREPARE_DEAD_SDATA' on `old_sdata'. (make_float): Poison float blocks on allocation, unpoisoning individual Lisp_Floats on allocation or removal from `float_free_list'. (sweep_floats): Unpoison float blocks before sweeping, poison dead/unmarked floats. (free_cons): Poison `ptr'. (Fcons): Poison cons blocks on allocation, unpoisoning individual Lisp_Cons on allocation or removal from `cons_free_list'. (sweep_conses): Poison dead/unmarked conses. (setup_free_list): Poison vectors put on `vector_free_lists'. (allocate_vector_from_block): Unpoison vectors taken from the free list, poison excess vector bytes when vectors allocated from the free list are larger than requested. (sweep_vectors): Unpoison vector blocks before sweeping them. (Fmake_symbol): Poison symbol blocks on initial allocation, unpoisoning individual Lisp_Symbols on allocation or removal from `symbol_free_list'. (sweep_symbols): Unpoison symbol blocks before sweeping, poisoning dead/unmarked symbols. (live_string_holding, live_cons_holding, live_symbol_holding) (live_float_holding): When compiling with address sanitization and GC poisoning enabled, return NULL if the passed address is poisoned, or if the Lisp object it resides in is poisoned, avoiding a use-after-poison trigger if these functions are called on a pointer that might be referring to a now dead/swept object. * etc/DEBUG: Add information about enabling ASan memory poisoning.
* ; Fix typosStefan Kangas2022-12-161-1/+1
|
* ; Add cross-reference to string-equal docstringStefan Kangas2022-12-031-1/+3
| | | | | * lisp/subr.el (string-equal-ignore-case): * src/fns.c (Fstring_equal): Doc fix; add cross-references.
* Improve documentation of locale-specific string comparisonEli Zaretskii2022-11-231-1/+2
| | | | | | * doc/lispref/strings.texi (Text Comparison): * src/fns.c (Fstring_collate_equalp): Improve documentation of 'string-collate-equalp' and 'string-collate-lessp'. (Bug#59275)
* Improve the doc string of 'string-collate-lessp'Ihor Radchenko2022-11-221-2/+3
| | | | | | | * src/fns.c (Fstring_collate_lessp): Clarify that IGNORE-CASE argument might be ignored when the operating system does not implement string collation for the specified locale. (Bug#59275)
* Merge remote-tracking branch 'origin/feature/noverlay'Stefan Monnier2022-10-281-8/+7
|\
| * Merge 'master' into noverlayStefan Monnier2022-09-251-1330/+2277
| |\
| * | Provide a new tree data-structure for overlays.Andreas Politz2017-10-041-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/itree.c (interval_generator_narrow, interval_generator_next) (interval_node_init, interval_node_begin) (interval_node_end, interval_node_set_region) (interval_tree_create, interval_tree_clear) (interval_tree_init, interval_tree_destroy) (interval_tree_size, interval_tree_insert) (interval_tree_contains, interval_tree_remove) (interval_tree_validate, interval_tree_iter_start) (interval_tree_iter_finish, interval_tree_iter_next) (interval_tree_iter_ensure_space, interval_tree_max_height) (interval_tree_insert_gap, interval_tree_delete_gap) (interval_generator_create, interval_generator_reset) (interval_generator_ensure_space, interval_node_intersects) (interval_generator_next, interval_generator_narrow) (interval_generator_destroy, interval_stack_create) (interval_stack_destroy, interval_stack_clear) (interval_stack_ensure_space, interval_stack_push) (interval_stack_push_flagged, interval_stack_pop) (interval_tree_update_limit, interval_tree_inherit_offset) (interval_tree_propagate_limit, interval_tree_rotate_left) (interval_tree_rotate_right, interval_tree_insert_fix) (interval_tree_remove_fix, interval_tree_transplant) (interval_tree_subtree_min): New file and new functions. * src/itree.h: New file. * configure.ac: Create Makefile for manual overlay tests. * src/Makefile.in: Add itree.o target. * src/alloc.c (build_overlay, mark_overlay, mark_buffer) (sweep_misc, sweep_buffers): Adapt to new tree data-structure. * src/buffer.c (overlays_in, overlays_at): Remove unused arguments prev_ptr and change_req, adapt to new data-structure and reuse code. (copy_overlays, drop_overlays, delete_all_overlays) (reset_buffer, kill-buffer, buffer-swap-text, next_overlay_change) (previous_overlay_change, mouse_face_overlay_overlaps) (disable_line_numbers_overlay_at_eob, overlay_touches_p) (overlay_strings, adjust_overlays_for_insert) (adjust_overlays_for_delete, overlayp, make-overlay, move-overlay) (delete-overlay, overlay-start, overlay-end, overlay-buffer) (overlay-properties, overlays-at, overlays-in) (next-overlay-change, previous-overlay-change, overlay-put) (overlay-get, report_overlay_modification, evaporate_overlays) (init_buffer_once): Adapt to changes and tree data-structure. (overlay-lists, overlay-recenter): Funtions are now obsolete, but kept anyway. (set_buffer_overlays_before, set_buffer_overlays_after) (recenter_overlay_lists,fix_start_end_in_overlays,fix_overlays_before) (unchain_overlay,): Removed functions of the old list data-structure. (swap_buffer_overlays, make_sortvec_item): New functions. (sort_overlays): Adapt to changes and tree data-structure. (sortvec): Moved to buffer.h . (make_lispy_interval_node, overlay_tree, overlay-tree) [ITREE_DEBUG]: New debugging functions. * src/buffer.h (overlays_before, overlays_after): Removed struct member of the list data-structure. (overlays): Added tree struct member. (sortvec): Moved here from buffer.c . (GET_OVERLAYS_AT): Adapt to changes. (set_buffer_intervals, OVERLAY_START, OVERLAY_END, OVERLAY_PLIST): Adapt to tree data-structure. (OVERLAY_POSITION): Removed macro of the list data-structure. (OVERLAY_REAR_ADVANCE_P, OVERLAY_FRONT_ADVANCE_P): New macros. (overlay_start, overlay_end) (set_overlay_region, maybe_alloc_buffer_overlays) (free_buffer_overlays, add_buffer_overlay) (remove_buffer_overlay, buffer_overlay_iter_start) (buffer_overlay_iter_next, buffer_overlay_iter_finish) (buffer_overlay_iter_narrow): New functions. (compare_overlays, make_sortvec_item): Export functions. * src/editfns.c (overlays_around): Reuse overlays_in. (get-pos-property): Adapt to tree data-structure. (transpose-regions): Remove call to deleted function. * src/fileio.c: (insert-file-contents): Remove references to deleted struct member. * src/fns.c (internal_equal): Adapt to tree data-structure. * src/indent.c (check_display_width): Adapt to tree data-structure. (skip_invisible): Remove call to deleted function. * src/insdel.c (adjust_markers_for_insert): Remove calls to deleted functions. * src/intervals.c (adjust_for_invis_intang): Adapt to tree data-structure. * src/keyboard.c (adjust_point_for_property): Adapt to tree data-structure. * src/lisp.h (Lisp_Overlay): Modified struct layout. * src/print.c (temp_output_buffer_setup, print_object): Adapt to tree data-structure. * src/textprop.c (get_char_property_and_overlay): Adapt to tree data-structure. Take advantage of the new data-structure. * src/window.h (overlay_matches_window): New function. * src/xdisp.h (next_overlay_change): Removed function. Use next-overlay-change, which does not use xmalloc anymore. (handle_single_display_spec, load_overlay_strings) (back_to_previous_visible_line_start, note_mouse_highlight): Adapt to tree data-structure. (move_it_to, display_line): Remove calls to deleted functions. * src/xfaces.c (face_at_buffer_position): Adapt to changes and tree data-structure. * test/src/buffer-tests.el: Many tests regarding overlays added. * test/manual/noverlay/itree-tests.c: New file with tests of the tree data-structure on the C level. * test/manual/noverlay/Makefile.in: New file. * test/manual/noverlay/check-sanitize.sh: New file. * test/manual/noverlay/emacs-compat.h: New file. * test/manual/noverlay/.gitignore: New file. * test/manual/noverlay/overlay-perf.el: New file providing performance tests. * test/manual/noverlay/many-errors.h: New file.
* | | Ignore non-base64 junk when decoding MIMEAndreas Schwab2022-10-251-18/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/fns.c (Fbase64_decode_region): Add optional argument IGNORE-INVALID and pass down to base64_decode_1. (Fbase64_decode_string): Likewise. (base64_decode_1): Add argument IGNORE_INVALID. * doc/lispref/text.texi (Base 64): Document them. * lisp/gnus/mm-bodies.el (mm-decode-content-transfer-encoding): Ignore any junk when decoding base64.
* | | Audit some plist uses with new predicate argumentBasil L. Contovounesios2022-10-221-44/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * doc/lispref/lists.texi (Plist Access): Improve description of default predicate. * lisp/emacs-lisp/cl-extra.el (cl-getf, cl--set-getf): Assume plist-member always returns a cons. * lisp/emacs-lisp/gv.el (plist-get): Support new optional predicate argument (bug#47425#91). * lisp/emacs-lisp/map.el: Bump minor version. (map--dispatch): Remove now that bug#58563 is fixed. Break two remaining uses out into corresponding cl-defmethods. (map--plist-p): Add docstring. (map--plist-has-predicate, map--plist-member-1, map--plist-member) (map--plist-put-1, map--plist-put): New definitions for supporting predicate argument backward compatibly. (map-elt): Fix generalized variable getter under a predicate (bug#58531). Use predicate when given a plist. (map-put): Avoid gratuitous warnings when called without the hidden predicate argument. Improve obsoletion message. (map-put!): Use predicate when given a plist. (map-contains-key): Ditto. Declare forgotten advertised-calling-convention (bug#58531#19). (map--put): Group definition in file together with that of map-put!. * lisp/files-x.el (connection-local-normalize-criteria): Simplify using mapcan + plist-get. * lisp/net/eudc.el (eudc--plist-member): New convenience function. (eudc-plist-member, eudc-plist-get, eudc-lax-plist-get): Use it instead of open-coding plist-member. * src/fns.c (Fplist_get, plist_get, Fplist_put, plist_put): Pass the plist element as the first argument to the predicate, for consistency with assoc + alist-get. (Fplist_member, plist_member): Move from widget to plist section. Open-code the EQ case in plist_member, and call it from Fplist_member in that case, rather than the other way around. * test/lisp/apropos-tests.el (apropos-tests-format-plist): Avoid polluting obarray. * test/lisp/emacs-lisp/cl-extra-tests.el (cl-getf): Extend test with generalized variables, degenerate plists, and improper lists. * test/lisp/emacs-lisp/gv-tests.el: Byte-compile file; in the meantime bug#24402 seems to have been fixed or worked around. (gv-setter-edebug): Inhibit printing messages. (gv-plist-get): Avoid modifying constant literals. Also test with a predicate argument. * test/lisp/emacs-lisp/map-tests.el (with-maps-do): Simplify docstring. (test-map-elt-testfn): Rename... (test-map-elt-testfn-alist): ...to this. Also test with a predicate argument. (test-map-elt-testfn-plist, test-map-elt-gv, test-map-elt-signature) (test-map-put!-plist, test-map-put!-signature) (test-map-contains-key-signature, test-map-plist-member) (test-map-plist-put): New tests. (test-map-contains-key-testfn): Also test with a predicate argument. (test-map-setf-alist-overwrite-key, test-map-setf-plist-insert-key) (test-map-setf-plist-overwrite-key): Avoid modifying constant literals. (test-hash-table-setf-insert-key) (test-hash-table-setf-overwrite-key): Fix indentation. (test-setf-map-with-function): Make test more precise. * test/lisp/net/eudc-tests.el: New file. * test/lisp/subr-tests.el (test-plistp): Extend test with circular list. * test/src/fns-tests.el (test-cycle-equal, test-cycle-nconc): Move from plist section to circular list section. (plist-put/odd-number-of-elements): Avoid modifying constant literals. (plist-member/improper-list): Simplify. (test-plist): Move to plist section. Also test with a predicate argument.
* | | ; * src/fns.c (HAVE_FAST_UNALIGNED_ACCESS): run faster on mainframesMattias Engdegård2022-10-111-1/+2
| | |
* | | Restrict string-lessp vectorisation to safe architecturesMattias Engdegård2022-10-081-10/+30
| | | | | | | | | | | | | | | | | | * src/fns.c (HAVE_FAST_UNALIGNED_ACCESS): New. (Fstring_lessp): Only use word operations where safe, because string data from purespace may be unaligned.
* | | Speed up string-lessp for multibyte stringsMattias Engdegård2022-10-071-12/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Improve comparison speed when both arguments are multibyte strings, at least one of them containing a non-ASCII character. (All-ASCII multibyte strings are already fast.) The speed-up is about 2× for strings of 10 chars, 10× for strings of 100 chars. * src/fns.c (Fstring_lessp): Quickly skip the common prefix by comparing words.
* | | Speed up string-lessp furtherMattias Engdegård2022-09-301-13/+43
| | | | | | | | | | | | | | | | | | * src/fns.c (Fstring_lessp): Use the memcmp fast path for ASCII-only multibyte strings as well. Specialise loops on argument multibyteness.
* | | ; * src/fns.c (Fcopy_alist): More accurate error typeMattias Engdegård2022-09-251-1/+1
| | |
* | | Don't crash in copy-alist with non-list argumentMattias Engdegård2022-09-251-0/+1
| |/ |/| | | | | | | * src/fns.c (Fcopy_alist): Check argument type. * test/src/fns-tests.el (fns--copy-alist): New test.
* | `append' doc string clarificationLars Ingebrigtsen2022-09-241-1/+4
| | | | | | | | * src/fns.c (Fappend): Clarify whether arguments are copied.
* | mapconcat fast path with `identity` function argumentMattias Engdegård2022-09-151-3/+25
| | | | | | | | | | | | | | | | | | This makes (mapconcat #'identity SEQ) slightly faster than (apply #'concat SEQ), which used to be much faster. Notably, `string-join` benefits from this change as it uses mapconcat. * src/fns.c (Fmapconcat): Speed up execution when the function argument is `identity`.
* | Better `take` and `ntake` bignum argument handlingMattias Engdegård2022-09-011-14/+20
| | | | | | | | | | | | * src/fns.c (Ftake, Fntake): Treat positive bignum arguments as most-positive-fixnum which results in better error checking of improper lists.
* | Accept bignum arguments in `take` and `ntake`Mattias Engdegård2022-08-301-2/+18
| | | | | | | | | | | | * src/fns.c (Ftake, Fntake): Accept any integer as first argument, for completeness. * test/src/fns-tests.el (fns--take-ntake): Add test cases.
* | Clarify `take` and `ntake` documentation (bug#56521)Mattias Engdegård2022-07-181-2/+3
| | | | | | | | | | * doc/lispref/lists.texi (List Elements): Describe `ntake` better. * src/fns.c (Ftake, Fntake): Rephrase doc strings.
* | Add `take` and `ntake` (bug#56521)Mattias Engdegård2022-07-171-0/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | These are useful list primitives, complementary to `nthcdr`. * src/fns.c (Ftake, Fntake): New. (syms_of_fns): Defsubr them. * doc/lispref/lists.texi (List Elements): * lisp/emacs-lisp/shortdoc.el (list): Document. * lisp/emacs-lisp/byte-opt.el (side-effect-free-fns, pure-fns): Declare `take` pure and side-effect-free. * test/src/fns-tests.el (fns-tests--take-ref, fns--take-ntake): New test. * etc/NEWS: Announce.
* | Allow commands that call `yes-or-no-p' to be repeatable againLars Ingebrigtsen2022-07-111-0/+5
| | | | | | | | | | | | | | * lisp/subr.el (y-or-n-p): Enable commands that call this function to be repeatable (bug#45999). This stopped working after this function started using read-from-minibuffer. * src/fns.c (Fyes_or_no_p): Ditto.
* | Simplify str_to_multibyte and related codeMattias Engdegård2022-07-111-36/+14
| | | | | | | | | | | | | | | | | | | | | | * src/character.h (str_to_multibyte): * src/character.c (str_to_multibyte): Remove `nbytes` argument; return it instead. Copy forwards. * src/fns.c (concat_to_string, Fstring_make_multibyte): Use str_to_multibyte. (string_make_multibyte): Remove. (string_to_multibyte): * src/print.c (print_string): Adapt calls.
* | Simplify and speed up string-to-multibyteMattias Engdegård2022-07-111-16/+7
| | | | | | | | | | | | | | | | | | | | | | | | * src/character.h (str_to_multibyte): * src/character.c (str_to_multibyte): Change signature and simplify; the conversion is no longer done in-place. * src/fns.c (string_to_multibyte): Drop temporary buffer and memcpy; adapt to new str_to_multibyte signature. * src/print.c (print_string): Drop memcpy; adapt call to str_to_multibyte. * test/src/fns-tests.el (fns--string-to-unibyte): Rename to... (fns--string-to-unibyte-multibyte): ... this and strengthen, so that the test covers string-to-multibyte reasonably well.
* | Speed up string-to-unibyteMattias Engdegård2022-07-101-10/+15
| | | | | | | | | | | | | | | | * src/character.h (str_to_unibyte): * src/character.c (str_to_unibyte): Remove. * src/fns.c (Fstring_to_unibyte): Ditch the call to str_to_unibyte and the unnecessary heap allocation. Write new, faster code. * test/src/fns-tests.el (fns--string-to-unibyte): New test.
* | Remove unused member of internal structMattias Engdegård2022-07-081-2/+0
| | | | | | | | * src/fns.c (struct textprop_rec, concat_to_string): Remove `from`.
* | Faster append and vconcatMattias Engdegård2022-07-071-86/+139
| | | | | | | | | | | | | | | | | | | | | | | | By separating the code paths for append and vconcat, each becomes simpler and faster. * src/fns.c (concat_strings): Rename to... (concat_to_string): ...this. (concat): Split into concat_to_list and concat_to_vector. (concat_to_list, concat_to_vector): New, specialised and streamlined from earlier combined code. (concat2, concat3, Fappend, Fconcat, Fvconcat): Adjust calls.
* | Merge from origin/emacs-28Stefan Kangas2022-07-021-1/+1
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1c3d107cb5 Fix "C-u C-x =" for SPC 7e33618bbc ; * src/fns.c (Frequire): Fix a typo in the doc string. (... 6908309827 Doc fixes: don't refer to some obsolete items dc3cb749f3 Remove obsolete cust-print from elisp index 9ffbbddf8e * admin/make-tarball.txt: Minor clarifications. f5421104e9 Fix external image conversion on MS-Windows 6f22631a63 * doc/emacs/buffers.texi (Indirect Buffers): Mention modif... # Conflicts: # doc/emacs/buffers.texi # lisp/emacs-lisp/nadvice.el # lisp/image/image-converter.el