diff options
| author | Gerd Möllmann | 2025-05-08 06:46:17 +0200 |
|---|---|---|
| committer | Gerd Möllmann | 2025-05-08 06:54:03 +0200 |
| commit | 38892c66d5467781b0ea512432fea6ecf637b4c7 (patch) | |
| tree | 2a8b7ff8e1c4e5147724440958219dd146ed377b /src/buffer.c | |
| parent | 3aa95eddac15fb09cdd73dbfea305c1b00f1ac03 (diff) | |
| download | emacs-scratch/text-index.tar.gz emacs-scratch/text-index.zip | |
DO_MARKERS -> Pip's FOR_EACH_MARKERscratch/text-index
* src/marker-vector.h (DO_MARKERS_OF_VECTOR, DO_MARKERS): Remove.
(build_for_each_marker_data, next_marker_entry):
(FOR_EACH_MARKER_OF_VECTOR, FOR_EACH_MARKER): New.
* .clang-format (IndentPPDirectives): Add new FOR_EACH_ macros.
* src/alloc.c (unchain_dead_markers):
* src/buffer.c (Fkill_buffer, Fbuffer_swap_text)
(Fset_buffer_multibyte):
* src/coding.c (decode_coding_object, encode_coding_object):
* src/editfns.c (transpose_markers):
* src/marker-vector.c (check_marker_vector, marker_vector_reset)
(marker_vector_adjust_for_insert)
(marker_vector_adjust_for_replace):
* src/undo.c (record_marker_adjustments): Use FOR_EACH_MARKER.
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/buffer.c b/src/buffer.c index 93a2edb3693..21b6096517d 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -2073,12 +2073,11 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 2073 | /* Unchain all markers that belong to this indirect buffer. | 2073 | /* Unchain all markers that belong to this indirect buffer. |
| 2074 | Don't unchain the markers that belong to the base buffer | 2074 | Don't unchain the markers that belong to the base buffer |
| 2075 | or its other indirect buffers. */ | 2075 | or its other indirect buffers. */ |
| 2076 | DO_MARKERS (b, m) | 2076 | FOR_EACH_MARKER (b, m) |
| 2077 | { | 2077 | { |
| 2078 | if (m->buffer == b) | 2078 | if (m->buffer == b) |
| 2079 | marker_vector_remove (XVECTOR (BUF_MARKERS (b)), m); | 2079 | marker_vector_remove (XVECTOR (BUF_MARKERS (b)), m); |
| 2080 | } | 2080 | } |
| 2081 | END_DO_MARKERS; | ||
| 2082 | 2081 | ||
| 2083 | /* Intervals should be owned by the base buffer (Bug#16502). */ | 2082 | /* Intervals should be owned by the base buffer (Bug#16502). */ |
| 2084 | i = buffer_intervals (b); | 2083 | i = buffer_intervals (b); |
| @@ -2618,7 +2617,7 @@ results, see Info node `(elisp)Swapping Text'. */) | |||
| 2618 | other_buffer->text->end_unchanged = other_buffer->text->gpt; | 2617 | other_buffer->text->end_unchanged = other_buffer->text->gpt; |
| 2619 | swap_buffer_overlays (current_buffer, other_buffer); | 2618 | swap_buffer_overlays (current_buffer, other_buffer); |
| 2620 | { | 2619 | { |
| 2621 | DO_MARKERS (current_buffer, m) | 2620 | FOR_EACH_MARKER (current_buffer, m) |
| 2622 | { | 2621 | { |
| 2623 | if (m->buffer == other_buffer) | 2622 | if (m->buffer == other_buffer) |
| 2624 | m->buffer = current_buffer; | 2623 | m->buffer = current_buffer; |
| @@ -2627,8 +2626,7 @@ results, see Info node `(elisp)Swapping Text'. */) | |||
| 2627 | BUF_MARKERS(buf) should either be for `buf' or dead. */ | 2626 | BUF_MARKERS(buf) should either be for `buf' or dead. */ |
| 2628 | eassert (!m->buffer); | 2627 | eassert (!m->buffer); |
| 2629 | } | 2628 | } |
| 2630 | END_DO_MARKERS; | 2629 | FOR_EACH_MARKER (other_buffer, m) |
| 2631 | DO_MARKERS (other_buffer, m) | ||
| 2632 | { | 2630 | { |
| 2633 | if (m->buffer == current_buffer) | 2631 | if (m->buffer == current_buffer) |
| 2634 | m->buffer = other_buffer; | 2632 | m->buffer = other_buffer; |
| @@ -2637,7 +2635,6 @@ results, see Info node `(elisp)Swapping Text'. */) | |||
| 2637 | BUF_MARKERS(buf) should either be for `buf' or dead. */ | 2635 | BUF_MARKERS(buf) should either be for `buf' or dead. */ |
| 2638 | eassert (!m->buffer); | 2636 | eassert (!m->buffer); |
| 2639 | } | 2637 | } |
| 2640 | END_DO_MARKERS; | ||
| 2641 | } | 2638 | } |
| 2642 | 2639 | ||
| 2643 | { /* Some of the C code expects that both window markers of a | 2640 | { /* Some of the C code expects that both window markers of a |
| @@ -2746,12 +2743,11 @@ current buffer is cleared. */) | |||
| 2746 | GPT = GPT_BYTE; | 2743 | GPT = GPT_BYTE; |
| 2747 | TEMP_SET_PT_BOTH (PT_BYTE, PT_BYTE); | 2744 | TEMP_SET_PT_BOTH (PT_BYTE, PT_BYTE); |
| 2748 | 2745 | ||
| 2749 | DO_MARKERS (current_buffer, tail) | 2746 | FOR_EACH_MARKER (current_buffer, tail) |
| 2750 | { | 2747 | { |
| 2751 | const ptrdiff_t bytepos = marker_vector_bytepos (tail); | 2748 | const ptrdiff_t bytepos = marker_vector_bytepos (tail); |
| 2752 | marker_vector_set_charpos (tail, bytepos); | 2749 | marker_vector_set_charpos (tail, bytepos); |
| 2753 | } | 2750 | } |
| 2754 | END_DO_MARKERS; | ||
| 2755 | 2751 | ||
| 2756 | /* Convert multibyte form of 8-bit characters to unibyte. */ | 2752 | /* Convert multibyte form of 8-bit characters to unibyte. */ |
| 2757 | pos = BEG; | 2753 | pos = BEG; |
| @@ -2901,13 +2897,12 @@ current buffer is cleared. */) | |||
| 2901 | TEMP_SET_PT_BOTH (position, byte); | 2897 | TEMP_SET_PT_BOTH (position, byte); |
| 2902 | } | 2898 | } |
| 2903 | 2899 | ||
| 2904 | DO_MARKERS (current_buffer, tail) | 2900 | FOR_EACH_MARKER (current_buffer, tail) |
| 2905 | { | 2901 | { |
| 2906 | ptrdiff_t bytepos = marker_vector_bytepos (tail); | 2902 | ptrdiff_t bytepos = marker_vector_bytepos (tail); |
| 2907 | bytepos = advance_to_char_boundary (bytepos); | 2903 | bytepos = advance_to_char_boundary (bytepos); |
| 2908 | marker_vector_set_charpos (tail, BYTE_TO_CHAR (bytepos)); | 2904 | marker_vector_set_charpos (tail, BYTE_TO_CHAR (bytepos)); |
| 2909 | } | 2905 | } |
| 2910 | END_DO_MARKERS; | ||
| 2911 | 2906 | ||
| 2912 | /* Do this last, so it can calculate the new correspondences | 2907 | /* Do this last, so it can calculate the new correspondences |
| 2913 | between chars and bytes. */ | 2908 | between chars and bytes. */ |