emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Lisp primitives and their calling of the change hooks


From: Alan Mackenzie
Subject: Re: Lisp primitives and their calling of the change hooks
Date: Sun, 7 Jan 2018 21:10:55 +0000
User-agent: Mutt/1.7.2 (2016-11-26)

Hello, Eli.

On Sun, Jan 07, 2018 at 21:58:33 +0200, Eli Zaretskii wrote:
> > Date: Sun, 7 Jan 2018 19:48:45 +0000
> > Cc: Eli Zaretskii <address@hidden>, address@hidden
> > From: Alan Mackenzie <address@hidden>

> > Anyhow, here's the patch, which appears to work as described above.  Any
> > comments?  Otherwise I'll commit it.

> Like I said, I think we should have only one pair of hooks, like we
> have in replace_range.

OK.  This is slightly more awkward: del_range needs to be replaced by
del_range_2, so as not to get an extra call to signal_after_change.
There is also no a-c-f call if the decompression exits with an error.
(It would be possible but a little awkward to do this.)



diff --git a/src/decompress.c b/src/decompress.c
index 41de6da1dd..f2dde7248e 100644
--- a/src/decompress.c
+++ b/src/decompress.c
@@ -141,6 +141,10 @@ This function can be called only in unibyte buffers.  */)
      the same.  */
   istart = XINT (start);
   iend = XINT (end);
+
+  /* Do the following before manipulating the gap. */
+  modify_text (istart, iend);
+
   move_gap_both (iend, iend);
 
   stream.zalloc = Z_NULL;
@@ -196,7 +200,10 @@ This function can be called only in unibyte buffers.  */)
   unwind_data.start = 0;
 
   /* Delete the compressed data.  */
-  del_range (istart, iend);
+  del_range_2 (istart, istart, /* byte and char offsets are the same. */
+               iend, iend, 0);
+
+  signal_after_change (istart, iend - istart, unwind_data.nbytes);
 
   return unbind_to (count, Qt);
 }


-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]