jlr/rainbow-delimiters — Issue #5: fails with temp buffers
Author: renard
Created: 2012-01-07 23:27:29+00:00
State: open

Hi Jeremy,

I guess I found a bug (or something goes wrong) when using
rainbow-delimiter-mode in temp buffers.

I do use temp buffer for exporting colorized source to html.

If you do run following snippets you don't get the same results:

(let ((rtn "(defun org-xor (a b)\n \"Exclusive or.\"\n (if a (not b) b))\n")
(mode 'emacs-lisp-mode)
(emacs-lisp-mode-hook nil))
(with-temp-buffer
(insert rtn)
(if (functionp mode)
(funcall mode)
(fundamental-mode))
(rainbow-delimiters-mode 1)
(font-lock-fontify-buffer)
(htmlize-region-for-paste (point-min) (point-max))))

This returns

"

(defun org-xor (a b)
\"Exclusive or.\"
(if a (not b) b))

"

It seems that the rainbow-delimiters-mode is not effective

But when using real buffer:

(let ((rtn "(defun org-xor (a b)\n \"Exclusive or.\"\n (if a (not b) b))\n")
(mode 'emacs-lisp-mode)
(emacs-lisp-mode-hook nil))
(with-current-buffer (get-buffer-create "*Just for test*")
(insert rtn)
(if (functionp mode)
(funcall mode)
(fundamental-mode))
(rainbow-delimiters-mode 1)
(font-lock-fontify-buffer)
(setq rtn (htmlize-region-for-paste (point-min) (point-max)))
(kill-buffer))
rtn)

It returns

"

(defun org-xor (a b)
\"Exclusive or.\"
(if a (not b) b))

"

As expected.

I do run rainbow-delimiters-mode Version: 1.3.3 and las emacs-snapshot
GNU Emacs 24.0.92.1 (x86_64-pc-linux-gnu, GTK+ Version 2.20.1) of
2012-01-05 on cw-bkp0, modified by Debian

Thanks you for your help and great work on rainbow-delimiters-mode.

Cheers