Subject: Re: bug#33794: 26.1; electric-pair-mode breaks auto-newline minor mode of cc-mode

From: João Távora <[email-masked]>
Date: Sat, 22 Dec 2018 13:47:31 +0000

Hello Alan,

I will be, again, responding to your two emails in one.

Alan Mackenzie <[email-masked]> writes:

> This clearly isn't true at the moment.  Have you tested it with, for
> example, Cperl Mode, or Vera Mode?  That characteristic is an
> aspiration, which is laudable.

Fair enough.  But what are the bugs in those modes?  I've just tested it
briefly there and it seems to work.  I type parenthesis of various kinds
and they get autopaired and autoskipped.

> I think that what is missing from this history is the stage where the
> idea with proposed solution is first discussed on emacs-devel, where
> conceptual problems can be identified and resolved.  As a result, e-p-m
> is only compatible with some major modes; it is incompatible with those
> that explicitly call self-insert-function as part of a command bound to
> a key which is usually self-inserting.  There are quite a few such
> modes.

I think, but I'm not sure, that anycommand that eventually calls
post-self-insert-hook would also work.

> The answer is, of course, that "{" should be inserted into the buffer.
> With electric-pair-mode-enabled, what actually happens is that "{}"
> gets inserted instead.  This is broken.  I ask you to consider this
> paragraph very carefully rather than reacting emotionally against it.

Alan, OK, that is your opinion, but please don't tell me which part of
my brain to use when reacting to something, that's a wee bit too
arrogant...

> Again, you're much more familiar with electric-indent-mode, and friends.
> Do they also break self-insert-command?

No idea.  And I'm not very familiar with them, no.

Look, the framework for inserting extra things in post-self-insert-hook
was already in place when I joined the party.  Be it space for indent or
newlines for layout or delimiters for pairing.  I just followed those
tracks, which apparently cause you dismay.  And I enjoyed it, hehehe,
sorry :-) it really did make coding easier.

> with a few quick hacks can only lead to frustration all round, and to
> tears.

My tears, certainly, because I'm such an emotional trainwreck :-)

> self-insert-command needs to behave correctly, according to its
> documentation.  It is surely not beyond us to fix these problems.

Of course there are different ways to solve problems.  I think the way I
am exploring is the best.  You think otherwise, that's OK.

> Can't say exactly, but a quick hack on some minor mode which violates
> and attempts to duplicate the conventions of the major mode, not
> intensively tested, is not going to work.

Who convened where to decide this that you call "convention"?

And exactly what conventions is electric-layout-mode breaking (btw, you
should be aware that electric-layout-mode exists since 2010: Again, long
before I joined the party).

>> What bugs?  If you know of any, it would be good to report them, right?
> See above.

I did, but I don't see any reports of flawed behaviour there.  I'm not
saying there aren't any bugs: I'm just saying you should first look to
indications or traces of these bugs before publically stating that there
are.

> Which is the wrong thing to do.

Did you see The Big Lebowsky by the Cohen brothers? :-) There's a nice
riposte there, apropos opinions.

> I don't think she wants to spend lots of time debugging (which is our
> job).

Yes, maybe.  It's up to her, of course.  But it's not my "job", it's
something I do for fun.  And Alan, I have some experience in dealing
with user's reports too (neatly over a decade long, since that seems to
matter to you) and some users are more cooperative than others, and
that's fine.

> Eh??  The auto-newline facility is there and is optional.  It is an
> integral part of CC Mode.  Where is this "forcing" you're referring
> to?

Fair enough, no "forcing".  It sounded like you were suggesting to
Beatrix that she stay away from any solution except yours, for no reason
other than your authority as CC-mode maintainer and some unsubstantiated
prophecies of disaster.

> Is there any documentation for the connections between
> electric-pair-mode and the other electric-... facilities?

I don't think so: unless you count comments.  The interfaces they adhere
to to work together is post-self-insert-hook, with a few hacks here and
there marked FIXME by Stefan.

> is social: somebody inventing facilities which impose constraints on
> Emacs in general, and imposing these on Emacs without public
> discussion.  That cannot end well, and it hasn't ended well.

There's something here that doesn't make sense: you repudiate
"constraints", but you laud "convention".  But, in my view, pieces of
software uses "interfaces" to work together.

We're just discussing here who violated them, that's all.

João

PS: Without public discussion??? This discussion _is_ public! :-)