summaryrefslogtreecommitdiff
path: root/src/buffer.c
Commit message (Collapse)AuthorAge
* Disallow creation of circular variable alias chainsMattias Engdegård2023-04-14
| | | | | | | | | | | | | | | | | | | | | | | | | Make `defvaralias` signal an error upon attempts to create variable alias cycles. This detects errors earlier and makes the alias traversal during execution simpler and faster since no cycle detection is needed elsewhere. Now variable and function aliases are handled identically in these respects. * src/lisp.h (indirect_variable): Remove declaration. * src/data.c (indirect_variable): Remove. (Findirect_variable): Update doc string. Simplify alias resolution. (Fboundp, find_symbol_value, set_internal, default_value) (set_default_internal, Fmake_variable_buffer_local) (Fmake_local_variable, Fkill_local_variable, Flocal_variable_p) (Flocal_variable_if_set_p, Fvariable_binding_locus): * src/buffer.c (buffer_local_value): * src/eval.c (specbind): Simplify variable alias resolution. (Fdefvaralias): Update doc string. Check for cycles. * doc/lispref/variables.texi (Variable Aliases): Mention that `defvaralias` can signal `cyclic-variable-indirection` but `indirect-variable` cannot. * etc/NEWS: Announce the change. * test/src/eval-tests.el (eval-tests-defvaralias): New test.
* * src/buffer.c (mode-line-format): Reorder and reformat %-construct docsPhil Sainty2023-03-27
| | | | | | | | | The original formatting dates back to the earliest commits. It saved a few lines but was harder to follow. As windows are typically taller now than the terminals of the time, this reformatting now makes better sense for readabiity. See bug#57080. * doc/lispref/modes.texi: Order change for consistency. Add index.
* * src/buffer.c (mode-line-format): Document %o and %q constructsPhil Sainty2023-03-27
| | | | Missed from commit b0b02ca7f3e06d0f092df6f81babd1277bf93b0f.
* * src/buffer.c (mode-line-format): Remove docs for obsolete %t constructPhil Sainty2023-03-27
| | | | | | | | | | | | | | | This documentation had been previously removed in 1999 in [1] but was subsequently restored again in a different form in 2006 in [2] as the construct was still supported on some systems. However it looks like it hasn't done what that documentation indicated since [3] in 2011, and the final remnant of this functionality was removed in [4] in 2013; so it seems clear that it's no longer supported and shouldn't be documented now. [1] commit 08de62001945d4dd32a3d6af44da05804cb296d5 [2] commit dafbe726b89a36010f3f24bb1efe4ace0a5f7f0f [3] commit 05c652517317d10690aaf0a6aa0bc876382b9d82 [4] commit 8549f9e89bd9288c4c709d183a5bf8f07dbeed3d
* Rename with/without-narrowing to with/without-restrictionEli Zaretskii2023-02-13
| | | | | | | | | | | | | | | | | * doc/lispref/commands.texi: * doc/lispref/display.texi: * doc/lispref/positions.texi: * etc/NEWS: * lisp/subr.el: * src/buffer.c: * src/editfns.c: * src/keyboard.c: * src/xdisp.c: * test/src/buffer-tests.el: Rename with-narrowing and without-narrowing to with-restriction and without-restriction. Likewise with internal--with-narrowing and internal--without-narrowing. All callers and documentation changed.
* Update the documentation about labeled (locked) narrowingGregory Heytings2023-02-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/xdisp.c (syms_of_xdisp) <fontification-functions>: Update docstring. * src/keyboard.c (syms_of_keyboard) <pre-command-hook>: (syms_of_keyboard) <post-command-hook>: Update docstring. * src/editfns.c: (narrowing_locks): Explain why an alist is used instead of a buffer-local variable. (reset_outermost_narrowings): Point to recipes that demonstrate why it is necessary to restore the user narrowing bounds when redisplay starts. (Fwiden): Update docstring. (Fnarrow_to_region): Update docstring. (Finternal__lock_narrowing): Update docstring. (Finternal__unlock_narrowing): Update docstring. (Fsave_restriction): Update docstring. * src/buffer.c (syms_of_buffer) <long-line-optimizations-region-size>: Update docstring. (syms_of_buffer) <long-line-optimizations-bol-search-limit>: Update docstring. * lisp/subr.el (with-narrowing): Update docstring. (without-narrowing): Update docstring. * etc/NEWS: Mention the 'long-line-optimizations-region-size' and 'long-line-optimizations-bol-search-limit' options. Announce the 'with-narrowing' and 'without-narrowing' forms. * doc/lispref/positions.texi (Narrowing): Update the documentation of 'narrow-to-region', 'widen' and 'save-restriction'. Document the 'with-narrowing' and 'without-narrowing' special forms. * doc/lispref/display.texi (Auto Faces): Update the documentation. * doc/lispref/commands.texi (Command Overview): Document the fact that the buffer is narrowed around 'pre-command-hook' and 'post-command-hook' when the buffer text includes very long lines.
* Rename two long line optimizations variablesGregory Heytings2023-02-09
| | | | | | | | | | | * src/buffer.c (syms_of_buffer): Rename two variables. * src/xdisp.c (get_locked_narrowing_begv): (get_locked_narrowing_zv): (handle_fontified_prop): Use the new names. * src/keyboard.c (safe_run_hooks_maybe_narrowed): Use the new names.
* Improve documentation of 'header-line-indent-mode'Eli Zaretskii2023-02-03
| | | | | | | | | | | | | | | * doc/lispref/modes.texi (Header Lines): Rewrite the documentation of 'header-line-indent-mode' and its two variables. Fix the example. * doc/lispref/display.texi (Pixel Specification): More accurate description of what happens with :align-to in header-lines. Improve indexing. (Bug#61239) * src/buffer.c (syms_of_buffer) <header-line-format>: * lisp/display-line-numbers.el (header-line-indent) (header-line-indent-width, header-line-indent-mode): Doc fixes. * etc/NEWS: Enhance the announcement of 'header-line-indent-mode'.
* Fix buffer-list-update-hook for indirect buffersBasil L. Contovounesios2023-01-17
| | | | | | | | | | | | | | | | | | Fmake_indirect_buffer can be told whether to run buffer hooks since bug#49160, but until now it ran buffer-list-update-hook irrespective of this. * src/buffer.c (Fmake_indirect_buffer): Don't run buffer-list-update-hook when called with a non-nil INHIBIT-BUFFER-HOOKS argument. (run_buffer_list_update_hook): Don't special-case NULL argument, as no such callers remain. * test/src/buffer-tests.el (buffer-tests-inhibit-buffer-hooks-indirect): Test whether indirect buffer hooks are run regardless of whether base buffer hooks are inhibited. Check that all three buffer hooks, not just kill-buffer-query-functions, are inhibited.
* ; Add 2023 to copyright years.Eli Zaretskii2023-01-01
|
* ; Fix last changes in buffer.cEli Zaretskii2022-12-16
| | | | | * src/buffer.c (other_buffer_safely): Ensure Lisp Interaction mode in *scratch*. (Bug#60096)
* A better fix for bug#60096Eli Zaretskii2022-12-16
| | | | | | | | | | | * lisp/startup.el (initial-scratch-message): * lisp/simple.el (get-scratch-buffer-create): Revert last changes. * src/window.c (Fset_window_configuration): Force recalculation of Vwindow_list after restoring the windows. * src/buffer.c (other_buffer_safely): Make sure we always return a valid buffer, even if 'get-scratch-buffer-create' signals an error.
* Update the documentation of overlays (bug#59996)Eli Zaretskii2022-12-14
| | | | | | | | | | | | | | | | | * src/buffer.c (Foverlay_recenter, Foverlay_lists): Update the doc strings. * lisp/subr.el (copy-overlay): Update comment. * doc/lispref/internals.texi (Buffer Internals): Remove buffer fields relevant to the old implementation; add the new interval tree field. * doc/lispref/display.texi (Overlays, Managing Overlays): Update text to be consistent with the new implementation of overlays. (Managing Overlays): Remove documentation of 'overlay-recenter'. * etc/NEWS: Mention incompatible aspects of overlay reimplementation.
* Actually improve detection of long linesGregory Heytings2022-12-11
| | | | | | | | | | | * 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-27
|\
| * Docstring improvementsGregory Heytings2022-11-26
| | | | | | | | | | | | | | * 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-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-21
|\|
| * itree: Make sure a deleted overlay has NULL pointer fieldsStefan Monnier2022-11-18
| | | | | | | | | | | | | | * 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 codeStefan Monnier2022-11-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-10
| |
| * buffer.c: evaporate overlays in all indirect buffersStefan Monnier2022-11-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-05
| | | | | | | | | | | | | | | | (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-04
| | | | | | | | | | | | | | 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-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-01
| | | | | | | | | | | | | | | | | | | | * 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-28
| |\
| | * Fix a narrow-to-region vs. overlays-at bugMatt Armstrong2022-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-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-19
| | |
| | * Tighten up handling of `otick`Stefan Monnier2022-10-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-02
| | |\
| | | * Make it compile with ITREE_DEBUG definedGerd Möllmann2022-10-01
| | | | | | | | | | | | | | | | | | | | * src/buffer.c (make_lispy_interval_node): Use make_fixnum. (overlay_tree): Use ITREE_NULL.
| | * | New ITREE_FOREACH macroStefan Monnier2022-10-02
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-29
| | | | | | | | | | | | | | | | | | | | | | | | * 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-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-ZVStefan Monnier2022-09-25
| | | | | | | | | | | | This fixes test failures in `test-overlays-in-2` and `test-remove-overlays`.
| | * Merge 'master' into noverlayStefan Monnier2022-09-25
| | |\ | | |/ | |/|
| | * Remove redundant checks for the empty overlay treeAndreas Politz2017-10-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-06
| | | | | | | | | | | | | | | | | | * src/buffer.c (set_overlays_multibyte): New function. (set-buffer-multibyte): Use function.
| | * Provide a new tree data-structure for overlays.Andreas Politz2017-10-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-29
|\| |
| * | Improve detection of long lines.Gregory Heytings2022-08-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-16
| | |
| * | Work around Bug#57211Paul Eggert2022-08-14
| | | | | | | | | | | | * src/buffer.c (Fgenerate_new_buffer_name): Allocate a bigger buffer.
| * | Speed up display of long lines under 'truncate-lines'Eli Zaretskii2022-08-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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'.