Skip to content

Commit 22a5482

Browse files
committed
Improve the shortdoc link action in *Help* buffers
* lisp/emacs-lisp/shortdoc.el (shortdoc-display-group): Allow taking an optional parameter to place point on a specific function. (shortdoc--display-function): Go to the function in question in the shortdoc buffer.
1 parent ceecac4 commit 22a5482

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

lisp/emacs-lisp/shortdoc.el

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,8 +1141,9 @@ There can be any number of :example/:result elements."
11411141
:eval (sqrt -1)))
11421142

11431143
;;;###autoload
1144-
(defun shortdoc-display-group (group)
1145-
"Pop to a buffer with short documentation summary for functions in GROUP."
1144+
(defun shortdoc-display-group (group &optional function)
1145+
"Pop to a buffer with short documentation summary for functions in GROUP.
1146+
If FUNCTION is non-nil, place point on the entry for FUNCTION (if any)."
11461147
(interactive (list (completing-read "Show summary for functions in: "
11471148
(mapcar #'car shortdoc--groups))))
11481149
(when (stringp group)
@@ -1173,15 +1174,17 @@ There can be any number of :example/:result elements."
11731174
(setq prev t)
11741175
(shortdoc--display-function data))))
11751176
(cdr (assq group shortdoc--groups))))
1176-
(goto-char (point-min)))
1177+
(goto-char (point-min))
1178+
(when function
1179+
(text-property-search-forward 'shortdoc-function function t)
1180+
(beginning-of-line)))
11771181

11781182
(defun shortdoc--display-function (data)
11791183
(let ((function (pop data))
11801184
(start-section (point))
11811185
arglist-start)
11821186
;; Function calling convention.
1183-
(insert (propertize "("
1184-
'shortdoc-function t))
1187+
(insert (propertize "(" 'shortdoc-function function))
11851188
(if (plist-get data :no-manual)
11861189
(insert-text-button
11871190
(symbol-name function)

lisp/help-fns.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ FILE is the file where FUNCTION was probably defined."
752752
(insert-text-button
753753
(symbol-name group)
754754
'action (lambda (_)
755-
(shortdoc-display-group group))
755+
(shortdoc-display-group group object))
756756
'follow-link t
757757
'help-echo (purecopy "mouse-1, RET: show documentation group")))
758758
groups)

0 commit comments

Comments
 (0)