I am an Emacs and Common Lisp novice. I have successfully installed SLIME in my Emacs, but I noticed it does not have rainbow parentheses (which comes as a surprise). How do I enable this feature? Thanks in advance.
There's a Rainbow Delimiters mode over on emacswiki which might suit you - otherwise there's a bunch of other parenthesis appearance packages there as well.
Update: This worked for me.
This is probably still not as novice-friendly as it could be. I've had 20 years of on-and-off use to help me forget what being a total Emacs novice is like...
First, make sure there's an .emacs
file in your home directory. C-x C-f
[visit-buffer] followed by ~/.emacs
and Enter should do the trick.
You also need a directory to save your elisp files in.
"~/.emacs.d/" is usually on the load-path
, so using that is the easiest way to get started.
Create it if it doesn't exist.
Next, download rainbow-delimiters.el. It should go into your elisp folder from the previous step.
Type M-x byte-compile-file
, followed by Return, then the path to your rainbow-delimiters.el (this step is only for efficiency).
Now enter the following in your .emacs
:
(require 'rainbow-delimiters)
(add-hook 'slime-repl-mode-hook 'rainbow-delimiters-mode)
and save (C-x C-s
) and restart.
(A "mode hook" is a function (or rather list of functions) that is called when Emacs switches to a specific mode.).
If you don't want to restart Emacs just to try it, you can position the cursor at the end of each expression and type C-x C-e
[eval-last-sexp] (this also works in the interactive "*scratch*" buffer).
Starting slime with M-x slime
after this gave me coloured parentheses.
The colour scheme is customizable; the easiest way of finding the options is M-x customize-apropos
(hit Return), type rainbow
(hit Return).
HTH.
Oh, and look through the built-in tutorial (C-h t
) if you haven't already. Emacs has a slightly peculiar vocabulary, so reading the documentation (C-h i
) now and then is good, and there's plenty of "oh, it can do that" moments in there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With