aboutsummaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorJonas Bernoulli <jonas@bernoul.li>2015-08-15 17:00:43 +0200
committerJonas Bernoulli <jonas@bernoul.li>2015-08-15 17:00:43 +0200
commitfdefb34fd8f97cd845ca8243f104d13e5e7b2ca9 (patch)
tree9824ae3e12be58e58e35e877bcbe6176b6b7204f /lisp
parent2d60e1596fd3927b4a983aade1f9b4dd9b59b23c (diff)
define commit popup without using magit-define-popup
This avoids having to advice `magit-commit-popup'.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/magit-commit.el67
1 files changed, 39 insertions, 28 deletions
diff --git a/lisp/magit-commit.el b/lisp/magit-commit.el
index 6028605..63487aa 100644
--- a/lisp/magit-commit.el
+++ b/lisp/magit-commit.el
@@ -43,6 +43,11 @@
;;; Options
+(defcustom magit-commit-arguments nil
+ "The arguments used when committing."
+ :group 'magit-commands
+ :type '(repeat (string :tag "Argument")))
+
(defcustom magit-commit-ask-to-stage t
"Whether to ask to stage everything when committing and nothing is staged."
:package-version '(magit . "2.1.0")
@@ -74,32 +79,41 @@ an error while using those is harder to recover from."
;;; Code
-;;;###autoload (autoload 'magit-commit-popup "magit-commit" nil t)
-(with-no-warnings ; quiet byte-compiler
-(magit-define-popup magit-commit-popup
+(defun magit-commit-popup (&optional arg)
"Popup console for commit commands."
- 'magit-commands
- :man-page "git-commit"
- :switches '((?a "Stage all modified and deleted files" "--all")
- (?e "Allow empty commit" "--allow-empty")
- (?v "Show diff of changes to be committed" "--verbose")
- (?n "Bypass git hooks" "--no-verify")
- (?s "Add Signed-off-by line" "--signoff")
- (?R "Claim authorship and reset author date" "--reset-author"))
- :options '((?A "Override the author" "--author=" read-from-minibuffer)
- (?S "Sign using gpg" "--gpg-sign=" magit-read-gpg-secret-key)
- (?C "Reuse commit message" "--reuse-message=" read-from-minibuffer))
- :actions '((?c "Commit" magit-commit)
- (?e "Extend" magit-commit-extend)
- (?f "Fixup" magit-commit-fixup)
- (?F "Instant Fixup" magit-commit-instant-fixup) nil
- (?w "Reword" magit-commit-reword)
- (?s "Squash" magit-commit-squash)
- (?S "Instant Squash" magit-commit-instant-squash) nil
- (?a "Amend" magit-commit-amend)
- (?A "Augment" magit-commit-augment))
- :max-action-columns 4
- :default-action 'magit-commit))
+ (interactive "P")
+ (--if-let (magit-commit-message-buffer)
+ (switch-to-buffer it)
+ (magit-invoke-popup 'magit-commit-popup nil arg)))
+
+(defvar magit-commit-popup
+ '(:variable 'magit-commit-arguments
+ :man-page "git-commit"
+ :switches ((?a "Stage all modified and deleted files" "--all")
+ (?e "Allow empty commit" "--allow-empty")
+ (?v "Show diff of changes to be committed" "--verbose")
+ (?n "Bypass git hooks" "--no-verify")
+ (?s "Add Signed-off-by line" "--signoff")
+ (?R "Claim authorship and reset author date" "--reset-author"))
+ :options ((?A "Override the author" "--author=" read-from-minibuffer)
+ (?S "Sign using gpg" "--gpg-sign=" magit-read-gpg-secret-key)
+ (?C "Reuse commit message" "--reuse-message=" read-from-minibuffer))
+ :actions ((?c "Commit" magit-commit)
+ (?e "Extend" magit-commit-extend)
+ (?f "Fixup" magit-commit-fixup)
+ (?F "Instant Fixup" magit-commit-instant-fixup) nil
+ (?w "Reword" magit-commit-reword)
+ (?s "Squash" magit-commit-squash)
+ (?S "Instant Squash" magit-commit-instant-squash) nil
+ (?a "Amend" magit-commit-amend)
+ (?A "Augment" magit-commit-augment))
+ :max-action-columns 4
+ :default-action 'magit-commit))
+
+(defun magit-commit-arguments nil
+ (if (eq magit-current-popup 'magit-commit-popup)
+ magit-current-popup-args
+ magit-commit-arguments))
(defun magit-commit-message-buffer ()
(let ((topdir (magit-toplevel)))
@@ -108,9 +122,6 @@ an error while using those is harder to recover from."
(append (buffer-list (selected-frame))
(buffer-list)))))
-(defadvice magit-commit-popup (around pop-to-ongoing activate)
- (--if-let (magit-commit-message-buffer) (switch-to-buffer it) ad-do-it))
-
;;;###autoload
(defun magit-commit (&optional args)
"Create a new commit on HEAD.