overtone/live-coding-emacs — pull request #10 by jlr (2011-12-30 20:56:52+00:00)
Title: Upgrade rainbow-delimiters to current version.

Hello,

I'm the author of rainbow-delimiters.el. First I'd like to say I watched your 4 minute Overtone intro video and I love the environment you've set up; I'm integrating the pieces of your config I don't already have. You've really amped up the speed. Overtone itself is brilliant, and I love the type of hacker who puts a lot of work into their environment as you have with live-coding-emacs.

I saw some discussion about moving live-coding-emacs to use a more recent version of my mode and that is definitely a good idea. You're using an ancient version of the mode; what happened here is I made a few modest changes to a rainbow-paren mode (unfortunately calling it rainbow-delimiters back then), but then decided it didn't fit my needs and wrote a version from scratch.

The main reason for that was speed. This version uses text properties instead of overlays. I've profiled rainbow-delimiters extensively and have gotten it to the point where it can scroll through my 4000 line dot-emacs (including a huge color-theme with many many parens on a 1600px tall buffer) without any pauses/hiccups at all.

It works on parens, brackets and braces so there's no need to use a second rainbow paren mode.

rainbow-delimiters.el (the current version, like I said a completely separate codebase) has:
- Speed: lots of performance tuning; use of text properties instead of overlays.
- Infinite depth support by cycling through the defined faces.
- Stability - it has been updated ~10 times and is very stable. I fix bugs.
- Works with color-theme; has faces for each depth and an unmatched-delimiter face.
- Customize interface, backwards compatibility with emacs version prior to 23.2,
global-rainbow-delimiters-mode.
- Works as a drop-in replacement for your current setup.

I took the liberty of forking the live-coding-emacs repo and getting everything set up correctly for you. It uses the colors you've chosen, puts the changes in the correct files, updates rainbow-delimiters.el to the latest version, and removes the unneeded references to the other rainbow-paren mode you'd been using (you don't need it and it's going to move much slower than rainbow-delimiters).

Take a look at the changes and give the branch a try. It won't behave differently, but will be faster. You'll like it.

Changes made:
- Update your version of rainbow-delimiters.el to the most recent.
- Remove all references to rainbow-parens.el.
- blackbored.el: Add entries for all the rainbow-delimiters depth faces to your blackbored.el color-theme, using the colors you prefer.
- blackbored.el: Since rainbow-delimiters.el automatically highlights unmatched closing parens, make them white (they'll be the only ones unhighlighted). This preserves the current behaviour of showing unmatched parens in purple/white when you move point over them. It can highlight unmatched delimiters more prominently if you like; just change 'rainbow-delimiters-unmatched-face' in blackbored.el.
- Add mode-hooks turning on rainbow-delimiters in clojure-mode and slime-repl-mode, along with the modes in lisp-conf.el.
- live-config/clojure-conf.el: Byte-compile rainbow-delimiters before requiring it (this is needed for speed; if there is a better way to byte-compile a file as it is loaded please let me know).
- live-config/lisps-conf.el: Change "rainbow-paren-mode" to "rainbow-delimiters-mode".
- lib/durendal/durendal.el: Remove unneeded line "(add-hook 'slime-repl-mode-hook 'rainbow-paren-mode)" -- the line directly above it activates rainbow-delimiters-mode in the same fashion, eliminating the need for rainbow-paren-mode.

There's a couple minor errata:
- rainbow-delimiters currently cycles through 9 faces, so the final two colors in your config (gold and turquoise) aren't used. If you like, I can increase the number of faces used by the mode - I just chose 9 arbitrarily when writing it, so if someone wants more, I'm happy to change that.
- Byte-compiling rainbow-delimiters.el as a part of loading live-config/clojure-conf.el may be seen as something of a hack.

Everything works identically to before except you'll have infinite depth support and it will be faster. If anything behaves differently it would be counted as a bug and should be sent to me. I'll be glad to submit updated versions through github when I update the mode, though it's quite solid as it is and likely won't ever need to be changed in this config again.

Have a nice day. Thanks for Overtone and the other fantastic work. I have one question for you: Please tell me there's video of your talk at the Conj this year? I really want to see what you did. You generated a lot of buzz!

Thanks,
- Jeremy Rayman
jeremy.rayman@gmail.com