GNU bug report logs - #68354
[PATCH 0/2] Add snippets based on skeleton system.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Tomas Volf <~@wolfsden.cz>; Keywords: patch; dated Tue, 9 Jan 2024 22:47:02 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.

Message received at 68354 <at> debbugs.gnu.org:


Received: (at 68354) by debbugs.gnu.org; 16 Jan 2024 17:11:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 16 12:11:21 2024
Received: from localhost ([127.0.0.1]:49632 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rPmy8-0006ta-MK
	for submit <at> debbugs.gnu.org; Tue, 16 Jan 2024 12:11:21 -0500
Received: from wolfsden.cz ([37.205.8.62]:34414)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <~@wolfsden.cz>) id 1rPmy5-0006tK-Dv
 for 68354 <at> debbugs.gnu.org; Tue, 16 Jan 2024 12:11:18 -0500
Received: by wolfsden.cz (Postfix, from userid 104)
 id 5043B2529F1; Tue, 16 Jan 2024 17:11:16 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail;
 t=1705425076; bh=TLcYHIorjI6O95x4WW4ACmbUKgIRaWTVI1bprryE//U=;
 h=From:To:Cc:Subject:Date:In-Reply-To:References;
 b=G/gj3EErEoy72trPXTpXX3k80g8MKLwTojvp7cTi2U2UZChxixPREUXR95VCaOzY/
 QfCE8tAMcz8W6DEitFwgrR8Alh83UJm28+aRFcTUVDPEQxq7CLZbtt9qHDw6xeA+uq
 p1YtJrFXeLUgBOrcdJZFVBpGHa1vQmn6AC4v+eGoulgWH+Ccj4B1maoAWSw7iF1yQf
 fiNHH17dDjtggAnhxEDEwCZiX+Q1cvV01zZnldkWwUXQt0ZGTqh3uwKU3n73Yf/NxE
 gI/SghYgo+27y4FX/vD23CRJ5bnBEjphHLsFZ/NmiTMrVTnWUqmEUQ4kKRZUsOlEpx
 LLsGpXBgsk0cHQVYlptIi3dfQm6L5/Y+aWjw+gwfiuFEQOiBpWPQ0nbUYQIeyWhoTb
 aCuBTdnjXlaqVqlyOND9qumwRFTCk3kgfE4eIeVGF5LI57L1RpAV+gPifD3xQY2bN9
 MO/CgR8NJZV6t3DewrjRb+r6vsEUbxPPRrAmipqDGoILVr4Jz5bOrtCQxjNV1xyOhz
 h9HJlEEiKzBfjje4EurRYQlVZkS3by/gHARHWgDVPJFSlg6x2bYHml/XPEBYUwLWNb
 RLLsdS+1YrudZPA7xVqslrCUZWpImZXG0wWtQnVsByy3KzT9GmC9NtZ0Er3UCWvxyy
 Eo4mN6qMn61h76j9P7UCmThg=
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on wolfsden
X-Spam-Level: 
X-Spam-Status: No, score=-1.2 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED,
 DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,T_SCC_BODY_TEXT_LINE,
 URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6
Received: from localhost (unknown [81.17.16.72])
 by wolfsden.cz (Postfix) with ESMTPSA id BB78A256F17;
 Tue, 16 Jan 2024 17:11:15 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail;
 t=1705425075; bh=TLcYHIorjI6O95x4WW4ACmbUKgIRaWTVI1bprryE//U=;
 h=From:To:Cc:Subject:Date:In-Reply-To:References;
 b=QtOM7yM8kTqKrlUGmALSYckgcrIyxdfOo68drKRttxf6ex4L/y1qnEyAOLnpsW229
 lgU984YchzQvAMTc8//EqT3xjXnGspP+eFJaMF+WDuzWZ+QssoAOV1PX/YD5+sn9Tl
 dDScBK6vt0iYwrIAB/nxgp1qIEse4Q0FC9KTkTxRL+WTQ/GxpCAlZ8OCdKSs0JzTQk
 cx3muecyvOqUcXuC5HuVru1lVYZTgaMHHP5YFyaKfa3xBXjhHI9iLYZchloSVSKaz/
 VRBhzDVo/eYvhBdBuj/YEF/bKijmCQqH0nJDX404IIP8C2xh0eajh6kgLBn7DVuZ5D
 oJvhHG9UAKpEHcKsTP8LGSR/JchGDI0Ym5dLjamEwIITq+mJr2UXCt5toisHrdjVj3
 u1xNgGQ8vQh53K4u74xqBcv2lQh8fzVIgAIk8z/k1s7IftzWMq/fm+NhSJI9whRV4j
 C4bqGDU6SBN9JziTRq2X70VIwVeBXB9DkZNwt4cnIrKHveuqJT08hXQxb+e+dqS1yf
 OI/U4aFShxz2QrfN1VC+wl0T2Qc0GuT2Hg3h8xr0M5raQ4BMfDuywpiMMn5gfOd7NG
 1a7/vnBYPo61oTQ5y6uEXuIxaYTqGPgn8Bnu5YohN1V5ELBI0j73raxttguQVDaQAp
 mSUXfYESWn/BV/zJEoCv5P/s=
