Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

counsel-ag error message #1287

Open
netjune opened this issue Nov 16, 2017 · 8 comments
Open

counsel-ag error message #1287

netjune opened this issue Nov 16, 2017 · 8 comments

Comments

@netjune
Copy link

netjune commented Nov 16, 2017

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)

@abo-abo
Copy link
Owner

abo-abo commented Nov 16, 2017

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.

@netjune
Copy link
Author

netjune commented Nov 18, 2017

Yes. When icomplete-mode is disabled, the error message disappears. But there is no completion when I run commands like discribe-function.

@abo-abo
Copy link
Owner

abo-abo commented Nov 18, 2017

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)

@netjune
Copy link
Author

netjune commented Nov 18, 2017

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?

@abo-abo
Copy link
Owner

abo-abo commented Nov 18, 2017

Ido and icomplete are in the same code base (core Emacs). Likely, the compatibility issues were taken care of.

@netjune
Copy link
Author

netjune commented Nov 23, 2017

Then what about helm-mode? I'm also using helm commands(helm-buffers-list, helm-imenu ...) together with ido and icomplete.

@abo-abo
Copy link
Owner

abo-abo commented Nov 23, 2017

Perhaps helm isn't affected by icomplete modifying post-command-hook in the minibuffer.

@runekaagaard
Copy link

runekaagaard commented Dec 2, 2023

The advice-add seems to break a few things on emacs 29, but https://github.com/emacsorphanage/helm-ag works beautifully alongside fido.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants