Skip to content

Commit

Permalink
legit commit: open .git/COMMIT_EDITMSG in legit-commit-mode
Browse files Browse the repository at this point in the history
  • Loading branch information
vindarel committed Nov 21, 2024
1 parent 370ce1d commit ff01fec
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions extensions/legit/legit-commit.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ Future:
;; no syntax highlihgt in fact.
(setf (variable-value 'enable-syntax-highlight) t))

(define-file-associations legit-commit-mode
((:file-namestring "COMMIT_EDITMSG")))

;; User parameters.
(defparameter *prompt-to-abort-commit* t
"If non t, abort the current commit message without asking for confirmation.")
Expand Down Expand Up @@ -86,7 +89,10 @@ two
"If the commit message is non-empty, commit, kill the commit buffer and come back to the legit status window.
Lines starting with '#' are ignored."
(let* ((message (buffer-text (make-buffer "*legit-commit*")))
;; The commit buffer can be:
;; - our *legit-commit* buffer
;; - the .git/COMMIT_EDITMSG file
(let* ((message (buffer-text (current-buffer)))
(cleaned-message (clean-commit-message message)))
(cond
((str:blankp cleaned-message)
Expand All @@ -96,7 +102,7 @@ two
(run-function (lambda ()
(lem/porcelain::commit vcs cleaned-message))
:message "commited")
(kill-buffer "*legit-commit*")
(kill-buffer (current-buffer))
;; come back on the status on the left:
(lem-core/commands/window:previous-window)
;; and refresh.
Expand Down

0 comments on commit ff01fec

Please sign in to comment.