From: Tomas Volf <~@wolfsden.cz>
To: 68354 <at> debbugs.gnu.org
Subject: [PATCH v2 2/2] etc: snippets: Add skeletons for scheme-mode.
Date: Tue, 16 Jan 2024 18:10:13 +0100
Message-ID: <7aed6e3ca232c3a6542abfe21fc35147d30e448e.1705425013.git.~@wolfsden.cz>
X-Mailer: git-send-email 2.41.0
In-Reply-To: <12887de50dc01339faf03aa66d298f1e16ec7b18.1705425013.git.~@wolfsden.cz>
References: <12887de50dc01339faf03aa66d298f1e16ec7b18.1705425013.git.~@wolfsden.cz>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 68354
Cc: Tomas Volf <~@wolfsden.cz>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

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
---
v2:
* Fix whitespace in the guix-insert-origin.

 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..4e6ddad0dc
--- /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 <https://www.gnu.org/licenses/>.
+
+;;; 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
-- 
2.41.0





Information forwarded to guix-patches@HIDDEN:
bug#68354; Package guix-patches. Full text available.

Message received at 68354 <at> debbugs.gnu.org:


Received: (at 68354) by debbugs.gnu.org; 16 Jan 2024 17:11:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 16 12:11:18 2024
Received: from localhost ([127.0.0.1]:49630 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rPmy5-0006tL-PX
	for submit <at> debbugs.gnu.org; Tue, 16 Jan 2024 12:11:18 -0500
Received: from wolfsden.cz ([37.205.8.62]:34400)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <~@wolfsden.cz>) id 1rPmy2-0006tB-OQ
 for 68354 <at> debbugs.gnu.org; Tue, 16 Jan 2024 12:11:16 -0500
Received: by wolfsden.cz (Postfix, from userid 104)
 id E64F6256FB2; Tue, 16 Jan 2024 17:11:11 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail;
 t=1705425071; bh=swEQJhLn/T/OuEPQd+vvLcyjo0JSHOWLXCLandLM0Jw=;
 h=From:To:Cc:Subject:Date;
 b=CthXxYBg7g/f+gHRhuL/lR9d3HzZHjVh9LYa4gjfbNsjknRNU8/hKzAFwkezGwZB9
 j/OP3+iTyc51bU/oTLFVLsKMnK0+OZYd/vMjhS0yxoWrqKSRgzsYmkn+XW863PW/9u
 YLfzvU+2a35QUTixeYtnK4DTVPY3Z7bfXrNedA5r03jfe0DhWlQgZl1eU2YsKKiOHH
 /N+oZ4cUdVtaAASJ9Bd6kAEnEdri/crAXc8VMCaGGWQ7jLGLqFjL6gQz46zcmBwzeH
 Sv6mgjaIaePRETpK4s2B0Gj4ThrtWEwrPQLjhyeecp9JdI2LFt35ubMb3vdOFof0X2
 3/F5XxpDFkB6aOc0Gf+Guu/PaIuhfZf4+tQ0vfxMiCvmRva2YlsKCGHAUzKvBLpOsO
 BDW7/bh5fHNylfhMR5MLj0YZyKTTX3JGNQhtbLOZJbY9TZYv3Y09Syh5lVDHVsdlnX
 xUfZeGNda9qqV2+cTmTSpaHiunWndXbRhP7RgP2iPy+c1HTqbeH/kl5cg4My7bO2uw
 N4UGylm+j++ftwWXH3y2zUsokRjgTspi/KbWd5BljhxokB3JODeyXZpNa2aSi/vhM1
 eWkHg+xCX5Em5vZaRVsFVaB1DrgchRfS4TI/9iHW681fRiLOKdN+f9rdWquwyuoou6
 mXWj7sDuYbYjNA2vRqtcOw8w=
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on wolfsden
X-Spam-Level: 
X-Spam-Status: No, score=-1.2 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED,
 DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,T_SCC_BODY_TEXT_LINE,
 URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6
Received: from localhost (unknown [81.17.16.72])
 by wolfsden.cz (Postfix) with ESMTPSA id 3B8B0256330;
 Tue, 16 Jan 2024 17:11:11 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail;
 t=1705425071; bh=swEQJhLn/T/OuEPQd+vvLcyjo0JSHOWLXCLandLM0Jw=;
 h=From:To:Cc:Subject:Date;
 b=CthXxYBg7g/f+gHRhuL/lR9d3HzZHjVh9LYa4gjfbNsjknRNU8/hKzAFwkezGwZB9
 j/OP3+iTyc51bU/oTLFVLsKMnK0+OZYd/vMjhS0yxoWrqKSRgzsYmkn+XW863PW/9u
 YLfzvU+2a35QUTixeYtnK4DTVPY3Z7bfXrNedA5r03jfe0DhWlQgZl1eU2YsKKiOHH
 /N+oZ4cUdVtaAASJ9Bd6kAEnEdri/crAXc8VMCaGGWQ7jLGLqFjL6gQz46zcmBwzeH
 Sv6mgjaIaePRETpK4s2B0Gj4ThrtWEwrPQLjhyeecp9JdI2LFt35ubMb3vdOFof0X2
 3/F5XxpDFkB6aOc0Gf+Guu/PaIuhfZf4+tQ0vfxMiCvmRva2YlsKCGHAUzKvBLpOsO
 BDW7/bh5fHNylfhMR5MLj0YZyKTTX3JGNQhtbLOZJbY9TZYv3Y09Syh5lVDHVsdlnX
 xUfZeGNda9qqV2+cTmTSpaHiunWndXbRhP7RgP2iPy+c1HTqbeH/kl5cg4My7bO2uw
 N4UGylm+j++ftwWXH3y2zUsokRjgTspi/KbWd5BljhxokB3JODeyXZpNa2aSi/vhM1
 eWkHg+xCX5Em5vZaRVsFVaB1DrgchRfS4TI/9iHW681fRiLOKdN+f9rdWquwyuoou6
 mXWj7sDuYbYjNA2vRqtcOw8w=
