From patchwork Tue Jan 9 22:47:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomas Volf <~@wolfsden.cz> X-Patchwork-Id: 58711 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id C93C727BBE9; Tue, 9 Jan 2024 22:48:33 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_ADSP_ALL, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id AEF7227BBE2 for ; Tue, 9 Jan 2024 22:48:32 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rNKt7-0007G3-JU; Tue, 09 Jan 2024 17:48:01 -0500 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 1rNKt2-0007DZ-An for guix-patches@gnu.org; Tue, 09 Jan 2024 17:47:57 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rNKt2-0004w7-2D for guix-patches@gnu.org; Tue, 09 Jan 2024 17:47:56 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rNKt9-0003B1-3H for guix-patches@gnu.org; Tue, 09 Jan 2024 17:48:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68354] [PATCH 2/2] etc: snippets: Add skeletons for scheme-mode. Resent-From: Tomas Volf <~@wolfsden.cz> Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 09 Jan 2024 22:48:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68354 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68354@debbugs.gnu.org Cc: Tomas Volf <~@wolfsden.cz> Received: via spool by 68354-submit@debbugs.gnu.org id=B68354.170484047212119 (code B ref 68354); Tue, 09 Jan 2024 22:48:03 +0000 Received: (at 68354) by debbugs.gnu.org; 9 Jan 2024 22:47:52 +0000 Received: from localhost ([127.0.0.1]:41239 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rNKsx-00039L-Vj for submit@debbugs.gnu.org; Tue, 09 Jan 2024 17:47:52 -0500 Received: from wolfsden.cz ([37.205.8.62]:50432) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <~@wolfsden.cz>) id 1rNKsu-00038f-1E for 68354@debbugs.gnu.org; Tue, 09 Jan 2024 17:47:48 -0500 Received: by wolfsden.cz (Postfix, from userid 104) id 5506E24E290; Tue, 9 Jan 2024 22:47:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1704840460; bh=7cKR1h15n1lkP+41ZrInoCaa71hPXBoan4B8K5dASCo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=HZD/jqpA4qvjvm4qtTtCBwVqDUnBTm5xSvCHKIvy9pz+Eo/recYetZh0kM6L2ER2R s784hynHabxZ7AqVuYyNUi4y/2J++MAoxH/6vY86OeedhW8DG0y8GcF2Zb3v4xjJkA mP83+FkytW4jQwdmUR0afhuevDvH/szln74YnFA3JYFL/de8oL3Ah5/l06nUbwF19J DNl5ZxvibAGPZfEyvhJmt2H92kTVaJkAsX9XgG4Bv4CWgjSjla1rmttzx+y0ICKYZS yOQCMwYgp6FFyqrIyEOxA6QQXG2MXGKJaJmcpphhYF/DRa6jrCdvw2/eoKU29OXtlT Ax3J/q5h8YgayZYv6GxkdJRuMPq93lMOmWa2WCdYxsVE2h5qlbKuXHUInR8b8fDuzb a8zwn2oz8xBHTVKrWlRGT4t2tPTvR28R8jHdgavarPQ4usnT1vuc15RaYyn8axsaQ1 vj5ueCJVNmzoQB1TpKicjrHLtORrrNmHEd2kZCsuwpMbYUBQHCABYuwzNVv+TP2F/K Y0CRLdtfUqHKnz9tElL7OUlMDzFA4eaSZFlN5e+Ac29jUMA77/rY7JSv0UjtSugW31 WO/eWN05Owj3/pXzP91S0bE2FfgbVrHQnZyl0LipdMpKHl0xt1Lsvk00Wy6BgGABk9 TpHajpT70IBplwaKNnfg+l54= Received: from localhost (unknown [146.70.134.143]) by wolfsden.cz (Postfix) with ESMTPSA id CB16C24D85C; Tue, 9 Jan 2024 22:47:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1704840459; bh=7cKR1h15n1lkP+41ZrInoCaa71hPXBoan4B8K5dASCo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=oc6nUytFtKNL303xGD29aOTK7iZWK2LT01j1d9/KRJu/M8hWNb4mHm6Zi4Z1C34XH btTX3chGnX6OuhFsMqkTt7bstqISZ5cwV42Rz3GjVfgYuh/7g4dJj6P5w97lnaElbL SDAbHyo0VRiAe8p7JwKfDRIfheArIHG9IH3V/6QgLrg7b41dp6f63HcdUqlSZIIdqB TSIRH6zI1JBORgJDunXOwd7ipVSpdaCFx0GHEQ376ZpE/QWe4WAPxyicMtDL1CSe54 M4ejpAJaYwnEciexZB64rtWxc5vdimvzRoZO67OL+DW6pEZ/esDB3vlSuKaDsG7ZOF LwHjhPqAzkwt/Y3WWTJmdyQjwhxtlbCkcrMzUcwbeEshnE2yuGRAfBnQI2zGw0WrUz pqA0YwbMQCTBoyOBgzJwI++LOn1eVn3bohrYeeT2BzuerNCimy0wQWe8U0sV5D4KBn /95YdI5nkx98OvC7l9bjiXqrFoXTnHv9HM2n097Cou7SE+lk3wboMeKYiOhO+0ovSY I/Rn6EiUtUxFw+8uzlw/ychGSBCILooSY7UADxA3pflg8zjfgmJIRzaBJ4h55Nzffv HoIBa5f+bjh7Djxg2OD0B7JNDQpqhXrLazjvjZLb5In71PEoh+ac+RlTVBrTVrBqAL GVM47wSeef0vfbwit2LxYKZo= From: Tomas Volf <~@wolfsden.cz> Date: Tue, 9 Jan 2024 23:47:34 +0100 Message-ID: <02b255ba2b890b842e7f6e42fa5a4c56efce6062.1704839576.git.~@wolfsden.cz> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 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+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches Some people use just plain old skeleton system, which comes with Emacs. This commit adds skeletons for generating package definition and some other common parts. * etc/snippets/skeleton/scheme.el: New file. * doc/contributing.texi (The Perfect Setup): Document it. Change-Id: Ided31c06266b0d3c70ae1e050ae8694fd5e47751 --- doc/contributing.texi | 22 ++++++ etc/snippets/skeleton/scheme.el | 117 ++++++++++++++++++++++++++++++++ 2 files changed, 139 insertions(+) create mode 100644 etc/snippets/skeleton/scheme.el diff --git a/doc/contributing.texi b/doc/contributing.texi index 1311098dfc..b5ee046c0a 100644 --- a/doc/contributing.texi +++ b/doc/contributing.texi @@ -380,6 +380,28 @@ The Perfect Setup The commit message skeletons depend on @url{https://magit.vc/, Magit}. +Additional skeletons for editing the package definitions are provided in +@file{etc/snippets/skeleton/scheme.el}. + +@cindex @code{M-x guix-insert-package} +@cindex @code{M-x guix-insert-origin} +@cindex @code{M-x guix-insert-git-reference} +@cindex @code{M-x guix-insert-hg-reference} +@cindex @code{M-x guix-insert-svn-reference} +@cindex @code{M-x guix-insert-bzr-reference} +@cindex @code{M-x guix-insert-cvs-reference} +@cindex @code{M-x guix-insert-:phases} +Once you load the file, the following functions are provided: +@code{guix-insert-package}, @code{guix-insert-origin}, +@code{guix-insert-git-reference}, @code{guix-insert-hg-reference}, +@code{guix-insert-svn-reference}, @code{guix-insert-bzr-reference}, +@code{guix-insert-cvs-reference} and @code{guix-insert-:phases}. They +do what you would expect based on the name, inserting the implied +snippet while asking for data to fill in. @code{guix-insert-:phases} +inserts commonly used snippet to edit phases for the package. + +The scheme skeletons might depend on paredit for correct indentation. + @cindex insert or update copyright @cindex @code{M-x guix-copyright} @cindex @code{M-x copyright-update} diff --git a/etc/snippets/skeleton/scheme.el b/etc/snippets/skeleton/scheme.el new file mode 100644 index 0000000000..6114b2ffbf --- /dev/null +++ b/etc/snippets/skeleton/scheme.el @@ -0,0 +1,117 @@ +;;; scheme.el --- skeletons for scheme-mode -*- lexical-binding: t; -*- + +;; Copyright (C) 2024 Tomas Volf + +;; Author: Tomas Volf <~@wolfsden.cz> +;; Keywords: convenience + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Code: + +(define-skeleton guix-insert-package + "Insert a Guix package definition." + "Name: " + "(define-public " str + \n"(package" + \n "(name \"" str "\")" + \n "(version \"" (skeleton-read "Version: ") "\")" + \n "(source " _ ")" + \n "(build-system " (skeleton-read "Build system: " "gnu") "-build-system)" + \n "(home-page \"" (skeleton-read "Homepage: ") "\")" + \n "(synopsis " (format "%S" (skeleton-read "Synopsis: ")) ")" + \n "(description " (format "%S" (skeleton-read "Description: ")) ")" + \n "(license license:" (skeleton-read "License: " "unknown") ")))" + \n) + +(define-skeleton guix-insert-origin + "Insert a Guix origin definition." + nil + '(setq v1 (skeleton-read "Method: " "url")) + '(setq v1 (if (string-search "-fetch" v1) + v1 + (concat v1 "-fetch"))) + "(origin" + \n"(method " v1 ")" + \n"(uri " (let ((skeleton-end-newline nil)) + (pcase v1 + ((or "git-fetch" "git-fetch/lfs") + (guix-insert-git-reference)) + ("hg-fetch" + (guix-insert-hg-reference)) + ("svn-fetch" + (guix-insert-svn-reference)) + ("bzr-fetch" + (guix-insert-bzr-reference)) + ("cvs-fetch" + (guix-insert-cvs-reference)) + ("url-fetch" + (insert (format "%S" (skeleton-read "URI: "))))) + nil) + ")" + \n (pcase v1 + ((or "git-fetch" "git-fetch/lfs") + "(file-name (git-file-name name version))") + ("hg-fetch" + "(file-name (hg-file-name name version))") + ((or "svn-fetch" "bzr-fetch" "cvs-fetch") + "(file-name (string-append name \"-\" version \"-checkout\"))")) + & \n"(sha256" + \n "(base32 " + ;; Hash of an empty directory + \n (format "%S" "0sjjj9z1dhilhpc8pq4154czrb79z9cm044jvn75kxcjv6v5l2m5") ")))") + +(define-skeleton guix-insert-git-reference + "Insert a Guix git-reference definition." + nil + "(git-reference" + \n"(url \"" (skeleton-read "URL: ") "\")" + \n"(commit \"" (skeleton-read "Commit / Tag: ") "\"))") + +(define-skeleton guix-insert-hg-reference + "Insert a Guix hg-reference definition." + nil + "(hg-reference" + \n"(url \"" (skeleton-read "URL: ") "\")" + \n"(changeset \"" (skeleton-read "Changeset: ") "\"))") + +(define-skeleton guix-insert-svn-reference + "Insert a Guix svn-reference definition." + nil + "(svn-reference" + \n"(url \"" (skeleton-read "URL: ") "\")" + \n"(revision \"" (skeleton-read "Revision: ") "\"))") + +(define-skeleton guix-insert-bzr-reference + "Insert a Guix bzr-reference definition." + nil + "(bzr-reference" + \n"(url \"" (skeleton-read "URL: ") "\")" + \n"(revision \"" (skeleton-read "Revision: ") "\"))") + +(define-skeleton guix-insert-cvs-reference + "Insert a Guix cvs-reference definition." + nil + "(cvs-reference" + \n"(root-directory \"" (skeleton-read "Root directory: ") "\")" + \n"(module \"" (skeleton-read "Module: ") "\")" + \n"(revision \"" (skeleton-read "Revision: ") "\"))") + +(define-skeleton guix-insert-:phases + "Insert a Guix #:phases snippet." + nil + "#:phases " \n + "(modify-phases %standard-phases" \n + _ ")") +;;; scheme.el ends here