elispでgrepする
普通に書くならば、
(let (matched)
(save-excursion
(goto-char (point-min))
(while (re-search-forward regexp nil t)
(push (match-string 0) matched))
(nreverse matched)))
正直ヘドが出るコードだ。
だがloopマクロを使うと簡潔に書ける。
(save-excursion
(goto-char (point-min))
(loop while (re-search-forward regexp nil t)
collect (match-string 0)))