読者です 読者をやめる 読者になる 読者になる

find-grep-diredした後にisearchする方法

emacs

M-x find-grep-dired した後,同じクエリでisearch-forward をするためには,ということ. 以下の関数を評価して使用する. isearchを続けていくには M-, を連続で押していけばよい.

(defun find-grep-dired-do-search (dir regexp)
  "First perform `find-grep-dired', and wait for it to finish.
Then, using the same REGEXP as provided to `find-grep-dired',
perform `dired-do-search' on all files in the *Find* buffer."
  (interactive "DFind-grep (directory): \nsFind-grep (grep regexp): ")
  (find-grep-dired dir regexp)
  (while (get-buffer-process (get-buffer "*Find*"))
    (sit-for 1))
  (with-current-buffer "*Find*"
    (dired-toggle-marks)
    (dired-do-search regexp)))

参考

http://stackoverflow.com/questions/4969373/emacs-find-grep-dired-then-automatically-isearch-forward-on-given-regexp