From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Newsgroups: gmane.emacs.bugs Subject: bug#62536: 30.0.50; Can we add """ ... """ electric pair in elixir, just like python Date: Tue, 4 Apr 2023 19:39:10 +0100 Message-ID: References: <83sfdm6bet.fsf@gnu.org> <87edp6oim6.fsf@gmail.com> <87lejay8n3.fsf@gmail.com> <06DAF2C4-C224-4C30-AAAE-96D1A84ED145@outlook.com> <87bkk642k0.fsf@gmail.com> <87edp2vzvg.fsf@gmail.com> <87h6tx74i4.fsf@gmail.com> <83y1n9ukqb.fsf@gnu.org> <83o7o5uj2c.fsf@gnu.org> <871ql06w59.fsf@gmail.com> <87zg7nfrex.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30279"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , 62536@debbugs.gnu.org, mou.tong@outlook.com To: Wilhelm Kirschbaum Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Apr 04 20:40:20 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 1pjlZs-0007kp-IW for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 04 Apr 2023 20:40:20 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pjlZf-00078t-7v; Tue, 04 Apr 2023 14:40:07 -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 1pjlZb-00078d-BM for bug-gnu-emacs@gnu.org; Tue, 04 Apr 2023 14:40: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 1pjlZb-0000f1-2B for bug-gnu-emacs@gnu.org; Tue, 04 Apr 2023 14:40:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pjlZa-0001Xf-GA for bug-gnu-emacs@gnu.org; Tue, 04 Apr 2023 14:40:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 04 Apr 2023 18:40: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.16806335695879 (code B ref 62536); Tue, 04 Apr 2023 18:40:02 +0000 Original-Received: (at 62536) by debbugs.gnu.org; 4 Apr 2023 18:39:29 +0000 Original-Received: from localhost ([127.0.0.1]:50184 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pjlZ3-0001Wl-7M for submit@debbugs.gnu.org; Tue, 04 Apr 2023 14:39:29 -0400 Original-Received: from mail-oi1-f171.google.com ([209.85.167.171]:36753) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pjlZ1-0001WX-M6 for 62536@debbugs.gnu.org; Tue, 04 Apr 2023 14:39:28 -0400 Original-Received: by mail-oi1-f171.google.com with SMTP id bj20so24922567oib.3 for <62536@debbugs.gnu.org>; Tue, 04 Apr 2023 11:39:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680633561; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=4gAyN9cfWnUVP8EMn6nA9Cxv6lQh/rci12J3qjyhZFY=; b=pBLVTDXX4CvvOHcFhEVaLBOCMYX14ltf4Mo7p15ybhikXSJdBIIKXGDy3XHxoQn2SQ TMjdXju1iVbwoyu7oLPALZ2IOCgDg+AnrZg5z2kUbaqEwTtloMUAB0wL5hrcT93M8TAz NZeSMlAP+uP2icZojA2DrramH1xRs/+KdaT2ojW67WM2sDyaUjoyqELXOM6+UYQAbmE4 A62wnx0SCqzn5z5UbrYiUwGkzkmWNninPI2Pl6y+6zRYnZaInNlnJkxYL4UoIHNWufI9 WhMyzCDNosKrfumxgdkclR6LPX5I5MjlPYgPaNICKMFFuLck48Lvg7Iij1fY/7O82yWw 14iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680633561; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4gAyN9cfWnUVP8EMn6nA9Cxv6lQh/rci12J3qjyhZFY=; b=niu/9QSO3QeTKI3Tx+0tUterA1+5WQTa0U8bSVYLSOj7d1jQTpOEsM3cjO4L8AeJQd X7jdWp8VFqZj0g1m6O1eJ81wW7fmQXV0GWsO/vT/X+oFiGdHgk4AtrWmj8IW4O/Pb7Rz 28peycZh6B+P0FI/IrxbsqSxCM+abJ8QlOG21wYTrl2HbbYuFTh0GLF8VyYMsfaLC5Hm m1YmSu8vZy7Bf3ZZ4LucYLAbhiUYClIGRdh0+JTdlJbZ5YVIZNd8msCByVoDCFW0opGQ eqH+2TBQPMGvyw2K2Z1HMxDJ68AscRLL+V/Ily05gAqWXoXaYesPhVYMcwcUAumHl8Co f9Zg== X-Gm-Message-State: AAQBX9dXlM1jJ1mkwtG98FnvYAkAzYN+GtsUzk/0L2FAIjd2y3V8Qynt p4bY3I39/FYTOjLq/TPkXrc6BIYJUI9iU26PVyI= X-Google-Smtp-Source: AKy350YxCbqZfn6LNsEd/X1jHRaPAsSQ9f3/dN2MZSDLsexdYNo6MlCrax1zdVvcv6OKIJHKLl7sTx+YNg4u1oSqCuI= X-Received: by 2002:a05:6808:2018:b0:384:1cf9:912e with SMTP id q24-20020a056808201800b003841cf9912emr1334610oiw.5.1680633561677; Tue, 04 Apr 2023 11:39:21 -0700 (PDT) In-Reply-To: <87zg7nfrex.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:259237 Archived-At: On Tue, Apr 4, 2023 at 7:12=E2=80=AFPM Wilhelm Kirschbaum 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. If that's _not_ what is meant, read on. Else skip to last paragraph. > Unless electric-indent-chars can identify the triple quotes, we > need a > custom psif regardless of other functionality, but I don't see > this > option. Maybe I am wrong and you can point me to this feature? Here, you'd not want electric-indent-chars, right? If you're dealing with the necessity of electrically adding a newline to maintain syntax correctness, you're looking for electric-layout-mode and electric-layout-rules, not electric-indent. And in electric-layout-rules you _can_, I think, identify triple quotes using a function as described in the last paragraph of its docstring. > If it does not make sense to add the newline as this might not be > expected behaviour when electric-layout-mode is not enabled, we > can add > a check before inserting the newline? Sure, but I'd say just use electric-layout-rules in that case. > I don't know if many people > using > elixir-ts-mode will know about the electric layout mode and might > get annoyed with > electric-pair-mode for heredocs ( tripple quote pairs ). But your suggestion to check for electric-layout-mode in the custom psif leads to same situation, right? You can choose to turn on electric-layout-mode by default locally in elixir-ts-mode if you want to give your users this sane behaviour by default. Like other electric-* modes, it's a mode that helps maintain the buffer valid (for some meaning of "valid"). Just like without electric-pair-mode you type a '{' and the buffer is syntactically invalid until you fix it. The "annoyance" can be solved by turning it on, unless it's on already. Anyway, I just wanted to call attention to these existing facilities in Emacs that were designed to help out major-mode authors so that ad-hoc solutions aren't replicated again and again, making maintenance difficult. But, then again, I understand that the facilities might not be as powerful as I and Stefan (mostly Stefan, really) intended. Here, my naive understanding of the matter tells me they are, but if I'm wrong and using the custom psif gets the job done, then don't take my suggestion as a blocker, especially if all your patches are ready and good to go. We can always come back to this later. Jo=C3=A3o