[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/agitate a2173cf82c 39/67: Implement conventional commit
From: |
ELPA Syncer |
Subject: |
[elpa] externals/agitate a2173cf82c 39/67: Implement conventional commits; refine emoji commits |
Date: |
Wed, 28 Sep 2022 16:57:28 -0400 (EDT) |
branch: externals/agitate
commit a2173cf82c90a6d0c2307dfb7396efd4374a4253
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Implement conventional commits; refine emoji commits
Those commands should be interactive-only. It makes no sense to use
the function if all you need to add something like "feat".
---
README.org | 16 +++++++++-------
agitate.el | 45 ++++++++++++++++++++++++++++++++-------------
2 files changed, 41 insertions(+), 20 deletions(-)
diff --git a/README.org b/README.org
index af8bd78d8e..95bc993a2f 100644
--- a/README.org
+++ b/README.org
@@ -124,13 +124,15 @@ The following sections document the extras per their
scope.
Unicode. Relevant applications will render those as their
corresponding graphical emoji.
-Relevant quote about the emoji commits from the source code:
-
-#+begin_src emacs-lisp
-;; TODO 2022-09-27: Learn about "conventional commits" and implement
-;; them like with `agitate-log-edit-emoji-commit':
-;; <https://www.conventionalcommits.org/en/v1.0.0-beta.2/#specification>.
-#+end_src
+#+findex: agitate-log-edit-conventional-commit
++ ~agitate-log-edit-conventional-commit~ :: Insert conventional commit
+ message at point. Prompt for entry among those declared in
+ ~agitate-log-edit-conventional-commits-collection~.
+
+#+vindex: agitate-log-edit-conventional-commits-collection
++ ~agitate-log-edit-conventional-commits-collection~ :: User options
+ whose value is a list of strings that represent completion
+ candidates for ~agitate-log-edit-conventional-commit~.
The emoji commits are inspired by <https://gitmoji.dev/>, though I
think most of those are superfluous. Less is more.
diff --git a/agitate.el b/agitate.el
index 6ba875c97a..6d3e112aea 100644
--- a/agitate.el
+++ b/agitate.el
@@ -62,9 +62,12 @@ will render those as their corresponding graphical emoji."
:type '(repeat string)
:group 'agitate)
-;; TODO 2022-09-27: Learn about "conventional commits" and implement
-;; them like with `agitate-log-edit-emoji-commit':
-;; <https://www.conventionalcommits.org/en/v1.0.0-beta.2/#specification>.
+(defcustom agitate-log-edit-conventional-commits-collection
+ '("build" "chore" "ci" "docs" "feat" "fix" "perf" "polish"
+ "refactor" "revert" "style" "test" "types" "workflow")
+ "Completion candidates for `agitate-log-edit-conventional-commit'."
+ :type '(repeat string)
+ :group 'agitate)
;;;; Commands for diff-mode
@@ -207,17 +210,33 @@ file extension. Else omit it."
"Minibuffer history of `agitate-log-edit-emoji-commit'.")
;;;###autoload
-(defun agitate-log-edit-emoji-commit (emoji-commit)
- "Insert EMOJI-COMMIT message at point.
-When called interactively, prompt for EMOJI-COMMIT among the
-`agitate-log-edit-emoji-collection'."
- (interactive
- (list
+(defun agitate-log-edit-emoji-commit ()
+ "Insert emoji commit message at point.
+Prompt for entry among `agitate-log-edit-emoji-collection'."
+ (declare (interactive-only t))
+ (interactive)
+ (insert
+ (completing-read
+ "Select type of commit+emoji: "
+ agitate-log-edit-emoji-collection nil t nil
+ 'agitate--log-edit-emoji-commit-history)))
+
+(defvar agitate--log-edit-conventional-commits-history nil
+ "Minibuffer history of `agitate-log-edit-conventional-commit'.")
+
+(defun agitate-log-edit-conventional-commit ()
+ "Insert conventional commit message at point.
+Prompt for entry among those declared in
+`agitate-log-edit-conventional-commits-collection'."
+ (declare (interactive-only t))
+ (interactive)
+ (insert
+ (concat
(completing-read
- "Select type of commit+emoji: "
- agitate-log-edit-emoji-collection nil t nil
- 'agitate--log-edit-emoji-commit-history)))
- (insert emoji-commit))
+ "Select type of conventional commit: "
+ agitate-log-edit-conventional-commits-collection nil t nil
+ 'agitate--log-edit-conventional-commits-history)
+ ": ")))
;;;; Commands for log-view (listings of commits)
- [elpa] externals/agitate 0b80819820 62/67: Refine regexp for git hash extraction, (continued)
- [elpa] externals/agitate 0b80819820 62/67: Refine regexp for git hash extraction, ELPA Syncer, 2022/09/28
- [elpa] externals/agitate 45eb3b6c5d 54/67: Declare agitate-vc-git-show as interactive-only, ELPA Syncer, 2022/09/28
- [elpa] externals/agitate 912161bfc1 27/67: Add doclicense.texi which is used in the manual, ELPA Syncer, 2022/09/28
- [elpa] externals/agitate 6eb66ed1cc 44/67: Add helper to extract commit hash, ELPA Syncer, 2022/09/28
- [elpa] externals/agitate 8bb7652cac 43/67: Rename to agitate-vc-git-grep, ELPA Syncer, 2022/09/28
- [elpa] externals/agitate 496eba8497 52/67: Add agitate-vc-git-show prototype, ELPA Syncer, 2022/09/28
- [elpa] externals/agitate 1e998e1466 59/67: Rename helper for single commit command, ELPA Syncer, 2022/09/28
- [elpa] externals/agitate de2094a2f5 53/67: Placate the compiler, ELPA Syncer, 2022/09/28
- [elpa] externals/agitate 50251c7eff 64/67: Add agitate-log-view-kill-revision-expanded cmd, ELPA Syncer, 2022/09/28
- [elpa] externals/agitate 60dea993b9 25/67: Add COPYING GNU General Public License, ELPA Syncer, 2022/09/28
- [elpa] externals/agitate a2173cf82c 39/67: Implement conventional commits; refine emoji commits,
ELPA Syncer <=
- [elpa] externals/agitate acaa1868d0 30/67: Move log-view section further down, ELPA Syncer, 2022/09/28
- [elpa] externals/agitate 2b8a593a5d 38/67: Add missing backronym from README.md, ELPA Syncer, 2022/09/28
- [elpa] externals/agitate 52c9968e5f 19/67: Refine agitate-vc-git-push doc string, ELPA Syncer, 2022/09/28
- [elpa] externals/agitate b7a51e04d2 18/67: Adjust indentation, ELPA Syncer, 2022/09/28
- [elpa] externals/agitate f29bc8e32a 21/67: Reorder some functions, ELPA Syncer, 2022/09/28
- [elpa] externals/agitate 3185f2becd 50/67: Clarify word in agitate-vc-git-grep doc string, ELPA Syncer, 2022/09/28
- [elpa] externals/agitate 8459e26050 45/67: Add helper prompt for commit log completion, ELPA Syncer, 2022/09/28