Created
May 15, 2009 12:43
-
-
Save whym/112196 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun my-change-log-extract (regexp) | |
"Extract the entries that matches to the regexp in change-log-mode" | |
(interactive "sregexp: ") | |
(goto-char (point-max)) | |
(do ((expression "^[0-9]\\{4\\}-[0-1][0-9]-[0-3][0-9]") | |
(pos (point) (point)) | |
(list nil (cons | |
(cons | |
(match-string 0) | |
(buffer-substring (match-beginning 0) pos)) list))) | |
((not (re-search-backward expression nil t)) | |
(with-output-to-temp-buffer "*Extracted*" | |
(switch-to-buffer "*Extracted*") | |
(mapc (lambda (item) | |
(if (string-match regexp (prin1-to-string (cdr item))) | |
(insert (cdr item)))) | |
list))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment