all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* search in loaded buffers
@ 2005-02-23 20:10 J. David Boyd
  2005-02-23 21:19 ` Greg Hill
  0 siblings, 1 reply; 3+ messages in thread
From: J. David Boyd @ 2005-02-23 20:10 UTC (permalink / raw)



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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: search in loaded buffers
       [not found] <mailman.1328.1109190535.32256.help-gnu-emacs@gnu.org>
@ 2005-02-23 20:32 ` roodwriter
  0 siblings, 0 replies; 3+ messages in thread
From: roodwriter @ 2005-02-23 20:32 UTC (permalink / raw)


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


Possibly moccur.el will do what you want. At least I hope that's its
name (going by faulty memory). It's in www.emacswiki.org, but I
haven't been able to get it to work for several weeks now. I miss
checking out the new lisp add-ons.

I could be wrong, but it seems to me there's a similar grep package.

--Rod 
Author of "Linux for Non-Geeks--Clear-eyed Answers for Practical Consumers"
and "Boring Stories from Uncle Rod." Both are available at
http://www.rodwriterpublishing.com/index.html.

To reply take the extra "o" out of the name.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: search in loaded buffers
  2005-02-23 20:10 J. David Boyd
@ 2005-02-23 21:19 ` Greg Hill
  0 siblings, 0 replies; 3+ messages in thread
From: Greg Hill @ 2005-02-23 21:19 UTC (permalink / raw)


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
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-02-23 21:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.1328.1109190535.32256.help-gnu-emacs@gnu.org>
2005-02-23 20:32 ` search in loaded buffers roodwriter
2005-02-23 20:10 J. David Boyd
2005-02-23 21:19 ` Greg Hill

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.