From: Tomas Volf <~@wolfsden.cz>
To: 68354 <at> debbugs.gnu.org
Subject: [PATCH v2 1/2] etc: snippets: Add skeletons for commit messages.
Date: Tue, 16 Jan 2024 18:10:12 +0100
Message-ID: <12887de50dc01339faf03aa66d298f1e16ec7b18.1705425013.git.~@wolfsden.cz>
X-Mailer: git-send-email 2.41.0
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 68354
Cc: Tomas Volf <~@wolfsden.cz>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Some people use just plain old skeleton system, which comes with Emacs.  This
commit adds skeletons for generating commit messages for the common
operations (updating packages, ...).

* etc/snippets/skeleton/commit-message.el: New file.
* doc/contributing.texi (The Perfect Setup): Document it.

Change-Id: Ic37b6455a337fc431ad2b049d5b7261da97e5a06
---
 doc/contributing.texi                   |  20 ++++
 etc/snippets/skeleton/commit-message.el | 143 ++++++++++++++++++++++++
 2 files changed, 163 insertions(+)
 create mode 100644 etc/snippets/skeleton/commit-message.el

diff --git a/doc/contributing.texi b/doc/contributing.texi
index 5707ff5cde..1311098dfc 100644
--- a/doc/contributing.texi
+++ b/doc/contributing.texi
@@ -360,6 +360,26 @@ The Perfect Setup
 @code{origin} snippet in turn may insert other trigger strings ending on
 @code{...}, which also can be expanded further.
 
