ディレクトリと探したいものとかを与えると grep-find してくれる関数(要 ack)

;; grep-find
(defvar dgrep-find-default-cmd
  "ack --nocolor --nogroup --type=%s %s \"%s\" \"%s\"")
(defvar dgrep-find-default-type "elisp")
(defvar dgrep-find-default-ctx 3)
(defvar dgrep-find-default-subject "")
(defun dgrep-find (dir subject type &optional ctx cmd)
  (interactive
    (list (read-directory-name "Drectory: ")
          (read-string "Subject: " dgrep-find-default-subject)
          (read-string "Type: " dgrep-find-default-type)
          (read-number "Context: " dgrep-find-default-ctx)
          (if current-prefix-arg
              (read-shell-command "Command (like this): " dgrep-find-default-cmd)
            dgrep-find-default-cmd)))
  (let ((dir (if (tramp-tramp-file-p dir)
                 (tramp-file-name-localname
                  (tramp-dissect-file-name (expand-file-name dir)))
               dir))
        (ctx-option (if (< 0 ctx) (format "-C %d" ctx) ""))
        (compilation-disable-input t))
    (setq dgrep-find-default-subject subject)
    (setq dgrep-find-default-cmd cmd)
    (setq dgrep-find-default-type type)
    (setq dgrep-find-default-ctx ctx)
    (grep-find (format cmd type ctx-option subject dir))))
  • windows だと compilation-start が標準入力になにか食わせてるらしく、ack が filter mode だかで動いてうまく動かない
  • ack を書き換えて標準入力殺せば動くよ!