emacs-elpa-diffs
[Top][All Lists]
Advanced

[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)
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]