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: [Emacs-diffs] scratch/widen-less a4ba846: Replace prog-widen with consolidating widen calls Date: Fri, 01 Dec 2017 21:24:56 -0500 Message-ID: References: <20171129233237.27462.23351@vcs0.savannah.gnu.org> <20171129233238.504B5204F1@vcs0.savannah.gnu.org> <5d668ce5-1482-a3d4-c01b-7d996a532567@yandex.ru> <20171130214621.GA22157@ACM> <27985594-3bb4-ce88-8928-2ccfeac13eae@yandex.ru> <20171201154913.GB3840@ACM> <3549c65b-e545-bd47-c25b-3a2c1e730804@yandex.ru> <021066bf-729d-4305-3e09-9b76ba353e0d@yandex.ru> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1512181515 14298 195.159.176.226 (2 Dec 2017 02:25:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 2 Dec 2017 02:25:15 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Alan Mackenzie , Tom Tromey , Vitalie Spinu , emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Dec 02 03:25:08 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 1eKxUH-000364-Eo for ged-emacs-devel@m.gmane.org; Sat, 02 Dec 2017 03:25:05 +0100 Original-Received: from localhost ([::1]:33951 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKxUO-0004Mg-O5 for ged-emacs-devel@m.gmane.org; Fri, 01 Dec 2017 21:25:12 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58835) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKxUE-0004MP-V8 for emacs-devel@gnu.org; Fri, 01 Dec 2017 21:25:03 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eKxUA-0005AO-0h for emacs-devel@gnu.org; Fri, 01 Dec 2017 21:25:02 -0500 Original-Received: from pmta11.teksavvy.com ([76.10.157.34]:55847) by eggs.gnu.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.71) (envelope-from ) id 1eKxU9-00059u-QT for emacs-devel@gnu.org; Fri, 01 Dec 2017 21:24:57 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2F2BwD6DSJa/1rWbkFcHAEBAQQBAQoBA?= =?us-ascii?q?YM8gVSDW4tfjgIBgXw0AZhdhT8EAgKFKkQUAQEBAQEBAQEBA2gohSQBBAFWIwU?= =?us-ascii?q?LCw4mEhQYDSQxiXwIqSCKWQEBAQEGAgEljDWLGQWTF4YeiS2LFJV2h1yYAzYjg?= =?us-ascii?q?U0yGggwgmSDBoFsI4o/AQEB?= X-IPAS-Result: =?us-ascii?q?A2F2BwD6DSJa/1rWbkFcHAEBAQQBAQoBAYM8gVSDW4tfjgI?= =?us-ascii?q?BgXw0AZhdhT8EAgKFKkQUAQEBAQEBAQEBA2gohSQBBAFWIwULCw4mEhQYDSQxi?= =?us-ascii?q?XwIqSCKWQEBAQEGAgEljDWLGQWTF4YeiS2LFJV2h1yYAzYjgU0yGggwgmSDBoF?= =?us-ascii?q?sI4o/AQEB?= X-IronPort-AV: E=Sophos;i="5.45,348,1508817600"; d="scan'208";a="10964013" Original-Received: from 65-110-214-90.cpe.pppoe.ca (HELO pastel.home) ([65.110.214.90]) by smtp.teksavvy.com with ESMTP; 01 Dec 2017 21:24:56 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 599E961445; Fri, 1 Dec 2017 21:24:56 -0500 (EST) In-Reply-To: <021066bf-729d-4305-3e09-9b76ba353e0d@yandex.ru> (Dmitry Gutov's message of "Fri, 1 Dec 2017 20:50:02 +0000") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 76.10.157.34 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:220605 Archived-At: >>>> (defvar prog-widen-function #'widen) >>>> (defun prog-widen () (funcall prog-widen-function)) > The idea for multi-mode packages has always been to make do without making > the major modes actually aware of hunk boundaries. [...] > And the snippet of code won't make them aware either, since the chunk > boundaries are conveyed via narrowing only in particular dynamic contexts, > such as when indent-line-functions is called. But widening/narrowing to the current chunk might be needed for commands specific to the major-mode, hence commands which the MMM framework doesn't know about (and hence doesn't wrap like it does for indent-line-function). > You probably mean adding a variable prog-first-column-function, then? Right. > Or will we expect multi-mode packages to simply advise the prog-first-column > function? I'm fine with that. Give that it's introduced specifically so it can be changed, relying advice would be a bad idea (especially since the advice would generally want to be buffer-local, which is easier to get with a variable). >> Here are some examples I can think of: >> - auto-fill-mode may like to compute the hypothetical indentation that >> would result from inserting a newline somewhere (and do that before >> touching the buffer). > Won't it need to call indent-line-function to find out how much the next > line should be indented? No because indent-line-function would actually perform the re-indentation, whereas we only want to calculate the hypothetical new indentation column. See `smie-auto-fill`. >> - some package may like to highlight lines which aren't currently >> indented right (so, it won't call indent-according-to-mode, but >> it will need to compute the "desired" indentation). > This example will *definitely* need to call indent-line-function. Again no, because it doesn't want to modify the buffer. > And both of them should be solved by exchanging indent-line-function for > (non-mutating) line-intentation-function. But that's a change for > another day. Ah, yes, that would be a good change. Arguably `smie-indent-functions` already provides that functionality. > I'm sure there can be. A complete proposal to let the modes know chunk > boundaries, etc, has yet to be finalized, however. And just having font-lock > and indentation work reliably in multi-mode contexts will > be a significant win. Agreed. As far as I'm concerned your proposal is good to go, which is why I was talking about subsequent changes. BTW, could we get some kind of multi-mode package in elpa.git or emacs.git to go along with that (it doesn't have to be fancy, but it's important that it doesn't have any submode-specific hacks). Maybe a generalization of mhtml-mode, or something separate but whose design is such that it can aim to (slowly) merge with mhtml-mode? Stefan