Pass prefix argument to command

This commit is contained in:
oscar 2010-05-16 01:14:34 +02:00
parent 09f09afd34
commit c40dfe75e5

View file

@ -3536,9 +3536,11 @@ With a non numeric prefix ARG, show all entries"
(format "\n%s %s" (string (nth 1 item)) (nth 2 item)))))) (format "\n%s %s" (string (nth 1 item)) (nth 2 item))))))
magit-group-menu)) magit-group-menu))
(defun magit-submenu (group &optional arg) (defun magit-submenu (group &optional prefix-arg)
(let ((magit-buf (current-buffer)) (let ((magit-buf (current-buffer))
(menu (magit-menu-for-group group)) (menu (magit-menu-for-group group))
(prompt (concat (if prefix-arg (format "(prefix: %s) " prefix-arg))
"Command key: "))
(chosen-fn nil)) (chosen-fn nil))
(save-window-excursion (save-window-excursion
(delete-other-windows) (delete-other-windows)
@ -3549,7 +3551,7 @@ With a non numeric prefix ARG, show all entries"
(fit-window-to-buffer) (fit-window-to-buffer)
(catch 'exit (catch 'exit
(while t (while t
(setq c (read-char-exclusive "Command key: ")) (setq c (read-char-exclusive prompt))
(message "%s" c) (message "%s" c)
(let ((case-fold-search nil)) (let ((case-fold-search nil))
(dolist (item magit-menu) (dolist (item magit-menu)
@ -3559,6 +3561,7 @@ With a non numeric prefix ARG, show all entries"
(throw 'exit 0)))) (throw 'exit 0))))
(error "Invalid key %c" c)))) (error "Invalid key %c" c))))
(when chosen-fn (when chosen-fn
(setq current-prefix-arg prefix-arg)
(call-interactively chosen-fn)))) (call-interactively chosen-fn))))
(defun magit-log-grep (str) (defun magit-log-grep (str)