From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: Unbalanced change hooks (part 2) Date: Sun, 31 Jul 2016 15:21:58 +0000 Message-ID: <20160731152158.GC2205@acm.fritz.box> References: <20160731121642.GB2205@acm.fritz.box> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1469978590 6150 80.91.229.8 (31 Jul 2016 15:23:10 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 31 Jul 2016 15:23:10 +0000 (UTC) User-Agent: Mutt/1.5.24 (2015-08-30) Cc: =?iso-8859-1?Q?=D3scar?= Fuentes , Richard Copley , Emacs developers To: Noam Postavsky Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jul 31 17:22:56 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bTsZr-0001YQ-Mk for ged-emacs-devel@m.gmane.org; Sun, 31 Jul 2016 17:22:55 +0200 Original-Received: from localhost ([::1]:39905 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bTsZn-0004Dn-Rc for ged-emacs-devel@m.gmane.org; Sun, 31 Jul 2016 11:22:51 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36559) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bTsZh-0004Dd-TF for emacs-devel@gnu.org; Sun, 31 Jul 2016 11:22:46 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bTsZd-0000F3-L8 for emacs-devel@gnu.org; Sun, 31 Jul 2016 11:22:44 -0400 Original-Received: from mail.muc.de ([193.149.48.3]:32396) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bTsZd-0000Eo-BC for emacs-devel@gnu.org; Sun, 31 Jul 2016 11:22:41 -0400 Original-Received: (qmail 70980 invoked by uid 3782); 31 Jul 2016 15:22:39 -0000 Original-Received: from acm.muc.de (p548C7DF4.dip0.t-ipconnect.de [84.140.125.244]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 31 Jul 2016 17:22:38 +0200 Original-Received: (qmail 4166 invoked by uid 1000); 31 Jul 2016 15:21:58 -0000 Content-Disposition: inline In-Reply-To: X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x X-Received-From: 193.149.48.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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:206269 Archived-At: Hello, Noam. On Sun, Jul 31, 2016 at 09:58:50AM -0400, Noam Postavsky wrote: > On Sun, Jul 31, 2016 at 8:16 AM, Alan Mackenzie wrote: > > The pertinent functions are insert_1_both, replace_range, del_range_1, > > del_range_byte, and del_range_both. These functions fall into two > > groups, the first two in group 1 and the rest in group 2. Those in group > > 2 always call signal_after_change, those in group 1 never do. > replace_range should be in group 2 as well, no? Er, yes, it should. ;-) So we have a group of 4 and a single function. Thanks for spotting that. > > There are invocations of group 2 functions with `prepare' false. This > > wrongly invokes after-change-functions without having invoked > > before-change-functions. > replace_range has one call with prepare = false, it's in > Fsubst_char_in_region. I think the idea is that the caller takes care > of calling both before (by calling modify_text) and after (by explicit > call and/or(??) by replace_range) change functions, though the code is > sufficiently convoluted that I can't really say whether it works > correctly or not. By taking signal_after_change out of prepare_to_modify_buffer, I'm rather hoping to reduce the convolution. -- Alan Mackenzie (Nuremberg, Germany).