* Serach and replace in all buffers
@ 2006-01-22 16:57 AndyJB (sent by Nabble.com)
2006-01-22 19:40 ` Drew Adams
2006-01-22 19:57 ` Serach " Eli Zaretskii
0 siblings, 2 replies; 8+ messages in thread
From: AndyJB (sent by Nabble.com) @ 2006-01-22 16:57 UTC (permalink / raw)
[-- Attachment #1.1: Type: text/plain, Size: 523 bytes --]
Hi
Is there a way of searching and replacing across all open buffers? I know you can use a tags file to search across multiple files but that's not quite what I'm looking for - it's inconvenient having to regenerate the tags file all the time (why oh why isn't that automatic?) and doesn't necessarily correspond to which files are currently open.
Thanks
Andy
--
View this message in context: http://www.nabble.com/Serach-and-replace-in-all-buffers-t973310.html#a2520975
Sent from the Emacs - Help forum at Nabble.com.
[-- Attachment #1.2: Type: text/html, Size: 690 bytes --]
[-- Attachment #2: Type: text/plain, Size: 152 bytes --]
_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: Serach and replace in all buffers
2006-01-22 16:57 Serach and replace in all buffers AndyJB (sent by Nabble.com)
@ 2006-01-22 19:40 ` Drew Adams
2006-01-22 22:23 ` Search " AndyJB (sent by Nabble.com)
[not found] ` <mailman.2152.1137968793.26925.help-gnu-emacs@gnu.org>
2006-01-22 19:57 ` Serach " Eli Zaretskii
1 sibling, 2 replies; 8+ messages in thread
From: Drew Adams @ 2006-01-22 19:40 UTC (permalink / raw)
Is there a way of searching and replacing across all open buffers?
http://www.emacswiki.org/cgi-bin/wiki/CategorySearchAndReplace
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Serach and replace in all buffers
2006-01-22 16:57 Serach and replace in all buffers AndyJB (sent by Nabble.com)
2006-01-22 19:40 ` Drew Adams
@ 2006-01-22 19:57 ` Eli Zaretskii
2006-01-22 22:33 ` Search " AndyJB (sent by Nabble.com)
1 sibling, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2006-01-22 19:57 UTC (permalink / raw)
> Date: Sun, 22 Jan 2006 08:57:22 -0800 (PST)
> From: "AndyJB (sent by Nabble.com)" <lists@nabble.com>
> Cc:
>
> Is there a way of searching and replacing across all open buffers? I know you can use a tags file to search across multiple files but that's not quite what I'm looking for - it's inconvenient having to regenerate the tags file all the time (why oh why isn't that automatic?) and doesn't necessarily correspond to which files are currently open.
You don't need to regenerate the TAGS file unless you add or delete
files, functions, macros, or typedefs. And for the purpose of search
and replace, you don't need to regenerate unless some files were added
or deleted.
An alternative method of multi-file search and replace is the Q
command in Dired buffers. You mark those files in which you wish to
search and replace, and then press Q; the rest is just like with TAGS,
except that no TAGS file is needed.
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: Search and replace in all buffers
2006-01-22 19:40 ` Drew Adams
@ 2006-01-22 22:23 ` AndyJB (sent by Nabble.com)
2006-01-23 0:31 ` AndyJB (sent by Nabble.com)
[not found] ` <mailman.2152.1137968793.26925.help-gnu-emacs@gnu.org>
1 sibling, 1 reply; 8+ messages in thread
From: AndyJB (sent by Nabble.com) @ 2006-01-22 22:23 UTC (permalink / raw)
[-- Attachment #1.1: Type: text/plain, Size: 549 bytes --]
Drew Adams wrote:
>
> http://www.emacswiki.org/cgi-bin/wiki/CategorySearchAndReplace
>
Thanks - there are a couple of things there that might be close to what I'm looking for - grep-buffers and moccur-edit look useful. I'll give them a try. It surprises me that something this obvious (to me) isn't part of standard Emacs - other editors I've used before moving to Emacs had it.
Andy
--
View this message in context: http://www.nabble.com/Search-and-replace-in-all-buffers-t973310.html#a2525115
Sent from the Emacs - Help forum at Nabble.com.
[-- Attachment #1.2: Type: text/html, Size: 1137 bytes --]
[-- Attachment #2: Type: text/plain, Size: 152 bytes --]
_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Search and replace in all buffers
2006-01-22 19:57 ` Serach " Eli Zaretskii
@ 2006-01-22 22:33 ` AndyJB (sent by Nabble.com)
2006-01-24 17:07 ` Kevin Rodgers
0 siblings, 1 reply; 8+ messages in thread
From: AndyJB (sent by Nabble.com) @ 2006-01-22 22:33 UTC (permalink / raw)
[-- Attachment #1.1: Type: text/plain, Size: 1510 bytes --]
Eli Zaretskii wrote:
>
> You don't need to regenerate the TAGS file unless you add or delete
> files, functions, macros, or typedefs. And for the purpose of search
> and replace, you don't need to regenerate unless some files were added
> or deleted.
>
Exactly - which is just about every time I search! When I'm programming I'm adding new files and definitions constantly.
> An alternative method of multi-file search and replace is the Q
> command in Dired buffers. You mark those files in which you wish to
> search and replace, and then press Q; the rest is just like with TAGS,
> except that no TAGS file is needed.
Thanks - didn't know that. It looks useful.
Back in my Windows days I used an editor called TSE, and I wrote something for it that achieved much the same effect as find-tag and friends without the need to manually update the tags file. It maintained the equivalent of a TAGS file and dynamically updated it as you added new files and definitions. I rather miss it's convenience - maybe one day I'll miss it enough to write an Emacs equivalent :) I suspect that all that wouldbe needed would be to hook something in to rerun "etags" at the appropriate times, so it would be easier than what I wrote for TSE, where I had to implement the whoe etags style functionality. Unless someone else has already done it?
Andy B
--
View this message in context: http://www.nabble.com/Search-and-replace-in-all-buffers-t973310.html#a2525247
Sent from the Emacs - Help forum at Nabble.com.
[-- Attachment #1.2: Type: text/html, Size: 2263 bytes --]
[-- Attachment #2: Type: text/plain, Size: 152 bytes --]
_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: Search and replace in all buffers
2006-01-22 22:23 ` Search " AndyJB (sent by Nabble.com)
@ 2006-01-23 0:31 ` AndyJB (sent by Nabble.com)
0 siblings, 0 replies; 8+ messages in thread
From: AndyJB (sent by Nabble.com) @ 2006-01-23 0:31 UTC (permalink / raw)
[-- Attachment #1.1: Type: text/plain, Size: 379 bytes --]
moccur-edit does what I want here, but I've got a small problem with it. After I've edited some text with it, it highlights the text in the original file green, and I can't remove the green! Any suggestions?
TIA
Andy
--
View this message in context: http://www.nabble.com/Search-and-replace-in-all-buffers-t973310.html#a2526557
Sent from the Emacs - Help forum at Nabble.com.
[-- Attachment #1.2: Type: text/html, Size: 542 bytes --]
[-- Attachment #2: Type: text/plain, Size: 152 bytes --]
_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Search and replace in all buffers
[not found] ` <mailman.2152.1137968793.26925.help-gnu-emacs@gnu.org>
@ 2006-01-23 2:28 ` Giorgos Keramidas
0 siblings, 0 replies; 8+ messages in thread
From: Giorgos Keramidas @ 2006-01-23 2:28 UTC (permalink / raw)
On Sun, 22 Jan 2006 14:23:43 -0800 (PST),
"AndyJB (sent by Nabble.com)" <lists@nabble.com> wrote:
> Drew Adams wrote:
> http://www.emacswiki.org/cgi-bin/wiki/CategorySearchAndReplace
>
> Thanks - there are a couple of things there that might be close to what
> I'm looking for - grep-buffers and moccur-edit look useful. I'll give them
> a try. It surprises me that something this obvious (to me) isn't part of
> standard Emacs - other editors I've used before moving to Emacs had it.
It's easy enough to implement with something like this, though:
| (dolist (elt (mapcar (function buffer-name) (buffer-list)) nil)
| (save-current-buffer
| (set-buffer elt)
| (if (not buffer-read-only)
| (progn ...))))
A friend of mine used the following to reindent many XML/HTML files and
was kind enough to share it:
| (defun indent-all-buffers ()
| "Reindent all currently open buffers, as long as they are
| not read-only. Read-only buffers are simply skipped."
| (interactive)
| (dolist (elt (mapcar (function buffer-name) (buffer-list)) nil)
| (save-current-buffer
| (set-buffer elt)
| (if (not buffer-read-only)
| (indent-region (point-min) (point-max) nil))))
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Search and replace in all buffers
2006-01-22 22:33 ` Search " AndyJB (sent by Nabble.com)
@ 2006-01-24 17:07 ` Kevin Rodgers
0 siblings, 0 replies; 8+ messages in thread
From: Kevin Rodgers @ 2006-01-24 17:07 UTC (permalink / raw)
AndyJB (sent by Nabble.com) wrote:
> Back in my Windows days I used an editor called TSE, and I wrote
> something for it that achieved much the same effect as find-tag and
> friends without the need to manually update the tags file. It maintained
> the equivalent of a TAGS file and dynamically updated it as you added
> new files and definitions. I rather miss it's convenience - maybe one
> day I'll miss it enough to write an Emacs equivalent :) I suspect that
> all that wouldbe needed would be to hook something in to rerun "etags"
> at the appropriate times, so it would be easier than what I wrote for
> TSE, where I had to implement the whoe etags style functionality. Unless
> someone else has already done it?
It should be as simple as:
(add-hook 'c-mode-hook
(lambda ()
(add-hook 'local-write-file-hooks
(lambda ()
(shell-command "etags (your arguments here)")
;; Return nil to ensure that file gets written:
nil))))
--
Kevin Rodgers
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2006-01-24 17:07 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-22 16:57 Serach and replace in all buffers AndyJB (sent by Nabble.com)
2006-01-22 19:40 ` Drew Adams
2006-01-22 22:23 ` Search " AndyJB (sent by Nabble.com)
2006-01-23 0:31 ` AndyJB (sent by Nabble.com)
[not found] ` <mailman.2152.1137968793.26925.help-gnu-emacs@gnu.org>
2006-01-23 2:28 ` Giorgos Keramidas
2006-01-22 19:57 ` Serach " Eli Zaretskii
2006-01-22 22:33 ` Search " AndyJB (sent by Nabble.com)
2006-01-24 17:07 ` Kevin Rodgers
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).