+@cindex skeleton
+If you use built-in skeleton system (@xref{Top,,,autotype}), you can
+load the snippets from the @file{etc/snippets/skeleton} directory.
+
+Skeletons for editing commit messages are provided in
+@file{etc/snippets/skeleton/commit-message.el}.
+
+@cindex @code{M-x guix-package-add}
+@cindex @code{M-x guix-package-remove}
+@cindex @code{M-x guix-package-update}
+@cindex @code{M-x guix-package-rename}
+@cindex @code{M-x guix-package-move}
+Once you load the file, the following functions are provided:
+@code{guix-package-add}, @code{guix-package-remove},
+@code{guix-package-update}, @code{guix-package-rename} and
+@code{guix-package-move}.  When editing a commit message, invoke the
+appropriate one using @code{M-x} to insert a message for the change.
+
+The commit message skeletons depend on @url{https://magit.vc/, Magit}.
+
 @cindex insert or update copyright
 @cindex @code{M-x guix-copyright}
 @cindex @code{M-x copyright-update}
diff --git a/etc/snippets/skeleton/commit-message.el b/etc/snippets/skeleton/commit-message.el
new file mode 100644
index 0000000000..698079a004
--- /dev/null
+++ b/etc/snippets/skeleton/commit-message.el
@@ -0,0 +1,143 @@
+;;; commit-message.el --- skeletons for Guix's commit messages  -*- lexical-binding: t; -*-
+;;; Copyright © 2024 Tomas Volf <~@wolfsden.cz>
+
+;; Author: Tomas Volf <~@wolfsden.cz>
+;; Keywords: vc, 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 <https://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(defun guix--package-name-from-magit-diff (regex)
+  (with-temp-buffer
+    (magit-git-wash #'magit-diff-wash-diffs "diff" "--cached")
+    (goto-char (point-min))
+    (when (re-search-forward regex
+                             nil 'noerror)
+      (match-string-no-properties 1))))
+
+(defun guix--first-file-from-magit-diff ()
+    (car (magit-staged-files)))
+
+(define-skeleton guix-package-add
+  "Insert a commit message for adding a package."
+  nil
+  '(setq v1 (or (guix--package-name-from-magit-diff
+                 (rx "+(define-public " (group (+ (not (syntax whitespace))))))
+                (skeleton-read "Package: ")))
+  '(setq v2 (or (guix--first-file-from-magit-diff)
+                (skeleton-read "File: ")))
+  ;; v1 - package, v2 - file
+  "gnu: Add " v1 "." \n
+  _ \n
+  "* " v2 " (" v1  "): New variable." \n)
+
+(define-skeleton guix-package-remove
+  "Insert a commit message for removing a package."
+  nil
+  '(setq v1 (or (guix--package-name-from-magit-diff
+                 (rx "-(define-public " (group (+ (not (syntax whitespace))))))
+                (skeleton-read "Package: ")))
+  '(setq v2 (or (guix--first-file-from-magit-diff)
+                (skeleton-read "File: ")))
+  ;; v1 - package, v2 - file
+  "gnu: Remove " v1 "." \n
+  _ \n
+  "* " v2 " (" v1  "): Delete variable." \n)
+
+(define-skeleton guix-package-update
+  "Insert a commit message for updating a package."
+  (or (guix--package-name-from-magit-diff
+       (rx line-start (* (syntax whitespace))
+           "(define-public " (group (+ (not (syntax whitespace))))))
+      (skeleton-read "Package: "))
+  '(setq v1 (or (with-temp-buffer
+                  (magit-git-wash #'magit-diff-wash-diffs
+                    "diff" "--cached")
+                  (goto-char (point-min))
+                  (search-forward "name" nil 'noerror)
+                  (search-forward "+" nil 'noerror) ; first change
+                  (when (and (search-forward "version " nil 'noerror)
+                             (looking-at-p "\""))
+                    (let ((end (save-excursion (search-forward "\")"
+                                                               nil 'noerror))))
+                      (when end
+                        (forward-char)
+                        (buffer-substring-no-properties (point) (- end 2))))))
+                (skeleton-read "New version: ")))
+  '(setq v2 (or (guix--first-file-from-magit-diff)
+                (skeleton-read "File: ")))
+  ;; str - package, v1 - new version, v2 - file
+  "gnu: " str ": Update to " v1 "." \n
+  _ \n
+  "* " v2 " (" str  "): Update to " v1 "." \n)
+
+(define-skeleton guix-package-rename
+  "Insert a commit message for renaming a package."
+  (or (guix--first-file-from-magit-diff)
+      (skeleton-read "File: "))
+  '(setq v1 (or (guix--package-name-from-magit-diff
+                 (rx "-(define-public " (group (+ (not (syntax whitespace))))))
+                (skeleton-read "Old package: ")))
+  '(setq v2 (or (guix--package-name-from-magit-diff
+                 (rx "+(define-public " (group (+ (not (syntax whitespace))))))
+                (skeleton-read "New package: ")))
+  ;; str - file, v1 - old package, v2 - new package
+  "gnu: " v1 ": Rename package to " v2 "." \n
+  _ \n
+  @
+  "* " str " (" v1 "): Define in terms of `deprecated-package'." \n
+  "(" v2 "): New variable, formerly known as `crawl'." \n
+  @
+  '(fill-region (cadr skeleton-positions) (car skeleton-positions)))
+
+(define-skeleton guix-package-move
+  "Insert a commit message for moving a package."
+  (or (guix--package-name-from-magit-diff
+       (rx "-(define-public " (group (+ (not (syntax whitespace))))))
+      (skeleton-read "Package: "))
+  '(setq v1 (or (with-temp-buffer
+                  (magit-git-wash #'magit-diff-wash-diffs
+                    "diff" "--cached" "--no-prefix")
+                  (goto-char (point-min))
+                  (when (and
+                         (re-search-forward "\\-(define-public \\(\\S-+\\)"
+                                            nil 'noerror)
+                         (re-search-backward "modified[ ]*\\(\\S-+\\)"
+                                             nil 'noerror))
+                    (match-string-no-properties 1)))
+                (skeleton-read "Old file: ")))
+  '(setq v2 (or (with-temp-buffer
+                  (magit-git-wash #'magit-diff-wash-diffs
+                    "diff" "--cached" "--no-prefix")
+                  (goto-char (point-min))
+                  (when (and
+                         (re-search-forward "\\+(define-public \\(\\S-+\\)"
+                                            nil 'noerror)
+                         (re-search-backward "modified[ ]*\\(\\S-+\\)"
+                                             nil 'noerror))
+                    (match-string-no-properties 1)))
+                (skeleton-read "New file: ")))
+  ;; str - package, v1 - old file, v2 - new file
+  "gnu: " str ": Move to ("
+  (string-replace ".scm" "" (string-replace "/" " " v2))
+  ")." \n
+  _ \n
+  @
+  "* " v1 " (" str "): Move from here..." \n
+  "* " v2 " (" str "): ...to here." \n
+  @
+  '(fill-region (cadr skeleton-positions) (car skeleton-positions)))
+
+;;; commit-message.el ends here

base-commit: b212e6934643e085f168a5364cb593f61aa616ba
-- 
2.41.0





Information forwarded to guix-patches@HIDDEN:
bug#68354; Package guix-patches. Full text available.

Message received at 68354 <at> debbugs.gnu.org:


Received: (at 68354) by debbugs.gnu.org; 9 Jan 2024 22:47:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 09 17:47:52 2024
Received: from localhost ([127.0.0.1]:41239 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rNKsx-00039L-Vj
	for submit <at> 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 <at> 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=
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on wolfsden
X-Spam-Level: 
X-Spam-Status: No, score=-1.2 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED,
 DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,T_SCC_BODY_TEXT_LINE,
 URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6
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>
To: 68354 <at> debbugs.gnu.org
Subject: [PATCH 2/2] etc: snippets: Add skeletons for scheme-mode.
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: <cover.1704839576.git.~@wolfsden.cz>
References: <cover.1704839576.git.~@wolfsden.cz>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 68354
Cc: Tomas Volf <~@wolfsden.cz>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

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 <https://www.gnu.org/licenses/>.
+
+;;; 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
-- 
2.41.0





Information forwarded to guix-patches@HIDDEN:
bug#68354; Package guix-patches. Full text available.

Message received at 68354 <at> debbugs.gnu.org:


Received: (at 68354) by debbugs.gnu.org; 9 Jan 2024 22:47:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 09 17:47:49 2024
Received: from localhost ([127.0.0.1]:41237 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rNKsv-000390-AC
	for submit <at> debbugs.gnu.org; Tue, 09 Jan 2024 17:47:49 -0500
Received: from wolfsden.cz ([37.205.8.62]:50418)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <~@wolfsden.cz>) id 1rNKss-00038V-Vd
 for 68354 <at> debbugs.gnu.org; Tue, 09 Jan 2024 17:47:47 -0500
Received: by wolfsden.cz (Postfix, from userid 104)
 id 1692024D85B; 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=Rgjc60/6oZgU1kPW+ugi02OL676aRVaBkL6MGU7vba4=;
 h=From:To:Cc:Subject:Date:In-Reply-To:References;
 b=iyV9u7lKD82iYACKuUIZ0An8SlNnW7BgYMIY7LMOchw26fsZXYZgwosQ0SJ13Amh5
 7kLKJCM5hAQWnQVoznVdtI0GYt1YMmFgFvieQPUzV9QXaJaRU+ndCP1bo0aVl8cXi7
 yO14HfUDHMJF44TaMimsXPgcGyCoNXb+8h3jj51WGoDFv9BVLr6W95BUYOK6p7SYak
 ug2y2m7GUJsgBtsC/WTZgOqEQRv13+8LdAMrqZReAah1WHE7AE2oibMCGt0jnovPk6
 vKrdcUmdgIB9JEwinWOZYB3wts0A8Cf2yZG0v2ll7ufyGn3/6G+aGLYZR7pCqeEQGr
 EmH1VIi6PNPDIGVDii4n1eP+xgJO29S3j3kSz3I7xRD6YXnBEMC8TX6wogq8paiUVj
 fmh0mvrZikTyzL7OjTKHr87TIPnUjgwtSiOZmztR/WV67Pv4jEZoyLDwsFIne1qHMX
 TcycUgayl2Y0khSw1+UiuVMBLI1kFP2pOhSjSVE+KAV2JWXU/l+m8srIZsAd6SHdOA
 aKDVHk3Ogg8dQwFqUgT78wuGX9C8kjir7ZuwaY9ZDV7Q77YIUPt/rkIXqYYqb3ulu6
 GCf1rT8hwN0Np+UofzLxyYDUaO7zficGb3MxKpK4Py+GHMP3bm4b90ia+t177FEAa/
 Yi90G6QBzXWvRh9cAlyTKFY8=
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on wolfsden
X-Spam-Level: 
X-Spam-Status: No, score=-1.2 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED,
 DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,T_SCC_BODY_TEXT_LINE,
 URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6
Received: from localhost (unknown [146.70.134.143])
 by wolfsden.cz (Postfix) with ESMTPSA id 1E47A24C45D;
 Tue,  9 Jan 2024 22:47:38 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail;
 t=1704840458; bh=Rgjc60/6oZgU1kPW+ugi02OL676aRVaBkL6MGU7vba4=;
 h=From:To:Cc:Subject:Date:In-Reply-To:References;
 b=NRZJO1d/YEdsmMfBwSkK9rfsPk3Y/tN71ZRQLINWHFnfm7PI0geZDpCETVMSdiQ08
 rheK8CpV1oy7rbmIGZT3s5FsN8vOamUWAGxJ2wACAkaDEj+EBkERd4bNnw+W3UguE8
 NpX24+cUBOkR3BIda5LA6+KOV+D3Iu1PnsqOyf9jgMFdFzSJp0wmBDOd18skFXiP4q
 hqTbsGHVTMSO5+qE/j34naVRE/+e7BxCymS4etAM3TWZaUzWEazdkDa8C/E7v902/R
 a0DVYhXngAFTDWaXTbFQaDOr0B/a51yQN/aqEm/1Kg8vCD0g/Agj5yvaag+LzcXRoD
 hF5hVJnnbkmaUnS2n/GfRaEUVOoKmUzZXWOLrE020+0xoSeUxJFa1BdTlTpdmGWYRI
 mLjymz7XQHtbHAcL0qZkslQ6iH4itcwYatdN9ZlyNiK8CG/+hyXKfXNH534iCwSTi+
 Jt9H/+lgBRC0WXpvWDYH2jyqDnPol1DdoJp6y23k1E++KNNfiHmfxWwiPBMoDBCuCH
 cuqkUaIRUNqoZpO2X8ukQvn3N+JLc6FAcUn0nLDB7I6HU+HH++h4ATLFAuS0HpxLCn
 sXOhQHWuC2WaOJNb3bWPElHMqgkvBsZhMzn2h2Rk3Rg+TbkxNv3GVwcxaTR7k1rijs
 qQjwgOXglQ8QZLdyXm2SkMMs=
From: Tomas Volf <~@wolfsden.cz>
To: 68354 <at> debbugs.gnu.org
Subject: [PATCH 1/2] etc: snippets: Add skeletons for commit messages.
Date: Tue,  9 Jan 2024 23:47:33 +0100
Message-ID: <12887de50dc01339faf03aa66d298f1e16ec7b18.1704839576.git.~@wolfsden.cz>
X-Mailer: git-send-email 2.41.0
In-Reply-To: <cover.1704839576.git.~@wolfsden.cz>
References: <cover.1704839576.git.~@wolfsden.cz>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 68354
Cc: Tomas Volf <~@wolfsden.cz>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Some people use just plain old skeleton system, which comes with Emacs.  This
commit adds skeletons for generating commit messages for the common
operations (updating packages, ...).

* etc/snippets/skeleton/commit-message.el: New file.
* doc/contributing.texi (The Perfect Setup): Document it.

Change-Id: Ic37b6455a337fc431ad2b049d5b7261da97e5a06
---
 doc/contributing.texi                   |  20 ++++
 etc/snippets/skeleton/commit-message.el | 143 ++++++++++++++++++++++++
 2 files changed, 163 insertions(+)
 create mode 100644 etc/snippets/skeleton/commit-message.el

diff --git a/doc/contributing.texi b/doc/contributing.texi
index 5707ff5cde..1311098dfc 100644
--- a/doc/contributing.texi
+++ b/doc/contributing.texi
@@ -360,6 +360,26 @@ The Perfect Setup
 @code{origin} snippet in turn may insert other trigger strings ending on
 @code{...}, which also can be expanded further.
 
+@cindex skeleton
+If you use built-in skeleton system (@xref{Top,,,autotype}), you can
+load the snippets from the @file{etc/snippets/skeleton} directory.
+
+Skeletons for editing commit messages are provided in
+@file{etc/snippets/skeleton/commit-message.el}.
+
+@cindex @code{M-x guix-package-add}
+@cindex @code{M-x guix-package-remove}
+@cindex @code{M-x guix-package-update}
+@cindex @code{M-x guix-package-rename}
+@cindex @code{M-x guix-package-move}
+Once you load the file, the following functions are provided:
+@code{guix-package-add}, @code{guix-package-remove},
+@code{guix-package-update}, @code{guix-package-rename} and
+@code{guix-package-move}.  When editing a commit message, invoke the
+appropriate one using @code{M-x} to insert a message for the change.
+
+The commit message skeletons depend on @url{https://magit.vc/, Magit}.
+
 @cindex insert or update copyright
 @cindex @code{M-x guix-copyright}
 @cindex @code{M-x copyright-update}
diff --git a/etc/snippets/skeleton/commit-message.el b/etc/snippets/skeleton/commit-message.el
new file mode 100644
index 0000000000..698079a004
--- /dev/null
+++ b/etc/snippets/skeleton/commit-message.el
@@ -0,0 +1,143 @@
+;;; commit-message.el --- skeletons for Guix's commit messages  -*- lexical-binding: t; -*-
+;;; Copyright © 2024 Tomas Volf <~@wolfsden.cz>
+
+;; Author: Tomas Volf <~@wolfsden.cz>
+;; Keywords: vc, 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 <https://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(defun guix--package-name-from-magit-diff (regex)
+  (with-temp-buffer
+    (magit-git-wash #'magit-diff-wash-diffs "diff" "--cached")
+    (goto-char (point-min))
+    (when (re-search-forward regex
+                             nil 'noerror)
+      (match-string-no-properties 1))))
+
+(defun guix--first-file-from-magit-diff ()
+    (car (magit-staged-files)))
+
+(define-skeleton guix-package-add
+  "Insert a commit message for adding a package."
+  nil
+  '(setq v1 (or (guix--package-name-from-magit-diff
+                 (rx "+(define-public " (group (+ (not (syntax whitespace))))))
+                (skeleton-read "Package: ")))
+  '(setq v2 (or (guix--first-file-from-magit-diff)
+                (skeleton-read "File: ")))
+  ;; v1 - package, v2 - file
+  "gnu: Add " v1 "." \n
+  _ \n
+  "* " v2 " (" v1  "): New variable." \n)
+
+(define-skeleton guix-package-remove
+  "Insert a commit message for removing a package."
+  nil
+  '(setq v1 (or (guix--package-name-from-magit-diff
+                 (rx "-(define-public " (group (+ (not (syntax whitespace))))))
+                (skeleton-read "Package: ")))
+  '(setq v2 (or (guix--first-file-from-magit-diff)
+                (skeleton-read "File: ")))
+  ;; v1 - package, v2 - file
+  "gnu: Remove " v1 "." \n
+  _ \n
+  "* " v2 " (" v1  "): Delete variable." \n)
+
+(define-skeleton guix-package-update
+  "Insert a commit message for updating a package."
+  (or (guix--package-name-from-magit-diff
+       (rx line-start (* (syntax whitespace))
+           "(define-public " (group (+ (not (syntax whitespace))))))
+      (skeleton-read "Package: "))
+  '(setq v1 (or (with-temp-buffer
+                  (magit-git-wash #'magit-diff-wash-diffs
+                    "diff" "--cached")
+                  (goto-char (point-min))
+                  (search-forward "name" nil 'noerror)
+                  (search-forward "+" nil 'noerror) ; first change
+                  (when (and (search-forward "version " nil 'noerror)
+                             (looking-at-p "\""))
+                    (let ((end (save-excursion (search-forward "\")"
+                                                               nil 'noerror))))
+                      (when end
+                        (forward-char)
+                        (buffer-substring-no-properties (point) (- end 2))))))
+                (skeleton-read "New version: ")))
+  '(setq v2 (or (guix--first-file-from-magit-diff)
+                (skeleton-read "File: ")))
+  ;; str - package, v1 - new version, v2 - file
+  "gnu: " str ": Update to " v1 "." \n
+  _ \n
+  "* " v2 " (" str  "): Update to " v1 "." \n)
+
+(define-skeleton guix-package-rename
+  "Insert a commit message for renaming a package."
+  (or (guix--first-file-from-magit-diff)
+      (skeleton-read "File: "))
+  '(setq v1 (or (guix--package-name-from-magit-diff
+                 (rx "-(define-public " (group (+ (not (syntax whitespace))))))
+                (skeleton-read "Old package: ")))
+  '(setq v2 (or (guix--package-name-from-magit-diff
+                 (rx "+(define-public " (group (+ (not (syntax whitespace))))))
+                (skeleton-read "New package: ")))
+  ;; str - file, v1 - old package, v2 - new package
+  "gnu: " v1 ": Rename package to " v2 "." \n
+  _ \n
+  @
+  "* " str " (" v1 "): Define in terms of `deprecated-package'." \n
+  "(" v2 "): New variable, formerly known as `crawl'." \n
+  @
+  '(fill-region (cadr skeleton-positions) (car skeleton-positions)))
+
+(define-skeleton guix-package-move
+  "Insert a commit message for moving a package."
+  (or (guix--package-name-from-magit-diff
+       (rx "-(define-public " (group (+ (not (syntax whitespace))))))
+      (skeleton-read "Package: "))
+  '(setq v1 (or (with-temp-buffer
+                  (magit-git-wash #'magit-diff-wash-diffs
+                    "diff" "--cached" "--no-prefix")
+                  (goto-char (point-min))
+                  (when (and
+                         (re-search-forward "\\-(define-public \\(\\S-+\\)"
+                                            nil 'noerror)
+                         (re-search-backward "modified[ ]*\\(\\S-+\\)"
+                                             nil 'noerror))
+                    (match-string-no-properties 1)))
+                (skeleton-read "Old file: ")))
+  '(setq v2 (or (with-temp-buffer
+                  (magit-git-wash #'magit-diff-wash-diffs
+                    "diff" "--cached" "--no-prefix")
+                  (goto-char (point-min))
+                  (when (and
+                         (re-search-forward "\\+(define-public \\(\\S-+\\)"
+                                            nil 'noerror)
+                         (re-search-backward "modified[ ]*\\(\\S-+\\)"
+                                             nil 'noerror))
+                    (match-string-no-properties 1)))
+                (skeleton-read "New file: ")))
+  ;; str - package, v1 - old file, v2 - new file
+  "gnu: " str ": Move to ("
+  (string-replace ".scm" "" (string-replace "/" " " v2))
+  ")." \n
+  _ \n
+  @
+  "* " v1 " (" str "): Move from here..." \n
+  "* " v2 " (" str "): ...to here." \n
+  @
+  '(fill-region (cadr skeleton-positions) (car skeleton-positions)))
+
+;;; commit-message.el ends here
-- 
2.41.0





Information forwarded to guix-patches@HIDDEN:
bug#68354; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 9 Jan 2024 22:46:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 09 17:46:30 2024
Received: from localhost ([127.0.0.1]:41223 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rNKre-00032I-Mc
	for submit <at> debbugs.gnu.org; Tue, 09 Jan 2024 17:46:30 -0500
Received: from lists.gnu.org ([2001:470:142::17]:44422)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <~@wolfsden.cz>) id 1rNKrd-0002wu-9i
 for submit <at> debbugs.gnu.org; Tue, 09 Jan 2024 17:46:29 -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 <~@wolfsden.cz>) id 1rNKrQ-000735-NG
 for guix-patches@HIDDEN; Tue, 09 Jan 2024 17:46:16 -0500
