helm-do-grep specification. Works in the shell, but not in helm?

143 views
Skip to first unread message

Josh

unread,
Feb 8, 2014, 5:20:13 PM2/8/14
to emacs...@googlegroups.com
Looking at Thierry's helm init file I saw the following:


      helm-grep-default-command "ack-grep -Hn --smart-case --no-group --no-color %e %p %f"
      helm-grep-default-recurse-command "ack-grep -H --smart-case --no-group --no-color %e %p %f"

On my machine, I can run the following:

ack-grep -Hn --smart-case --no-group --no-color <pattern>

line on the shell with no problem.

But if I try using Thierry's definitions for helm-grep-default-command and helm-grep-default-recurse-command for helm-do-grep, I don't get anything on the output buffer (even though if I try the same pattern on the shell with the command above, it works.

With this, my questions are:

1) What are %e %p and %f in the helm definitions?
2) Why can I run ack-grep on the shell perfectly well, but I don't see any results when using helm-do-grep with Thierry's definitions?

Thanks,

Josh

Thierry Volpiatto

unread,
Feb 9, 2014, 12:35:50 AM2/9/14
to Josh, emacs...@googlegroups.com
Josh <ribonu...@gmail.com> writes:

> Looking at Thierry's helm init file<https://github.com/thierryvolpiatto/emacs-tv-config/blob/master/init-helm-thierry.el>I saw the following:
>
>
> helm-grep-default-command "ack-grep -Hn --smart-case --no-group --no-color %e %p %f"
> helm-grep-default-recurse-command "ack-grep -H --smart-case --no-group --no-color %e %p %f"
>
> On my machine, I can run the following:
>
>
> ack-grep -Hn --smart-case --no-group --no-color <pattern>
>
>
> line *on the shell* with no problem.
>
>
> But if I try using Thierry's definitions for helm-grep-default-command
> and helm-grep-default-recurse-command for helm-do-grep, I don't get
> anything on the output buffer (even though if I try the same pattern
> on the shell with the command above, it works.

What pattern and against what ?
Try on helm directory with pattern "defun" for example.

>
> With this, my questions are:
>
>
> 1) What are %e %p and %f in the helm definitions?

See documentation of `helm-grep-default-command'. (`C-h v' or M-x helm-apropos)

> 2) Why can I run ack-grep on the shell perfectly well, but I don't see any results when using helm-do-grep with Thierry's definitions?

No ideas yet, try to start from ./emacs-helm.sh and:

(setq helm-grep-default-command "ack-grep -Hn --smart-case --no-group --no-color %e %p %f"
helm-grep-default-recurse-command "ack-grep -H --smart-case --no-group --no-color %e %p %f")

in scratch buffer. It is working perfectly here.

Describe exactly what you are doing step by step with all details.

Also what emacs version are you using ?

--
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997

Josh

unread,
Feb 9, 2014, 9:01:41 PM2/9/14
to emacs...@googlegroups.com
Thanks Thierry.

I just runt he following test:

M-x helm-do-grep <RET>
/home/josh/.emacs.d/elpa/helm-20140208.1010 <RET>
defun <RET>

All I get is an empty buffer with the following title above:
Ack (C-c ? help)

I used the following definitions

      helm-grep-default-command "ack -Hn --smart-case --no-group --no-color %e %p %f"
      helm-grep-default-recurse-command "ack -H --smart-case --no-group --no-color %e %p %f"

I also tried with the following since I read in the helm documentation that %e is optional :

      helm-grep-default-command "ack -Hn --smart-case --no-group --no-color %p %f"
      helm-grep-default-recurse-command "ack -H --smart-case --no-group --no-color %p %f"

This is all on OS X Mavericks with Emacs from http://emacsformacosx.com/

> emacs --version
GNU Emacs 24.3.1

To clarify, if I run the following from the shell:

> cd /home/josh/.emacs.d/elpa/helm-20140208.1010 <RET>
> ack -Hn --smart-case --no-group --no-color defun <RET>

I get plenty of results.

Any thoughts on why my attempts didn't work?

Thanks,

Josh


> Looking at Thierry's helm init file<https://github.com/thierryvolpiatto/emacs-tv-config/blob/master/init-helm-thierry.el>I saw the following: 



>       helm-grep-default-command                  "ack-grep -Hn --smart-case --no-group --no-color %e %p %f" 
>       helm-grep-default-recurse-command          "ack-grep -H --smart-case --no-group --no-color %e %p %f" 

> On my machine, I can run the following: 


> ack-grep -Hn --smart-case --no-group --no-color <pattern> 


> line *on the shell* with no problem. 



> But if I try using Thierry's definitions for helm-grep-default-command 
> and helm-grep-default-recurse-command for helm-do-grep, I don't get 
> anything on the output buffer (even though if I try the same pattern 
> on the shell with the command above, it works. 
What pattern and against what ? 
Try on helm directory with pattern "defun" for example. 

> With this, my questions are: 


> 1) What are %e %p and %f in the helm definitions? 
See documentation of `helm-grep-default-command'. (`C-h v' or M-x helm-apropos) 
> 2) Why can I run ack-grep on the shell perfectly well, but I don't see any results when using helm-do-grep with Thierry's definitions? 
No ideas yet, try to start from ./emacs-helm.sh and: 
(setq helm-grep-default-command          "ack-grep -Hn --smart-case --no-group --no-color %e %p %f" 
      helm-grep-default-recurse-command  "ack-grep -H --smart-case --no-group --no-color %e %p %f") 
