Blender, graphic, software, open source, Linux LibreOffice, open source, openoffice Gimp, graphic, software, open source, Linux kernel, Linux, software, open source Linux, distributions, Ubuntu, Linux Mint, Fedora, Mandriva Jamin, gpl, library, open source matroska, multimedia, container, linux pcman, file manager, linux LuninuX, distribition, Linux, open source Linux, infographic, history

Friday, May 15, 2009

ParEdit mode (paredit.el) is a minor mode for performing structured editing of S-expression data

ParEdit mode (paredit.el) is a minor mode for performing structured editing of S-expression data. The typical example of this would be Lisp or Scheme source code.

ParEdit helps keep parentheses balanced and adds many keys for moving s-expressions and moving around in S-expressions.

The latest stable version is available at paredit.el. Reference Table. Release Notes.

Here is one page cheatsheet: PareditCheatsheet

The latest development version (recommended) is available at paredit-beta.el Reference Table.

A spinoff of ParEdit (by the same author) is also now available in the current CVS version of EdWin, MIT Scheme’s Emacs clone. Type M-x paredit-mode RET to enable it, or add the following code to your .edwin file to enable it automatically in the Scheme mode:

(add-event-receiver! (ref-variable scheme-mode-hook)
(lambda (buffer)
(enable-buffer-minor-mode! buffer (ref-mode-object paredit))))

(You can substitute other modes for scheme-mode also.)

Contents

This is what I am currently using to activate paredit in EmacsLispMode? and LispMode? (plus SlimeMode too):

(mapc (lambda (mode)
(let ((hook (intern (concat (symbol-name mode)
"-mode-hook"))))
(add-hook hook (lambda () (paredit-mode +1)))))
'(emacs-lisp lisp inferior-lisp))

(Ok actually I commented it out in my DotEmacs. To know the reasons why, look at #Questions)

Patch

Autoload won’t work as expected since paredit-beta.el lacks the autoload cookie.

Add it to enable this

Questions

I downloaded paredit a long time ago but I did not succeed in using it daily. I have two questions here:

 1. What is really *useful* with paredit that we can't get with
standard skeletons ?

Check out the ParEdit reference table mentioned above, especially the parts “Depth-Changing Commands” and “Barfage & Slurpage”. Skeletons are like templates, they’re static. ParEdit can modify the structure of Lisp code. So basically, they have different purposes. – PeterBarabas

 2. How do you delete a parenthesis ? I often end up with unbalanced
parentheses when coding something (without paredit) and activating
paredit prevents me from deleting the leading parenthesis.

It takes a bit of getting used to, but after that you’ll never end up with unbalanced parentheses. Just use ParEdit’s commands, e.g. paredit-open-parenthesis, paredit-wrap-sexp instead of manually typing/editing parentheses. ParEdit really makes transforming Lisp code easy. – PeterBarabas

C-u DEL falls back to ‘backward-delete-char’. Similarly, you can insert single parentheses with C-q ( and C-q )YannHodique



Related Post


Yahoo!    Personals


123inkjets.com    - Printer Ink, Toner, & More

  • Get Paid     to Blog About the Things You Love


iPowerWeb    Web Hosting


Linux Links


No comments:

Recent Posts

Linux News

My Blog List

BlogESfera Directorio de Blogs Hispanos - Agrega tu Blog Add to Technorati Favorites BlogItalia.it - La directory italiana dei blog Il Bloggatore Find the best blogs at Blogs.com. AddThis Social Bookmark Button page counter Mi Ping en TotalPing.com