Emacs Paredit Notes for OSX

2 Jun 2012

Some notes on Emacs’ Paredit mode.

More so I can stop fighting with Paredit and do some Clojure programming than show any expertise - see Mudphone’s Paredit Preso for the real deal, as well as hagelb’s Paredit screencast notes and the Paredit Cheat Sheet.

  • M-(  wrap parens around something. Also for { [ “

  • M-s  remove parens from something

  • M-S-s  split sexpr into two

  • M-S-j  join sexprs

  • C-q ♦  just do what I say, dammit! force insert of paren or bracket ♦

  • C-u DEL  force delete paren or bracket

“Barfage and slurpage” ie moving parens left and right.  I had some trouble getting this going on OSX, as the terminal doesn’t seem to map control key sequences correctly. After modifying emacs (see below), I got these going:

  • C-, C-  move right paren right or left

  • ESC C-, ESC C- move left paren right or left

I wrote this elisp for my ~/.emacs.d/sonia.el (I’m using Technomancy’s Emacs Starter Kit):

(when (eq system-type 'darwin)
  (eval-after-load 'paredit
       ;; C-left
       (define-key paredit-mode-map (kbd "M-[ 5 d")
       ;; C-right
       (define-key paredit-mode-map (kbd "M-[ 5 c")
       ;; ESC-C-left
       (define-key paredit-mode-map (kbd "ESC M-[ 5 d")
       ;; ESC-C-right
       (define-key paredit-mode-map (kbd "ESC M-[ 5 c")

Lisp Parens

comments powered by Disqus

  « Previous: Next: »