GNU bug report logs - #61368
[PATCH] Extend go-ts-mode with support for pre-filling return statements

Previous Next

Package: emacs;

Reported by: Evgeni Kolev <evgenysw <at> gmail.com>

Date: Wed, 8 Feb 2023 15:29:02 UTC

Severity: normal

Tags: patch

Full log


Message #29 received at 61368 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Evgeni Kolev <evgenysw <at> gmail.com>
Cc: dev <at> rjt.dev, theo <at> thornhill.no, joaotavora <at> gmail.com, 61368 <at> debbugs.gnu.org
Subject: Re: bug#61368: [PATCH] Extend go-ts-mode with support for pre-filling
 return statements
Date: Mon, 20 Feb 2023 14:55:53 +0200
> From: Evgeni Kolev <evgenysw <at> gmail.com>
> Date: Mon, 20 Feb 2023 10:54:06 +0200
> Cc: 61368 <at> debbugs.gnu.org, Randy Taylor <dev <at> rjt.dev>, 
> 	Theodor Thornhill <theo <at> thornhill.no>
> 
> 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.




This bug report was last modified 1 year and 208 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.