Wilfred / ag.el

An Emacs frontend to The Silver Searcher
http://agel.readthedocs.org/en/latest/
524 stars 61 forks source link

Unable to pass additional args to ag when invoking using prefix (C-u) key-stoke #38

Closed evanspa closed 10 years ago

evanspa commented 10 years ago

Hello,

I just installed your excellent "ag.el" package into my Emacs-24 installation (I used MELPA). I'm trying to pass a prefix argument so that ag is invoked with more arguments. Specifically, I want ag to only search XML files. So here's what I do: C-u M-x ag-project, then I hit , and in the mini-buffer I'm prompted for a search string, which I input, and then, (because I launched ag-project with "C-u"), the mini-buffer shows: Arg arguments ("--smart-case" "--nogroup" "--column" "--") and the cursor is sitting immediately right of the closing-paren. I just don't know what to type here. I tried a few things like "-G xml" (I tried both including and not including the double-quotes) and "--file-search-regex xml" but every time it seems what I've entered is ignored. In the ag results buffers, where it displays the actual full ag command-line that was executed, There is no sign of the "-G" or "--file-search-regex" argument that I wanted added.

Thank you,

-Paul

Wilfred commented 10 years ago

Hmm, sorry about this. This is new functionality and feedback like this is very helpful.

The immediate answer to your question is to just add items to list. So, edit the list to ("--smart-case" "--nogroup" "--column" "-G" "xml" "--") and you should get the result you want.

This functionality was added for #36. I think we should make the following changes:

  1. Give the user plain text (e.g. --smart-case --nogroup --column --) instead of a list. Using a list is an internal detail that the user shouldn't care about.
  2. Allow the user to modify the arguments after we've built the full command. Currently, we append things like --color afterwards. Editing the full command would make this functionality more general and more useful.
evanspa commented 10 years ago

Ahhh - I see how it's supposed to work now :) Yup, just tried it and it worked. Yeah, I think this was just a usability thing. I agree with your solution of removing the parens and making it be just plain text. Thank you!