|
From: | Dmitry Gutov |
Subject: | Re: [Emacs-diffs] scratch/widen-less a4ba846: Replace prog-widen with consolidating widen calls |
Date: | Thu, 30 Nov 2017 10:58:47 +0000 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Thunderbird/57.0 |
On 11/30/17 8:59 AM, Dmitry Gutov wrote:
On 11/30/17 1:53 AM, Stefan Monnier wrote:Replace prog-widen with consolidating widen callsSo, IIUC the idea is that the multi-major-mode framework will *have* to use narrowing to indicate to the sub-modes the boundaries of the current chunk, right?Yes. Just like it would *have* to bind prog-indentation-context to a complex-ish value in the previous proposal.
And while the difference isn't night and day, allow me to elaborate why I think this is a move in a good direction:
- Major mode authors have been forgetting to widen in all the cases they actually have to. Or they would do that in indent-line-function, but forget in beginning-of-defun-function, etc. Now, they are *mandated* to obey the current narrowing (deleting code is easy, and some won't have delete anything at all). The indentation code might fail to work inside narrowing (like all of CC Mode, probably), but that's an orthogonal issue.
- Multi-mode packages have been using narrowing for this purpose for years, so they won't have to change much.
And, it's kind of funny, mhtml-indent-line which we've reviewed and added recently, uses narrow-to-region too. :-) While disregarding the second element of prog-indentation-context (which it set to the value "widen all you want"). Which works well enough because SMIE doesn't widen, and I've removed the `widen' call from js-mode indentation code 3.5 years ago.
I'm adding Tom and Vitalie to Cc. Maybe they have something to add.
[Prev in Thread] | Current Thread | [Next in Thread] |