swiper
swiper copied to clipboard
counsel-ag error message
Everytime I run the command counsel-ag, emacs reports the following error message:
Error in post-command-hook (icomplete-post-command-hook): (wrong-number-of-arguments (((ag-prompt) (extra-ag-args) (initial-directory) (initial-input) smex-ido-cache info-lookup-mode t) (string) (counsel-ag-function string counsel-ag-base-command extra-ag-args)) 3)
This is a bug with your config, seems you added icomplete-post-command-hook
to the post-command-hook
list. It's probably via icomplete-mode
. Disable icomplete-mode
and the bug should disappear.
Yes. When icomplete-mode is disabled, the error message disappears. But there is no completion when I run commands like discribe-function.
Put simply, Emacs can use only one global mode for completion: you have to choose between icomplete-mode
, ido-mode
, ivy-mode
, helm-mode
etc. So a quick fix is to use ivy-mode
instead of icomplete-mode
.
If you want to keep icomplete-mode
on, but still use counsel-ag
, use advice-add:
(defun ivy-icomplete (f &rest r)
(icomplete-mode -1)
(unwind-protect
(apply f r)
(icomplete-mode 1)))
(advice-add 'ivy-read :around #'ivy-icomplete)
But I'm using ido commands with no error messages while the icomplete-mode is on. Does ido internally run like in your code snippet?
Ido and icomplete are in the same code base (core Emacs). Likely, the compatibility issues were taken care of.
Then what about helm-mode? I'm also using helm commands(helm-buffers-list, helm-imenu ...) together with ido and icomplete.
Perhaps helm isn't affected by icomplete
modifying post-command-hook
in the minibuffer.
The advice-add
seems to break a few things on emacs 29, but https://github.com/emacsorphanage/helm-ag works beautifully alongside fido.