From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Wilhelm Kirschbaum Newsgroups: gmane.emacs.bugs Subject: bug#62536: 30.0.50; Can we add """ ... """ electric pair in elixir, just like python Date: Sun, 02 Apr 2023 21:24:24 +0200 Message-ID: <87edp2vzvg.fsf@gmail.com> References: <83sfdm6bet.fsf@gnu.org> <87edp6oim6.fsf@gmail.com> <87lejay8n3.fsf@gmail.com> <06DAF2C4-C224-4C30-AAAE-96D1A84ED145@outlook.com> <87bkk642k0.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; format=flowed Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25021"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.9.3; emacs 30.0.50 Cc: "62536@debbugs.gnu.org" <62536@debbugs.gnu.org> To: Mou Tong Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 02 21:39:24 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pj3Xv-0006LY-8F for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 02 Apr 2023 21:39:23 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pj3Xc-0001et-10; Sun, 02 Apr 2023 15:39:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pj3Xb-0001ef-8B for bug-gnu-emacs@gnu.org; Sun, 02 Apr 2023 15:39:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pj3Xa-0008HG-TK for bug-gnu-emacs@gnu.org; Sun, 02 Apr 2023 15:39:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pj3Xa-0000AH-EH for bug-gnu-emacs@gnu.org; Sun, 02 Apr 2023 15:39:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Wilhelm Kirschbaum Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 02 Apr 2023 19:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62536 X-GNU-PR-Package: emacs Original-Received: via spool by 62536-submit@debbugs.gnu.org id=B62536.1680464305587 (code B ref 62536); Sun, 02 Apr 2023 19:39:02 +0000 Original-Received: (at 62536) by debbugs.gnu.org; 2 Apr 2023 19:38:25 +0000 Original-Received: from localhost ([127.0.0.1]:42700 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pj3Wy-00009P-V5 for submit@debbugs.gnu.org; Sun, 02 Apr 2023 15:38:25 -0400 Original-Received: from mail-wr1-f51.google.com ([209.85.221.51]:36657) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pj3Wv-00009B-Fz for 62536@debbugs.gnu.org; Sun, 02 Apr 2023 15:38:23 -0400 Original-Received: by mail-wr1-f51.google.com with SMTP id i9so27251518wrp.3 for <62536@debbugs.gnu.org>; Sun, 02 Apr 2023 12:38:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680464295; h=mime-version:message-id:in-reply-to:date:subject:cc:to:from :user-agent:references:from:to:cc:subject:date:message-id:reply-to; bh=SjcRsLzxh0Tiiw4jCt6podzTSKLxLfzjt12mfpMhABE=; b=X6R3SSnAT68B782+nwU2ECJFSAO3dktZrUl14Xm50rDF4Zx35ZNl4l4ZAn963MxJrP 2MIvuj0Al6PBuHta+M8kzr7YUw6HIvBiuPmOrmoMCgScQ19MyF2C2Ny1e1W2qo8tP5Uu +DHkh+gRzhVGCQgLboTflWVREjn/tMbHoysZg+vBFrmpqF5ib5zeqjMqUnAdF7o85cta 2AzB6WpB0L9VePVNB4BEwi2mA/GoK0AWccHl5JTj5X6Njtg3XUSjUEXkY2QDpWSJuKqo ZPvcBck0+ABTDdoRAOU/W6jb+7A/W9TSHQmBkq+nR/cXpnCmUb8Ir5mtxLcfMWDSp1rm f0TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680464295; h=mime-version:message-id:in-reply-to:date:subject:cc:to:from :user-agent:references:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=SjcRsLzxh0Tiiw4jCt6podzTSKLxLfzjt12mfpMhABE=; b=e0r1/Y0cfkOwpGhPTc4jXSmzastx5Pux65eMq18IJQbcrzvz+JFj+qFKqQP01ZQpVZ V1FHt/TM3fvyvwuneEF4sU0a/tImF5HrmmSMk4PPTqLBOokZbt3a4RIqeoewL/1x3F1Y j2bOlQSB7X/fcVwP7ht28bndCmmtSSsegTcOo+d1AwSbenG5ySmo3PocoUicqTLGMGfC /GRY6lehtZBjDzcbE5tfDcIL4Wdfk8mrqjJdY9iKoHkEldv8I2itd/ytH/fM2vOHwDjr qSXa0VWK1J2bANCC94SK6vK3zYjUbwXPgU+aTiRTSPociW4BNY25l4l/XlhxaBa+mNpM ab4w== X-Gm-Message-State: AAQBX9c0UylPhxUgN9Zf0390tRbZkF68m4LF+Ep1w39P1kPq92YXS0Jb PTgZ00XxXLxR33CUkBvHxZoUAbSox5A= X-Google-Smtp-Source: AKy350Y46H4GjNem1Pv7OB7uhVe7dvMTQdSi19HfAp9N9YR9tCdqBSbucfbqBbyjb+xwnHJBMNeSmg== X-Received: by 2002:adf:de88:0:b0:2d8:5df8:4566 with SMTP id w8-20020adfde88000000b002d85df84566mr25518528wrl.8.1680464295104; Sun, 02 Apr 2023 12:38:15 -0700 (PDT) Original-Received: from melissa.local ([2c0f:ef18:1431:0:b09:9616:db04:c248]) by smtp.gmail.com with ESMTPSA id y6-20020adff6c6000000b002ceac2ccc4asm7938581wrp.23.2023.04.02.12.38.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Apr 2023 12:38:14 -0700 (PDT) In-reply-to: <87bkk642k0.fsf@gmail.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:259130 Archived-At: > Mou Tong writes: > >>> Will it make sense to also add a newline when closing a >>> multiline >>> comment/heredoc? It feels smoother to me rather than having to >>> press >>> enter and then C-o ( open-line ) to position the cursor >>> correctly? >> >> I agree with you, but I think it might be better to imitate >> what >> `c-mode` did: >> >> ```c >> int main () {|} >> ``` >> >> When `electric-pair-mode` is on, input the left `{`, Emacs >> helps you >> complete the right `}`. After press enter, your cursor will >> move to >> the >> next line and auto-indented according to your offset config: >> >> ```c >> int main () { >> | >> } >> ``` >> >> So how about making it work like this? >> >> ```elixir-ts >> @doc """|""" >> >> # after press enter >> @doc """ >> | >> """ >> ``` > > Yes, I think that is better, let me have a go at it. I was > concerned > of doing unsolicited movement with my suggestion of inserting > newlines. Playing around with it I think we should add a newline, I changed my mind. Unlike the c example above, the following syntax is not valid elixir: `""""""` and it requires a newline to make it valid. Part of the appeal of making the heredoc electric is to keep the syntax valid. There should never be a reason for the heredoc to be on a single line and also makes the tree-sitter grammar invalid, which causes the blinking issue. This will mean: ``` @doc ""| ``` when typing `"` it will insert `\n"""` and thus have the minimal valid elixir syntax without doing extra movement. ``` @doc """| """ ``` This will be the change ( looking at the electric.el code ).