From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: /* FIXME: Call signal_after_change! */ in callproc.c. Well, why not? Date: Sat, 21 Dec 2019 20:11:01 +0200 Message-ID: <83k16pzgzu.fsf@gnu.org> References: <20191221172324.GA8692@ACM> Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="189645"; mail-complaints-to="usenet@blaine.gmane.org" Cc: emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Dec 21 19:12:14 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iijEc-000nGL-MA for ged-emacs-devel@m.gmane.org; Sat, 21 Dec 2019 19:12:14 +0100 Original-Received: from localhost ([::1]:41386 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iijEb-0002hQ-Cx for ged-emacs-devel@m.gmane.org; Sat, 21 Dec 2019 13:12:13 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39718) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iijDo-00027P-EA for emacs-devel@gnu.org; Sat, 21 Dec 2019 13:11:26 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:60877) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iijDn-0000yv-S8; Sat, 21 Dec 2019 13:11:23 -0500 Original-Received: from [176.228.60.248] (port=1615 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iijDn-0003mB-2s; Sat, 21 Dec 2019 13:11:23 -0500 In-reply-to: <20191221172324.GA8692@ACM> (message from Alan Mackenzie on Sat, 21 Dec 2019 17:23:24 +0000) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:243541 Archived-At: > Date: Sat, 21 Dec 2019 17:23:24 +0000 > From: Alan Mackenzie > > /* FIXME: Call signal_after_change! */ > + beg = PT; Can you tell why you needed this variable and the assignment? AFAIK, PT doesn't change when we call decode_coding_c_string. > decode_coding_c_string (&process_coding, > (unsigned char *) buf, nread, curbuf); > unbind_to (count1, Qnil); > + signal_after_change (beg, 0, PT - beg); > if (display_on_the_fly > && CODING_REQUIRE_DETECTION (&saved_coding) > && ! CODING_REQUIRE_DETECTION (&process_coding)) > > > , and this appears to solve the OP's problem. > > However, a few lines further on, there's a del_range_2 call inside a condition > I don't understand (though might, with a great deal of study). I suspect that > the call to signal_after_change ought to take this del_range_2 into account, > possibly coming after it. > > Would somebody who's familiar with this bit of callproc.c please help me out > here, and explain what this call to del_range_2 is doing, and whether there's > anything basically wrong with my simple-minded addition of > signal_after_change. I'm not sure what you want to hear. The del_range_2 call deletes the just-inserted text, because the condition means that text was inserted using the wrong coding-system to decode the incoming bytes. What does that mean for the modification hooks, I don't know: the before-change-functions were already called, but nothing was inserted from the Lisp application's POV, so if you insist on having before and after hooks to be called in pairs, you are in a conundrum. It's possible that we should simplify all this by calling the before hooks just once before the loop and the after hooks just once after the loop, instead of calling them for each individual chunk inside the loop, but again I don't know what that means for applications which expects these hook calls to pair.