3

Trying to find in Project with Projectile.. In the Projectile menu i have

  • Find in project (grep)
  • Find in project (ack)

Grep works but if i try ack i get..

-*- mode: ack-and-a-half; default-directory: "~/Desktop/proj/" -*- Ack started at Mon Dec 29
16:39:24
 --ignore-dir=.idea --ignore-dir=.eunit --ignore-dir=.git --ignore-dir=.hg --ignore-dir=.fslckout --ignore-dir=.bzr --ignore-dir=_darcs --ignore-dir=.tox --ignore-dir=.svn --ignore-dir=build --ignore-file=is:TAGS --nocolor --nogroup --column --smart-case --env -- audio zsh:1: command not found: --ignore-dir=.idea
Ack exited abnormally with code 127 at Mon Dec 29 16:39:24

I haven't done much to get it to work except install ack-and-a-half and ag.el from MELPA (I'm confused about which I want / how to replace one with the other) but don't know how to proceed or debug - I can't find any documentation

ack and ag both work from the terminal and my homebrew dir has been added to the emacs path

any help for an emacs begginer is much appreciated

1
  • 1
    I would reckon that the variable that ack-and-a-half uses to store the program name is nil. Commented Dec 29, 2014 at 19:27

3 Answers 3

7

ack-and-a-half is now abandonware. I don't think plain projectile-ack is still functional in current Projectile -- maybe you should try ag. If you really want ack, you could give helm-projectile-ack a try.

3
  • Thanks very much for the heads up. I'm a bit scared of Helm - feels too soon to jump in, but maybe ill give it a try Commented Dec 29, 2014 at 19:16
  • @mustISignUp Helm is good, and I very much recommend ag (or pt if you often work with multi-byte-encoded in your files). If you want a good config for helm-ag, I recommend L389 of my own .emacs Commented Dec 29, 2014 at 19:27
  • Helm is not difficult at all. You can start easy with my guide.
    – Tu Do
    Commented Dec 30, 2014 at 4:55
5

According to the source, I would reckon ack-and-a-half-executable is nil. This would explain the output you get. Again from the source, it would appear that ack is not visible to Emacs.

Note the TODO:

; TODO Determine how to fall back to using ack-grep if ack is not found.
(defcustom ack-and-a-half-executable (executable-find "ack")
  "*The location of the ack executable"
  :group 'ack-and-a-half
  :type 'file)

;...

(compilation-start
  (mapconcat 'identity
             (nconc (list ack-and-a-half-executable)
                    arguments)
             " ")
  'ack-and-a-half-mode))

See exec-path and $PATH for information on how to show Emacs where ack is.

Note that @TuDo's answer stands as good advice -- drop ack-and-a-half in favor of another solution (such as helm-ag or simply ag.el) -- but I hope this answer actually diagnosis the problem for you or anyone else who has become dependent on ack-and-a-half.

2
  • Thanks for the useful info. Im still learning how to approach problems in Emacs and this helps alot. Commented Dec 29, 2014 at 20:53
  • @mustISignUp Some just comes from experience (i.e. messing up often enough to learn what to look for), but Emacs' help system is truly great. I recommend exploring M-x apropos (or even better if you have an idea of what you're looking for: M-x helm-apropos) -- this is how I found that variable :) Commented Dec 29, 2014 at 21:02
0
  • The ack utility is better than the grep utility – but apt-get install ack installs a japanese kanji package!

  • Do this instead: Use pkg-divert to force the package name to ack:

    dpkg-divert --local --divert /usr/bin/ack --rename --add /usr/bin/ack-grep
    apt-get install ; apt-get install ack-grep -f -y --force-yes
    
  • For more see: http://betterthangrep.com

  • Suggest installing the Perl App::Ack package too.

1
  • 2
    Welcome to the site! You should take a look at the 'about' page to learn more about the format here. For instance, signatures are unnecessary since they're automatically added. Also note that this doesn't really fully answer the question – you should explain why this may work. Commented Jan 4, 2015 at 8:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.