LoginSignup
27
21

More than 5 years have passed since last update.

rainbow-delimiters.el の括弧の色を強調する方法 (たぶん) 決定版

Last updated at Posted at 2015-03-04

概要

rainbow-delimiters.el といえば、対応するカッコに自動的に色をつけてわかりやすくしてくれる便利な emacs 拡張です。しかし、デフォルトではなぜか色が淡くて違いがよくわかりません。

1.png

そこで、括弧の色をより強調する設定が考案され、公開されています。

ところが、環境によってなぜかちゃんと色が付かないことがあったので、ちゃんと色が付くように修正してみました。

参考サイト

設定

以下を .emacs 等に追記。

;; rainbow-delimiters を使うための設定
(require 'rainbow-delimiters)
(add-hook 'prog-mode-hook 'rainbow-delimiters-mode)

;; 括弧の色を強調する設定
(require 'cl-lib)
(require 'color)
(defun rainbow-delimiters-using-stronger-colors ()
  (interactive)
  (cl-loop
   for index from 1 to rainbow-delimiters-max-face-count
   do
   (let ((face (intern (format "rainbow-delimiters-depth-%d-face" index))))
    (cl-callf color-saturate-name (face-foreground face) 30))))
(add-hook 'emacs-startup-hook 'rainbow-delimiters-using-stronger-colors)

どうも色設定を行うタイミングがよろしくないようだったので、 emacs が一通り起動したあとに色の強調処理を行うようにしました。

結果

解決!

2.png

不具合の出た環境

参考までに。

  • Cent OS 6.4(Vagrant で起動した仮想マシン)
  • Teraterm 4.83 でログイン
  • emacs 24.3.1
27
21
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
27
21