Closed jdtsmith closed 1 year ago
I think we already have that in the form of the command corfu-info-documentation
?
EDIT: But that buffer gets also closed after some time, right? I think you can create a simple command which first calls corfu-info-documentation
. The resulting buffer can be cloned and displayed first and then killed.
I added prefix arguments to corfu-info-location
and corfu-info-documentation
in order to summon a persistent window/buffer, see https://github.com/minad/corfu/commit/2019688dfb59f73b54573a25bc5111367fa6e0a3.
This is quite useful, thanks! To hook this into corfu-popupinfo, maybe corfu-popupinfo-documentation
could also take a prefix arg, and if passed, hand off to corfu-info-documentation
, setting its prefix arg.
modified extensions/corfu-popupinfo.el
@@ -447,11 +447,15 @@ See `corfu-popupinfo-scroll-up' for more details."
corfu-popupinfo--candidate nil)
(corfu-popupinfo--show (nth corfu--index corfu--candidates))))
-(defun corfu-popupinfo-documentation ()
+(defun corfu-popupinfo-documentation (arg)
"Show or hide documentation in popup.
-Behaves like `corfu-popupinfo-toggle'."
- (interactive)
- (corfu-popupinfo--toggle #'corfu-popupinfo--get-documentation))
+Behaves like `corfu-popupinfo-toggle'. With prefix ARG, hand
+control to `corfu-info-documentation', to create a persistent
+buffer."
+ (interactive "P")
+ (if arg
+ (corfu-info-documentation 'persist)
+ (corfu-popupinfo--toggle #'corfu-popupinfo--get-documentation)))
That works very well in my testing.
I am not too fond of that since this would introduce further coupling between corfu-popupinfo and corfu-info. Also it doesn't interact nicely with corfu-popupinfo-toggle.
M-h
toggles corfu-popupinfo. This is nice if you have a longcorfu-popupinfo-delay
and want the popup to appear "right now". But then I miss the old behavior of persisting doc info in its own separate buffer, after which you can continue to browse candidates.An idea would be a command, say
corfu-popupinfo-persist-documentation
(M-S-h
?), which calls the:company-doc-buffer
function, then replicates and displays a persistent copy of the doc buffer. This would be the best of both worlds: quick peek at the docs via popupinfo, with a persistent "full form" doc buffer for further study.