Using with Projectile

Projectile supports ag.el. If you have Projectile installed, C-c p s s runs ag on your project or ag-regexp if a prefix argument is provided.

Customising the project root

By default, ag-project and ag-project-regexp use the root of the VCS repo as the directory to search in. You can override this by setting or customising ag-project-root-function.

Editing the results inline

wgrep has support for ag.el. If you install wgrep-ag (available on MELPA), you can simply run wgrep-change-to-wgrep-mode and edit the *ag* buffer. Press C-x C-s when you’re done to make the changes to buffers.

Focusing and filtering the results

winnow can be used to focus or filter the results from ag. With the minor mode enabled, x excludes unwanted results, and m selects only the lines that match.

Writing Your Own

You can use ag, ag-project and so on from an elisp function. ag/FOO functions are private and are more likely to change. Please file a bug if you find a use for internal functions that you can’t do otherwise.