aboutsummaryrefslogtreecommitdiffstats
path: root/src/coding.c
diff options
context:
space:
mode:
authorDmitry Gutov2024-06-14 19:50:59 +0300
committerDmitry Gutov2024-06-14 19:50:59 +0300
commita8d5c5fd8789f28ddd040e497f03a988e5f0703c (patch)
tree22a48883834d5d93f8aa52ee65bf67010e83c6e0 /src/coding.c
parent08e38818f6ff4e514ac291bc5a7686f4390759b0 (diff)
downloademacs-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/coding.c')
-rw-r--r--src/coding.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/coding.c b/src/coding.c
index 5e4e92ea6e2..b48164efc69 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -5698,6 +5698,7 @@ setup_coding_system (Lisp_Object coding_system, struct coding_system *coding)
5698 coding->default_char = XFIXNUM (CODING_ATTR_DEFAULT_CHAR (attrs)); 5698 coding->default_char = XFIXNUM (CODING_ATTR_DEFAULT_CHAR (attrs));
5699 coding->carryover_bytes = 0; 5699 coding->carryover_bytes = 0;
5700 coding->raw_destination = 0; 5700 coding->raw_destination = 0;
5701 coding->insert_before_markers = 0;
5701 5702
5702 coding_type = CODING_ATTR_TYPE (attrs); 5703 coding_type = CODING_ATTR_TYPE (attrs);
5703 if (EQ (coding_type, Qundecided)) 5704 if (EQ (coding_type, Qundecided))
@@ -7209,7 +7210,8 @@ produce_chars (struct coding_system *coding, Lisp_Object translation_table,
7209 7210
7210 produced = dst - (coding->destination + coding->produced); 7211 produced = dst - (coding->destination + coding->produced);
7211 if (BUFFERP (coding->dst_object) && produced_chars > 0) 7212 if (BUFFERP (coding->dst_object) && produced_chars > 0)
7212 insert_from_gap (produced_chars, produced, 0); 7213 insert_from_gap (produced_chars, produced, 0,
7214 coding->insert_before_markers);
7213 coding->produced += produced; 7215 coding->produced += produced;
7214 coding->produced_char += produced_chars; 7216 coding->produced_char += produced_chars;
7215 return carryover; 7217 return carryover;
@@ -7814,7 +7816,8 @@ encode_coding (struct coding_system *coding)
7814 } while (coding->consumed_char < coding->src_chars); 7816 } while (coding->consumed_char < coding->src_chars);
7815 7817
7816 if (BUFFERP (coding->dst_object) && coding->produced_char > 0) 7818 if (BUFFERP (coding->dst_object) && coding->produced_char > 0)
7817 insert_from_gap (coding->produced_char, coding->produced, 0); 7819 insert_from_gap (coding->produced_char, coding->produced, 0,
7820 coding->insert_before_markers);
7818 7821
7819 SAFE_FREE (); 7822 SAFE_FREE ();
7820} 7823}
@@ -8008,7 +8011,7 @@ decode_coding_gap (struct coding_system *coding, ptrdiff_t bytes)
8008 } 8011 }
8009 coding->produced = bytes; 8012 coding->produced = bytes;
8010 coding->produced_char = chars; 8013 coding->produced_char = chars;
8011 insert_from_gap (chars, bytes, 1); 8014 insert_from_gap (chars, bytes, 1, coding->insert_before_markers);
8012 return; 8015 return;
8013 } 8016 }
8014 } 8017 }
@@ -9980,7 +9983,7 @@ encode_string_utf_8 (Lisp_Object string, Lisp_Object buffer,
9980 struct buffer *oldb = current_buffer; 9983 struct buffer *oldb = current_buffer;
9981 9984
9982 current_buffer = XBUFFER (buffer); 9985 current_buffer = XBUFFER (buffer);
9983 insert_from_gap (outbytes, outbytes, false); 9986 insert_from_gap (outbytes, outbytes, false, false);
9984 current_buffer = oldb; 9987 current_buffer = oldb;
9985 } 9988 }
9986 return val; 9989 return val;
@@ -10290,7 +10293,7 @@ decode_string_utf_8 (Lisp_Object string, const char *str, ptrdiff_t str_len,
10290 struct buffer *oldb = current_buffer; 10293 struct buffer *oldb = current_buffer;
10291 10294
10292 current_buffer = XBUFFER (buffer); 10295 current_buffer = XBUFFER (buffer);
10293 insert_from_gap (outchars, outbytes, false); 10296 insert_from_gap (outchars, outbytes, false, false);
10294 current_buffer = oldb; 10297 current_buffer = oldb;
10295 } 10298 }
10296 return val; 10299 return val;