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: New hook before-region-change-functions wanted Date: Sat, 9 Sep 2017 08:33:26 +0000 Message-ID: <20170909083326.GA5194@ACM> References: <20170908144657.GA3463@ACM> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1504946320 9324 195.159.176.226 (9 Sep 2017 08:38:40 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 9 Sep 2017 08:38:40 +0000 (UTC) User-Agent: Mutt/1.7.2 (2016-11-26) Cc: emacs-devel@gnu.org To: Richard Stallman Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Sep 09 10:38:36 2017 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 1dqbHY-0001mZ-Tc for ged-emacs-devel@m.gmane.org; Sat, 09 Sep 2017 10:38:29 +0200 Original-Received: from localhost ([::1]:48677 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dqbHe-00088f-F3 for ged-emacs-devel@m.gmane.org; Sat, 09 Sep 2017 04:38:34 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46071) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dqbHY-00088W-Lx for emacs-devel@gnu.org; Sat, 09 Sep 2017 04:38:29 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dqbHV-0001aZ-Jf for emacs-devel@gnu.org; Sat, 09 Sep 2017 04:38:28 -0400 Original-Received: from ocolin.muc.de ([193.149.48.4]:48464 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1dqbHV-0001WD-CI for emacs-devel@gnu.org; Sat, 09 Sep 2017 04:38:25 -0400 Original-Received: (qmail 68531 invoked by uid 3782); 9 Sep 2017 08:38:20 -0000 Original-Received: from acm.muc.de (p548C7C7C.dip0.t-ipconnect.de [84.140.124.124]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sat, 09 Sep 2017 10:38:19 +0200 Original-Received: (qmail 5234 invoked by uid 1000); 9 Sep 2017 08:33:26 -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.4 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:218046 Archived-At: Hello, Richard. On Fri, Sep 08, 2017 at 18:22:15 -0400, Richard Stallman wrote: > [[[ To any NSA and FBI agents reading my email: please consider ]]] > [[[ whether defending the US Constitution against all enemies, ]]] > [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > > I would like to implement a new abnormal hook, > > before-change-region-functions. It would be called just before a change > > in the buffer's restriction (i.e., from widen and from narrow-to-region) > > and each function on it would take two parameters, the beginning and end > > of the new region being set. > That kind of hook is pandora's box. It is too powerful, and would > interact in complex ways. There will be many cases that are hard to > implement correctly, or cause trouble. To implement this probably > means future hassles for ourselves and for package developers. I actually implemented it, and it worked as intended. It's not often I get criticised for proposing something too powerful. > > The reason I want it is as part of the solution to bug #22983 > > (syntax-ppss returns wrong result). I envisage two (or possibly more) > > mutually independent caches, and a switch being made to the appropriate > > cache when the region is changed. > For this, all you need to do is record, for each alternative cache, > what buffer restrictions it corresponds to. Then use the right cache. > That is a much safer way to do it. OK. I will keep my new implementation under lock and key. As you suggest, managing without it is not difficult. Thanks for the criticism. > -- > Dr Richard Stallman > President, Free Software Foundation (gnu.org, fsf.org) > Internet Hall-of-Famer (internethalloffame.org) > Skype: No way! See stallman.org/skype.html. -- Alan Mackenzie (Nuremberg, Germany).