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: Lisp primitives and their calling of the change hooks Date: Fri, 5 Jan 2018 17:38:50 +0000 Message-ID: <20180105173850.GD6954@ACM> References: <20180103124543.GA5435@ACM> <20180104155111.GB6846@ACM> <20180104211154.GC6846@ACM> <838tdcbxrb.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 1515174115 16693 195.159.176.226 (5 Jan 2018 17:41:55 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 5 Jan 2018 17:41:55 +0000 (UTC) User-Agent: Mutt/1.7.2 (2016-11-26) Cc: Eli Zaretskii , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jan 05 18:41:51 2018 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 1eXW02-0003fz-6q for ged-emacs-devel@m.gmane.org; Fri, 05 Jan 2018 18:41:46 +0100 Original-Received: from localhost ([::1]:50886 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eXW21-0003pi-IY for ged-emacs-devel@m.gmane.org; Fri, 05 Jan 2018 12:43:49 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43791) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eXW1P-0003pN-VY for emacs-devel@gnu.org; Fri, 05 Jan 2018 12:43:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eXW1M-0003VA-Pk for emacs-devel@gnu.org; Fri, 05 Jan 2018 12:43:11 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:14126 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1eXW1M-0003U8-8A for emacs-devel@gnu.org; Fri, 05 Jan 2018 12:43:08 -0500 Original-Received: (qmail 53301 invoked by uid 3782); 5 Jan 2018 17:43:06 -0000 Original-Received: from acm.muc.de (p548C703C.dip0.t-ipconnect.de [84.140.112.60]) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 05 Jan 2018 18:43:05 +0100 Original-Received: (qmail 17354 invoked by uid 1000); 5 Jan 2018 17:38:50 -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 [fuzzy] X-Received-From: 193.149.48.1 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:221624 Archived-At: Hello, Stefan. On Fri, Jan 05, 2018 at 11:50:56 -0500, Stefan Monnier wrote: > > How will the reader know to distinguish between these two classes of > > primitives? > He won't and shouldn't attempt to (the boundary between those two is an > internal implementation detail that is subject to change). > > Without such an ability, the extra accuracy in this text > > is not useful. > I find it useful in order to explain why naively observing the behavior > may give one the impression that all b-c-f and a-c-f calls are > "balanced". > Maybe the first paragraph should be reworded a bit so it doesn't sound > like a promise of behavior? How 'bout: > The vast bulk of buffer changes will call `before-change-functions' > and `after-change-functions' in balanced pairs, once for each > change where the arguments to these hooks will exactly delimit the > change being made. Yet, hook functions should not rely on this > being always the case: > Other, more complex primitives may call `before-change-functions' > once before making changes and then call `after-change-functions' > zero, one, or several times, depending on how many individual > changes the primitive makes. The `BEG' and `END' arguments to > `before-change-functions' will enclose a region in which the > individual changes are made, but won't necessarily be the minimal > such region. The `BEG', `END', and `OLD-LEN' arguments to each > successive call of `after-change-functions' will more accurately > delimit the current change. I like that, in general. :-) It gets rid of the awkward terms "atomic" and "complex" which were more trouble than they were worth. Just two tiny amendments: (i) I think a comma is needed in the first paragraph after "in balanced pairs, once for each change". (ii) The "may" at the start of the second paragraph is not wanted. It suggests that b-c-f is optional. Simply "Other, more complex primitives call `b-c-f' once before ....". > -- Stefan -- Alan Mackenzie (Nuremberg, Germany).