From 63daee4b9429929ea1ed2636c0021cd34d86de2e Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 23 Feb 2023 00:06:04 -0500 Subject: [PATCH] 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. --- modules/lang/sh/autoload.el | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/modules/lang/sh/autoload.el b/modules/lang/sh/autoload.el index c9f221874..0c5cc686b 100644 --- a/modules/lang/sh/autoload.el +++ b/modules/lang/sh/autoload.el @@ -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))))