]> git.eshelyaron.com Git - emacs.git/commitdiff
read_and_insert_process_output: Insert before markers
authorDmitry Gutov <dmitry@gutov.dev>
Tue, 11 Jun 2024 18:02:57 +0000 (21:02 +0300)
committerEshel Yaron <me@eshelyaron.com>
Wed, 12 Jun 2024 09:29:01 +0000 (11:29 +0200)
* src/insdel.c (adjust_markers_for_insert): Make non-static.

* src/lisp.h: Add declaration for it.

* src/process.c (read_and_insert_process_output): Use it here.
And also call insert_1_both with BEFORE_MARKERS=t, for
compatibility with internal-default-process-filter (bug#66020).

(cherry picked from commit 3199b8584e4583a4b74263f5704a21c3431658c2)

src/insdel.c
src/lisp.h
src/process.c

index 3809f8bc060fc5431a3d8edf31d0167354ade120..fbf71e1e595c00069a8af074483aa262be9f3f7f 100644 (file)
@@ -284,7 +284,7 @@ adjust_markers_for_delete (ptrdiff_t from, ptrdiff_t from_byte,
    we advance it if either its insertion-type is t
    or BEFORE_MARKERS is true.  */
 
-static void
+void
 adjust_markers_for_insert (ptrdiff_t from, ptrdiff_t from_byte,
                           ptrdiff_t to, ptrdiff_t to_byte, bool before_markers)
 {
index e1911cbb6608aebbae09d974d767219f08db2fb4..21dada59132604d3c3ec1c148c0c654a385dba75 100644 (file)
@@ -4399,6 +4399,8 @@ extern void adjust_after_insert (ptrdiff_t, ptrdiff_t, ptrdiff_t,
                                 ptrdiff_t, ptrdiff_t);
 extern void adjust_markers_for_delete (ptrdiff_t, ptrdiff_t,
                                       ptrdiff_t, ptrdiff_t);
+extern void adjust_markers_for_insert (ptrdiff_t, ptrdiff_t,
+                                      ptrdiff_t, ptrdiff_t, bool);
 extern void adjust_markers_bytepos (ptrdiff_t, ptrdiff_t,
                                    ptrdiff_t, ptrdiff_t, int);
 extern void replace_range (ptrdiff_t, ptrdiff_t, Lisp_Object, bool, bool,
index 43a02affa90ad4d810e422987cbc6fc4d3677b95..eb526311c53b4ad4f6f4e9bdc28cdf9c7afe237e 100644 (file)
@@ -6406,7 +6406,7 @@ read_and_insert_process_output (struct Lisp_Process *p, char *buf,
   if (NILP (BVAR (XBUFFER (p->buffer), enable_multibyte_characters))
           && ! CODING_MAY_REQUIRE_DECODING (process_coding))
     {
-      insert_1_both (buf, nread, nread, 0, 0, 0);
+      insert_1_both (buf, nread, nread, 0, 0, 1);
       signal_after_change (PT - nread, 0, nread);
     }
   else
@@ -6423,6 +6423,9 @@ read_and_insert_process_output (struct Lisp_Process *p, char *buf,
       specbind (Qinhibit_modification_hooks, Qt);
       decode_coding_c_string (process_coding,
                              (unsigned char *) buf, nread, curbuf);
+      adjust_markers_for_insert (PT, PT_BYTE,
+                                PT + process_coding->produced_char,
+                                PT_BYTE + process_coding->produced, true);
       unbind_to (count1, Qnil);
 
       read_process_output_set_last_coding_system (p, process_coding);