From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:5f26::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id DqEyMjzNnWVqRgAAkFu2QA (envelope-from ) for ; Tue, 09 Jan 2024 23:48:28 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id OBzKLDzNnWW8WAEAqHPOHw (envelope-from ) for ; Tue, 09 Jan 2024 23:48:28 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=wolfsden.cz header.s=mail header.b=iyV9u7lK; dkim=fail ("headers rsa verify failed") header.d=wolfsden.cz header.s=mail header.b="NRZJO1d/"; 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"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=wolfsden.cz (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1704840508; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=wH31Y1AtU/aU3o8JGTCvaaTSZItIWlOQ3/tTKEUt/Z8=; b=awt+83dRhlO5KyBlBHMGzUhvE4TpPgXLTKpJ9ldbO95Mk6pNfVhPxOFxvwK77AqQzcpGxN IL6w33jYsMa4L4Y5PakeE4FRwByHvDVbB2vT5cexu+Q0AKSseTk0vijre030S5YaDablxV m+jy3A2uWEUURP2vvTlbxepxJXwyIftemOZ6cg4W/3eFTvWjkog3mAh/LEdf1O8wbGIphC 8YiBJ6g0B7EyVgKOUutmQPGuHT3nsYxDQjUn5H0lfX3z6xxzCiFFRwsSnJX+HX60o0mmGs TDg54AAE5n0C0PkEpvtmyGE8BL4aIHzm0GLvTFNRF1KVVE3NZmesse70FuGMyg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1704840508; a=rsa-sha256; cv=none; b=uCYEjDhgVn58I0MX2XeFa4DaQrDLkJDNAvY582aX8bcfcNQW1U6kLDj54w4ziH6iROHWPf DkVO/A2KGUmizKgyFF209+VZzhPdjPEI4BnmBpCBwFDDNXO2Qy3mWAV6dUA3HTLOMtRR7A JWdkOuXif16O2pwdUxgWESK+tHVr0xPplj4Aix2bgVkrpk1TS3Q4Mbo/EySWIe8QYVV8AK 1uFQnKYTsMqGq04S3rgo0iTxP0fVim68muEHh/lQsOlREdejnfZ36gnS3PnqbllPk75m2G EZN7VI7U0HTLla9uv7YgAQ+BtUQKLTEYXSPlMxtpVhNx8WkaPMmnv93qPD4Vxw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=wolfsden.cz header.s=mail header.b=iyV9u7lK; dkim=fail ("headers rsa verify failed") header.d=wolfsden.cz header.s=mail header.b="NRZJO1d/"; 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"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=wolfsden.cz (policy=none) 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 7C986330CD for ; Tue, 9 Jan 2024 23:48:28 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rNKt4-0007FT-GL; Tue, 09 Jan 2024 17:47:58 -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 1rNKt1-0007DJ-UW for guix-patches@gnu.org; Tue, 09 Jan 2024 17:47:55 -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 1rNKt1-0004vd-LA for guix-patches@gnu.org; Tue, 09 Jan 2024 17:47:55 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rNKt8-0003As-N1 for guix-patches@gnu.org; Tue, 09 Jan 2024 17:48:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68354] [PATCH 1/2] etc: snippets: Add skeletons for commit messages. Resent-From: Tomas Volf <~@wolfsden.cz> Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 09 Jan 2024 22:48:02 +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.170484047012096 (code B ref 68354); Tue, 09 Jan 2024 22:48:02 +0000 Received: (at 68354) by debbugs.gnu.org; 9 Jan 2024 22:47:50 +0000 Received: from localhost ([127.0.0.1]:41237 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rNKsv-000390-AC for submit@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@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= 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> 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: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -2.71 X-Spam-Score: -2.71 X-Migadu-Queue-Id: 7C986330CD X-Migadu-Scanner: mx12.migadu.com X-TUID: 3zgUKHw+x8+o 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 . + +;;; 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