From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Unbalanced change hooks (part 2) [Documentation fix still remaining] Date: Tue, 30 Aug 2016 14:14:51 -0400 Message-ID: References: <7e1478b6-cf00-fcbf-8c24-43bdaa57e2b6@dancol.org> <415d1cca-f32c-624e-a4be-9aadcf8a0f17@dancol.org> <83inujbpek.fsf@gnu.org> <20160830171222.GA6672@acm.fritz.box> <83inuimajv.fsf@gnu.org> <20160830174223.GB6672@acm.fritz.box> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1472726127 18209 195.159.176.226 (1 Sep 2016 10:35:27 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 1 Sep 2016 10:35:27 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Sep 01 12:35:20 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 1bfPL4-0003na-JM for ged-emacs-devel@m.gmane.org; Thu, 01 Sep 2016 12:35:18 +0200 Original-Received: from localhost ([::1]:36091 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bfPL5-0002QZ-Bj for ged-emacs-devel@m.gmane.org; Thu, 01 Sep 2016 06:35:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43016) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bfPH3-0008Re-PR for emacs-devel@gnu.org; Thu, 01 Sep 2016 06:31:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bfPGy-0005Qq-Po for emacs-devel@gnu.org; Thu, 01 Sep 2016 06:31:08 -0400 Original-Received: from [195.159.176.226] (port=51128 helo=blaine.gmane.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bfPGy-0005Qk-Ii for emacs-devel@gnu.org; Thu, 01 Sep 2016 06:31:04 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1benVq-0006oz-6r for emacs-devel@gnu.org; Tue, 30 Aug 2016 20:11:54 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 29 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:+yo6dgVar1xk7RjihoHGfFkt8a8= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 195.159.176.226 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:207052 Archived-At: > Normally the before-change-functions and the after-change-functions > hooks are called in balanced pairs around each buffer change, I could agree with that. > enabling state to be determined in a before-change function and used in an > after-change function. But this encourages reliance on this pairing, even though experience shows that it's better to try not to rely on it (both in the sense that I personally believe that it results in better designs, and in the sense that such designs will break down in the non-"normal" case). So I'm strongly opposed to such statements. > However on rare occasions, before-change-functions is not called > before a buffer change and That would be documenting bugs as being normal behavior. > after-change-functions is thus called twice in succession. Your > program should be ready to deal with such an occurrence. Two successive calls of a-c-f are indeed acceptable and code should be ready to deal with such occurrence, but only because a previous b-c-f call covered both changes, not because b-c-f failed to be called. Stefan