all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Eli Zaretskii <eliz@gnu.org>
Cc: acm@muc.de, tom@tromey.com, monnier@iro.umontreal.ca,
	spinuvit@gmail.com, emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] scratch/widen-less a4ba846: Replace prog-widen with consolidating widen calls
Date: Sun, 3 Dec 2017 19:43:31 +0000	[thread overview]
Message-ID: <cdede7a9-b531-71db-1511-55e58b11aa77@yandex.ru> (raw)
In-Reply-To: <83k1y3zq2n.fsf@gnu.org>

On 12/3/17 5:20 PM, Eli Zaretskii wrote:

>> This feature is *not* targeted at Emacs development.
> 
> It is for me.

You are not working on it. You've expressed no interest in this problem 
until now. Maybe delegate the basic requirements, at least, to the 
people who did?

>>> Indeed; and C-like languages are quite popular among them.
>>
>> Not in comparison to JS, CSS and HTML.
> 
> Maybe in your world, but not in mine.  So we will have to agree (or
> disagree, if you want) that both worlds need to be catered to.

Yes, and they can be catered to, *as soon as* the authors of each 
individual major mode make the effort to support the feature.

Having it work in HTML, CSS, JS and Ruby is in no way dependent in 
investigating and fixing the behemoth that CC Mode is.

>>> How will we look if we support JS and Ruby embedded in HTML, but not C
>>> code embedded in Yacc grammars nor Awk snippets embedded in shell
>>> scripts?  Both are quite frequent out there.  We will be laughed at.
>>
>> We'll be fine.
> 
>  From your POV, maybe.  Not from mine.

Eli, we already have a feature in Emacs (prog-indentation-context) that 
does not adhere to your (unreasonably high) requirements.

Let's at least take it out, then.

>>> Convince Alan to do what?
>>
>> To adhere to the current proposal (avoid widening in
>> indent-line-function and font-lock-keywords, to start with).
> 
> We need to understand the full extent of problems, and then we need to
> see how to go about them, at least design-wise.  "To start with" is a
> start, but it cannot be the middle and the end.

The full extent of the problem can be realized as one tried to do what I 
said, step by step. And see what else can be is going wrong.

> If he agrees, that'd be swell.  If not, I see no reason why someone
> else couldn't do that and report back, it's not like CC Mode is hard
> to activate and see what problems pop up.

Please go ahead and do it, then.

If you're really expecting me to do it, it's unrealistic. Getting 
oriented in CC Mode will take days, if not weeks. And I have no interest 
nor energy to do that.

>> I have a rough understanding of the issue, but since I haven't reached a
>> working state, I don't know how many pitfalls there are left.
> 
> How about describing what you do know?

Already did. Last time I tried investigating it was 1-2 years ago, and 
at no point I felt I reached an understanding of why CC Mode exhibits 
the problems it does, or what I could change to fix them.

So all I have are vague recollections.

>> I imagine the process itself might be trickier than expected. Various
>> primitives use caches that save context information. What is such
>> primitive to do if the cache contains "beginning of nesting" outside of
>> the current restriction, and the logic of said primitive says "go to the
>> beginning of the current function and do such and such"? The answer
>> isn't obvious to me.
> 
> I don't understand: AFAIU in the use cases supported by MMM there can
> be nothing outside of the current restriction that is of interest for
> the mode which supports the chunk under the restriction.  So what kind
> of "nesting outside of the current restriction" are we talking about,
> and how does it come into play?

Imagine if the chunk contains only this:

    <

And, to fontify it, CC Mode, tried to find out what syntactic element it 
is, and to do that, calls some function that uses a specialized cache 
that's contained in a variable that mmm-mode knows nothing about.

And that cache point to a position outside of the current restriction. 
Confusion ensues. I've seen errors originating from that (I think), but 
can't recall the exact sequence of calls.

>> The proposal itself is very small, and there's not much to explain. Just
>> look at the changes in the manual, in this branch.
> 
> That just removes text, more or less, and what it adds doesn't explain
> itself well enough, sorry.  Otherwise I wouldn't have asked these
> questions, believe me.

The text it adds is more important. Including the mentions of 
font-lock-keywords and syntax-propertize-function, by the way.

>> It simply facilitates what mmm-mode (and other modes, including
>> mhtml-mode) has been doing for years, with varying success.
> 
> Sorry, that doesn't help me understand the proposal, as I don't know
> mmm-mode well enough.  How hard is it to just describe the idea in a
> few sentences?

Not really sure what to describe.

