Skip to content

Instantly share code, notes, and snippets.

@tobias
Created February 11, 2010 04:13
Show Gist options
  • Save tobias/301205 to your computer and use it in GitHub Desktop.
Save tobias/301205 to your computer and use it in GitHub Desktop.
(defun ack-in-project (pattern)
"Run ack, with user-specified ARGS, and collect output in a buffer.
While ack runs asynchronously, you can use the \\[next-error] command to
find the text that ack hits refer to. The command actually run is
defined by the ack-command variable."
(interactive (list (read-string "Ack for (in app root): " (thing-at-point 'symbol))))
(let (compile-command
(compilation-error-regexp-alist grep-regexp-alist)
(compilation-directory default-directory)
(ack-full-buffer-name (concat "*ack-" pattern "*")))
;; lambda defined here since compilation-start expects to call a function to get the buffer name
(compilation-start (concat ack-command " -i --noheading --nocolor " pattern " " (rinari-root)) 'ack-mode
(when ack-use-search-in-buffer-name
(function (lambda (ignore)
ack-full-buffer-name)))
(regexp-quote pattern))))
(global-set-key "\C-cfa" 'ack-in-project)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment