Me and my colleague see a problem where paredit-mode makes the cider-repl buffer in emacs doesn’t really work anymore. It is still possible to send sexprs to cider from buffers with code in them.
When paredit is disabled things seem to work as they should.
I tried to create a new .emacs and tried with smart-parens, which is probably even better than paredit, but I don’t understand how to bind sp-kill-hybrid-sexp to C-k. This is the paredit-functionality I use the most so I cannot really live without it.
How do I bind sp-kill-hybrid-sexp to C-k when smartparens mode is enabled?
When I add this line I get errors when I open emacs:
Warning (initialization): An error occurred while loading ‘c:/Users/John/AppData/Roaming/.emacs’:
Symbol’s value as variable is void: paredit-mode-map
To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file. Start Emacs with
the ‘–debug-init’ option to view a complete error backtrace. Disable showing Disable logging
I have the following lines:
(add-hook 'cider-repl-mode-hook #'paredit-mode)
(add-hook 'cider-mode-hook #'paredit-mode)
(add-hook 'clojure-mode-hook #'paredit-mode)
(define-key paredit-mode-map (kbd “RET”) nil)
Maybe I shouldn’t have the hook language, maybe just the (require 'paredit). I got the language from somewhere on the web. Whenever I went into emacs I had to turn paredit on manually instead of it just being on right away. I added those lines and it fixed that.
The reason it didn’t work before is those other lines you quoted load paredit only when cider mode, clojure mode or cider repl mode are active, so the define-key line you added errors because it runs at startup before that happens.
By calling require as I did you’re keeping paredit loaded unconditionally at startup - probably fine, there is some memory cost but probably pretty small. I find paredit useful when editing elisp so I keep it always loaded. If you are worried about memory use, though, you could write your own elisp function (look up defun) that has the require ‘paredit line AND the define-key line and then sub the function name in to the add-hook calls where you currently have paredit-mode currently. But if you don’t code elisp that will become a learning experience and may take some fiddling strictly optional
Do you know why adding that line alone worked for the first questioner, but not me?
Is there any way for me to not have the (require 'paredit) in my .emacs file and still have the (define-key paredit-mode-map (kbd “RET”) nil) work properly?
On the Cider Docs site (Troubleshooting :: CIDER Docs) they also list the same solution as you originally did, but they didn’t use the require language.
This is slightly off topic, but related. How do you drop lines in the cider-repl with paredit running in it?
I get error messages when I hit return, say in an IF function.
Is there a way to get multiple lines of text in the cider-repl with paredit running? If not, it doesn’t seem practical to use paredit in the cider-repl.
I’ve noticed that if I don’t have paredit running in the cider-repl then I can drop lines just fine.