emacs SearchBuffers

referenced fro m emacswiki

Search through multiple (possibly all) buffers.

  1. Multi-Occur
  2. Search and Replace Using Icicles
  3. search-buffers
  4. moccur
  5. color-moccur
    1. moccur-edit
    2. restrict moccur search to current major mode
  6. grep-buffers
  7. moccur-grep and moccur-grep-find
  8. offby1's crude but effective method

Multi-Occur

Built into Emacs 23, this command can search any files or buffers matching a regexp for a particular regexp.

To select buffers to search individually:

 

To select files to search by regexp:

 

To select buffers to search by regexp:

 

Search and Replace Using Icicles

You can use Icicles to search any number of buffers – pick the buffers individually using completion, or pick all that match a regexp, or pick all. Similarly, you can pick files to open and search.

You can use multiple regexps for searching and change regexps on the fly (incrementally). See Icicles - Search Commands, Overview. Search-and-replace across multiple buffers or files, with complex replacement possibilities – see Icicles - Search-And-Replace.

search-buffers

M-x list-matches-in-buffers

Search all buffers for REGEXP and present matching lines like grep.

Sample

 

Screenshot

moccur

M-x moccur

Search all buffers that have a file name associated with them and present matching lines. And C-c C-c gets you to the occurence.

Sample

 

color-moccur

M-x moccur

Search all buffers that have a file name associated with them

C-u M-x moccur

Search all file buffers and not file buffers

M-x dmoccur

Search files in a directory like grep

C-u M-x dmoccur

Search files in the directory which is setted in your .emacs

dired-do-moccur, Buffer-menu-moccur,ibuffer-do-occur

can search from dired,buffer-menu,ibuffer

moccur is basis of color-moccur. You can search all buffers and matched line is displayed to other window.

Screenshot, searching for “setq match”:

moccur-split-word : non-nil means to input word splited by space. You can search “(setq ov (make-overlay (match-beginning 0)” by “setq match” or “match setq”. You don’t need to input complicated regexp.

http://www.bookshelf.jp/emacswiki/moccur.png

Upperside:Search result buffer, lowerside:matched file buffer

moccur-edit

moccur-edit allows you to edit files by just editing the Moccur buffer of color-moccur.

Screenshot, where “ov” is replaced with “moccur-ov”:

http://www.bookshelf.jp/emacswiki/moccur-edit.png

restrict moccur search to current major mode

The following function does the same thing as moccur, but the search is restricted to buffers with the same major mode as the current buffer.

 

grep-buffers

M-x grep-buffers

This code lets you grep through all loaded buffers that have a file associated with them. It’s similar to ‘moccur’ and it’s many variants, but uses the standard compilation-mode interface, i.e. next-error, previous-error, etc. all work.

I have the same problem with symbol-near-point. Replacing it with symbol-at-point fixes problem. I’m using Emacs 22. -Petteri

Problem should be fixed now. -ScottFrazer

moccur-grep and moccur-grep-find

grep(-find) by elisp

M-x moccur-grep and input directory, regexp, filemask

 

In MiniBuffer, input directory

 

In minibuffer, input regexp and filemask. Last word is filemask.

 

M-x moccur-grep-find

How to use is same to M-x moccur-grep.

offby1's crude but effective method

 

CategorySearchAndReplace

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值