From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Daniel Colascione Newsgroups: gmane.emacs.devel Subject: Re: Unbalanced change hooks (part 2) [Documentation fix still remaining] Date: Tue, 30 Aug 2016 11:04:07 -0700 Message-ID: References: <20160811112951.GA2154@acm.fritz.box> <7e1478b6-cf00-fcbf-8c24-43bdaa57e2b6@dancol.org> <415d1cca-f32c-624e-a4be-9aadcf8a0f17@dancol.org> <83inujbpek.fsf@gnu.org> <20160830171222.GA6672@acm.fritz.box> <5857ab7e-e85c-c6ae-ba1a-b1337ae57f2c@dancol.org> <83fupmm9ul.fsf@gnu.org> <67e1e007-c944-b91e-6c4b-b06b51beddc1@dancol.org> <83bn0am91r.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1472580283 4903 195.159.176.226 (30 Aug 2016 18:04:43 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 30 Aug 2016 18:04:43 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 Cc: acm@muc.de, monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Aug 30 20:04:35 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 1benOk-0000aS-6T for ged-emacs-devel@m.gmane.org; Tue, 30 Aug 2016 20:04:34 +0200 Original-Received: from localhost ([::1]:50582 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1benOh-0001o0-SA for ged-emacs-devel@m.gmane.org; Tue, 30 Aug 2016 14:04:31 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33464) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1benOT-0001gn-Oy for emacs-devel@gnu.org; Tue, 30 Aug 2016 14:04:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1benOP-0002h3-A3 for emacs-devel@gnu.org; Tue, 30 Aug 2016 14:04:16 -0400 Original-Received: from dancol.org ([2600:3c01::f03c:91ff:fedf:adf3]:54350) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1benOO-0002fr-UT; Tue, 30 Aug 2016 14:04:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dancol.org; s=x; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:Cc:References:To:Subject; bh=fNRWUZL4DiFGCCnyJ9+pP2s6u/HjnoVo/Ykd3y9OF8s=; b=o5maInic9ovLZY/ExuubHfST92VwxUFYxaxNUoDp350skvvEzg42tff/hrnaWIfiUawfaC12jgIEvUuieIzhAztV2/48B6zJecpUZC6maLz5oXwmJZtCQjOMBIfQNNafHxVnTt3V4rTT1tsbI9iHwYsT9sMt/8jx57XdngmHzT4i71e7+hIDUNHVFIZaQ2HYyQNDzFP5owfFutDC2vc005nPwVJ+LD7y1zlHmTHfxYg8tjhPvTfsqZ4vnPirGzuEl1yTvz6RsQsvPVCGy4nhqFlLzfWOdyQ5eS1eF4iFBmvDxtA3hEjYagdvFYdvVG2akf+xcJP6O1N3o09X8VgBAA==; Original-Received: from c-73-97-199-232.hsd1.wa.comcast.net ([73.97.199.232] helo=[192.168.1.173]) by dancol.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1benON-0007UH-7y; Tue, 30 Aug 2016 11:04:11 -0700 In-Reply-To: <83bn0am91r.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2600:3c01::f03c:91ff:fedf:adf3 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:206987 Archived-At: On 08/30/2016 11:00 AM, Eli Zaretskii wrote: >> Cc: acm@muc.de, monnier@iro.umontreal.ca, emacs-devel@gnu.org >> From: Daniel Colascione >> Date: Tue, 30 Aug 2016 10:46:44 -0700 >> >>>> - Do @emph{not} expect the before-change hooks and the after-change >>>> -hooks be called in balanced pairs around each buffer change. Also >>>> -don't expect the before-change hooks to be called for every chunk of >>>> -text Emacs is about to delete. These hooks are provided on the >>>> -assumption that Lisp programs will use either before- or the >>>> -after-change hooks, but not both, and the boundaries of the region >>>> -where the changes happen might include more than just the actual >>>> -changed text, or even lump together several changes done piecemeal. >>>> + Do @emph{not} expect the before-change hooks and the after-change >>>> +hooks be called in balanced pairs around each buffer change. >>>> +The before-change-functions region is a conservative bound on the zero >>>> +or more fine-grained changes to follow. Emacs informs user code about >>>> +the actual changes to the buffer through calls to >>>> +after-change-functions; these fine-grained changes will always fall >>>> +inside the broad change region Emacs describes by calling >>>> +before-change-functions. >>> >>> You removed the part about text deletion, which is not specific to >>> revert-buffer, so that information is now lost. I don't want to lose >>> it. >> >> The text deletion part is a real and serious bug. As Stefan points out, >> it makes it impossible to use b-c-f to invalidate caches. > > You misunderstand what Stefan says. He says not calling the > before-change hook _at_all_ is a bug. Not calling it for every chunk > of deleted text is not necessarily a bug, if there's a previous less > fine-grained call to the hook. And that's what the text above > conveys: that note every chunk to be deleted will have its own call to > a hook. So we're in agreement? True or false: b-c-f ought to be a conservative bound on subsequent a-c-f calls. > >>> Other than that, I don't see how your text is more accurate, it's just >>> a different wording dancing around the same issues trying to side-step >>> them by replacing one vague description by another. >> >> My proposed description highlights how the b-c-f region contains the >> a-c-f regions. I understand that you believe that the existing >> documentation communicates this fact, but I strongly disagree. The >> relationship between the b-c-f region and the a-c-f regions needs to be >> spelled out explicitly. > > They cannot be spelled out explicitly without going into a lot more > internal details that are inappropriate for the Lisp-level manual. Not the case at all. That's the point of saying b-c-f is a conservative bound. The words "conservative bound" free you from having to describe the precise ways the b-c-f region and the a-c-f region can differ. > >>> If all you want is to remove this part: >>> >>> These hooks are provided on the assumption that Lisp programs will >>> use either before- or the after-change hooks, but not both >>> >>> then I don't necessarily mind, although I do believe it is true, and >>> the readers should be aware of that. >> >> I strongly disagree. b-c-f is a perfectly good way to invalidate caches. > > So the readers need to know they cannot rely on that. Why shouldn't they be able to rely on that? What *should* they use to invalidate caches? Your position is not very clear to me.