paul@gill.UUCP (Paul Nordstrom) (08/25/89)
Within gnu emacs, is there a simple way to search for a string across *all* buffers currently loaded? I have looked with reasonable diligence through TFM and see no reference to such a function. If there is no standard way to do this, has anyone written a function to perform this type of search? Thanks in advance for any help with this question. -- Paul Nordstrom Gill & Co., L.P. uunet!gill!paul
roy@sts.sts.UUCP (08/26/89)
/* Written 12:56 pm Aug 24, 1989 by paul@gill.UUCP in sts:gnu.emacs */ /* ---------- "Multi-Buffer search?" ---------- */ Within gnu emacs, is there a simple way to search for a string across *all* buffers currently loaded? I have looked with reasonable diligence through TFM and see no reference to such a function. If there is no standard way to do this, has anyone written a function to perform this type of search? Thanks in advance for any help with this question. -- Paul Nordstrom Gill & Co., L.P. uunet!gill!paul /* End of text from sts:gnu.emacs */ How 'bout GNU grep? (sorry, I couldn't resist! Sounds like a good idea though ...)
montnaro@sprite.crd.ge.com (Skip Montanaro) (08/26/89)
REgarding GNU grep, there is a grep command defined in compile.el that lets you use next-error to march through the grep output. If all your buffers are associated with files, this may be a simple solution to the problem. -- Skip Montanaro (montanaro@sprite.crd.ge.com)
tk@RESEARCH.ATT.COM (08/26/89)
how bout: (defun search-buffers (s &optional fn) (interactive "sString: ") (if (null fn) (setq fn (symbol-function 'recursive-edit))) (save-excursion (catch 'search-buffers-abort (mapcar (function (lambda (x) (message "searching %s..." (buffer-name x)) (set-buffer x) (save-excursion (save-restriction (widen) (goto-char (point-min)) (if (search-forward s nil t) (progn (switch-to-buffer x) (funcall fn) (while (search-forward s nil t) (funcall fn)))))))) (buffer-list))))) (defun screwit () "quick way out of search-buffers" (interactive) (throw 'search-buffers-abort nil))