Received: from wolfsden.cz ([37.205.8.62])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <~@wolfsden.cz>) id 1rNKrO-0004II-TF
 for guix-patches@HIDDEN; Tue, 09 Jan 2024 17:46:16 -0500
Received: by wolfsden.cz (Postfix, from userid 104)
 id 5E9A024E485; Tue,  9 Jan 2024 22:46:12 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail;
 t=1704840372; bh=QaPIYyjsYQ1BE+9T+O/j/9B64AeIR3ES7xZZH2w/GQk=;
 h=From:To:Cc:Subject:Date;
 b=hAWpZdhXTS/oBGqPXnXjBveIPNQsw8J2SmisM8AIFDBgBorEry5gkPygwoEOdYO1s
 cv+ab+LDxl5EtEK3oPN1CLqEzFx5iu63MW/sWF0w6fXfrMJ2VjyebVNHsNKBwOXBRt
 VvqB5pwPMeEFv5LaHcVkrK0DgGrERCaK5CUwmhpY2WggdxixZYyMOc9ISVsE9cIG+b
 BiEHzha7KyTwtLl0EtborS2O+gIvg2pw6sU8wcUj9AhFYVhCVgWE4OhkmfMNeC4h7H
 ydRxzrTlddGHyQt48qXWOaoI2Vbe2fJCzRAigAIilo4h3COFRkQXFKD2OsS2jO/47D
 0YhbEMAmpDl9kVZExnmpUficCjaaAEDjLgdFrfU215Hzb5pXg4nUmfC3wxreIQjKOU
 ei8xstWziJWEh7WpzWGa9iSD70ZEq+zxhK6uT4TAWGhaHeI9nFh2t1uxW/OxqqznLm
 MMp25qcOi2wXHeV534QPdif9h8nym5rcA9kKzEZG0BcDLRBpdnlLKfaOEPWnRY247t
 qIq07sqffHOUYlnASHUnbBBTSF6cxopFk+j9Uks41jRrVMONxLI7AEEatMkAZuP9od
 pcvxCavJHBhFXo5oqAwj3aiQIpvemztTcxbQXSvewHOSZB5xKEssmldeF+d4773l3H
 3EyWumBR6kenlbomx5RQbMI0=
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on wolfsden
X-Spam-Level: 
X-Spam-Status: No, score=-1.2 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED,
 DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,T_SCC_BODY_TEXT_LINE,
 URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6
Received: from localhost (unknown [146.70.134.143])
 by wolfsden.cz (Postfix) with ESMTPSA id 5955824D64C;
 Tue,  9 Jan 2024 22:46:11 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail;
 t=1704840371; bh=QaPIYyjsYQ1BE+9T+O/j/9B64AeIR3ES7xZZH2w/GQk=;
 h=From:To:Cc:Subject:Date;
 b=Qzm/UV+NbYF72yRlK+wLj36j+KxTlu5QUSmb9cWjsuSYu0qaCwu7ILBA4X7vGxj2Y
 Ug8XNtucrLT+XhEEDQOJH1DYgKAjgAFZY1Lz0SiJ+1HFEHqNAYGWXk2vpW1XYQJbKb
 PHfBstQgmBzwbYq8Ix9ofsZZMQO5+Ax2cvTdrezUhtpzaf0SHytk90E2+sELrK3hes
 QrgZySBRZ6fcbwqkP8hFHNEapuy63x8hU9I4r9smwfUuM2ejm76Dhkr1N1VmiZ07Ob
 HagMExOA0dvqSpXVyEJqcGyIrXRreZ5pQ3SmkrTAHffhLrd6CeOzOiYLEJ+1/4kPw4
 lkftS9Wn9aVCPopE78wWZbp89b+0vKqu/zsXweigZA3PL/CwbiRtSuryRyGWmJ6fxr
 wlQlvm8GA1fTkLXuLgXOb3zCPm04+5Y7ruOYvG8pxTJY/Mb/XMteJsWKVMRFiA22Lu
 dGibQHDteXIuQl6l2q853hVVvUkJPHe32RAEvmvLFRnrpgnVpY4fJqQd11ubFreDVG
 SvOSHH8vA1FLW6yH0JYvE0NNg0BaYeP9HkUUaN/ELjA5O4OYpYJEIW6mDOd2o13Akf
 MDxwVrA0oh1TPWcfBwaxgoOkKJAcHiAXW2vtEWCiyuSy1hrls5o+lMStdxTmfMdGvb
 bSL61EA+XFpoauAWrApVJEbc=