To fontify (or indent) a chunk, mmm-mode narrows to its bounds, and 
calls the corresponding indent-line-function (or applies 
font-lock-keywords). If either of those calls (widen), that causes problems.

So we want to document a convention that they don't call widen. That's 
really it.

>> I never actually supported it, just stopped arguing because I didn't
>> have a good alternative idea. Now I do, I think. And there is some
>> agreement from Stefan.
> 
> (whose change of hearts is also a mystery for me)

Sometimes a better technical proposal does that.

For more context: we're been waiting for some kind of improvement for 
this problem for years. Then prog-indentation-context came along, and it 
wasn't terrible (though it didn't solve all of the problems we wanted). 
That seemed a good enough reason to adopt it, to some of us.

Since then, for the mentioned two years, the original author contributed 
no improvements aside from the mentioned support in python-mode, and no 
other mode added support for it, or used it, inside or outside Emacs. So 
it seems to me like it pretty much failed.

>>> How do you address the issues which prog-indentation-context did
>>> (e.g., if the embedded chunk of code is incomplete, and perhaps even
>>> syntactically invalid)?
>>
>> prog-indentation-context never addressed that issue, and we don't
>> either.
> 
> I think it does, at least to some extent.

Not any more than scratch/widen-less.

> And even if I'm wrong, then
> what is the equivalent of what it does address in your proposal?

There are full equivalents.

We keep 'prog-first-column' from that proposal, and instead of allowing 
MMM to indicate the chunk bounds through prog-indentation-context, we 
allow MMM to apply narrowing directly, and that modes honor it.

> In any case, we should at least have provisions for supporting that
> within the proposed framework, and we should be fairly certain that
> supporting that later will not blow things up.

I have honestly no idea where to begin in addressing that issue.

On the other hand, there are third-party MMM framework that function 
within these limitations, and are helpful to users.

>> That's the thing: we're not giving up much
> 
> For the modes that are dear to your heart, maybe.  But that's not all
> Emacs should support well, IMO.

For all modes. The user won't lose any functionality, at all. Even if 
the programmer might have to spend some effort for that to happen, for 
some of the modes.

> The 'widen' thing is a non-issue; it's the other stuff I'm worried
> about, mostly because it is left unsaid, undiscussed, and I fear
> uncatered-to by the design.

What other stuff? We basically say "widen happens in one place, don't do 
that again", and that's it.

>> Not really. There's a minor issue of whether to make prog-first-column a
>> variable, or a hook right away, but the importance of that choice isn't big.
> 
> The fact is, it isn't done yet, let alone well-tested.

It can be "done" in a day or two.

>>> That code is in Emacs for more than 2 years.  It was admitted with
>>> Stefan's full support, and at least ANTLR needs it in conjunction with
>>> Python.
>>
>> Transitioning from prog-indentation-context to the new approach is very
>> easy.
> 
> That's what I thought.  And that's why we should do that
> simultaneously with landing the new approach.  There's no reason to do
> that earlier.

Why confuse the language modes authors?

>> So really, it's been here for 2 years, and virtually nobody's using it,
>> or improving it.
> 
> It's definitely used by its author, so "nobody uses it" is untrue, and
> even unfair: that feature was accepted by Stefan, under the assumption
> that it will be used.

...and improved, and support for CC Mode would be contributed. Which it 
wasn't.

The author, who's the only user of prog-indentation-context, can 
transition to the new convention trivially.

>>> Removing it without having some alternative again makes no
>>> sense to me.
>>
>> You have the alternative, though.
> 
> No, we don't.  You are asking to remove the code _before_ the
> alternative lands.

You have the choice of accepting the alternative sooner, though.

>>> We should discuss this when the incompatible code lands;
>>
>> How about we discuss it now?
> 
> The incompatible code didn't land yet.  But feel free to include the
> replacement in your branch.

It's in there already.

>> Take a look at any third-party packages. I'm willing to bet none use
>> prog-indentation-context yet.
> 
> We cannot know that.  Once the code is that long with us, we cannot
> throw it away without a equivalent replacement.  And I see no reason
> to do that now, since the fact that this code will exist in Emacs 26
> doesn't hurt anyone, especially since the replacement will be easy, as
> you say.

Well... you have a point there. The result will be pretty ugly, though. 
Adding an API in one version, and removing it in another.

They are incompatible with each other, so it's not like there can be a 
smooth transition.



  reply	other threads:[~2017-12-03 19:43 UTC|newest]

