Created
December 7, 2010 11:11
-
-
Save offby1/731686 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 search-all-buffers (regexp prefix) | |
"Searches file-visiting buffers for occurence of REGEXP. With | |
prefix > 1 (i.e., if you type C-u \\[search-all-buffers]), | |
searches all buffers." | |
(interactive (list (grep-read-regexp) | |
current-prefix-arg)) | |
(message "Regexp is %s; prefix is %s" regexp prefix) | |
(multi-occur | |
(if (member prefix '(4 (4))) | |
(buffer-list) | |
(remove-if | |
(lambda (b) (some (lambda (rx) (string-match rx (file-name-nondirectory (buffer-file-name b)))) search-all-buffers-ignored-files)) | |
(remove-if-not 'buffer-file-name (buffer-list)))) | |
regexp)) | |
(global-set-key [f7] 'search-all-buffers) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment