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: Mon, 8 Aug 2016 16:54:49 +0000 Message-ID: <20160808165449.GB7208@acm.fritz.box> References: <20160731121642.GB2205@acm.fritz.box> <20160802101549.GA2328@acm.fritz.box> <83r3a7md69.fsf@gnu.org> <20160802165545.GD2328@acm.fritz.box> <83fuqnm6og.fsf@gnu.org> <83eg67m3aq.fsf@gnu.org> <20160808143614.GA7208@acm.fritz.box> <83mvkni7xf.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1470675520 23629 195.159.176.226 (8 Aug 2016 16:58:40 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 8 Aug 2016 16:58:40 +0000 (UTC) User-Agent: Mutt/1.5.24 (2015-08-30) Cc: ofv@wanadoo.es, rcopley@gmail.com, rms@gnu.org, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 08 18:58:36 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 1bWnsc-0003Y3-Ul for ged-emacs-devel@m.gmane.org; Mon, 08 Aug 2016 18:58:23 +0200 Original-Received: from localhost ([::1]:58807 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bWnsY-00062r-Vk for ged-emacs-devel@m.gmane.org; Mon, 08 Aug 2016 12:58:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41777) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bWnpp-0004tG-9J for emacs-devel@gnu.org; Mon, 08 Aug 2016 12:55:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bWnpm-00052t-Fl for emacs-devel@gnu.org; Mon, 08 Aug 2016 12:55:28 -0400 Original-Received: from mail.muc.de ([193.149.48.3]:59676) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bWnpm-00052R-5w for emacs-devel@gnu.org; Mon, 08 Aug 2016 12:55:26 -0400 Original-Received: (qmail 13151 invoked by uid 3782); 8 Aug 2016 16:55:24 -0000 Original-Received: from acm.muc.de (p4FC46EDC.dip0.t-ipconnect.de [79.196.110.220]) by colin.muc.de (tmda-ofmipd) with ESMTP; Mon, 08 Aug 2016 18:55:22 +0200 Original-Received: (qmail 8425 invoked by uid 1000); 8 Aug 2016 16:54:49 -0000 Content-Disposition: inline In-Reply-To: <83mvkni7xf.fsf@gnu.org> 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:206491 Archived-At: Hello, Eli. On Mon, Aug 08, 2016 at 06:42:20PM +0300, Eli Zaretskii wrote: > > Date: Mon, 8 Aug 2016 14:36:14 +0000 > > Cc: ofv@wanadoo.es, rcopley@gmail.com, rms@gnu.org, emacs-devel@gnu.org > > From: Alan Mackenzie > > If you're right in supposing that only insert-file-contents with those > > particular parameters can cause the omission of the > > before-change-functions call, then a solution would be for CC Mode to > > advise those commands which call insert-f-c this way. > I thought our policy was to leave advising to users, and never do > that in core. I suppose so. In that case, I can do the advising in standalone CC Mode, but we hard code a solution in savannah master. > I asked a few questions a couple of days ago, with the purpose of > coming up with idea for how to solve this issue in a more acceptable > way. You never answered them. Could you please humor me? Sorry about that. I think you mean the following. Otherwise, would you please clarify. ######################################################################### >> Things are cached in text properties on the text itself. These >> properties can only be examined before the text is deleted. > OK, so you must also have code that computes and places those > properties, right? Yes. > What triggers that code? before/after-change-functions. For example, in C++ Mode, if a "<" template delimiter is about is in a region about to be deleted, and the matching ">" is after that region, the pertinent function called from c-before-change (c-before-change-check-<>-operators) removes the syntax-table properties from each of them. > E.g., when a file is visited, what invokes that code, and how much of > the buffer it processes when invoked? On a newly visited file, the entire buffer is scanned by (the components of) c-before-change and c-after-change, setting the text properties. > If it doesn't process the entire buffer in one go, how is it invoked > to process the rest of the buffer? It does process the entire buffer in one go. ######################################################################### > If nothing better comes up, I'd prefer to do something special in > insert-file-contents, specifically for CC Mode, rather than going to > the extremes you describe above and in the other messages. What I'm looking at at the moment is calling revert-buffer a second time if CC Mode signals a missing before-change-functions the first time. After the test scenario, M-x revert-buffer works, so it might work if called from the code instead. > Thanks. -- Alan Mackenzie (Nuremberg, Germany).