emacsclojureparedit

Can't find a place to bind paredit's convolute-sexp


Strangely, while the various paredit cheatsheets show M-? bound to paredit-convolute-sexp, the paredit.el file doesn't have any binding for that function, though it does define the function. I edited paredit.el to add it here:

 ....
("M-q"  paredit-reindent-defun)
("M-\?" paredit-convolute-sexp)

But after restarting emacs, it is still not bound to M-?. I tried using just "M-?" in the binding with no backslash, but made no difference.

I also tried to do this:

(defun my-clojure-hook ()
  (auto-complete-mode 1)
  (define-key clojure-mode-map
    (kbd "M-\?" 'paredit-convolute-sexp)))

(add-hook 'clojure-mode-hook 'my-clojure-hook)

Also tried with and without the backslash.

That also made no difference, even though it does turn on auto complete mode fine.

Can anyone advise where I should put this binding?


Solution

  • You're missing a close parenthesis on your call to kbd. Your hook should read as follows (incidentally, I don't think you need to escape the question mark):

    (defun my-clojure-hook ()
      (auto-complete-mode 1)
      (define-key clojure-mode-map
        (kbd "M-?") 'paredit-convolute-sexp))
    

    And actually, the call to define-key only needs to be made once (say, in your .emacs file) rather than every time you open a new clojure buffer, so you don't need to put it in the hook per se.