jhelwig/ack-and-a-half — Issue #7: Add support for grin?
Author: DarwinAwardWinner
Created: 2012-02-27 20:43:10+00:00
State: open

Grin is another grep-like tool, written in Python. It has a lot in common with ack, and I managed to get a basic working `grin-and-a-half` command working in emacs with this:

```lisp
(defvar grin-and-a-half-executable "grin")
(defvar grin-and-a-half-arguments '("--emacs"))

(defun grin-and-a-half-run (directory regexp &rest arguments)
"Run grin in DIRECTORY with ARGUMENTS."
(setq default-directory
(if directory
(file-name-as-directory (expand-file-name directory))
default-directory))
(setq arguments (append grin-and-a-half-arguments
arguments))
(compilation-start (mapconcat 'identity (nconc (list grin-and-a-half-executable) arguments) " ")
'ack-and-a-half-mode))

(defun grin-and-a-half (pattern &optional regexp directory)
(interactive (ack-and-a-half-interactive))
(grin-and-a-half-run directory regexp (ack-and-a-half-shell-quote pattern)))
```

the interactive interface of `grin-and-a-half` works just like `ack-and-a-half`. Do you have any interest in merging a mode for running grin? If so, I can expand this minimal implementation into its own mode and submit a pull request.

(If you're wondering, the main feature lacking in ack that grin provides is grepping through compressed files.)