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 #14 received at 62536 <at> debbugs.gnu.org (full text, mbox):

From: Mou Tong <mou.tong <at> outlook.com>
To: Wilhelm Kirschbaum <wkirschbaum <at> gmail.com>
Cc: "62536 <at> debbugs.gnu.org" <62536 <at> debbugs.gnu.org>
Subject: 回复: bug#62536: 30.0.50; Can we add """ ... """ electric pair in elixir, just like python
Date: Thu, 30 Mar 2023 08:25:34 +0000
[Message part 1 (text/plain, inline)]
> automatically insert `end` when `do` is entered, which might be a good
> addition as well.

Eglot can handle this and it works pretty good for now:

Open a ex file, enable `eglot`, insert `do` and press `tab`, eglot will
help you insert `end` automatically.

I think it's better to let user trigger `do`'s completion.  Because when
someone want to write a one line function, the `end` is not needed:

```elixir-ts
def foo(a), do: a
```

Anyway, hope to see the new feature ;)
________________________________
发件人: Wilhelm Kirschbaum <wkirschbaum <at> gmail.com>
发送时间: 2023年3月30日 14:19
收件人: Eli Zaretskii <eliz <at> gnu.org>
抄送: 牟 桐 <mou.tong <at> outlook.com>; 62536 <at> debbugs.gnu.org <62536 <at> debbugs.gnu.org>
主题: Re: bug#62536: 30.0.50; Can we add """ ... """ electric pair in elixir, just like python

>> From: 牟 桐 <mou.tong <at> outlook.com>
>> Date: Thu, 30 Mar 2023 04:25:07 +0000
>>
>> In elixir, the docs in src are like this:
>>
>> ``` elixir-ts-mode
>> defmodule Foo do
>>   @moduledoc """
>>   Foo-related functions.
>>
>>   ## Examples
>>
>>       iex> Foo.sum(1, 2)
>>       3
>>   """
>>
>>   @doc """
>>   Calculate the sum of two numbers.
>>   """
>>   def sum(a, b), do: a + b
>> end
>> ```
>>
>> In python-mode, input the continious triple quotes, it will
>> insert the
>> left quotes when electric-pair-mode is on.
>>
>> python-mode did it here:
>>
>> https://github.com/emacs-mirror/emacs/blob/bfa3500c3c6e4df58978e84753718cd5358c06fb/lisp/progmodes/python.el#L6599-L6607
>>
>>
>> https://github.com/emacs-mirror/emacs/blob/bfa3500c3c6e4df58978e84753718cd5358c06fb/lisp/progmodes/python.el#L6637-L6639
>>
>>
>> This behavior is also very common in elixir, so can we add this
>> to
>> elixir-ts-mode? thx
>
> Wilhelm, WDYT?

Yes, I think we should add some version of this.  I am currently
testing a
syntax-propertize-function addition to solve an issue related to
electric-pair-mode and will have a look at this straight after.

There was another request to automatically insert `end` when `do`
is
entered, which might be a good addition as well.
[Message part 2 (text/html, inline)]

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.