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

Sean Allred
  • 6,861
  • 16
  • 85
mustISignUp
  • 243
  • 1
  • 7

3 Answers3

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.

Sean Allred
  • 6,861
  • 16
  • 85
Tu Do
  • 6,772
  • 20
  • 39
  • 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 – mustISignUp Dec 29 '14 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`](https://github.com/vermiculus/dotfiles/blob/master/.emacs.d/init.el#L389) – Sean Allred Dec 29 '14 at 19:27
  • Helm is not difficult at all. You can start easy with [my guide](http://tuhdo.github.io/helm-intro.html). – Tu Do Dec 30 '14 at 04: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.

Sean Allred
  • 6,861
  • 16
  • 85
  • Thanks for the useful info. Im still learning how to approach problems in Emacs and this helps alot. – mustISignUp Dec 29 '14 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 :) – Sean Allred Dec 29 '14 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.

Sean Allred
  • 6,861
  • 16
  • 85
  • 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. – Sean Allred Jan 04 '15 at 08:04