Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I automatically get paredit in a emacs nrepl session?

I have the following line in my emacs init file.

(setq auto-mode-alist (cons `("\*nrepl\*" . paredit-mode) auto-mode-alist))

I check that this works by creating a new buffer called *nrepl* Ctrl-x-f *nrepl*. Yes, the *nrepl* buffer has Paredit active, paredit-mode was enabled.

I close the *nrepl* buffer without saving it.

I start up a nrepl session by typing M-x nrepl-jack-in. The nrepl server starts up and I am presented with the nrepl repl. The nrepl repl is also called *nrepl*, however Paredit is not enabled.

What am I doing wrong?

like image 857
Stephen Cagle Avatar asked Oct 21 '12 21:10

Stephen Cagle


Video Answer


1 Answers

You're confusing buffers and files: auto-mode-alist matches file names against regexps to decide which mode to use when editing those files. But *nrepl* is a buffer that does not contain a file, so auto-mode-alist has no effect for it. Instead, you probably want to figure out which major-mode *nrepl* uses and then use (add-hook '<the-major-mode>-hook 'paredit-mode).

like image 87
Stefan Avatar answered Sep 21 '22 02:09

Stefan