I saw the following entry in etc/TODO some days ago: ** Implement intelligent search/replace, going beyond query-replace (see http://graphics.csail.mit.edu/~rcm/chi04.pdf). I thought I could work on it when reading that. After a few days' working, I get a prototype. I should have discussed it in this list, but I found difficulties talking about my thought in English, so the only way to describe it clearly for me is to write such a prototype. I apologize for this. The prototype is attached in this message. It is merely a prototype, so many features, such as documents, mouse operation supports, more precise classifications and so on, are not present in it. However, it works well (at least in my opinion) with keyboard. To start with it, first load the attached file. To replace text intelligently, execute M-x ireplace. It will ask for a piece of text. Another window will be opened to show all classified matches of text in the buffer that M-x ireplace is executed in, and the cursor will be moved into this window automatically. I call this buffer the "ireplace" buffer. The ireplace buffer contains many classes, classified with some method. Each of the classes itself contains many "blocks". Classes and blocks are showed in alternate color, respectively, to help the user distinguish them. The user can mark several classes and/or blocks, and then replace text of marked classes and/or blocks with another text. Then, the user may mark and replace again. In the ireplace buffer, the user can: - Type n and p to move through blocks; - Type M-n and M-p to move through classes; - Type RET to follow the block, or open/fold a class; - Type m to mark or de-mark blocks or classes; - Type r to mark blocks reversely; - Type M-r to mark classes reversely; - Type x to perform the replace; - Type q to close the ireplace buffer. Please try out the prototype. As I said, there are many features missed in the prototype: - User interface re-design; - Mouse operations; - Console support; - More commands; - More precise classifying algorithm, for many mainstream major modes; - Documents and comments in source code; - Coordination in details; - Code improvement; - Emacs convension commits, and perhaps other things. These are because that I am not sure about them. Please give me suggestions on those things, I will improve the prototype. When it becomes stable/mature, I would like to contribute it into Emacs. Thanks. Regards, Guanpeng Xu _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/