diff options
| author | Dmitry Gutov | 2024-06-14 19:50:59 +0300 |
|---|---|---|
| committer | Dmitry Gutov | 2024-06-14 19:50:59 +0300 |
| commit | a8d5c5fd8789f28ddd040e497f03a988e5f0703c (patch) | |
| tree | 22a48883834d5d93f8aa52ee65bf67010e83c6e0 /src/process.c | |
| parent | 08e38818f6ff4e514ac291bc5a7686f4390759b0 (diff) | |
| download | emacs-a8d5c5fd8789f28ddd040e497f03a988e5f0703c.tar.gz emacs-a8d5c5fd8789f28ddd040e497f03a988e5f0703c.zip | |
"Insert before markers" in read_and_insert_process_output properly
* src/coding.c (setup_coding_system): Initialize it.
(produce_chars, encode_coding, decode_coding_gap):
Obey it in insert_from_gap calls.
(encode_string_utf_8, decode_string_utf_8): Update the other calls
to insert_from_gap to have one new argument (false).
* src/coding.h: New field insert_before_markers.
* src/decompress.c (Fzlib_decompress_region): Here too.
* src/insdel.c (insert_from_gap):
Accept new argument BEFORE_MARKERS (bug#71525) and pass it through
to adjust_markers_for_insert.
* src/lisp.h: Update prototype.
* src/process.c (read_and_insert_process_output):
Set process_coding->insert_before_markers instead of calling
adjust_markers_for_insert.
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/process.c b/src/process.c index eb526311c53..58d9f8162df 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -6406,6 +6406,9 @@ read_and_insert_process_output (struct Lisp_Process *p, char *buf, | |||
| 6406 | if (NILP (BVAR (XBUFFER (p->buffer), enable_multibyte_characters)) | 6406 | if (NILP (BVAR (XBUFFER (p->buffer), enable_multibyte_characters)) |
| 6407 | && ! CODING_MAY_REQUIRE_DECODING (process_coding)) | 6407 | && ! CODING_MAY_REQUIRE_DECODING (process_coding)) |
| 6408 | { | 6408 | { |
| 6409 | /* For compatibility with the long-standing behavior of | ||
| 6410 | internal-default-process-filter we insert before markers, | ||
| 6411 | both here and in the 'else' branch. */ | ||
| 6409 | insert_1_both (buf, nread, nread, 0, 0, 1); | 6412 | insert_1_both (buf, nread, nread, 0, 0, 1); |
| 6410 | signal_after_change (PT - nread, 0, nread); | 6413 | signal_after_change (PT - nread, 0, nread); |
| 6411 | } | 6414 | } |
| @@ -6415,6 +6418,7 @@ read_and_insert_process_output (struct Lisp_Process *p, char *buf, | |||
| 6415 | specpdl_ref count1 = SPECPDL_INDEX (); | 6418 | specpdl_ref count1 = SPECPDL_INDEX (); |
| 6416 | 6419 | ||
| 6417 | XSETBUFFER (curbuf, current_buffer); | 6420 | XSETBUFFER (curbuf, current_buffer); |
| 6421 | process_coding->insert_before_markers = true; | ||
| 6418 | /* We cannot allow after-change-functions be run | 6422 | /* We cannot allow after-change-functions be run |
| 6419 | during decoding, because that might modify the | 6423 | during decoding, because that might modify the |
| 6420 | buffer, while we rely on process_coding.produced to | 6424 | buffer, while we rely on process_coding.produced to |
| @@ -6423,9 +6427,6 @@ read_and_insert_process_output (struct Lisp_Process *p, char *buf, | |||
| 6423 | specbind (Qinhibit_modification_hooks, Qt); | 6427 | specbind (Qinhibit_modification_hooks, Qt); |
| 6424 | decode_coding_c_string (process_coding, | 6428 | decode_coding_c_string (process_coding, |
| 6425 | (unsigned char *) buf, nread, curbuf); | 6429 | (unsigned char *) buf, nread, curbuf); |
| 6426 | adjust_markers_for_insert (PT, PT_BYTE, | ||
| 6427 | PT + process_coding->produced_char, | ||
| 6428 | PT_BYTE + process_coding->produced, true); | ||
| 6429 | unbind_to (count1, Qnil); | 6430 | unbind_to (count1, Qnil); |
| 6430 | 6431 | ||
| 6431 | read_process_output_set_last_coding_system (p, process_coding); | 6432 | read_process_output_set_last_coding_system (p, process_coding); |