Key for showing the docstring of the associated function
This commit is contained in:
parent
0f03b076e7
commit
f028c76330
1 changed files with 21 additions and 8 deletions
23
magit.el
23
magit.el
|
@ -3545,7 +3545,9 @@ With a non numeric prefix ARG, show all entries"
|
||||||
(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))
|
(prompt (concat (if prefix-arg (format "(prefix: %s) " prefix-arg))
|
||||||
"Command key: "))
|
"Command key (? for help): "))
|
||||||
|
(original-prompt "")
|
||||||
|
(display-help-p)
|
||||||
(chosen-fn nil))
|
(chosen-fn nil))
|
||||||
(save-window-excursion
|
(save-window-excursion
|
||||||
(delete-other-windows)
|
(delete-other-windows)
|
||||||
|
@ -3554,15 +3556,26 @@ With a non numeric prefix ARG, show all entries"
|
||||||
(insert menu)
|
(insert menu)
|
||||||
(setq buffer-read-only nil)
|
(setq buffer-read-only nil)
|
||||||
(fit-window-to-buffer)
|
(fit-window-to-buffer)
|
||||||
|
(setq original-prompt prompt)
|
||||||
(catch 'exit
|
(catch 'exit
|
||||||
(while t
|
(while t
|
||||||
(setq c (read-char-exclusive prompt))
|
(let ((c (read-char-exclusive prompt))
|
||||||
(let ((case-fold-search nil))
|
(case-fold-search nil))
|
||||||
|
(cond
|
||||||
|
((char-equal c ??)
|
||||||
|
(setq display-help-p t)
|
||||||
|
(setq prompt "Show help for command: "))
|
||||||
|
(t
|
||||||
(dolist (item magit-menu)
|
(dolist (item magit-menu)
|
||||||
(when (char-equal c (nth 1 item))
|
(when (char-equal c (nth 1 item))
|
||||||
|
(if display-help-p
|
||||||
|
(progn
|
||||||
|
(describe-function (nth 3 item))
|
||||||
|
(setq prompt original-prompt)
|
||||||
|
(setq display-help-p nil))
|
||||||
(setq chosen-fn (nth 3 item))
|
(setq chosen-fn (nth 3 item))
|
||||||
(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)
|
(setq current-prefix-arg prefix-arg)
|
||||||
(call-interactively chosen-fn))))
|
(call-interactively chosen-fn))))
|
||||||
|
|
Loading…
Reference in a new issue