2009-06-12

emacs, efficient way to edit lisp code

On Jun 12, 12:05 am, rustom wrote:
> Im hacking on a 700 line elisp function.
> While doing some (fairly mechanical) cut-paste operations it looks
> like either Ive got a parenthesis or a quote (most likely double quote
> but could also be single quote) error.
>
> Any suggestions on how to catch such errors?

here's some recommendation based on how i code elisp.

• never type single paren. I always type them in pairs. And never delete one of them.
• use tree navigation to move between code.
• to delete or move parts of expression, select the whole expression, cut & copy to move.

so, when i code in lisp, there is never ever unmatched parenthesis.

this method beats paren-edit mode.

the detail of my editing and setup is here:

• Tips For Editing Lisp Code With Emacs
http://xahlee.org/emacs/emacs_editing_lisp.html

to select current unit of sexp, i press one key, which is bound to extend-selection, which is defined in my ergoemacs mode. The code is shown here:

• A Text Editor Feature: Extend Selection By Semantic Unit
http://xahlee.org/emacs/syntax_tree_walk.html

Xah
∑ http://xahlee.org/

No comments:

Post a Comment