From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [Patch] hard-widen-limits [was Re: Syntax tables for multiple modes [was: bug#22983: syntax-ppss returns wrong result.]] Date: Mon, 21 Mar 2016 08:39:28 -0400 Message-ID: References: <20160311151512.GD2888@acm.fritz.box> <20160311212410.GG2888@acm.fritz.box> <73903215-f94b-e194-7bfe-0d6350c95769@yandex.ru> <20160311221540.GH2888@acm.fritz.box> <2c301ec9-041d-9172-d628-479062314b23@yandex.ru> <20160314151621.GF1894@acm.fritz.box> <874mc2dqtk.fsf@gmail.com> <87egb5cpmg.fsf@gmail.com> <87a8lsd4j3.fsf@gmail.com> <87mvpsbeok.fsf_-_@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1458564001 4861 80.91.229.3 (21 Mar 2016 12:40:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 21 Mar 2016 12:40:01 +0000 (UTC) Cc: Alan Mackenzie , emacs-devel , Dmitry Gutov To: Vitalie Spinu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Mar 21 13:39:52 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ahz7e-00017g-P7 for ged-emacs-devel@m.gmane.org; Mon, 21 Mar 2016 13:39:50 +0100 Original-Received: from localhost ([::1]:57531 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ahz7e-0000FC-78 for ged-emacs-devel@m.gmane.org; Mon, 21 Mar 2016 08:39:50 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42497) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ahz7O-0000Es-VR for emacs-devel@gnu.org; Mon, 21 Mar 2016 08:39:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ahz7K-00049k-0C for emacs-devel@gnu.org; Mon, 21 Mar 2016 08:39:34 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:49218) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ahz7J-00049g-Rw for emacs-devel@gnu.org; Mon, 21 Mar 2016 08:39:29 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CXDQA731xV/3D5d0tcgxCEAshgBAICgTw8EQEBAQEBAQGBCkEFg10BAQRWIxALNAcLFBgNJIg/zyMBAQEBBgEBAQEeizqFBQeELQWzP4FFI4I7gVkigngBAQE X-IPAS-Result: A0CXDQA731xV/3D5d0tcgxCEAshgBAICgTw8EQEBAQEBAQGBCkEFg10BAQRWIxALNAcLFBgNJIg/zyMBAQEBBgEBAQEeizqFBQeELQWzP4FFI4I7gVkigngBAQE X-IronPort-AV: E=Sophos;i="5.13,465,1427774400"; d="scan'208";a="197397236" Original-Received: from 75-119-249-112.dsl.teksavvy.com (HELO pastel.home) ([75.119.249.112]) by ironport2-out.teksavvy.com with ESMTP; 21 Mar 2016 08:39:28 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id BE10E605A0; Mon, 21 Mar 2016 08:39:28 -0400 (EDT) In-Reply-To: <87mvpsbeok.fsf_-_@gmail.com> (Vitalie Spinu's message of "Mon, 21 Mar 2016 06:08:59 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:201982 Archived-At: > + DEFVAR_LISP ("hard-widen-limits", Vhard_widen_limits, > + doc: /* When non-nil `widen` will widen to these limits. > +Must be a cons of the form (MIN . MAX) where MIN and MAX are integers or markers. */); > + Vhard_widen_limits = Qnil; Sorry to nitpick, but I'm not completely happy with this API. As an implementation it might be OK, but I can imagine wanting to change the implementation in the future but being stuck by the exposed internals. So I suggest we instead expose only a new primitive "call-with-hard-narrowing" which could look like: (defun call-with-hard-narrowing (from to func) (make-local-variable 'internal--hard-widen-limits) (let ((internal--hard-widen-limits (cons from to))) (funcall func))) which could be supplemented with a corresponding macro (defmacro with-hard-narrowing (from to &rest body) `(call-with-hard-narrowing ,from ,to (lambda () ,body))) -- Stefan