From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#61368: [PATCH] Extend go-ts-mode with support for pre-filling return statements Date: Mon, 20 Feb 2023 14:55:53 +0200 Message-ID: <83o7pov6li.fsf@gnu.org> References: <83edr0nmq6.fsf@gnu.org> <83357flzys.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="450"; mail-complaints-to="usenet@ciao.gmane.io" Cc: dev@rjt.dev, theo@thornhill.no, joaotavora@gmail.com, 61368@debbugs.gnu.org To: Evgeni Kolev Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 20 13:56: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 1pU5iR-000ARZ-Jh for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 20 Feb 2023 13:56:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pU5iA-000569-Rc; Mon, 20 Feb 2023 07:56:06 -0500 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 1pU5i6-00054U-Q1 for bug-gnu-emacs@gnu.org; Mon, 20 Feb 2023 07:56:02 -0500 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 1pU5i6-0001V5-9j for bug-gnu-emacs@gnu.org; Mon, 20 Feb 2023 07:56:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pU5i5-0001pj-Td for bug-gnu-emacs@gnu.org; Mon, 20 Feb 2023 07:56:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 20 Feb 2023 12:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61368 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 61368-submit@debbugs.gnu.org id=B61368.16768977537032 (code B ref 61368); Mon, 20 Feb 2023 12:56:01 +0000 Original-Received: (at 61368) by debbugs.gnu.org; 20 Feb 2023 12:55:53 +0000 Original-Received: from localhost ([127.0.0.1]:50872 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pU5hw-0001pL-SV for submit@debbugs.gnu.org; Mon, 20 Feb 2023 07:55:53 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:56480) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pU5hv-0001p9-Cw for 61368@debbugs.gnu.org; Mon, 20 Feb 2023 07:55:51 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pU5hp-0001QV-Mu; Mon, 20 Feb 2023 07:55:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=uX67UP7vFtikb7tMGZRpvdHqGfwCkstpsmY5cLxHGEE=; b=He2osKUy+UCKwAzIPl+q EqT5fDM+e1DB2WFym+bKzNmttlVaZ2E2dUzJJQLbUFvX4kZOPmjcJuTFtY2qXHFyGl0/KiPykwpjK L4gRz451kUxwS1DfEral35JtPzDUjXM/GVSRgOIpYTKV+SwWURW/DFKtBP1CAZ3GLC2QI3vWHPoab rhEN47O0J4IUysHVvbGHNXGTTB835Sao4nM+hG0xFQZRgGbXWyNZdasU34LG8+xK9Pcmg0NM3WzKF QQZZLAa2YSh/XETTW7nbNuDdt+Uzi3WwYLS9zmAsD39/OsIPxBZKiAICoZK5YTsZf2GqmvWa4/ktS AzYVGdfJVfxW6A==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pU5hp-0007pX-9L; Mon, 20 Feb 2023 07:55:45 -0500 In-Reply-To: (message from Evgeni Kolev on Mon, 20 Feb 2023 10:54:06 +0200) 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:256162 Archived-At: > From: Evgeni Kolev > Date: Mon, 20 Feb 2023 10:54:06 +0200 > Cc: 61368@debbugs.gnu.org, Randy Taylor , > Theodor Thornhill > > Thank you João for the input! I think something like this would make > sense in go-ts-mode.el: > ``` > (with-eval-after-load 'yasnippet > (yas-define-snippets 'go-ts-mode > '(("return" (yas-expand-snippet > (go-ts-mode-return))) > ("iferr" (yas-expand-snippet > (format "if err != nil {\n%s\n}" > (go-ts-mode-return))))))) > ``` > > A custom variable go-ts-mode-want-yasnippet could be added to > optionally prevent adding the snippets. > > Eli, would you consider something like the code above acceptable as an > alternative to an electric "return" mode? > > Having optional yasnippet integration was also brought up by Theo in > this message[1] and this one [2]. > > [1]: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=60805#11 > [2]: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=60805#17 IMO, if we are going to support yasnippet, we should do it in more than just one mode. So a short addition to just the go-ts-mode will not do, and if we want to include stuff like that, it should be part of a larger patch for Emacs 30. Whether this is a good alternative for some electricity is also a good topic for discussion: electric is part of Emacs whereas yasnippet isn't, so there are advantages and disadvantages to this proposal. Thanks.