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

Using require is better to check helm-ag or counsel installed or not #43

Closed
SuzumiyaAoba opened this issue Jul 19, 2018 · 4 comments
Closed
Labels

Comments

@SuzumiyaAoba
Copy link

Now using package-installed-p but it can support users who install packages via package.el.

emacs-easy-hugo/easy-hugo.el

Lines 1163 to 1167 in 3b0516c

(if (package-installed-p 'counsel)
(counsel-ag nil (expand-file-name easy-hugo-postdir easy-hugo-basedir))
(if (package-installed-p 'helm-ag)
(helm-ag (expand-file-name easy-hugo-postdir easy-hugo-basedir))
(error "'counsel' or 'helm-ag' is not installed")))))

This doesn't support those who use Cask, el-get, etc.
Is it better to use require instead of package-installed-p?

(defun easy-hugo-ag ()
  "Search for blog article with counsel-ag or helm-ag."
  (interactive)
  (easy-hugo-with-env
   (if (require 'counsel nil t)
       (counsel-ag nil (expand-file-name easy-hugo-postdir easy-hugo-basedir))
     (if (require 'helm-ag nil t)
	 (helm-ag (expand-file-name easy-hugo-postdir easy-hugo-basedir))
         (error "'counsel' or 'helm-ag' is not installed")))))
@SuzumiyaAoba SuzumiyaAoba changed the title Using require is better to check helm-ag or courcel installed or not Using require is better to check helm-ag or counsel installed or not Jul 19, 2018
masasam added a commit that referenced this issue Jul 19, 2018
@masasam
Copy link
Owner

masasam commented Jul 19, 2018

Hi @SuzumiyaAoba .
Thank you for comment.

This doesn't support those who use Cask, el-get, etc.
Is it better to use require instead of package-installed-p?

You're right.
I 've fixed it at e0bbe40.
Thank you for your advice.

@masasam masasam added the bug label Jul 19, 2018
@SuzumiyaAoba
Copy link
Author

Thanks for your swift response.

It works for me, but new problem appears.
If I installed both counsel and helm-ag then it is forced to use counsel-ag
(I mainly use helm-ag, but counsel is also installed because some packages seem like depending on counsel).
So this package should provide the option of using helm-ag or counsel.

@masasam
Copy link
Owner

masasam commented Jul 19, 2018

Hi @SuzumiyaAoba .
Make helm-ag and counsel-ag selectable at 8bf48b9 .

You can use helm-ag by writing the following to .emacs or init.el

(setq easy-hugo-helm-ag t)

@SuzumiyaAoba
Copy link
Author

Thanks for your work!

This package is more useful 🎉

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

No branches or pull requests

2 participants