Difference between revisions of "Paredit-mode"

From WikEmacs
Jump to navigation Jump to search
m
Line 52: Line 52:
 
* [http://mumble.net/~campbell/emacs/paredit.el Stable Version]
 
* [http://mumble.net/~campbell/emacs/paredit.el Stable Version]
 
* [http://mumble.net/~campbell/emacs/paredit-beta.el Beta Version]
 
* [http://mumble.net/~campbell/emacs/paredit-beta.el Beta Version]
 +
* [http://mumble.net/~campbell/emacs/paredit.html Official documentation]
  
 
= Tutorial Pages =
 
= Tutorial Pages =
 +
 +
= External Links =
 +
* [http://emacswiki.org/emacs/PareditCheatsheet Cheat Sheet]
 +
* [http://www.slideshare.net/mudphone/paredit-preso Paredit Preso]
  
 
[[Category:Project Management]][[Category:Convenience]][[Category:Third Party Package]]
 
[[Category:Project Management]][[Category:Convenience]][[Category:Third Party Package]]

Revision as of 09:21, 2 April 2012

Paredit
Description structural editing of S-expression data
Author name of author
Maintainer Taylor Campbell
Source http://mumble.net/~campbell/emacs/paredit.el

Paredit 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.

Basic setup

(autoload 'paredit-mode "paredit"
      "Minor mode for pseudo-structurally editing Lisp code." t)
(add-hook 'emacs-lisp-mode-hook       (lambda () (paredit-mode +1)))
(add-hook 'lisp-mode-hook             (lambda () (paredit-mode +1)))
(add-hook 'lisp-interaction-mode-hook (lambda () (paredit-mode +1)))
(add-hook 'scheme-mode-hook           (lambda () (paredit-mode +1)))

Helpful keybindings

[C-M-f]
Forward sexp
[C-M-b]
Backward sexp

Common Customization

SLIME REPL

(add-hook 'slime-repl-mode-hook (lambda () (paredit-mode +1)))

SLIME’s REPL has the very annoying habit of grabbing DEL which interferes with paredit’s normal operation. To alleviate this problem use the following code:

 ;; Stop SLIME's REPL from grabbing DEL,
 ;; which is annoying when backspacing over a '('
 (defun override-slime-repl-bindings-with-paredit ()
   (define-key slime-repl-mode-map
      (read-kbd-macro paredit-backward-delete-key) nil))
      (add-hook 'slime-repl-mode-hook 'override-slime-repl-bindings-with-paredit)

See Also

Project Pages

Tutorial Pages

External Links