Closed jdtsmith closed 2 years ago
There are two ways to implement this:
;;;###autoload
(defun cape-capf-dispatcher (dispatch)
"Call DISPATCH function which must return a Capf."
(lambda ()
(when-let (capf (funcall dispatch))
(pcase (funcall capf)
(`(,beg ,end ,table . ,plist)
`(,beg ,end
,(lambda (str pred action)
(let ((new-capf (funcall dispatch)))
(unless (eq capf new-capf)
(pcase (funcall new-capf)
(`(,_beg ,_end ,new-table . ,_plist)
(setq table new-table capf new-capf)))))
(complete-with-action action table str pred))
,@plist))))))
cape-dict
, cape-dabbrev
and a dabbrev+dict super capf to different keys. Then Corfu will allow you to toggle between these different capfs. See https://github.com/minad/cape#configuration. For this reason I don't see the need to add further narrowing support as in consult-buffer
.Dispatcher could also return a list of capfs for a dynamic super-capf.
Dispatcher could also return a list of capfs for a dynamic super-capf.
No. Instead the dispatcher should just call cape-super-capf
itself and return the constructed capf.
This probably isn't a CAPE issue, but since CAPE will enable for the first (?) time drawing completions from many unrelated CAPF's into one result super-set...
In addition to the annotation-function idea I mentioned in #10 (which I continue to believe will be a highly desired feature), consult interaction gave me the following idea: add a binding during corfu pop-up when working with super-CAPFs (
C-+
) that allow you to focus down on just one category. Similar to e.g. "buffers only" in consult-buffer. So basically a multi-capf that can dynamically "de-scope" itself during completion down to a single CAPF, or vv.