etc: snippets: Fix name extraction.
authorNicolas Goaziou <mail@nicolasgoaziou.fr>
Fri, 4 Dec 2020 17:19:39 +0000 (18:19 +0100)
committerNicolas Goaziou <mail@nicolasgoaziou.fr>
Fri, 4 Dec 2020 17:19:39 +0000 (18:19 +0100)
* etc/snippets/text-mode/guix-commit-message-add-package: Fix name
extraction. This is a follow-up to 988a49c78ef19ad25cef543e2059a19db04bbd36.

etc/snippets/text-mode/guix-commit-message-add-package

index e54a06d..7cebd40 100644 (file)
@@ -6,8 +6,8 @@
 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)))`}.
+                (goto-char (point-min))
+                (when (re-search-forward "\\+(define-public \\(\\S-+\\)" nil 'noerror)
+                  (match-string-no-properties 1)))`}.
 
 * `(car (magit-staged-files))` ($1): New variable.
\ No newline at end of file