Move rainbow-identifiers from spacemacs config to syl20bnr

It is a pretty heavy subjective setting so moved it in my
configuration layer and documented it in a readme for this
layer
This commit is contained in:
syl20bnr 2014-09-25 22:12:40 -04:00
parent c1095ba501
commit 90c6c16da0
5 changed files with 44 additions and 46 deletions

View File

@ -25,7 +25,7 @@
- [Configuration layers](#configuration-layers)
- [Contributions](#contributions)
- [Main principles](#main-principles)
- [UI and syntax highlighting](#ui-and-syntax-highlighting)
- [UI tweaks](#ui-tweaks)
- [Commands](#commands)
- [Return to normal mode](#return-to-normal-mode)
- [Executing Vim and Emacs commands](#executing-vim-and-emacs-commands)
@ -99,7 +99,6 @@ to load.
## Screenshots
![src_startup](https://raw.githubusercontent.com/syl20bnr/spacemacs/master/doc/spacemacs_startup.png)
![scr_python](https://raw.githubusercontent.com/syl20bnr/spacemacs/master/doc/spacemacs.png)
*Note: Even though screenshots are updated frequently, `Spacemacs` is evolving
quickly and the screenshots may not reflect exactly the current state of the
@ -167,7 +166,7 @@ few examples:
- Save all opened buffers: `<SPC> f S`
- Open (switch) to a buffer with `helm`: `<SPC> b s`
## UI and syntax highlighting
## UI tweaks
`Spacemacs` has a minimalistic and distraction free UI with a lot of subtle
customizations which make it unique compared to other Emacs kits:
@ -179,11 +178,6 @@ customizations which make it unique compared to other Emacs kits:
- custom fringe bitmaps for [git gutter][git-gutter].
- dedicated startup page with a mode aimed at easily managing `Spacemacs`
`Spacemacs` syntax highlighting is also different from the majority of other
Emacs configurations: instead of colorized keywords, `Spacemacs` has *colorized
variables and functions* using the [rainbow identifiers][rainbow-identifiers]
mode. Each variable and function has a unique color associated to it.
## Commands
Every sequences must be performed in `normal` mode.
@ -834,4 +828,3 @@ Send code to inferior process commands:
[monokai-theme]: https://github.com/oneKelvinSmith/monokai-emacs
[zenburn-theme]: https://github.com/bbatsov/zenburn-emacs
[git-gutter]: https://github.com/syohex/emacs-git-gutter-fringe
[rainbow-identifiers]: https://github.com/Fanael/rainbow-identifiers

View File

@ -0,0 +1,18 @@
(defun syl20bnr/tweak-theme-colors (theme)
"Tweak color themes by adjusting rainbow-identifiers colors settings an by
disabling some faces in order to make colored identifiers stand out."
(interactive)
(pcase theme
(`solarized-dark (setq rainbow-identifiers-cie-l*a*b*-saturation 60
rainbow-identifiers-cie-l*a*b*-lightness 50))
(`solarized-light (setq rainbow-identifiers-cie-l*a*b*-saturation 100
rainbow-identifiers-cie-l*a*b*-lightness 40))
(_ (setq rainbow-identifiers-cie-l*a*b*-saturation 80
rainbow-identifiers-cie-l*a*b*-lightness 45)))
;; To make the variables stand out, keyword coloring is disabled
;; (set-face-attribute 'highlight-quoted-symbol nil
;; :foreground nil :slant 'normal :weight 'bold)
(set-face-attribute 'font-lock-function-name-face nil
:foreground nil :slant 'normal :weight 'normal)
(set-face-attribute 'font-lock-keyword-face nil
:foreground nil :slant 'normal :weight 'bold))

View File

@ -1 +1,22 @@
(defvar syl20bnr-packages '())
(defvar syl20bnr-packages
'(
rainbow-identifiers
)
"List of all packages to install and/or initialized. Built-in packages
which require an initialization must be listed explicitly in the list.")
(defun syl20bnr/init-rainbow-identifiers ()
(use-package rainbow-identifiers
:commands rainbow-identifiers-mode
:init
(progn
(setq rainbow-identifiers-choose-face-function 'rainbow-identifiers-cie-l*a*b*-choose-face
rainbow-identifiers-cie-l*a*b*-saturation 100
rainbow-identifiers-cie-l*a*b*-lightness 40
;; override theme faces
rainbow-identifiers-faces-to-override '(highlight-quoted-symbol
font-lock-variable-name-face))
(add-to-hooks 'rainbow-identifiers-mode '(prog-mode-hook
erlang-mode-hook)))
:config
(syl20bnr/tweak-theme-colors 'solarized-light)))

View File

@ -297,24 +297,7 @@ changed to THEME."
'flycheck-color-mode-line-info-face nil
:foreground ml-foreground
:background ml-background
:box (list :line-width 1 :color (face-foreground 'flycheck-fringe-info)))))
(eval-after-load "rainbow-identifiers"
;; adjust saturation and lightness of rainbow-delimiters depending on the
;; current theme
(pcase theme
(`solarized-dark (setq rainbow-identifiers-cie-l*a*b*-saturation 60
rainbow-identifiers-cie-l*a*b*-lightness 50))
(`solarized-light (setq rainbow-identifiers-cie-l*a*b*-saturation 100
rainbow-identifiers-cie-l*a*b*-lightness 40))
(_ (setq rainbow-identifiers-cie-l*a*b*-saturation 80
rainbow-identifiers-cie-l*a*b*-lightness 45))))
;; To make the variables stand out, keyword coloring is disabled
;; (set-face-attribute 'highlight-quoted-symbol nil
;; :foreground nil :slant 'normal :weight 'bold)
(set-face-attribute 'font-lock-function-name-face nil
:foreground nil :slant 'normal :weight 'normal)
(set-face-attribute 'font-lock-keyword-face nil
:foreground nil :slant 'normal :weight 'bold))
:box (list :line-width 1 :color (face-foreground 'flycheck-fringe-info))))))
;; From http://xugx2007.blogspot.ca/2007/06/benjamin-rutts-emacs-c-development-tips.html
(setq compilation-finish-function

View File

@ -91,7 +91,6 @@
;; not working well for now
;; rainbow-blocks
rainbow-delimiters
rainbow-identifiers
rainbow-mode
rcirc
rcirc-color
@ -116,8 +115,7 @@
zenburn-theme
)
"List of all packages to install and/or initialized. Built-in packages
which require an initialization must be listed explicitly in the list."
)
which require an initialization must be listed explicitly in the list.")
;; Initialization of packages
@ -1313,21 +1311,6 @@ which require an initialization must be listed explicitly in the list."
erlang-mode-hook
)))))
(defun spacemacs/init-rainbow-identifiers ()
(use-package rainbow-identifiers
:commands rainbow-identifiers-mode
:init
(progn
(setq rainbow-identifiers-choose-face-function 'rainbow-identifiers-cie-l*a*b*-choose-face
rainbow-identifiers-cie-l*a*b*-saturation 100
rainbow-identifiers-cie-l*a*b*-lightness 40
;; override theme faces
rainbow-identifiers-faces-to-override '(highlight-quoted-symbol
font-lock-variable-name-face))
(add-to-hooks 'rainbow-identifiers-mode '(prog-mode-hook
erlang-mode-hook)))
))
(defun spacemacs/init-rainbow-mode ()
(use-package rainbow-mode
:defer t