Skip to content

Commit

Permalink
feat(help)!: Display symbol details when completing helpful
Browse files Browse the repository at this point in the history
When completing any of the `helpful` commands, for example
`helpful-function` (`C-h f`), `helpful-variable` or (`C-h v`) display details
of the completion. This is ahieved by using helm provided function, that is by
default used to provide affixations for symbols (i.e., when using
`describe-function` or `describe-variable`).

BREAKING CHANGE: Use built-in `completions-detailed` as per helm advice and
  hide it behind a `exodrium-help-extenstions` flag
  • Loading branch information
pkryger committed Jan 13, 2025
1 parent 8259160 commit 59c4610
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion modules/init-help.el
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@


(use-package helpful
:functions (exordium--helpful-with-affixation)
:init
(use-package helm
:defer t
Expand All @@ -59,6 +60,12 @@ Otherwise pop to buffer (presumably in a new window)."
(pop-to-buffer-same-window buffer)
(pop-to-buffer buffer)))

(defun exordium--helpful-with-affixation (orig-fun &rest args)
"Ensure `helm-symbol-completion-table-affixation' is used."
(let ((completion-extra-properties
'(:affixation-function helm-symbol-completion-table-affixation)))
(apply orig-fun args)))

:custom
;; By default `show-paren-mode' is disabled in modes deriving from
;; `special-mode'. Enable it for `helpful' if it doesn't match
Expand All @@ -72,6 +79,7 @@ Otherwise pop to buffer (presumably in a new window)."
(list 'or '(derived-mode . helpful-mode)
show-paren-predicate)))
(helpful-switch-buffer-function #'exordium--helpful-pop-to-buffer)
(completions-detailed t)

:bind
(;; Note that the built-in `describe-function' includes both functions
Expand All @@ -90,7 +98,10 @@ Otherwise pop to buffer (presumably in a new window)."
("C-h C" . #'helpful-command)
:map helpful-mode-map
("C-c C-d" . #'helpful-at-point)
("C-c C-o" . #'exordium-browse-url-at-point)))
("C-c C-o" . #'exordium-browse-url-at-point))
:config
(advice-add 'helpful--read-symbol
:around #'exordium--helpful-with-affixation))


(when (version< "29" emacs-version) ;; Since Emacs-29
Expand Down

0 comments on commit 59c4610

Please sign in to comment.