diff options
| author | Yuan Fu | 2025-03-18 17:26:26 -0700 |
|---|---|---|
| committer | Yuan Fu | 2025-03-19 11:59:42 -0700 |
| commit | 289e1bdae28d7dbb27ae8f323b6f50f5c430a961 (patch) | |
| tree | eca2b73e0fba0d5c58e832fa80d08ce5525d1ae6 /src/buffer.c | |
| parent | 72f6cf8e77f3eac8fe2e5fc6ad29c2348314b84b (diff) | |
| download | emacs-scratch/ts-linecol.tar.gz emacs-scratch/ts-linecol.zip | |
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/buffer.c b/src/buffer.c index a408b799ff4..e1f138d6f42 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -641,6 +641,13 @@ even if it is dead. The return value is never nil. */) | |||
| 641 | bset_width_table (b, Qnil); | 641 | bset_width_table (b, Qnil); |
| 642 | b->prevent_redisplay_optimizations_p = 1; | 642 | b->prevent_redisplay_optimizations_p = 1; |
| 643 | 643 | ||
| 644 | #ifdef HAVE_TREE_SITTER | ||
| 645 | b->ts_linecol_cache.pos = 1; | ||
| 646 | b->ts_linecol_cache.byte_pos = 1; | ||
| 647 | b->ts_linecol_cache.line = 1; | ||
| 648 | b->ts_linecol_cache.col = 0; | ||
| 649 | #endif | ||
| 650 | |||
| 644 | /* An ordinary buffer normally doesn't need markers | 651 | /* An ordinary buffer normally doesn't need markers |
| 645 | to handle BEGV and ZV. */ | 652 | to handle BEGV and ZV. */ |
| 646 | bset_pt_marker (b, Qnil); | 653 | bset_pt_marker (b, Qnil); |
| @@ -867,6 +874,13 @@ Interactively, CLONE and INHIBIT-BUFFER-HOOKS are nil. */) | |||
| 867 | b->bidi_paragraph_cache = 0; | 874 | b->bidi_paragraph_cache = 0; |
| 868 | bset_width_table (b, Qnil); | 875 | bset_width_table (b, Qnil); |
| 869 | 876 | ||
| 877 | #ifdef HAVE_TREE_SITTER | ||
| 878 | b->ts_linecol_cache.pos = 1; | ||
| 879 | b->ts_linecol_cache.byte_pos = 1; | ||
| 880 | b->ts_linecol_cache.line = 1; | ||
| 881 | b->ts_linecol_cache.col = 0; | ||
| 882 | #endif | ||
| 883 | |||
| 870 | name = Fcopy_sequence (name); | 884 | name = Fcopy_sequence (name); |
| 871 | set_string_intervals (name, NULL); | 885 | set_string_intervals (name, NULL); |
| 872 | bset_name (b, name); | 886 | bset_name (b, name); |
| @@ -2618,6 +2632,11 @@ results, see Info node `(elisp)Swapping Text'. */) | |||
| 2618 | bset_point_before_scroll (current_buffer, Qnil); | 2632 | bset_point_before_scroll (current_buffer, Qnil); |
| 2619 | bset_point_before_scroll (other_buffer, Qnil); | 2633 | bset_point_before_scroll (other_buffer, Qnil); |
| 2620 | 2634 | ||
| 2635 | #ifdef HAVE_TREE_SITTER | ||
| 2636 | swapfield_ (ts_parser_list, Lisp_Object); | ||
| 2637 | swapfield (ts_linecol_cache, struct ts_linecol); | ||
| 2638 | #endif | ||
| 2639 | |||
| 2621 | modiff_incr (¤t_buffer->text->modiff, 1); | 2640 | modiff_incr (¤t_buffer->text->modiff, 1); |
| 2622 | modiff_incr (&other_buffer->text->modiff, 1); | 2641 | modiff_incr (&other_buffer->text->modiff, 1); |
| 2623 | modiff_incr (¤t_buffer->text->chars_modiff, 1); | 2642 | modiff_incr (¤t_buffer->text->chars_modiff, 1); |
| @@ -5019,8 +5038,6 @@ DEFUN ("overlay-tree", Foverlay_tree, Soverlay_tree, 0, 1, 0, | |||
| 5019 | } | 5038 | } |
| 5020 | #endif | 5039 | #endif |
| 5021 | 5040 | ||
| 5022 | |||
| 5023 | |||
| 5024 | /* Initialize the buffer routines. */ | 5041 | /* Initialize the buffer routines. */ |
| 5025 | void | 5042 | void |
| 5026 | syms_of_buffer (void) | 5043 | syms_of_buffer (void) |