Created
April 21, 2012 14:03
-
-
Save offby1/2437224 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 non-hidden buffers; with C-u C-u, searches *all* | |
buffers." | |
(interactive (list (grep-read-regexp) | |
current-prefix-arg)) | |
(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 (kbd "<f7>") 'search-all-buffers) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment