summary refs log tree commit diff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2019-03-08 00:17:30 +0100
committerRicardo Wurmus <rekado@elephly.net>2019-03-08 00:17:30 +0100
commit95803946c7dbdff88db09fa5fe98e70d607712a7 (patch)
tree9090f8b7072aca75fac8637ebe83c39b9d1d1b3d
parent933dad9156bfb05fc264fda01de351839403316b (diff)
downloadguix-95803946c7dbdff88db09fa5fe98e70d607712a7.tar.gz
etc: snippets: Prefill package name.
* etc/snippets/text-mode/guix-commit-message-add-package: Extract package
name from diff.
-rw-r--r--etc/snippets/text-mode/guix-commit-message-add-package7
1 files changed, 6 insertions, 1 deletions
diff --git a/etc/snippets/text-mode/guix-commit-message-add-package b/etc/snippets/text-mode/guix-commit-message-add-package
index 1aebe8a763..0dff2cbcf5 100644
--- a/etc/snippets/text-mode/guix-commit-message-add-package
+++ b/etc/snippets/text-mode/guix-commit-message-add-package
@@ -3,6 +3,11 @@
 # key: add
 # condition: git-commit-mode
 # --
-gnu: Add $1.
+gnu: Add ${1:`(with-temp-buffer
+                (magit-git-wash #'magit-diff-wash-diffs
+                  "diff" "--staged")
+                (beginning-of-buffer)
+                (when (search-forward "(define-public " nil 'noerror)
+                  (thing-at-point 'sexp 'no-properties)))`}.
 
 * `(car (magit-staged-files))` ($1): New variable.
\ No newline at end of file