emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/transient 732ec975ec 5/6: transient--describe-function:


From: Jonas Bernoulli
Subject: [elpa] externals/transient 732ec975ec 5/6: transient--describe-function: Refactor setting help buffer/window
Date: Sun, 29 Sep 2024 15:21:08 -0400 (EDT)

branch: externals/transient
commit 732ec975ec0a9597c4bb4ce79c6040da72a66df2
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>

    transient--describe-function: Refactor setting help buffer/window
    
    Bind `help-window-select' to select the window used to display the help
    buffer.  Use `temp-buffer-window-setup-hook' to get our hands at that
    buffer, despite `describe-function' (and the lower-level functions it
    uses) neither returning the used buffer nor making it current.
    
    `transient-show-help' expects the used buffer to be current after
    calling functions such as this one, so that it can finish its own setup
    of that buffer.
---
 lisp/transient.el | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/lisp/transient.el b/lisp/transient.el
index 54fec732b6..eb38eff8ef 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -4226,15 +4226,13 @@ manpage, then try to jump to the correct location."
   (transient--describe-function cmd))
 
 (defun transient--describe-function (fn)
-  (describe-function fn)
-  (when-let* (((not (derived-mode-p 'help-mode)))
-              (buf (get-buffer "*Help*"))
-              (win (or (and buf (get-buffer-window buf))
-                       (cl-find-if (lambda (win)
-                                     (with-current-buffer (window-buffer win)
-                                       (derived-mode-p 'help-mode)))
-                                   (window-list)))))
-    (select-window win)))
+  (let* ((buffer nil)
+         (help-window-select t)
+         (temp-buffer-window-setup-hook
+          (cons (lambda () (setq buffer (current-buffer)))
+                temp-buffer-window-setup-hook)))
+    (describe-function fn)
+    (set-buffer buffer)))
 
 (defun transient--show-manual (manual)
   (info manual))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]