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

From: João Távora <[email-masked]>
Date: Sun, 23 Dec 2018 21:38:29 +0000

Hello Alan,

Alan Mackenzie <[email-masked]> writes:

> Hello, João.

> CC Mode is not customisable in this way, any more than any other major
> mode.  Ripping out and replacing the innards of Lisp code is called
> "hacking", not "customisation".

Very well, if you consider my personal customization counts a hack, I
will just have to live with that weight on my shoulders.  I will not
report bugs about CC-mode based on my customization, only Emacs -Q.

Hmmm, come to think of it, I don't think I ever did.

> At the moment, electric-pair-mode does not work with c-electric-brace
> and c-electric-paren.  This is the bug reported by Beatrix, the OP.  You
> are telling me you are not working on fixing the part of this problem
> which is in e-p-m.  Please understand me being somewhat frustrated by
> this.  If I were to dig in to e-p-m, make fixes, and commit them, I
> suspect you would be somewhat annoyed.

If you propose changes to e-p-m that:

* don't break any (more) unit tests;

* don't introduce new interfaces to special case cc-mode;

* Stefan accepts, since the self-insert-command-hook part was his
  responsibility entirely, (as I have tried to explain a million times.)

Then I don't see why I would be annoyed.

(You could of course come to the faint realization that maybe there is
the off-chance that there exists a glimmer of possibility that in a
remote part of the multiverse it is quite possible that a minute part
the problem lies in cc-mode.  But no, that is preposterous! let us not
even consider that heresy!  It's decades old after all, it MUST be
correct, forever and absolutely!)

> But you're posting in the thread for bug #33794.  I'm disappointed
> you're not cooperating with me to fix this bug.

I'm posting here because you summoned me, remember?  And now I am
replying to you.  After analysing the problem of Beatrix, I offered an
alternative solution to her actual problem using electric-layout-mode.
(as have you in the meantime).  Seeing as electric-layout-mode was
manifestly insufficient to fix her problem I started working on making
it better.

>> Also, can you once and for all describe the "unusabilities" in other
>> modes you keep talking about???
> Yes.  These other modes call self-insert-command.  self-insert-command,
> because of the way post-self-insert-hook is (ab)used, has no definite
> function.  Sometimes it does what the doc says (inserting N copies of
> the last character typed), other times it does other things.

Again philosophical elucubrations?  Say one concrete thing that is
broken in these modes!  No far-fetched hypotheticals.  Here's a template
for your report:

   Emacs -Q
   M-x electric-pair-mode
   M-x horribly-broken-mode-that-only-you-know-about
   some legitimate user input
   some horribly wrong result

I'm not saying there aren't such bugs, but why are you evading the
question?  Or just say you haven't really witnessed any such bugs and
let's be done with the farce.

> You're working on #33794.  You must surely have some notion of the cause
> of the bug.  I've said what my idea is, and I'm somewhat disappointed
> you've failed to comment on this central point.  Without understanding
> the cause of a bug, any fix is going to be suboptimal.

Look, I haven't looked into this and I don't want to go into a
discussion with you about it because frankly, very frankly indeed, it
would be no fun.  You've already decided long ago that the world is
wrong.  Any comment I could make about how CC-mode could be changed
would just prompt some comment about how it's "always worked", "for
decades" and "look at how fluffy the whiskers on this gray old Gandalf
of a mode are", and "look at this young arriviste e-p-m rascal causing
all the mischief".  In a great part I symphatize immensely with your
ardent defense of your work, if it were literature or art I would
definitely be on your side, the patron saint of idiosyncrasies.  On the
other hand, seeing as this is software, I would find myself having to
point out that these arguments have no bearing on reality.

I'll say this: consider that it is not a bug: e-p-m's contract is: works
for every mode, except cc-mode, where mileage may vary.  Mileage is
indeed slightly shorter on cc-mode with c-toggle-auto-newline: let's
live with it and move on.

> But you're commenting on this thread, which is about a bug concerning
> the interaction of e-p-m with CC Mode, not e-l-m.

If you're suggesting I stop replying to these emails, then maybe you
have a point.  I'm a little tired.

Merry Christmas, Alan
João