From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stephen Leake Newsgroups: gmane.emacs.devel Subject: Re: Lifting all buffer restrictions in indentation functions Date: Fri, 08 Dec 2017 16:40:27 -0600 Message-ID: <86609g9738.fsf@stephe-leake.org> References: <83wp1xupqs.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1512772922 11910 195.159.176.226 (8 Dec 2017 22:42:02 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 8 Dec 2017 22:42:02 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (windows-nt) To: emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Dec 08 23:41:58 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 1eNRLB-0002z3-Q3 for ged-emacs-devel@m.gmane.org; Fri, 08 Dec 2017 23:41:57 +0100 Original-Received: from localhost ([::1]:39311 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eNRLJ-0007ZE-5l for ged-emacs-devel@m.gmane.org; Fri, 08 Dec 2017 17:42:05 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38690) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eNRJy-0006wl-2E for emacs-devel@gnu.org; Fri, 08 Dec 2017 17:40:44 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eNRJt-0003ON-2u for emacs-devel@gnu.org; Fri, 08 Dec 2017 17:40:42 -0500 Original-Received: from smtp65.ord1d.emailsrvr.com ([184.106.54.65]:58335) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eNRJs-0003Hi-UD for emacs-devel@gnu.org; Fri, 08 Dec 2017 17:40:37 -0500 Original-Received: from smtp1.relay.ord1d.emailsrvr.com (localhost [127.0.0.1]) by smtp1.relay.ord1d.emailsrvr.com (SMTP Server) with ESMTP id 2E6344006D for ; Fri, 8 Dec 2017 17:40:30 -0500 (EST) X-Auth-ID: board-president@tomahawk-creek-hoa.com Original-Received: by smtp1.relay.ord1d.emailsrvr.com (Authenticated sender: board-president-AT-tomahawk-creek-hoa.com) with ESMTPA id E20C140069 for ; Fri, 8 Dec 2017 17:40:29 -0500 (EST) X-Sender-Id: board-president@tomahawk-creek-hoa.com Original-Received: from Takver4 (76-218-37-33.lightspeed.kscymo.sbcglobal.net [76.218.37.33]) by 0.0.0.0:25 (trex/5.7.12); Fri, 08 Dec 2017 17:40:30 -0500 In-Reply-To: <83wp1xupqs.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 08 Dec 2017 18:51:55 +0200") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 184.106.54.65 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:220805 Archived-At: Eli Zaretskii writes: > Hi, Emacs. > > The issue I raise here is a spin-off from discussing the changes on > the widen-less branch, but I think it is largely independent and has > more broad effect, so IMO it should be discussed separately. > > The widen-less branch proposes to have indent-according-to-mode, > indent-for-tab-command, and indent-region call 'widen' before calling > indent-line-function. This call is unconditional, so for example the > following > > (save-excursion > (narrow-to-region START END) > (indent-for-tab-command)) > > will not do what the caller expects, because indent-line-function will > not run restricted to the region bounds, but will instead be able to > access the whole buffer. > > The rationale for this change seems to be twofold: > > . it is TRT for indentation operations > . MMM and similar features need that, and will apply the restriction > as appropriate before calling the mode-specific indentation > function > > I'm worried by widening unconditionally, because some strange mode > could need to run its indentation function restricted, and the > indentation function itself might not have enough context to narrow by > itself. > > IOW, widening unconditionally seems to invalidate potentially > legitimate uses of this functionality, so I wonder whether we should > have some "fire escape", or maybe condition this widening only on MMM > and similar modes being active. > > I'd like to hear opinions about this. If I'm the only one who is > bothered by this, then I will defer to Stefan's and Dmitry's opinions. > > TIA As I understand it, what MMM will do in these functions is change the buffer bounds to the current chunk. Since MMM needs to change the buffer bounds, why can't it just disregard the current bounds, instead of relying on the caller to widen first? -- -- Stephe