-
|
I asked the question in reddit: https://www.reddit.com/r/emacs/comments/1ogfffc/how_to_disable_the_advice_of/ When I use gtags to find candidates in large repo, I notice significant lag due to lots of candidates when the input is empty. When using ivy, I can let-bind the completion-in-region-function and call completing-read-default. This is much faster as it doesn't need to load the candidates. (defun gtags-completing-read (prompt
collection &optional predicate
require-match initial-input
hist def inherit-input-method)
"Default completion read, which will disable ivy due to performance reason"
(let ((completion-in-region-function 'completion--in-region))
(completing-read-default prompt collection predicate
require-match initial-input
hist def inherit-input-method)))However, in vertico, this doesn't work as the completing-read-default is advised. I followed some suggestion to temporarily disable vertico-mode in gtags completion: (defun gtags-completing-read (prompt
collection &optional predicate
require-match initial-input
hist def inherit-input-method)
"Default completion read, which will disable ivy due to performance reason"
(let ((completion-in-region-function 'completion--in-region)
(mode-enable (and (boundp 'vertico-mode) vertico-mode)))
(unwind-protect
(progn
(if mode-enable (vertico-mode -1))
(completing-read-default prompt collection predicate
require-match initial-input
hist def inherit-input-method))
(if mode-enable (vertico-mode t)))))This works most of the time, but sometimes I see warnings Is it possible that vertico changes the function completing-read-function and not advises completing-read-default? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
No, this is out of scope, since I want to keep a unified UI across all completions, and Vertico can handle many thousands of candidates (~50k - 100k). Vertico is interruptible so it is possible to continue typing while the candidates are computed. The problem here is that the prompt is not yet displayed, but this can be worked around with a (completing-read
"Prompt: "
(completion-table-dynamic
(let (initialized)
(lambda (input)
;; Force displaying the prompt early on
(unless initialized
(redisplay)
(setq initialized t))
(sleep-for 1) ;; Simulate extremely slow completion table
(list "foo" "bar" "baz")))))Unfortunately we cannot add the early Alternatively you can try this something along the lines of https://github.com/minad/vertico/wiki#completion-style-to-avoid-filtering-candidates-for-empty-input. |
Beta Was this translation helpful? Give feedback.
No, this is out of scope, since I want to keep a unified UI across all completions, and Vertico can handle many thousands of candidates (~50k - 100k). Vertico is interruptible so it is possible to continue typing while the candidates are computed. The problem here is that the prompt is not yet displayed, but this can be worked around with a
redisplaybefore the computation:Un…