Thread overview: 194+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20171129233237.27462.23351@vcs0.savannah.gnu.org>
     [not found] ` <20171129233238.504B5204F1@vcs0.savannah.gnu.org>
2017-11-30  1:53   ` [Emacs-diffs] scratch/widen-less a4ba846: Replace prog-widen with consolidating widen calls Stefan Monnier
2017-11-30  8:59     ` Dmitry Gutov
2017-11-30 10:58       ` Dmitry Gutov
2017-11-30 15:31         ` Tom Tromey
2017-11-30 21:28           ` Dmitry Gutov
2017-11-30 21:46         ` Alan Mackenzie
2017-11-30 23:03           ` [SUSPECTED SPAM] " Stefan Monnier
2017-12-01 16:07             ` Alan Mackenzie
2017-11-30 23:09           ` Dmitry Gutov
2017-12-01 15:49             ` Alan Mackenzie
2017-12-01 16:26               ` Stefan Monnier
2017-12-01 18:20                 ` Alan Mackenzie
2017-12-01 18:59                 ` Dmitry Gutov
2017-12-01 19:51                   ` Stefan Monnier
2017-12-01 20:50                     ` Dmitry Gutov
2017-12-02  2:24                       ` Stefan Monnier
2017-12-02 20:01                         ` Dmitry Gutov
2017-12-02 23:47                           ` Stefan Monnier
2017-12-03  3:38                             ` Eli Zaretskii
2017-12-03 23:43                               ` Dmitry Gutov
2017-12-04  3:38                                 ` Eli Zaretskii
2017-12-04 11:53                                   ` Dmitry Gutov
2017-12-04 16:41                                     ` Eli Zaretskii
2017-12-04 17:45                                       ` Stefan Monnier
2017-12-05  0:10                                       ` Dmitry Gutov
2017-12-03 16:42                             ` Dmitry Gutov
2017-12-03 21:23                               ` Stefan Monnier
2017-12-03 23:58                                 ` Dmitry Gutov
2017-12-01 17:06               ` Drew Adams
2017-12-01 18:03               ` Stefan Monnier
2017-12-01 21:27                 ` Vitalie Spinu
2017-12-01 21:38                   ` Dmitry Gutov
2017-12-01 22:45                 ` Alan Mackenzie
2017-12-02  2:53                   ` Stefan Monnier
2017-12-02 14:02                     ` Tom Tromey
2017-12-02 23:48                   ` Richard Stallman
2017-12-01 19:13               ` Dmitry Gutov
2017-12-01 22:35                 ` Alan Mackenzie
2017-12-01 23:24                   ` Dmitry Gutov
2017-12-02  2:47                     ` Stefan Monnier
2017-12-02 20:28                       ` Alan Mackenzie
2017-12-03  0:03                         ` Stefan Monnier
2017-12-03 12:18                           ` Alan Mackenzie
2017-12-03 16:02                             ` Dmitry Gutov
2017-12-03  3:52                         ` Dmitry Gutov
2017-12-03 14:54                           ` Alan Mackenzie
2017-12-03 18:40                             ` Stefan Monnier
2017-12-03 22:26                               ` Alan Mackenzie
2017-12-03 23:42                                 ` Stefan Monnier
2017-12-04  2:33                                   ` syntax-propertize and CC-mode (was: [Emacs-diffs] scratch/widen-less a4ba846: Replace prog-widen with consolidating widen calls) Stefan Monnier
2017-12-03 23:53                             ` [Emacs-diffs] scratch/widen-less a4ba846: Replace prog-widen with consolidating widen calls Dmitry Gutov
2017-12-02  8:27                     ` Eli Zaretskii
2017-12-02 10:50                       ` Dmitry Gutov
2017-12-02 11:10                         ` Eli Zaretskii
2017-12-02 16:41                           ` Stefan Monnier
2017-12-02 17:13                             ` Eli Zaretskii
2017-12-02 17:53                               ` Stefan Monnier
2017-12-02 18:33                                 ` Eli Zaretskii
2017-12-02 20:18                               ` Dmitry Gutov
2017-12-02 20:14                           ` Dmitry Gutov
2017-12-02 20:58                             ` Eli Zaretskii
2017-12-02 21:35                               ` Dmitry Gutov
2017-12-03 15:28                                 ` Eli Zaretskii
2017-12-03 16:35                                   ` Dmitry Gutov
2017-12-03 17:20                                     ` Eli Zaretskii
2017-12-03 19:43                                       ` Dmitry Gutov [this message]
2017-12-04 15:52                                         ` Eli Zaretskii
2017-12-04 16:35                                           ` Stefan Monnier
2017-12-04 16:56                                             ` Eli Zaretskii
2017-12-04 22:57                                               ` Dmitry Gutov
2017-12-04 23:27                                           ` Dmitry Gutov
2017-12-03 18:59                                     ` Alan Mackenzie
2017-12-03 19:25                                       ` Eli Zaretskii
2017-12-03 21:20                                         ` Alan Mackenzie
2017-12-04 16:10                                           ` Eli Zaretskii
2017-12-04 16:23                                             ` Alan Mackenzie
2017-12-04 16:48                                               ` Eli Zaretskii
2017-12-03 22:01                                       ` Stefan Monnier
2017-12-04  0:37                                       ` Dmitry Gutov
2017-12-04 15:52                                         ` Alan Mackenzie
2017-12-04 16:46                                           ` Eli Zaretskii
2017-12-05 13:08                                           ` Dmitry Gutov
2017-12-05 19:01                                             ` CC Mode in MMM Mode(s). [Was: Re: [Emacs-diffs] scratch/widen-less a4ba846: Replace prog-widen with consolidating widen calls] Alan Mackenzie
2017-12-05 23:34                                               ` Dmitry Gutov
2017-12-06 18:19                                                 ` CC Mode in MMM Mode(s) Alan Mackenzie
2017-12-07  0:21                                                   ` Dmitry Gutov
2017-12-07 19:49                                                     ` Richard Stallman
2017-12-07 23:43                                                       ` Dmitry Gutov
2017-12-08 21:36                                                         ` Richard Stallman
2017-12-09 15:20                                                           ` Dmitry Gutov
2017-12-03 21:52                                   ` [Emacs-diffs] scratch/widen-less a4ba846: Replace prog-widen with consolidating widen calls Stefan Monnier
2017-12-04  0:03                                     ` Dmitry Gutov
2017-12-04  2:24                                       ` [SUSPECTED SPAM] " Stefan Monnier
2017-12-04 10:03                                         ` Dmitry Gutov
2017-12-04 16:21                                         ` Eli Zaretskii
2017-12-04 17:12                                           ` Stefan Monnier
2017-12-04 17:40                                             ` Eli Zaretskii
2017-12-04 17:52                                               ` Stefan Monnier
2017-12-04 19:53                                                 ` Eli Zaretskii
2017-12-04 20:36                                                   ` Eli Zaretskii
2017-12-04 21:00                                                   ` Stefan Monnier
2017-12-04 21:50                                                   ` Dmitry Gutov
2017-12-06 18:41                                               ` Dmitry Gutov
2017-12-09 10:47                                                 ` Eli Zaretskii
2017-12-09 11:05                                                   ` Eli Zaretskii
2017-12-10  5:01                                                     ` Stefan Monnier
2017-12-10  6:53                                                       ` Eli Zaretskii
2017-12-10 20:08                                                         ` Stefan Monnier
2017-12-11 14:18                                                         ` Getting rid of prog-indentation-context Stefan Monnier
2017-12-11 16:18                                                           ` Eli Zaretskii
2017-12-11 17:08                                                             ` Stefan Monnier
2017-12-11 17:26                                                               ` Stefan Monnier
2017-12-11 18:02                                                               ` Eli Zaretskii
2017-12-11 18:53                                                                 ` Ingo Lohmar
2017-12-11 21:42                                                                   ` Dmitry Gutov
2017-12-09 17:56                                                   ` [SUSPECTED SPAM] Re: [Emacs-diffs] scratch/widen-less a4ba846: Replace prog-widen with consolidating widen calls John Wiegley
2017-12-10 20:19                                                     ` Dmitry Gutov
2017-12-10 20:38                                                       ` Stefan Monnier
2017-12-10 21:41                                                         ` Dmitry Gutov
2017-12-11  9:53                                                           ` Tom Tromey
2017-12-11 15:31                                                             ` Stefan Monnier
2017-12-10 20:39                                                       ` Eli Zaretskii
2017-12-10 21:39                                                         ` [SUSPECTED SPAM] Re: [Emacs-diffs] scratch/widen-less a4ab846: " John Wiegley
2017-12-10 21:43                                                           ` Dmitry Gutov
2017-12-10 21:53                                                         ` [SUSPECTED SPAM] Re: [Emacs-diffs] scratch/widen-less a4ba846: " Dmitry Gutov
2017-12-11 16:04                                                           ` Eli Zaretskii
2017-12-11 16:25                                                             ` Dmitry Gutov
2017-12-11 17:43                                                               ` Eli Zaretskii
2017-12-11 18:22                                                                 ` Eli Zaretskii
2017-12-11 20:47                                                                   ` John Wiegley
2017-12-11 21:35                                                                     ` Dmitry Gutov
2017-12-11 21:43                                                                       ` John Wiegley
2017-12-14  9:32                                                                         ` Dmitry Gutov
2017-12-14 13:20                                                                           ` Dmitry Gutov
2017-12-15 11:56                                                                             ` Dmitry Gutov
2017-12-14 14:01                                                                           ` Stefan Monnier
2017-12-14 14:17                                                                             ` Dmitry Gutov
2017-12-14 14:32                                                                               ` Stefan Monnier
2017-12-14 15:17                                                                                 ` Robert Weiner
2017-12-15 11:54                                                                                   ` Dmitry Gutov
2017-12-15 11:54                                                                                 ` Dmitry Gutov
2017-12-20  0:08                                                                           ` Dmitry Gutov
2017-12-20  2:41                                                                             ` Stefan Monnier
2017-12-20 19:13                                                                             ` John Wiegley
2017-12-20 22:30                                                                               ` Dmitry Gutov
2017-12-21  1:33                                                                                 ` John Wiegley
2017-12-21 22:07                                                                                   ` Dmitry Gutov
2017-12-21 23:49                                                                                     ` John Wiegley
2017-12-11 17:21                                                             ` Stefan Monnier
2017-12-11 18:04                                                               ` Eli Zaretskii
2017-12-11 22:20                                                                 ` Stefan Monnier
2017-12-10 22:43                                                   ` Dmitry Gutov
2017-12-10 23:30                                                   ` Dmitry Gutov
2017-12-11  0:26                                                     ` Dmitry Gutov
2017-12-04 21:46                                             ` Dmitry Gutov
2017-12-04 22:05                                               ` Stefan Monnier
2017-12-04 22:45                                                 ` Dmitry Gutov
2017-12-05  6:03                                                   ` Eli Zaretskii
2017-12-05 10:42                                                     ` Dmitry Gutov
2017-12-05 17:49                                                       ` Eli Zaretskii
2017-12-04 16:12                                     ` Eli Zaretskii
2017-12-04 16:49                                       ` Stefan Monnier
2017-12-04 17:28                                         ` Eli Zaretskii
2017-12-04 21:52                                           ` Dmitry Gutov
2017-12-05  5:08                                             ` Eli Zaretskii
2017-12-05  5:33                                               ` Eli Zaretskii
2017-12-05 10:55                                                 ` Dmitry Gutov
2017-12-05 17:53                                                   ` Eli Zaretskii
2017-12-05 18:40                                                     ` Dmitry Gutov
2017-12-05 20:49                                                       ` Eli Zaretskii
2017-12-05 23:16                                                         ` Dmitry Gutov
2017-12-06  9:28                                                           ` Eli Zaretskii
2017-12-06 13:36                                                             ` Dmitry Gutov
2017-12-08 16:41                                                               ` Eli Zaretskii
2017-12-09 15:17                                                                 ` Dmitry Gutov
2017-12-09 15:43                                                                   ` Eli Zaretskii
2017-12-10 19:59                                                                     ` Dmitry Gutov
2017-12-10 20:04                                                                       ` Eli Zaretskii
2017-12-05 12:55                                               ` Dmitry Gutov
2017-12-05 17:57                                                 ` Eli Zaretskii
2017-12-05 18:54                                                   ` Dmitry Gutov
2017-12-05 20:48                                                     ` Eli Zaretskii
2017-12-05 21:08                                                       ` Ingo Lohmar
2017-12-06  9:26                                                         ` Eli Zaretskii
2017-12-06 13:37                                                       ` Dmitry Gutov
2017-12-15 15:48 Wedler, Christoph
2017-12-16 15:00 ` Stefan Monnier
2017-12-16 17:34 ` Dmitry Gutov
2017-12-18 12:39   ` Wedler, Christoph
2017-12-18 14:50     ` Dmitry Gutov
2017-12-18 17:41       ` Wedler, Christoph
2017-12-19  0:27         ` Dmitry Gutov
2017-12-19 11:27           ` Wedler, Christoph
2017-12-20  0:07             ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cdede7a9-b531-71db-1511-55e58b11aa77@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=acm@muc.de \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=spinuvit@gmail.com \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.