From: Greg Hill <ghill@CURTISSWRIGHT.com>
Subject: Re: search in loaded buffers
Date: Wed, 23 Feb 2005 13:19:41 -0800 [thread overview]
Message-ID: <A1EB702A-85E0-11D9-ABC8-0030654D638C@curtisswright.com> (raw)
In-Reply-To: <811xb7ca0l.fsf@adboyd.com>
Dave,
I have my own home-brewed function for doing that. Here is what I have
in my .emacs file. It is not bullet-proof, but it gets the job done
(i.e. "No warrantee is expressed or implied ...") Hope it helps.
--Greg
(defun search-multiple-buffers (search-string)
"Search through all currently loaded \"normal\" buffers for the next
occurance of SEARCH-STRING"
(interactive
(list (read-string
(concat "Search for (" (car search-ring) "): ")
nil
'search-ring
(car search-ring))))
(unless (interactive-p)
(push search-string search-ring))
(let ((start-buffer (current-buffer))
(buflist (cdr (buffer-list)))
(save-point (point))
(start-point (point))
buffer-type)
(catch 'buflist
(while
(progn
(setq buffer-type
(string-to-char (buffer-name (current-buffer))))
(if (or (= buffer-type ?*) (= buffer-type ?\ ))
t
;; (not (search-forward search-string nil t))))
(not (let ((case-fold-search nil))
(search-forward search-string nil t)))))
(goto-char save-point)
(if buflist
(progn
(bury-buffer)
(set-buffer (car buflist))
(setq buflist (cdr buflist))
(setq save-point (point))
(goto-char (point-min)))
(set-buffer start-buffer)
(beginning-of-buffer)
(if (or (not (let ((case-fold-search nil))
(search-forward search-string nil t)))
(>= (point) (start-point)) )
(progn
(message "not found: %s" search-string)
(goto-char start-point)
(throw 'buflist nil) ) ) ) ) )
(set-window-buffer (selected-window) (current-buffer))))
(global-set-key [A-f5] 'search-multiple-buffers)
(defun more-search-multiple-buffers () (interactive)
(search-multiple-buffers (car search-ring)))
(global-set-key [?\A-g] 'more-search-multiple-buffers)
(defun smb-this-symbol ()
(interactive)
(search-multiple-buffers (symbol-name (symbol-at-point))) )
(global-set-key [C-A-f5] 'smb-this-symbol)
On Feb 23, 2005, at 12:10 PM, J. David Boyd wrote:
>
> I've scanned the docs, and don't seem to be able to locate what I'm
> searching
> for.
>
> Is there a way in emacs to search (or grep) through all the loaded
> buffers,
> and only the loaded buffers?
>
> Dave in Largo, FL
>
>
>
> _______________________________________________
> Help-gnu-emacs mailing list
> Help-gnu-emacs@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
>
next prev parent reply other threads:[~2005-02-23 21:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-23 20:10 search in loaded buffers J. David Boyd
2005-02-23 21:19 ` Greg Hill [this message]
[not found] <mailman.1328.1109190535.32256.help-gnu-emacs@gnu.org>
2005-02-23 20:32 ` roodwriter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=A1EB702A-85E0-11D9-ABC8-0030654D638C@curtisswright.com \
--to=ghill@curtisswright.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).