Subject: bug#62536: 30.0.50; Can we add """ ... """ electric pair in elixir, just like python

From: João Távora <[email-masked]>
Date: Tue, 4 Apr 2023 10:08:27 +0100

On Tue, Apr 4, 2023 at 6:43 AM Wilhelm Kirschbaum <[email-masked]> wrote:
>
> >> From: Wilhelm Kirschbaum <[email-masked]>
> >> Date: Mon, 3 Apr 2023 16:17:51 +0200
> >> Cc: 牟 桐 <[email-masked]>, [email-masked]
> >>
> >> On Mon, 3 Apr 2023, 16:02 Eli Zaretskii, <[email-masked]> wrote:
> >>
> >>  > Cc: "[email-masked]" <[email-masked]>
> >>  > From: Wilhelm Kirschbaum <[email-masked]>
> >>  > Date: Mon, 03 Apr 2023 10:26:59 +0200
> >>  >
> >>  > These two patches should then be sufficient to better handle
> >>  > heredocs for electric-pair-mode:
> >>
> >>  Do these replace the two previous ones you posted?  Or are
> >>  they in
> >>  addition to them?
> >>
> >> Sorry, they replace the previous two.
> >
> > OK, but I understand you are still considering a better way to
> > solve
> > this?  So I should not yet install the last patches?
>
> I had a look and don't see how without changing elec-pair.el that
> there
> is a more elegant way to do this.  I am happy with the current
> patches
> to be installed and then perhaps if there is a better way we can
> apply
> it to both python-mode and elixir-ts-mode later.

It seems what you are trying to do is actually a functionality
of electric-layout-mode,  right? It's creating newlines between
two sets of '"""' so that if the user types one newline between
them, then one extra newline is inserted after and the line is
indented one level deeper than the '"""'.

If so, it would seem like 'electric-layout-rules' would be a good
match.  The behaviour would happen _only_ if the user has
electric-layout-mode, which is the standard Emacs mode for
controlling this kind of electricity.  The last paragraph
of the docstring of 'electric-layout-rules' seems to describe
a powerful enough mechanism to do achieve what the custom
psif does.

João