GNU bug report logs - #62536
30.0.50; Can we add """ ... """ electric pair in elixir, just like python

Previous Next

Package: emacs;

Reported by: 牟 桐 <mou.tong <at> outlook.com>

Date: Thu, 30 Mar 2023 04:31:02 UTC

Severity: normal

Found in version 30.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #74 received at 62536 <at> debbugs.gnu.org (full text, mbox):

From: Wilhelm Kirschbaum <wkirschbaum <at> gmail.com>
To: João Távora <joaotavora <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 62536 <at> debbugs.gnu.org, mou.tong <at> outlook.com
Subject: Re: bug#62536: 30.0.50; Can we add """ ... """ electric pair in
 elixir, just like python
Date: Tue, 04 Apr 2023 21:46:47 +0200
>> On Tue, Apr 4, 2023 at 7:12 PM Wilhelm Kirschbaum
>> <wkirschbaum <at> gmail.com> wrote:
>>
>>> The custom psif is not for the newline, but for pairing up the
>>> triple
>>> quotes `"""` with another set of tripe quotes when
>>> electric-pair-mode is
>>> enabled.  The newline is for keeping the syntax valid in 
>>> elixir,
>>> otherwise the font and navigation breaks because `""""""` is 
>>> not
>>> valid
>>> Elixir syntax and the tree-sitter grammar really does not like 
>>> it.
>>
>> I see.  My apologies for not having noticed this in the 
>> preceding
>> emails.  If you want some kind of electricity so that typing 
>> the
>> third `"` results in two `"` and a newline getting added, then
>> that is completely new and probably does require a custom psif.
>>


Just to clarify on the desired behaviour:

With `|` is (point):

When typing the first quote `"|` it pairs to be `"|"` as single 
quote
strings are valid in Elixir.  Then when typing the second `"` it 
skips
the second quote `""|`, now when typing the third quote `""|"` it 
pairs
the heredoc: `"""|"""` and with electric-layout it will now insert 
the
newlines: `"""\n|\n"""`.

This means, as the original report, the user can type

`@doc """|` and will correctly jump into the heredoc and 
tree-sitter
grammar will stay valid.

@doc """
|
"""

There is no scenario in Elixir I can thin of where this is not the
desired behaviour.







This bug report was last modified 2 years and 48 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.