all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Liliana Marie Prikler <liliana.prikler@gmail.com>
To: Nicolas Graves <ngraves@ngraves.fr>, 57069@debbugs.gnu.org
Subject: [bug#57069] [PATCH v2] etc: Add tempel snippets.
Date: Tue, 30 Aug 2022 11:51:33 +0200	[thread overview]
Message-ID: <5da120ffb052cbe3a3aaa684b5cde7092be45b7b.camel@gmail.com> (raw)
In-Reply-To: <87czd69e4a.fsf@ngraves.fr>

Am Freitag, dem 12.08.2022 um 08:20 +0200 schrieb Nicolas Graves:
> > > +text-mode :when (git-commit-mode)
> 
> Here I have a bug when magit has never been opened before opening a
> text-mode file, saying that git-commit-mode is not defined. Not sure
> what the best way to resolve this is. Will investigate that.
A strange error indeed.  I encounter a similar one if I use emacs as
EDITOR in git.

> > I'd suggest skipping the completing-read and just (p "gnu").  Most
> > build systems should be easy enough to type without autocompletion.
> 
> But then you have to know the name and loose the listing if you're a
> beginner and not sure. I'm fine with both options. I will follow your
> suggestion if you confirm that you took this type of user into
> account and still prefer just (p "gnu").
The reason I prefer (p "gnu") is because completing-read completely
breaks tempel.  Yes, I'm aware that this won't yield complete feature
parity between tempel and yasnippet, but you have to consider that
these *are* distinct systems after all.

FWIW you could try using NOINSERT t for the p, but I'd hazard a guess
that that still won't give you the prompt at the right time with the
correct safeties.

> > Here, I think (p "url-fetch"), but (s "method") might also work.
> 
> I'm not sure I understand what you meant here. Can you write the
> final method you would get this way?
I got (p "url-fetch" method), which uses "url-fetch" as default value
and binds method.

> > Will this cl-case be dynamically recomputed?  I wonder if we can
> > get the result of the previous p/s here...
> 
> Yes it is recomputed. p/s stores the variable and for evaluations
> "Named fields are lexically bound." It works when tested, we can get
> the result of the previous p. As Daniel Mendler stressed here
> (https://github.com/minad/tempel/issues/65), there is no possibility
> to do a recursive template i.e. with a FORM evaluating to elements of
> a snippet. So the best thing we might do with conditionals is to
> return a string.
Bummer, but I got something working out of it anyway.

> > Rather than that I think adding a template (git-file-name...) which
> > expands to (file-name (git-file-name (p "name") (p "version")) and
> > variants for the others is a better idea.
> 
> In most guix packages, it is left as simply name and version strings,
> since they are defined for the package itself. I took the same
> approach as the yasnippet template, since these field are almost
> always left untouched. I don't see the benefit of this other
> approach.
The benefit would have been that auto-completion is relatively cheap,
so folks could just write git, see git-file-name, TAB, M-RET, done.

> Your other comments have been taken into account, I'm sending an
> updated series as soon as I'm done with the git-commit-mode issue.
> Feel free to send an idea for this issue if you have one! 
I see you already solved it, so I'm now processing v3.  As laid out
above, I replaced all occurrences of completing-read with simple ps, as
those are easier to work with in tempel.  I did keep your cl-case to
conditionally insert git-file-name, etc. but I fixed it up a little so
that it's dynamically recomputed.  I also fixed up the documentation
and dropped the license: completion as it was a completing-read once
more.  You could replace those with a bunch of self-expanding snippets,
but I think geiser and/or dabbrev ought to have us covered here.

Cheers




  reply	other threads:[~2022-08-30  9:52 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-09 10:16 [bug#57069] Tempel snippets Nicolas Graves via Guix-patches via
2022-08-09 10:24 ` [bug#57069] [PATCH 1/4] etc: Add tempel snippets Nicolas Graves via Guix-patches via
2022-08-09 10:24   ` [bug#57069] [PATCH 2/4] etc: Add tempel snippet for :phases Nicolas Graves via Guix-patches via
2022-08-09 10:24   ` [bug#57069] [PATCH 3/4] etc: Add tempel snippet for license: Nicolas Graves via Guix-patches via
2022-08-09 10:24   ` [bug#57069] [PATCH 4/4] etc: Update guix-package yasnippet build-system list Nicolas Graves via Guix-patches via
2022-08-09 16:52 ` [bug#57069] Tempel snippets Liliana Marie Prikler
2022-08-11  6:17   ` Nicolas Graves via Guix-patches via
2022-08-11 15:53     ` Liliana Marie Prikler
2022-08-16  4:23       ` Andrew Tropin
2022-08-16 16:09         ` Liliana Marie Prikler
2022-08-17  4:26           ` Andrew Tropin
2022-08-11  6:07 ` [bug#57069] [PATCH v2] etc: Add tempel snippets Nicolas Graves via Guix-patches via
2022-08-11 16:21   ` Liliana Marie Prikler
2022-08-12  6:20     ` Nicolas Graves via Guix-patches via
2022-08-30  9:51       ` Liliana Marie Prikler [this message]
2022-08-30  9:53         ` bug#57069: " Liliana Marie Prikler
2022-08-12  8:58 ` [bug#57069] [PATCH v3 1/4] " Nicolas Graves via Guix-patches via
2022-08-12  8:58   ` [bug#57069] [PATCH v3 2/4] etc: Add tempel snippet for :phases Nicolas Graves via Guix-patches via
2022-08-12  8:58   ` [bug#57069] [PATCH v3 3/4] etc: Add tempel snippet for license: Nicolas Graves via Guix-patches via
2022-08-12  8:58   ` [bug#57069] [PATCH v3 4/4] etc: Update guix-package yasnippet build-system list Nicolas Graves via Guix-patches via

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

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

  git send-email \
    --in-reply-to=5da120ffb052cbe3a3aaa684b5cde7092be45b7b.camel@gmail.com \
    --to=liliana.prikler@gmail.com \
    --cc=57069@debbugs.gnu.org \
    --cc=ngraves@ngraves.fr \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.