guix-commit-message-update-package 1.0 KB

1234567891011121314151617181920212223242526
  1. # -*- mode: snippet -*-
  2. # name: guix-commit-message-update-package
  3. # key: update
  4. # condition: git-commit-mode
  5. # --
  6. gnu: ${1:`(with-temp-buffer
  7. (magit-git-wash #'magit-diff-wash-diffs
  8. "diff" "--staged")
  9. (goto-char (point-min))
  10. (when (re-search-forward "(define-public \\(\\S-+\\)" nil 'noerror)
  11. (match-string-no-properties 1)))`}: Update to ${2:`(with-temp-buffer
  12. (magit-git-wash #'magit-diff-wash-diffs
  13. "diff" "--staged")
  14. (goto-char (point-min))
  15. (search-forward "name" nil 'noerror)
  16. (search-forward "+" nil 'noerror) ; first change
  17. (when (and (search-forward "version " nil 'noerror)
  18. (looking-at-p "\""))
  19. (let ((end (save-excursion (search-forward "\")" nil 'noerror))))
  20. (when end
  21. (forward-char)
  22. (buffer-substring-no-properties (point) (- end 2))))))`}.
  23. * `(car (magit-staged-files))` ($1): Update to $2.$0
  24. `(mapconcat (lambda (file) (concat "* " file)) (cdr (magit-staged-files)) "\n")`