[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/transient 9d4fabc3c5 1/3: transient--describe-function:
From: |
Jonas Bernoulli |
Subject: |
[elpa] externals/transient 9d4fabc3c5 1/3: transient--describe-function: Handle renamed help buffer |
Date: |
Sat, 17 Sep 2022 13:29:00 -0400 (EDT) |
branch: externals/transient
commit 9d4fabc3c5c58fb845d8a1aa73cd7f889033c95f
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
transient--describe-function: Handle renamed help buffer
We have to make sure that the help buffer becomes the current buffer
so that typing "q" resumes the transient as advertised. When a hook
is used to rename "the" help buffer, then the previous approach
resulted in an error because we reasonably, but wrongly, assumed
that we would always be able to find the buffer using `help-buffer'.
Closes #208.
---
lisp/transient.el | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/lisp/transient.el b/lisp/transient.el
index 8dce4d638d..1a28519f73 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -3669,7 +3669,13 @@ manpage, then try to jump to the correct location."
(defun transient--describe-function (fn)
(describe-function (if (symbolp fn) fn 'transient--anonymous-infix-argument))
- (select-window (get-buffer-window (help-buffer))))
+ (unless (derived-mode-p 'help-mode)
+ (when-let ((bw (or (get-buffer "*Help*")
+ (cl-find-if (lambda (win)
+ (with-current-buffer (window-buffer win)
+ (derived-mode-p 'help-mode)))
+ (window-list)))))
+ (select-window (if (windowp bw) bw (get-buffer-window bw))))))
(defun transient--anonymous-infix-argument ()
"Cannot show any documentation for this anonymous infix command.