aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Actually improve detection of long linesGregory Heytings2022-12-111-1/+0
| | | | | | | | | | | * src/xdisp.c (redisplay_window): Update condition. * src/xdisp.c (mark_window_display_accurate_1): * src/pdumper.c (dump_buffer): * src/buffer.h (BUF_CHARS_UNCHANGED_MODIFIED): (struct buffer_text): * src/buffer.c (Fget_buffer_create): Revert 1c837c42c2, which was misguided.
* Merge branch 'feature/improved-locked-narrowing'Gregory Heytings2022-11-271-1/+36
|\
| * Docstring improvementsGregory Heytings2022-11-261-1/+3
| | | | | | | | | | | | | | * src/xdisp.c (syms_of_xdisp): * src/keyboard.c (syms_of_keyboard): * src/buffer.c (syms_of_buffer): Docstring improvements.
| * Improve locked narrowing around low-level hooks.Gregory Heytings2022-11-261-1/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/buffer.c (syms_of_buffer): Two new variables, 'long-line-locked-narrowing-region-size' and 'long-line-locked-narrowing-bol-search-limit', to make the locked narrowing around low-level hooks configurable. Increase the default value of 'long-line-threshold'. After carefully considering the (few) bug reports about long line optimizations, I concluded that the previous default value was too low. * src/xdisp.c (get_locked_narrowing_begv) (get_locked_narrowing_zv): Two new functions. (handle_fontified_prop, reseat): Use them. * src/keyboard.c (safe_run_hooks_maybe_narrowed): Use them. * src/dispextern.h (struct it): Add two new fields to store the values returned by these functions. Make them externally visible. * src/editfns.c: (Fsave_restriction): Update docstring.
* | Merge remote-tracking branch 'savannah/master' into feature/tree-sitterYuan Fu2022-11-211-1043/+485
|\ \ | |/
| * itree: Make sure a deleted overlay has NULL pointer fieldsStefan Monnier2022-11-181-10/+7
| | | | | | | | | | | | | | * src/buffer.c (delete_all_overlays): Use POST_ORDER to set the node's pointers to NULL, as god intended. * src/itree.c (itree_insert_node): Uncomment the assertion accordingly.
| * itree.c: Get rid of the old iterator codescratch/noverlayStefan Monnier2022-11-171-10/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Only use the new iterator which relies on a fixed size (and small) state in the iterator. This makes non-local exits safe within ITREE_FOREACH loops. * src/itree.c (make_nav, nav_nodeptr, nav_flag, itree_stack_clear) (itree_stack_push_flagged): Delete functions. (nodeptr_and_flag): Delete type. (struct itree_stack): Make the array hold plain pointers instead. (itree_stack_push): Inline the former code of `itree_stack_push_flagged`. (itree_stack_pop): Change return type. (itree_contains): Don't call `ITREE_FOREACH_ABORT` any more. (itree_insert_gap): Simplify access to the stack of nodes. (itree_delete_gap, itree_insert_gap): Adjust code to new return type of `itree_stack_pop`. (itree_iterator_finish): Delete function. (itree_iterator_start): Don't setup the `stack` field any more. (itree_iterator_next): Delete function. (itree_iter_next): Rename to `itree_iterator_next` and make it non-static. (itree_iterator_narrow): Don't check the `running` flag any more. * src/itree.h (itree_iterator_finish): Remove declaration. (struct itree_iterator): Remove the `stack` and `running` fields. (ITREE_FOREACH_ABORT): Delete macro. (ITREE_FOREACH): Don't call `itree_iterator_finish` any more. * src/xdisp.c (strings_with_newlines): * src/buffer.c (overlays_in, next_overlay_change, overlay_touches_p): Don't call `ITREE_FOREACH_ABORT` any more.
| * ; * src/buffer.c (Foverlays_in): Doc fix. (Bug#59067)Eli Zaretskii2022-11-101-1/+3
| |
| * buffer.c: evaporate overlays in all indirect buffersStefan Monnier2022-11-051-22/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes bug#58928. The patch works by moving the `evaporate_overlays` check closer to `itree_delete_gap`. * src/buffer.c (adjust_overlays_for_delete_in_buffer): New function, integrating the functionality of `evaporate_overlays`. (adjust_overlays_for_delete): Use it. (evaporate_overlays): Delete function. * src/buffer.h (evaporate_overlays): Delete declaration. * src/insdel.c (adjust_markers_for_replace): Minor optimization. (adjust_after_replace, replace_range, replace_range_2, del_range_2): Don't call `evaporate_overlays`. * test/src/buffer-tests.el (buffer-tests--overlays-indirect-evaporate): Remove the `:expected-result :failed` attribute.
| * Minor tweaks to the fix for `insert-before-markers' overlay fixMatt Armstrong2022-11-051-1/+2
| | | | | | | | | | | | | | | | (bug#58928) * src/buffer.c (adjust_overlays_for_insert): wrap to less than 80 chars. * src/itree.c: document BEFORE_MARKERS.
| * Pacify gcc -Wanalyzer-null-dereferencePaul Eggert2022-11-041-1/+1
| | | | | | | | | | | | | | This is for gcc 12.2.1 20220819 (Red Hat 12.2.1-2) x86-64 when Emacs is configured with --enable-gcc-warnings. * src/buffer.c (Fmove_overlay): Prefer BASE_EQ to EQ in a place where they’re equivalent because the only symbol allowed here is nil.
| * itree: Reproduce markers's behavior more faithfully (bug#58928)Stefan Monnier2022-11-031-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The most obvious problem was the lack of support for `insert-before-markers`, but the behavior was also different in a few other cases. * src/itree.h (itree_insert_gap): * src/itree.c (itree_insert_gap): Add `before_markers` arg. * src/lisp.h (adjust_overlays_for_insert): * src/buffer.c (adjust_overlays_for_insert): Add `before_markers` arg. * src/insdel.c (adjust_markers_for_replace, adjust_markers_for_insert) (adjust_markers_for_delete): Adjust overlays directly from here. (insert_1_both, insert_from_string_1, insert_from_gap) (insert_from_buffer_1, adjust_after_replace, replace_range) (replace_range_2, del_range_2): Don't adjust overlays explicitly here any more. * test/src/buffer-tests.el (test-overlay-insert-before-markers-empty) (test-overlay-insert-before-markers-non-empty): New tests.
| * Port interval trees to --enable-checking=structsBasil L. Contovounesios2022-11-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some names under the interval_* namespace were renamed under the itree_* namespace in commits: 0. f421b58db5 of 2022-10-19 "Prefix all itree.h type names with itree_". 1. 37a1145410 of 2022-10-19 "Rename all exported itree.h functions with the itree_ prefix" Further, some values still referenced in commentary were removed in commits: 2. 258e618364 of 2022-10-17 "Delete the itree_null sentinel node, use NULL everywhere." 3. 2c4a3910b3 of 2022-10-02 "itree: Use a single iterator object" * src/emacs.c (main): Allocate global itree iterator once and for all. * src/alloc.c (mark_overlay): * src/buffer.c (set_overlays_multibyte): * src/itree.c (itree_destroy): Update commentary. (interval_stack_ensure_space, itree_insert_gap): Prefer unsigned-to-unsigned comparisons over signed-to-unsigned. (interval_stack_push_flagged, interval_tree_insert) (interval_tree_contains, itree_iterator_start) (itree_iterator_finish, itree_iterator_next, itree_iterator_narrow): Improve assertions. (itree_init): Rename... (init_itree): ...to this, for consistency with other global init functions. (itree_create): Stop leaking a global iterator allocation on each call. (interval_tree_init): Complete renames of interval_tree -> itree_tree and interval_tree_clear -> itree_clear. (interval_tree_remove_fix): Fix indentation. * src/itree.h: Declare init_itree. (ITREE_FOREACH): Fix typo in commentary. * src/pdumper.c [CHECK_STRUCTS] (dump_interval_node): Use the correct name in the HASH condition and #error message. (dump_overlay, dump_buffer): Update HASH (bug#58975).
| * src/buffer.c: Fix interaction between overlays & indirect buffers (bug#58928)Stefan Monnier2022-11-011-8/+26
| | | | | | | | | | | | | | | | | | | | * src/buffer.c (adjust_overlays_for_insert) (adjust_overlays_for_delete): Repeat for all buffers sharing the same text. * src/itree.c (itree_insert_gap, itree_delete_gap): Allow an empty tree. * test/src/buffer-tests.el (buffer-tests--overlays-indirect-bug58928): New test.
| * Merge remote-tracking branch 'origin/feature/noverlay'Stefan Monnier2022-10-281-1040/+465
| |\
| | * Fix a narrow-to-region vs. overlays-at bugMatt Armstrong2022-10-211-10/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See bug#58703. * src/buffer.c (overlays_in): Add a new TRAILING arg expressing the behavior wanted by `overlays-at', namely to include all overlays beginning at the POS passed to `overlays-at', even if POS is the end of the narrowed region. Pass true and the search range is extended to ZV+1 if END is greater than ZV, just as is done for EMPTY. (overlays_at): Pass 'true' for the new trailing arg. At present this is the only caller passing 'true'. (mouse_face_overlay_overlaps): Pass 'false' for the new trailing arg. (disable_line_numbers_overlay_at_eob): ditto. (Foverlays_in): ditto. * src/editfns.c (overlays_around): ditto. * test/src/buffer-tests.el (sorted-overlays): Add a spot test for this.
| | * Fix handling of overlays that begin at END in 'overlays_in'Matt Armstrong2022-10-211-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When passed EMPTY, 'overlays_in' should return empty overlays at END. It was doing so, but it was also returning any other overlay that happened to begin at END. bug#58672 * src/buffer.c (overlays_in): Don't return overlays at END unless they are empty overlays. (disable_line_numbers_overlay_at_eob): Pass 'false' instead of 'NULL' for the bool 'empty' arg. * test/src/buffer-tests.el (sorted-overlays-in): New helper function. (test-overlays-in-empty-range): New test exhaustively covering these edge conditions. (test-overlays-in-empty-range-bug58672): Simple test for one case.
| | * Rename all exported itree.h functions with the itree_ prefixMatt Armstrong2022-10-191-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For the most part, I replaced the interval_tree_ prefix with itree_, interval_node_ with itree_node_, etc. * src/alloc.c: Rename everywhere as appropriate. * src/alloc.c: ditto. * src/buffer.c: ditto. * src/buffer.h: ditto. * src/itree.c: ditto. * src/itree.h: ditto.
| | * Prefix all itree.h type names with itree_Matt Armstrong2022-10-191-20/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rename interval_node -> itree_node, interval_tree -> itree_tree, interval_tree_order -> itree_order. * src/alloc.c: Renames. * src/buffer.c: ditto. * src/itree.c: ditto. * src/itree.h: ditto. * src/lisp.h: ditto. * src/pdumper.h: ditto. * src/textprop.h: ditto. * src/xdisp.h: ditto.
| | * ; * src/buffer.c (set_overlay_region): remove unused function.Matt Armstrong2022-10-191-9/+0
| | |
| | * Tighten up handling of `otick`Stefan Monnier2022-10-091-16/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move args between `build_overlay` and `add_buffer_overlay`, to try and keep buffer positions together with their buffer. Be more strict in the `otick` values passed to `interval_tree_insert`. Move a few things around to try and reduce dependencies through `.h` files. Fix a thinko bug in `check_tree`. * src/alloc.c (build_overlay): Remove `begin` and `end` args. * src/buffer.c (add_buffer_overlay): Move from `buffer.h`. Add `begin` and `end` args. (copy_overlays): Adjust accordingly. (Fmake_overlay): Use BUF_BEG and BUF_Z; adjust call to `build_overlay` and `add_buffer_overlay`. (Fmove_overlay): Use BUF_BEG and BUF_Z; Use the new `begin` and `end` args of `add_buffer_overlay` so we don't need to use `interval_node_set_region` when moving to a new buffer. (remove_buffer_overlay, set_overlay_region): Move from `buffer.h`. * src/buffer.h (set_overlay_region, add_buffer_overlay) (remove_buffer_overlay): Move to `buffer.c`. (build_overlay): Move from `lisp.h`. (maybe_alloc_buffer_overlays): Delete function (inline into its only caller). * src/itree.c (interval_tree_insert): Move declaration `from buffer.h`. (check_tree): Fix initial offset in call to `recurse_check_tree`. Remove redundant check of the `limit` value. (interval_node_init): Remove `begin` and `end` args. (interval_tree_insert): Mark it as static. Assert that the new node's `otick` should already be uptodate and its new parent as well. (itree_insert_node): New function. (interval_tree_insert_gap): Assert the otick of the removed+added nodes were uptodate and mark them as uptodate again after adjusting their positions. (interval_tree_inherit_offset): Check that the parent is at least as uptodate as the child. * src/lisp.h (build_overlay): Move to `buffer.h`. * src/itree.h (interval_node_init): Adjust accordingly. (interval_tree_insert): Remove declaration. (itree_insert_node): New declaration.
| | * Merge remote-tracking branch 'origin/feature/noverlay' into noverlayStefan Monnier2022-10-021-6/+6
| | |\
| | | * Make it compile with ITREE_DEBUG definedGerd Möllmann2022-10-011-6/+6
| | | | | | | | | | | | | | | | | | | | * src/buffer.c (make_lispy_interval_node): Use make_fixnum. (overlay_tree): Use ITREE_NULL.
| | * | New ITREE_FOREACH macroStefan Monnier2022-10-021-56/+41
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/itree.h (interval_tree_iter_start): Adjust type. (interval_tree_nodes): Delete declaration. (ITREE_FOREACH, ITREE_FOREACH_ABORT, ITREE_FOREACH_NARROW): New macros. * src/itree.c (interval_tree_contains, interval_tree_insert_gap): Use the new ITREE_FOREACH macro. (interval_tree_nodes): Delete function. (interval_tree_iter_start): Return the iterator. (interval_generator_next, interval_tree_destroy): Don't accept a NULL arg any more. * src/xdisp.c (load_overlay_strings, strings_with_newlines): * src/textprop.c (get_char_property_and_overlay): * src/buffer.c (copy_overlays, delete_all_overlays) (set_overlays_multibyte, swap_buffer_overlays, overlays_in) (next_overlay_change, previous_overlay_change, overlay_touches_p) (overlay_strings, Foverlay_lists, report_overlay_modification) (evaporate_overlays): Use the new ITREE_FOREACH macro. * src/buffer.h (buffer_overlay_iter_start1) (buffer_overlay_iter_start, buffer_overlay_iter_next) (buffer_overlay_iter_finish, buffer_overlay_iter_narrow): Delete declarations.
| | * itree.c: Improve division between tree and iteratorStefan Monnier2022-09-301-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/buffer.c (delete_all_overlays): Add comment. * src/itree.c (struct interval_generator): New fields `running`, `file`, and `line` moved from `interval_tree`. (interval_stack_push_flagged): Adjust comment to resolve a FIXME. (interval_tree_clear): Replace assignment with an a (interval_tree_iter_next): Delete function. (interval_tree_clear): Don't set `iter_running` here any more. (interval_generator_create): Set it here instead. (interval_tree_iter_start): Fetch `iter` once and for all. (interval_generator_narrow): Mark it as non-static. (interval_tree_iter_next, interval_tree_iter_narrow): Delete functions. Inline their old bodies in the callers. (interval_tree_iter_finish): Take the iter rather than the whole tree. Adjust all callers. (interval_generator_next): Move `running `assertion here from `interval_tree_iter_next`. * src/buffer.h: Adjust accordingly. * src/itree.h (struct interval_tree): Remove fields `iter_running`, `file`, and `line`, moved to `interval_generator`. (interval_generator_narrow): Replace `interval_tree_iter_narrow`.
| | * free_buffer_overlays: Move nearer to its sole callerStefan Monnier2022-09-291-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | * src/buffer.c (free_buffer_overlays): Move from `buffer.h`. * src/buffer.h (free_buffer_overlays): Move to `buffer.c`. * src/itree.c (interval_tree_iter_narrow, interval_tree_iter_finish) (interval_tree_iter_next): Prefer `eassert`.
| | * itree.[ch]: Add sanity checks, comments, and minor tweaksStefan Monnier2022-09-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/alloc.c (mark_overlay): Add sanity check. * src/buffer.c (next_overlay_change, previous_overlay_change): Tweak code to keep the same vars for the bounds. * src/itree.c (interval_tree_clear, interval_tree_insert) (interval_tree_remove, interval_tree_insert_fix, interval_tree_remove_fix): Adjust to the `color` -> `red` change. (interval_tree_clear): Prefer `true/false` for booleans. (interval_generator_create): Use an actual `interval_tree_order` value rather than 0. (interval_generator_next): Simplify a tiny bit. Add comment. (interval_generator_narrow): Add sanity check. * src/itree.h (struct interval_node): Replace `color` field with boolean `red` field. (enum interval_tree_order): Remove unused `ITREE_DEFLT_ORDER` value. * src/pdumper.c (dump_interval_node): Adjust to the `color` -> `red` change.
| | * * src/buffer.c (overlays_in): Fix confusion Z-vs-ZVscratch/noverlay-wipStefan Monnier2022-09-251-2/+2
| | | | | | | | | | | | This fixes test failures in `test-overlays-in-2` and `test-remove-overlays`.
| | * Merge 'master' into noverlayStefan Monnier2022-09-251-477/+701
| | |\ | | |/ | |/|
| | * Remove redundant checks for the empty overlay treeAndreas Politz2017-10-091-46/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/alloc.c (mark_buffer): Remove b->overlays check. * src/buffer.c (copy_overlays): Also. * src/buffer.c (swap_buffer_overlays, overlays_in): Also. (next_overlay_change, previous_overlay_change): Also. (overlay_touches_p, Foverlay_lists): Also. (evaporate_overlays): Also. * src/xdisp.c (load_overlay_strings): Also.
| | * Adapt overlays when multibyteness changesAndreas Politz2017-10-061-0/+52
| | | | | | | | | | | | | | | | | | * src/buffer.c (set_overlays_multibyte): New function. (set-buffer-multibyte): Use function.
| | * Provide a new tree data-structure for overlays.Andreas Politz2017-10-041-1052/+406
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | | Merge remote-tracking branch 'origin/master' into feature/tree-sitterYuan Fu2022-08-291-32/+80
|\ \ \ | |/ /
| * | Improve detection of long lines.Gregory Heytings2022-08-231-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/buffer.h (struct buffer_text): New field. (BUF_CHARS_UNCHANGED_MODIFIED, CHARS_UNCHANGED_MODIFIED): New macros. * src/buffer.c (Fget_buffer_create): Initialize the new field. * src/xdisp.c (mark_window_display_accurate_1): Set the new field. (redisplay_window): Use it, together with CHARS_MODIFF, instead of MODIFF and UNCHANGED_MODIFIED to decide whether to check for long lines. * src/pdumper.c (dump_buffer): Dump the new field.
| * | * src/buffer.c (Frename_buffer): Fix bug#56693Stefan Monnier2022-08-161-2/+4
| | |
| * | Work around Bug#57211Paul Eggert2022-08-141-1/+2
| | | | | | | | | | | | * src/buffer.c (Fgenerate_new_buffer_name): Allocate a bigger buffer.
| * | Speed up display of long lines under 'truncate-lines'Eli Zaretskii2022-08-131-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/xdisp.c (partial_line_height): Return zero for long and truncated lines. (fast_move_it_horizontally): New function. (hscroll_window_tree, display_line): Use 'fast_move_it_horizontally' in preference to 'move_it_in_display_line_to', when dealing with long and truncated lines. (redisplay_internal): Optimize "optimization 3" for long and truncated lines. * src/buffer.c (syms_of_buffer) <large-hscroll-threshold>: New variable. * etc/NEWS: Announce 'large-hscroll-threshold'.
| * | Fix forgotten initialization for long line optimizations.Gregory Heytings2022-08-011-1/+4
| | | | | | | | | | | | | | | | | | | | | * src/xdisp.c (init_iterator): Initialize the 'narrowed_begv' field. * src/buffer.c (syms_of_buffer): Docstring clarification.
| * | ; Clarify doc string of 'long-line-threshold'Eli Zaretskii2022-07-211-5/+7
| | | | | | | | | | | | | | | * src/buffer.c (syms_of_buffer) <long-line-threshold>: Clarify the doc string.
| * | Merge branch 'feature/fix-the-long-lines-display-bug'Gregory Heytings2022-07-211-8/+18
| |\ \
| | * | Further tweaks to long lines handling.Gregory Heytings2022-07-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/xdisp.c (redisplay_window): Increase the threshold above which long lines detection is performed in the buffer. This should avoid triggering that detection for most simple editing operations. * src/lisp.h (modiff_incr): Explain why the counter is incremented logarithmically. * src/buffer.h (struct buffer_text): Adapt the comment about the 'modiff' field accordingly. * src/buffer.c (modify_overlay): Increase the counter by 1 instead of the size of the buffer section on which the overlay is placed. * etc/NEWS: Small improvement.
| | * | Simplified and improved heuristic for long lines detection.Gregory Heytings2022-07-191-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/lisp.h (modiff_incr): Add a parameter to 'modiff_incr' to record the extent of the modification. * src/insdel.c (insert_1_both, insert_from_string_1, insert_from_gap, insert_from_buffer_1, adjust_after_replace, replace_range, replace_range_2, del_range_2, modify_text): Add an argument to each call to 'modiff_incr'. * src/textprop.c (modify_text_properties): Add an argument to the call to 'modiff_incr'. * src/buffer.c (Frestore_buffer_modified_p, Fbuffer_swap_text, modify_overlay): Add an argument to each call to 'modiff_incr'. * src/xdisp.c (redisplay_window): Use the improved version of 'MODIFF' for the heuristic.
| | * | Revert commits 1ff69cc744 and 9a894206f6.Gregory Heytings2022-07-191-6/+0
| | | |
| | * | Improve the heuristic for long lines detection.Gregory Heytings2022-07-181-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/buffer.h (struct buffer_text): New 'unchanged_size' field. (BUF_UNCHANGED_SIZE): New macro to access the field. * src/buffer.c (Fget_buffer_create): Initialize the field. (Fbuffer_swap_text): Handle it. * src/xdisp.c (mark_window_display_accurate_1): Set the field. (redisplay_window): Use the field for long lines detection.
| | * | Improvements to long lines handling.Gregory Heytings2022-07-161-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/buffer.h (struct buffer): New field 'long_line_optimizations_p'. * src/buffer.c (syms_of_buffer): New variable 'long-line-threshold'. (reset_buffer): Initialize the 'long_line_optimizations_p' field. (Fbuffer_swap_text): Handle it. * src/xdisp.c (redisplay_window): Set 'long_line_optimizations_p' when a buffer contains long lines. (init_iterator): Use 'long_line_optimizations_p'. (get_narrowed_begv): Update. (SET_WITH_NARROWED_BEGV): New macro. (unwind_narrowed_begv): New internal function used by the new macro. (back_to_previous_line_start, get_visually_first_element, move_it_vertically_backward): Use the new macro. * src/search.c (find_newline1): Make it externally visible. * src/lisp.h: Make 'find_newline1' externally visible. * src/dispextern.h (struct it): Update comment. Remove the 'WITH_NARROWED_BEGV' macro. * etc/NEWS: Mention the 'long-line-threshold' variable.
| | * | Revert commit 38b3780f6e.Gregory Heytings2022-07-081-8/+1
| | | |
| | * | Actually fix the long lines display bug (bug#56393).Gregory Heytings2022-07-061-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/files.el (auto-narrow-mode): New minor mode. (auto-narrow-pre-command-function, auto-narrow-post-command-function): New auxiliary functions for the minor mode. (auto-narrow-display-length, auto-narrow-widen-automatically): New defcustoms for the minor mode. (auto-narrow--widen-automatically, auto-narrow--isearch-widen-automatically, auto-narrow--initialized): New internal variables for the minor mode. * src/buffer.h (struct buffer): New internal variable for the minor mode. (bset_auto_narrow__narrowing_state, BUFFER_AUTO_NARROWED_P): New auxiliary functions. * src/buffer.c (init_buffer_once, syms_of_buffer): New internal variable for the minor mode. Update the docstring of mode-line-format. * src/fileio.c (Finsert_file_contents): Detect whether the minor mode should be entered when the buffer is displayed. (syms_of_fileio): New defcustom for the minor mode. * src/keyboard.c (syms_of_keyboard): New hook functions for the minor mode. (command_loop_1): Execute the hook functions. * src/xdisp.c (redisplay_window): Enter the minor mode when the buffer is displayed. (decode_mode_spec): Indicate when the minor mode is active in the modeline. Indicate the buffer position relative to the whole buffer. (set_vertical_scroll_bar): Indicate the buffer position relative to the whole buffer. (syms_of_xdisp): Two new symbols. * lisp/isearch.el (isearch-widen-automatically): New defcustom. (isearch-search): Use the new defcustom. * lisp/bindings.el (mode-line-modes): Do not propertize the indication in the modeline when the new minor mode is active. * etc/NEWS: Announce the new minor mode, and remove the unobsoletion indication for 'longlines-mode'. * lisp/longlines.el: Reobsolete longlines-mode. * doc/emacs/display.texi (Auto-Narrowing): New section, describing the new minor mode. (Display): Entry for the new section. * doc/emacs/trouble.texi (Long Lines): Remove the section. (Lossage): Remove the entry for the Long Lines section. * doc/emacs/emacs.texi (Top): Remove the entry for the Long Lines section.
| * | | Merge from origin/emacs-28Stefan Kangas2022-07-191-1/+4
| |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 282dde887d ; Fix typo missed in previous change 62c47ffd5f ; * lisp/net/tramp-crypt.el: Improve commentary cba30431ff Merge branch 'emacs-28' of git.savannah.gnu.org:/srv/git/e... 8f9993bb3f ; * src/buffer.c (syms_of_buffer) <mode-line-format>: Doc ... fec4bb89f9 ; Fix typos (Bug#56550)
| | * | | ; * src/buffer.c (syms_of_buffer) <mode-line-format>: Doc fix.Eli Zaretskii2022-07-181-1/+4
| | | | |
| * | | | Fix buffer-stale-function fixLars Ingebrigtsen2022-07-121-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/buffer.c (Fmake_indirect_buffer): Kill the local buffer-stale-function variable instead of setting it buffer-locally to the default value. This should have the same effect, but is less confusing.