fix(sh): docs lookup handler must be invoked twice

Invoking +lookup/documentation in shell-script-mode will yield an "X man
page formatted" in the minibuffer with no man page popup. It must be
invoked a second time to see it. This commit fixes that.
This commit is contained in:
Henrik Lissner 2023-02-23 00:06:04 -05:00
parent 7a8383c2d1
commit 63daee4b94
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -41,8 +41,12 @@
(defun +sh-lookup-documentation-handler ()
"Look up documentation in `man' or `woman'."
(interactive)
(call-interactively
(if (executable-find "man")
#'man
#'woman))
(current-buffer))
(require 'man)
(let ((input (Man-default-man-entry)))
(if (executable-find "man")
(let* ((input (Man-translate-references input))
(buffer (Man-getpage-in-background input)))
(when (buffer-live-p buffer)
(switch-to-buffer buffer)))
(woman input t)
(current-buffer))))