Fix showing help

Now it exits after showing the help window because the user can't
interact with it while the menu is working and on some cases the help
buffer uses the same window as the menu, hidding it.
This commit is contained in:
oscar 2010-05-16 20:18:31 +02:00
parent 903e642bf6
commit 626af3b9c1

View file

@ -3592,14 +3592,12 @@ With a non numeric prefix ARG, show all entries"
(menu-items (magit-get-menu-options group)) (menu-items (magit-get-menu-options group))
(prompt (concat (if prefix-arg (format "(prefix: %s) " prefix-arg)) (prompt (concat (if prefix-arg (format "(prefix: %s) " prefix-arg))
"Command key (? for help): ")) "Command key (? for help): "))
(original-prompt "")
(display-help-p) (display-help-p)
(chosen-fn nil)) (chosen-fn nil))
(save-window-excursion (save-window-excursion
(delete-other-windows) (delete-other-windows)
(switch-to-buffer-other-window " *Magit Commands*" t) (switch-to-buffer-other-window " *Magit Commands*" t)
(setq menu-buf (current-buffer)) (setq menu-buf (current-buffer))
(setq original-prompt prompt)
(catch 'exit (catch 'exit
(while t (while t
(pop-to-buffer menu-buf) (pop-to-buffer menu-buf)
@ -3629,17 +3627,18 @@ With a non numeric prefix ARG, show all entries"
(setcar (nthcdr 5 item) (setcar (nthcdr 5 item)
(funcall (nth 4 item) (nth 2 item)))) (funcall (nth 4 item) (nth 2 item))))
(display-help-p (display-help-p
(describe-function fn) (setq chosen-fn fn)
(setq prompt original-prompt) (throw 'exit 0))
(setq display-help-p nil))
(t (t
(setq chosen-fn fn) (setq chosen-fn fn)
(throw 'exit 0)))))) (throw 'exit 0))))))
(error "Invalid key: %c" c)))))) (error "Invalid key: %c" c))))))
(when chosen-fn (when chosen-fn
(if display-help-p
(describe-function chosen-fn)
(setq current-prefix-arg prefix-arg) (setq current-prefix-arg prefix-arg)
(let ((magit-custom-options (magit-menu-make-option-list menu-items))) (let ((magit-custom-options (magit-menu-make-option-list menu-items)))
(call-interactively chosen-fn))))) (call-interactively chosen-fn))))))
(defun magit-menu-make-option-list (menu-items) (defun magit-menu-make-option-list (menu-items)
(let ((result '()) (let ((result '())