ntriisii
ntriisii

Reputation: 99

how to properly disable auto-completion when doing macro expansion

I'm looking for a way to temporarily disable auto-completion frameworks (corfu in my case) when I'm doing macro-expansion. the problem is that when I'm running a kbd-macro, or trying to insert to multiple lines in evil-visual-line, auto completion gets triggered, this corrupts my insertion and makes macros run very slow.

I already tried using advice around the kmacro-end-or-call-macro like this:

(defun my-marco-advice-deactivate-some-modes (fn &rest args)
    (corfu-mode -1) (apply fn args) (corfu-mode 1))

(advice-add #'kmacro-end-or-call-macro :around #'my-marco-advice-deactivate-some-modes)

the problem here is when I use C-g to quit the macro corfu-mode will be disabled afterward and I have to re-enable again.

in the case of evil-visual-line I couldn't figure out a way to disable corfu-mode as pressing I runs evil-insert.

is there a more general way to solve this problem as I think both kmacro-end-or-call-macro and visual-line insertion use macro-expansion ?

Upvotes: 1

Views: 249

Answers (0)

Related Questions