On 20 Aug 2006 21:49:45 -0700, Xah Lee <[EMAIL PROTECTED]> wrote: > can anyone give me a guide about writing a short elisp function? (for > non-emacs readers, this message will describe a editor feature i think > will be very beneficial to spread this concept.) > > i want to write a function such that, when run, highlight a region > between the nearest left and right delimiters. Delimiters are any of > parenthesis, square brackets, or single and double quotes etc. When the > function is run again, it extends the selection to the next enclosing > delimiters. > > So, in this way, a user can repeatedly press a keyboard shortcut and > extend the selection.
This functionality can be found in NewEdit (http://wiki.woodpecker.org.cn/moin/NewEdit), first put the caret in middle of delimeters, such as ''""(){}[], then press Ctrl+E, the text between delimeters will be selected. And there are two direction of selection, left first and right first(Ctrl+Shift+E). If you press Ctrl+Alt+E again, the the delimeters will be selected. > > This is feature of BBEdit/TextWrangler on the Mac, which extend > selection to the nearest outer parenthesis. This is also a feature of > the Mathematica editor, which actually extend selection to the nearest > syntactical unit in the language, not just paired delimiters. > > What i wanted this for is mostly in editing HTML/XML, where one press > can select the content, another press will include the enclosing tags, > another press extends the selection to the next outer content, and > another press include that tags too, and so on. > NewEdit can not support this feature now. -- I like python! My Blog: http://www.donews.net/limodou My Django Site: http://www.djangocn.org NewEdit Maillist: http://groups.google.com/group/NewEdit -- http://mail.python.org/mailman/listinfo/python-list