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

If you don't have git installed, using M-p from counsel-find-file raises a user-error #1216

Closed
oantolin opened this Issue Sep 27, 2017 · 3 comments

Comments

Projects
None yet
2 participants
@oantolin

oantolin commented Sep 27, 2017

On a computer where I don´t have git installed, every time I try to use M-p from counsel-find-file (which runs ivy-previous-history-element) I get an error message that says 'Required program "git" not found in your path'.

The reason this message occurs is that counsel adds counsel-emacs-url-p and counsel-github-url-p to the variable ivy-ffap-url-functions which is used by ivy--cd-maybe. Those functions use counsel-require-program to check that git is installed and produce an error message if it is not.

Is this really the best way to handle this? I'd prefer to have counsel-emacs-url-p and counsel-github-url-p just silently return nil if the use doesn't have git, rather than see an error message every time I try to use the history in counsel-find-file. Or maybe have counsel check for git before putting counsel-emacs-url-p and counsel-github-url-p in ivy-ffap-url-functions. The point is a gitless person should just not get the extra functionality instead of being constantly scolded. :P

@oantolin oantolin changed the title from If you don't have git installed and have counsel-find-file-at-point set to t, using M-p from counsel-find-file raises a user-error to If you don't have git installed, using M-p from counsel-find-file raises a user-error Sep 27, 2017

@oantolin

This comment has been minimized.

oantolin commented Sep 27, 2017

I am currently working around this by adding this to my init.el:

(unless (executable-find "git")
    (setq ivy-ffap-url-functions
          (remq 'counsel-emacs-url-p
                (remq 'counsel-github-url-p
                      ivy-ffap-url-functions))))

(I have git on some but not all the computers I use Emacs on.)

@abo-abo abo-abo closed this in d4f3735 Sep 27, 2017

@abo-abo

This comment has been minimized.

Owner

abo-abo commented Sep 27, 2017

Thanks, I added something similar to your workaround for counsel.el.

@oantolin

This comment has been minimized.

oantolin commented Sep 27, 2017

Looks perfect, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment