Commits

Peter Szilagyi  committed ec2a423

Simplified Jane.rainbow-delemiters per discussion with jli.

  • Participants
  • Parent commits dc23ea6

Comments (0)

Files changed (1)

File js-micro-features.el

 (defun Jane.rainbow-delimiters ()
   "Color delimiters based on depth, including first atom in sexps.
 
-\\[Jane.rainbow-delimiters-mode] observes
-`Jane.rainbow-delimiters-maximum-size' for individual buffers,
-but you can manually override per buffer with
-\\[rainbow-delimiters-mode]."
+Enable `rainbow-delimiters-mode' for `lisp-mode' and
+`scheme-mode' (popular choices for .sexp files), modulo
+`Jane.rainbow-delimiters-maximum-size'."
   ;; Because we stick with the Emacs Lisp source, rather than
   ;; compiling, `rainbow-delimiters-mode' is slow, especially when
   ;; disabling in large buffers.
   ;; pszilagyi: In fact, I turned bharrison's first suggestion for a
   ;; limit (10MB) down quite a bit.
   (defcustom Jane.rainbow-delimiters-maximum-size 1e6
-    "Maximum size of a buffer for `Jane.rainbow-delimiters-mode'.")
-  ;; Actually, we could just have made lisp-mode-hook and
-  ;; scheme-mode-hook conditional, like this:
-  ;;
-  ;; (add-hook 'lisp-mode-hook
-  ;;   (lambda ()
-  ;;     (if (<= (buffer-size) Jane.rainbow-delimiters-maximum-size)
-  ;;         (rainbow-delimiters-mode 1))))
-  ;;
-  ;; Then we still could have overridden the default with
-  ;; \\[rainbow-delimiters-mode].
-  (define-minor-mode Jane.rainbow-delimiters-mode
-    "Implement `rainbow-delimiters-mode' modulo `Jane.rainbow-delimiters-maximum-size'."
-    nil nil nil
+    "Maximum size of a buffer for `Jane.rainbow-delimiters'.")
+
+  ;;(require 'rainbow-delimiters)
+  ;;(load "elisp/contrib/rainbow-delimiters")
+  (load "elisp/contrib/rainbow-sexp") ; jli's modified version
+
+  (defun Jane.rainbow-delimiters-enable ()
+    "Enable `rainbow-delimiters-mode' modulo
+`Jane.rainbow-delimiters-maximum-size'."
     (if (<= (buffer-size) Jane.rainbow-delimiters-maximum-size)
         (rainbow-delimiters-mode 1)))
-  ;;(require 'rainbow-delimiters)
-  ;;(load "elisp/contrib/rainbow-delimiters")
-  (load "elisp/contrib/rainbow-sexp")   ; jli's modified version
+  (add-hook 'lisp-mode-hook 'Jane.rainbow-delimiters-enable)
+  (add-hook 'scheme-mode-hook 'Jane.rainbow-delimiters-enable)
+
   (custom-set-variables
    '(rainbow-delimiters-highlight-first-term-p t))
   (custom-set-faces
    '(rainbow-delimiters-depth-7-face ((((background dark)) (:foreground "#ce91e0"))))
    '(rainbow-delimiters-depth-8-face ((((background dark)) (:foreground "#e091b1"))))
    '(rainbow-delimiters-depth-9-face ((((background dark)) (:foreground "#e0217f"))))
-   '(rainbow-delimiters-unmatched-face ((((background dark)) (:foreground "red")))))
-  (add-hook 'lisp-mode-hook (lambda () (Jane.rainbow-delimiters-mode 1)))
-  (add-hook 'scheme-mode-hook (lambda () (Jane.rainbow-delimiters-mode 1))))
+   '(rainbow-delimiters-unmatched-face ((((background dark)) (:foreground "red"))))))
 
 ;; (Jane.recentf)
 (defun Jane.recentf ()