From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: phillip.lord@russet.org.uk (Phillip Lord) Newsgroups: gmane.emacs.devel Subject: Re: Unbalanced change hooks (part 2) [Documentation fix still remaining] Date: Wed, 31 Aug 2016 12:12:59 +0100 Message-ID: <87wpix5gzo.fsf@russet.org.uk> References: <83inv9hkjd.fsf@gnu.org> <83h9ashfgx.fsf@gnu.org> <831t1wharr.fsf@gnu.org> <20160810161821.GB3413@acm.fritz.box> <83wpjofttf.fsf@gnu.org> <20160810185735.GD3413@acm.fritz.box> <20160811112951.GA2154@acm.fritz.box> <87a8fue656.fsf@russet.org.uk> <834m62ntqs.fsf@gnu.org> <83lgzembwt.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1472642039 19870 195.159.176.226 (31 Aug 2016 11:13:59 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 31 Aug 2016 11:13:59 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) Cc: Stefan Monnier , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Aug 31 13:13:55 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 1bf3St-0004lq-LR for ged-emacs-devel@m.gmane.org; Wed, 31 Aug 2016 13:13:55 +0200 Original-Received: from localhost ([::1]:53521 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bf3Sr-0007vX-AF for ged-emacs-devel@m.gmane.org; Wed, 31 Aug 2016 07:13:53 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33053) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bf3SK-0007v8-Iv for emacs-devel@gnu.org; Wed, 31 Aug 2016 07:13:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bf3SJ-0000cO-I1 for emacs-devel@gnu.org; Wed, 31 Aug 2016 07:13:20 -0400 Original-Received: from cloud103.planethippo.com ([31.216.48.48]:56191) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bf3SF-0000bU-Mx; Wed, 31 Aug 2016 07:13:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=russet.org.uk; s=default; h=Content-Type:MIME-Version:Message-ID: In-Reply-To:Date:References:Subject:Cc:To:From; bh=ckX62Cz+k7E4T9RE4FvUPd4CsTh9F7OhBb1PFhOY62Y=; b=mHtaHtI0LYxUqRIBXSCpEgW660 q8sTGRC4oMR96vEU3iztJ6+neamB1Vv+4e2b1caE4Zi0B2+OfODkm5WEyQ6RIPEV16VnsSSuld7qg MxvQ8sJ/tI1YqbQANd/GsW08hPlqFVE3gRI8yYkBV6tFBQWomuFDQPJAyZ4rpmZqO+SrfXJGHSrR/ fcn70ohCVytHJ2nPiWdRqKPWn+J2jzMTx4LBGoWkzB2t0itFcZE7S/VerkHJd+zBKI0NPqZ2p4iKH Ah6zeQobKp0ARFGDh8SGSusRxlrRqMwhsOTs7shwO3Cfre1GOWuGMGAJfnNIoElN03wgfKgLLLdTm oRVPozGQ==; Original-Received: from janus-nat-128-240-225-60.ncl.ac.uk ([128.240.225.60]:48223 helo=russet.org.uk) by cloud103.planethippo.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.86_1) (envelope-from ) id 1bf3S9-000rTc-LL; Wed, 31 Aug 2016 12:13:09 +0100 In-Reply-To: <83lgzembwt.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 30 Aug 2016 19:58:26 +0300") X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - cloud103.planethippo.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - russet.org.uk X-Get-Message-Sender-Via: cloud103.planethippo.com: authenticated_id: phillip.lord@russet.org.uk X-Authenticated-Sender: cloud103.planethippo.com: phillip.lord@russet.org.uk X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 31.216.48.48 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:207019 Archived-At: Eli Zaretskii writes: >> Actually, we do have some idea beforehand, as evidenced by the fact that >> we call b-c-f with valid data. It's just that after the fact we have >> a more precise knowledge of what has actually been changed, so a-c-f can >> give more precise bounds. > > I was under the impression that Phillip wanted the data be accurate, > not just valid. Because if validity is the only requirement, we could > always call the before-change hook with the limits of the entire > buffer, and be done. Clearly, that would not be very useful, to say > the least. I want it to be as accurate as possible given the constraint of validity. If it is invalid this breaks my use case (except that I detect this and have an unoptimized fall back plan). If it is inaccurate (in the sense of wider than necessary), this makes my code potentially less efficient. >> We could also change the C code to perform this "extension" of the >> region passed to a-c-f so that the b-c-f region and the a-c-f region >> match, but that would make the region passed to a-c-f less precise, so >> those users of a-c-f which don't care about the pairing (the majority of >> the users) would be penalized (tho they'd still work correctly: just >> suboptimally) since there's no way for them to recover the >> tighter region. > > Right. The sad thing is that, certainly for subst-char-in-region, both of these pieces of information are available to the code that calls a-c-f. But I can see no clean way of signalling this information: adding the data to a-c-f would change it's interface, and storing it in global state is just ugly. Phil