in scratch buffer. It is working perfectly here. 
Describe exactly what you are doing step by step with all details. 
Also what emacs version are you using ? 
-- 
Thierry 
Get my Gnupg key: 
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 

Thierry Volpiatto

unread,
Feb 9, 2014, 11:44:13 PM2/9/14
to Josh, emacs...@googlegroups.com
Josh <ribonu...@gmail.com> writes:

> Thanks Thierry.
>
> I just runt he following test:
>
> M-x helm-do-grep <RET>
> /home/josh/.emacs.d/elpa/helm-20140208.1010 <RET>
> defun <RET>

Why Do you hit <RET> ?
let the time to ack to feed your buffer.

> All I get is an empty buffer with the following title above:
> Ack (C-c ? help)
>
> I used the following definitions
>
> helm-grep-default-command "ack -Hn --smart-case --no-group --no-color %e %p %f"
> helm-grep-default-recurse-command "ack -H --smart-case --no-group --no-color %e %p %f"

This is good.

> This is all on OS X Mavericks with Emacs from http://emacsformacosx.com/

I didn't have any report about helm grep on this platform.

>> emacs --version
> GNU Emacs 24.3.1

Works fine on this one.

> To clarify, if I run the following from the shell:
>
>> cd /home/josh/.emacs.d/elpa/helm-20140208.1010 <RET>
>> ack -Hn --smart-case --no-group --no-color defun <RET>
>
> I get plenty of results.

So it should work fine in helm.

> Any thoughts on why my attempts didn't work?

Maybe you are pressing RET immediately after entering your pattern as
said above ?

Josh Wasserstein

unread,
Feb 11, 2014, 2:42:43 PM2/11/14
to Thierry Volpiatto, emacs...@googlegroups.com
Thanks Thierry - Sorry for the confusion, but I am not pressing <RET> after entering my pattern above. Helm works great on my system, every single Helm feature I have tried works well, except this one. Don't know why.

Also, in case it matters, I am using v 2.12 of ack.

Josh

Thierry Volpiatto

unread,
Feb 12, 2014, 1:47:47 AM2/12/14
to Josh Wasserstein, emacs...@googlegroups.com
Josh Wasserstein <ribonu...@gmail.com> writes:

> Also, in case it matters, I am using v 2.12 of ack.

Aha! this is maybe the reason, I am using 1.92.
See https://github.com/emacs-helm/helm/issues/422

I will try to find the last version of ack-grep and fix.

Thanks.

Thierry Volpiatto

unread,
Feb 12, 2014, 3:56:08 AM2/12/14
to Josh Wasserstein, emacs...@googlegroups.com

Ok I have fixed Issue #422, and tested here on Ubuntu 12.04 LTS with
ack-grep version 2.12, all is working fine.
Please try again, be sure the executable name of ack-grep is "ack-grep"
and not "ack", in this case:
(setq helm-ack-grep-executable "ack")
If it still not working, turn on debug-on-error, run helm grep, run
M-x helm-debug-open-last-log
and send me the relevant bits of the resulting buffer.

Thanks.

Josh Wasserstein

unread,
Feb 14, 2014, 2:17:06 PM2/14/14
to Thierry Volpiatto, emacs...@googlegroups.com
Thank you Thierry - I am still confused though.

My binary is ack,not ack-grep (although I could alias ack-grep to ack).

Say I don't create that alias, would this do the trick? 
(setq helm-ack-grep-executable "ack") 

Wouldn't that instruct help to use ack and not ack-grep?

Thanks,

Josh

Thierry Volpiatto

unread,
Feb 15, 2014, 2:22:59 AM2/15/14
to Josh Wasserstein, emacs...@googlegroups.com
Josh Wasserstein <ribonu...@gmail.com> writes:

> Thank you Thierry - I am still confused though.
>
> My binary is *ack,*not* ack-grep* (although I could alias *ack-grep* to
> *ack*).
>
> Say I don't create that alias, would this do the trick?
> (setq helm-ack-grep-executable "ack")

Yes.

BTW I was confused because on precedent post you said you used
the command line "ack-grep [...]" which would not work if your
executable is "ack"

Ben K

unread,
May 1, 2015, 5:35:41 AM5/1/15
to emacs...@googlegroups.com, ribonu...@gmail.com
Even after I do 

 (setq helm-ack-grep-executable "ack") 

It's still only showing 
Ack-Grep (C-c ? Help)

Anyone know how to fix this?

Thierry Volpiatto

unread,
May 1, 2015, 5:55:35 AM5/1/15
to emacs...@googlegroups.com

Ben K <ben.k...@gmail.com> writes:

> Even after I do
>
> (setq helm-ack-grep-executable "ack")
>
> It's still only showing
> Ack-Grep (C-c ? Help)
>
> Anyone know how to fix this?

Probably you didn't setup your command line.

See `helm-grep-default-command' docstring and my config file (you have a
link to it in the README on github)

Le Wang

unread,
May 1, 2015, 7:15:56 AM5/1/15
to emacs...@googlegroups.com
I run ack on mac without issues.  Make sure you start Emacs from your shell to inherit your interactive path settings.  e.g. "open -a emacs"

--
You received this message because you are subscribed to the Google Groups "emacs-helm" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emacs-helm+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Le
Reply all
Reply to author
Forward
0 new messages