From: Tomas Volf <~@wolfsden.cz>
To: guix-patches@HIDDEN
Subject: [PATCH 0/2] Add snippets based on skeleton system.
Date: Tue,  9 Jan 2024 23:46:03 +0100
Message-ID: <cover.1704839576.git.~@wolfsden.cz>
X-Mailer: git-send-email 2.41.0
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=37.205.8.62; envelope-from=~@wolfsden.cz;
 helo=wolfsden.cz
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001,
 SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: submit
Cc: Tomas Volf <~@wolfsden.cz>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

Until now there was no support for commit message and package generation for
people not using either tempel or yasnippet.  This commit adds third set of
snippets based on skeleton system, which comes with Emacs out of the box.

Tomas Volf (2):
  etc: snippets: Add skeletons for commit messages.
  etc: snippets: Add skeletons for scheme-mode.

 doc/contributing.texi                   |  42 +++++++
 etc/snippets/skeleton/commit-message.el | 143 ++++++++++++++++++++++++
 etc/snippets/skeleton/scheme.el         | 117 +++++++++++++++++++
 3 files changed, 302 insertions(+)
 create mode 100644 etc/snippets/skeleton/commit-message.el
 create mode 100644 etc/snippets/skeleton/scheme.el


base-commit: b212e6934643e085f168a5364cb593f61aa616ba
--
2.41.0




Acknowledgement sent to Tomas Volf <~@wolfsden.cz>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#68354; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sat, 20 Jan 2024 12:30:02 UTC

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