unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Evgeni Kolev <evgenysw@gmail.com>
To: "João Távora" <joaotavora@gmail.com>, "Eli Zaretskii" <eliz@gnu.org>
Cc: Randy Taylor <dev@rjt.dev>, Theodor Thornhill <theo@thornhill.no>,
	61368@debbugs.gnu.org
Subject: bug#61368: [PATCH] Extend go-ts-mode with support for pre-filling return statements
Date: Mon, 20 Feb 2023 10:54:06 +0200	[thread overview]
Message-ID: <CAMCrgaWnYpHby+Kn2khq3OX2b80hbwgqXKmKa-MmpLS3q1xhyQ@mail.gmail.com> (raw)
In-Reply-To: <CALDnm53sBt-o8txJ7ToZsA3BaFzYUVtnMLzPKz8wf0jKUROQPA@mail.gmail.com>

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





  reply	other threads:[~2023-02-20  8:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-08 15:27 bug#61368: [PATCH] Extend go-ts-mode with support for pre-filling return statements Evgeni Kolev
2023-02-08 16:30 ` Eli Zaretskii
2023-02-09 11:47   ` Evgeni Kolev
2023-02-09 13:39     ` Eli Zaretskii
2023-02-18 11:46       ` Evgeni Kolev
2023-02-18 12:14         ` João Távora
2023-02-20  8:54           ` Evgeni Kolev [this message]
2023-02-20 12:55             ` Eli Zaretskii
2023-02-22 14:36               ` Evgeni Kolev
2024-01-10 22:43                 ` Stefan Kangas
2024-01-15  8:21                   ` Evgeni Kolev
2024-01-15  8:39                     ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-15 11:40                       ` João Távora
2023-02-08 19:20 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMCrgaWnYpHby+Kn2khq3OX2b80hbwgqXKmKa-MmpLS3q1xhyQ@mail.gmail.com \
    --to=evgenysw@gmail.com \
    --cc=61368@debbugs.gnu.org \
    --cc=dev@rjt.dev \
    --cc=eliz@gnu.org \
    --cc=joaotavora@gmail.com \
    --cc=theo@thornhill.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).