From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id mGm9NsjdDWO/hQEAbAwnHQ (envelope-from ) for ; Tue, 30 Aug 2022 11:52:08 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id iGN5NsjdDWNhkQAAauVa8A (envelope-from ) for ; Tue, 30 Aug 2022 11:52:08 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 925C735962 for ; Tue, 30 Aug 2022 11:52:08 +0200 (CEST) Received: from localhost ([::1]:51402 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oSxuh-0005S2-Kq for larch@yhetil.org; Tue, 30 Aug 2022 05:52:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45452) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oSxuc-0005Rs-PW for guix-patches@gnu.org; Tue, 30 Aug 2022 05:52:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:45036) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oSxuc-0007dI-F2 for guix-patches@gnu.org; Tue, 30 Aug 2022 05:52:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oSxuc-0000SS-3I for guix-patches@gnu.org; Tue, 30 Aug 2022 05:52:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57069] [PATCH v2] etc: Add tempel snippets. Resent-From: Liliana Marie Prikler Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 30 Aug 2022 09:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57069 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: Nicolas Graves , 57069@debbugs.gnu.org Received: via spool by 57069-submit@debbugs.gnu.org id=B57069.16618531041731 (code B ref 57069); Tue, 30 Aug 2022 09:52:02 +0000 Received: (at 57069) by debbugs.gnu.org; 30 Aug 2022 09:51:44 +0000 Received: from localhost ([127.0.0.1]:34784 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oSxuJ-0000Rr-Sn for submit@debbugs.gnu.org; Tue, 30 Aug 2022 05:51:44 -0400 Received: from mail-ej1-f66.google.com ([209.85.218.66]:35736) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oSxuH-0000Rd-Mx for 57069@debbugs.gnu.org; Tue, 30 Aug 2022 05:51:42 -0400 Received: by mail-ej1-f66.google.com with SMTP id og21so21007648ejc.2 for <57069@debbugs.gnu.org>; Tue, 30 Aug 2022 02:51:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:date:to:from:subject:message-id:from:to:cc; bh=GDezZFMvJI82Iod/8GuujkZftz+Mu9s6ZGuPG59+czU=; b=bRa//g9pOjXDEmvX8agLYskw0Sm2fksOu9Dy87jf+jUuhsHpysc82Jfs3D6hTuoNaA 9p+B8tjsYP9szdepzNCnrfUhRF4NWTquy0OdBVzqGd6homIH0JAKsSl4zhnHVtI2K5P/ iT/9U7I8/Kvk0z6DAM2nihwh2i7hZsS9xyxAj6lciDWFWBbXJQX2ljSlWQtCshSAZwoN BQBAwOgSDuhSN0ghcih0ZunEkYMqci+ftkZQ21KutSR40R+fSMZArhxoF4jiVJsIsntT vsQQRB0LWZF3txkRFmOV4pesC6vpxeoQYtlqx1WavPQjQwLvJfKYg5eXpYfRMysQYmzI /pcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc; bh=GDezZFMvJI82Iod/8GuujkZftz+Mu9s6ZGuPG59+czU=; b=VYd9HbxBbH7dl/WlneHK7nZlSlcuDocwt3QyXUW8RvMy/FaW2s2i0TrgaaJdQWPPko HRl+EKqTq3B2a2y29Uty2ZTkvEv4S9wVWdOUW19v6VkBz4lBPkk7PtaGVcillJfGi8FU H5F7o3Jt+O9JpDMGYJLuGXk7gTTq93qUyMZG0efWgbKoFcxWcQdwUTAm6p/EAvvPbgPa CxNohUqMyjJp9s10/fPo3FObd3uHYHnz4YsaFfenXINJXGanI1v2PvuXAuDFQM7KAGUu tPQVQIuPF1crsS47pacRilsEON6VZiErOvV83whXX3wLqq0G5ZkG9WLTLnpGO79e9yu3 Df2A== X-Gm-Message-State: ACgBeo3KOCQnEphb5uo1EoySi54KpxbqsXE1lKDKX1AamANyKPf6QZ3r Ltl4s5zi5O2F+7yprcWjRGU= X-Google-Smtp-Source: AA6agR7WRQDivIdwBbDl4Ig+wwcBYRn4lvZtQeA/N9ZCfLJDQN6FFc/BoP2xJQkKElX+Bl5FcYKwdg== X-Received: by 2002:a17:907:2bf9:b0:73d:dd00:9ce8 with SMTP id gv57-20020a1709072bf900b0073ddd009ce8mr14464821ejc.151.1661853095518; Tue, 30 Aug 2022 02:51:35 -0700 (PDT) Received: from nijino.fritz.box (85-127-52-93.dsl.dynamic.surfer.at. [85.127.52.93]) by smtp.gmail.com with ESMTPSA id u26-20020a1709064ada00b007313a25e56esm5581328ejt.29.2022.08.30.02.51.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Aug 2022 02:51:34 -0700 (PDT) Message-ID: <5da120ffb052cbe3a3aaa684b5cde7092be45b7b.camel@gmail.com> From: Liliana Marie Prikler Date: Tue, 30 Aug 2022 11:51:33 +0200 In-Reply-To: <87czd69e4a.fsf@ngraves.fr> References: <20220811060745.6892-1-ngraves@ngraves.fr> <87czd69e4a.fsf@ngraves.fr> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.42.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1661853128; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=GDezZFMvJI82Iod/8GuujkZftz+Mu9s6ZGuPG59+czU=; b=FyYsqyBaIe65t+iXRAwsnhkE5gBQ9g2ffHZ/Fcx+ZUl3Ubdzs6EpWsEmC0Q+72GHThNzLA 6oFla3Vp9d7vjMZfaYH+WIUmnwpna37xnbkKmpn0k6bHsB3E3MY8v21kOrPVQaEEr8BxPC 652TNYQtNL+TtOXkiIVeWlsYUY4G6iY9DlngT+HEsTTY6c3vQbt0MDQesjfZYW9VDhLSLQ rh2IOWxLCpL6qck8pA25IextKgKOydSK17YfIr8ED5GhxygenblQ06N4mqOkEdTf2lI/7k G57KBIggApLfBj6c8Y2W+WUO+F9GBtqjmSaDxUWVbXJBb8TapBtv3cT8qYMmyg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1661853128; a=rsa-sha256; cv=none; b=OIHk/VjP3wpMMDl6c5goJcJj8EjsXvfOJFbqUS/ix0YWmkek5L5Nw7K4Ti1Q04cGRP5Qot QGE954Aokw6pyWQhbamhwBt5fuHdRojpBs10g+cG89QZ91g3cWLX0O3vv48mzZt8luwFER T8SJ1x3xmtlWa+Kdw9FvcQidWF8PdbHQ0KWRWjmgu3QdAoq8Rnjv4pWEBtlv2IU5r1ZU/i Tv5d+kt3t4RzDBOSuKk/Li99ejzUPZSqV/eYx7p8jtbkKWbdU2P3xwycnc5aFoIOfn6F5U SngasImv9aNGyuI4sPLBiIWGhmmohuRLM09AoDyVC+Mj9o2U9t+9ZCsWEPE/YA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b="bRa//g9p"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 6.21 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b="bRa//g9p"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 925C735962 X-Spam-Score: 6.21 X-Migadu-Scanner: scn1.migadu.com X-TUID: /13McwfVQo2a 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