aboutsummaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorJonas Bernoulli <jonas@bernoul.li>2015-08-16 14:18:15 +0200
committerJonas Bernoulli <jonas@bernoul.li>2015-08-16 14:18:15 +0200
commit4a31214f3c4dcbd8d8b339361ec27686c71df280 (patch)
tree423f66b32d9f0a281fb90c33f6e206d3b047a88e /lisp
parent18211c7f95c2c8987162e10313a75efb55f3060e (diff)
magit-define-popup-keys-deferred: new function
Not all popups are defined using `magit-define-popup' so move the code responsible for defining deferred user bindings out of that macro and into the new function `magit-define-popup-keys-deferred', and for each popup that is defined without using the macro, call this new function explicitly.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/magit-commit.el2
-rw-r--r--lisp/magit-diff.el4
-rw-r--r--lisp/magit-log.el3
-rw-r--r--lisp/magit-popup.el19
4 files changed, 20 insertions, 8 deletions
diff --git a/lisp/magit-commit.el b/lisp/magit-commit.el
index 54a5bb0..d125377 100644
--- a/lisp/magit-commit.el
+++ b/lisp/magit-commit.el
@@ -110,6 +110,8 @@ an error while using those is harder to recover from."
:max-action-columns 4
:default-action 'magit-commit))
+(magit-define-popup-keys-deferred 'magit-commit-popup)
+
(defun magit-commit-arguments nil
(if (eq magit-current-popup 'magit-commit-popup)
magit-current-popup-args
diff --git a/lisp/magit-diff.el b/lisp/magit-diff.el
index 33554ab..273ef1a 100644
--- a/lisp/magit-diff.el
+++ b/lisp/magit-diff.el
@@ -522,6 +522,10 @@ The following `format'-like specs are supported:
(?f "Flip revisions" magit-diff-flip-revs))
:max-action-columns 2))
+(magit-define-popup-keys-deferred 'magit-diff-popup)
+(magit-define-popup-keys-deferred 'magit-diff-refresh-popup)
+(magit-define-popup-keys-deferred 'magit-diff-mode-refresh-popup)
+
(defcustom magit-diff-arguments '("--no-ext-diff")
"The diff arguments used in buffers whose mode derives from `magit-diff-mode'."
:group 'magit-diff
diff --git a/lisp/magit-log.el b/lisp/magit-log.el
index 2497ccc..458b19b 100644
--- a/lisp/magit-log.el
+++ b/lisp/magit-log.el
@@ -349,6 +349,9 @@ are no unpulled commits) show."
(?w "Save defaults" magit-log-save-default-arguments))
:max-action-columns 2))
+(magit-define-popup-keys-deferred 'magit-log-popup)
+(magit-define-popup-keys-deferred 'magit-log-refresh-popup)
+
(defun magit-log-arguments (&optional refresh)
(cond ((memq magit-current-popup
'(magit-log-popup magit-log-refresh-popup))
diff --git a/lisp/magit-popup.el b/lisp/magit-popup.el
index f1f7af1..fd59d79 100644
--- a/lisp/magit-popup.el
+++ b/lisp/magit-popup.el
@@ -502,13 +502,7 @@ keywords are also meaningful:
(magit-invoke-popup ',name ,mode arg))
(defvar ,name
(list :variable ',opt ,@args))
- (cl-loop for args in (get ',name 'magit-popup-deferred)
- do (condition-case err
- (apply #'magit-define-popup-key ',name args)
- ((debug error)
- (display-warning
- 'magit (error-message-string err) :error)))
- finally (put ',name 'magit-popup-deferred nil))
+ (magit-define-popup-keys-deferred ',name)
,@(when opt
`((defcustom ,opt (plist-get ,name :default-arguments)
""
@@ -632,9 +626,18 @@ It's better to use one of the specialized functions
(cons elt value)
(append value (list elt)))))
(set popup (plist-put plist type value)))
- (push (list type key def at prepend) (get popup 'magit-popup-deferred)))
+ (push (list type key def at prepend)
+ (get popup 'magit-popup-deferred)))
(error "Unknown popup event type: %s" type)))
+(defun magit-define-popup-keys-deferred (popup)
+ (dolist (args (get popup 'magit-popup-deferred))
+ (condition-case err
+ (apply #'magit-define-popup-key popup args)
+ ((debug error)
+ (display-warning 'magit (error-message-string err) :error))))
+ (put popup 'magit-popup-deferred nil))
+
(defun magit-change-popup-key (popup type from to)
"In POPUP, bind TO to what FROM was bound to.
TYPE is one of `:action', `:switch', or `:option'.