6
votes

I'm using the Clojure mode package from ELPA. Otherwise everything is fine, but I just can't stand paredit mode. I can't seem to turn it off easily, now I just disable it for every buffer I open. I tried setting this variable to nil:

(setq clojure-enable-paredit nil)

But paredit still appears. Any ideas?

3
One thing that might make it tolerable is knowing that C-u and C-q will allow you to escape the next keystroke. I use C-u DEL to delete unwanted braces/quotes, and C-q ( or C-q ) to insert needed braces. You'll need that if you ever kill/yank or clipboard-yank a block of text into your buffer since that often causes unbalanced forms.Brian Cooley
I wonder if the original author ever decided he liked paredit mode, or found a satisfactory way to turn it off.amalloy
you should mark your own answer as correct.Pedro Rolo

3 Answers

29
votes

Not an answer to your actual question, but give paredit mode a chance. I, too, was really annoyed with it automatically closing my parens, and refusing to delete just a single paren for me.

But doing this enables it to be certain at all times that the buffer is a well-balanced sexp, so it can perform many useful sexp-oriented tasks for you instead of just text-oriented tasks. For example, I use the following all the time:

  • M-( to wrap a sexp with a new one, eg turn (map f some-list) into (doto (map f some-list) println)
  • C-) to "slurp" another sexp into the current one, eg turn (let [x 10]) (println x) into (let [x 10] (println x))
  • M-<UP> and/or M-r to pull the sexp at point a level "higher" in the source tree, destroying the thing that was wrapping it, eg to turn (first (map f some-list)) into (map f some-list) or (first some-list)

There are zillions of useful features like this, that let you start editing code instead of text. And while there are plenty of excellent Lisp hackers who don't like paredit mode, I advise you not to decide against it before you realize the awesome stuff it can do for you.

16
votes

Found one trick that works. Before the elpa packages are loaded in init.el, add this hook to clojure mode:

(add-hook 'clojure-mode-hook (lambda () (paredit-mode nil)))
0
votes

For what it's worth, I use clojure-mode through ELPA too, and it doesn't imply paredit. Maybe just uninstall it? I find clojure-mode, slime and slime-repl are the only packages I need to install on a clean EMACS to get clojure/swank/slime working.

I only tested this:

http://www.learningclojure.com/2010/08/clojure-emacs-swank-slime-maven-maven.html

a few weeks ago, and it still works fine.