[Emacs] Set highlight-indent-guides faces automatically
This commit is contained in:
parent
9c2ff311a1
commit
2ce30cfb89
@ -1614,10 +1614,70 @@ https://github.com/alpaker/Fill-Column-Indicator/issues/21 for more details
|
|||||||
(use-package highlight-indent-guides
|
(use-package highlight-indent-guides
|
||||||
:commands highlight-indent-guides-mode
|
:commands highlight-indent-guides-mode
|
||||||
:preface
|
:preface
|
||||||
(add-hook 'prog-mode-hook 'highlight-indent-guides-mode)
|
(progn
|
||||||
|
(use-package hexrgb :demand t)
|
||||||
|
|
||||||
|
(defun imalison:change-hsv-value-by (delta)
|
||||||
|
(lambda (h s v)
|
||||||
|
(list h s (+ v delta))))
|
||||||
|
|
||||||
|
(defun imalison:build-safe-change-hsv-value (delta)
|
||||||
|
(lambda (h s v)
|
||||||
|
(imalison:safe-change-hsv-value
|
||||||
|
h s v delta)))
|
||||||
|
|
||||||
|
(defun imalison:new-hsv-value-safe (value)
|
||||||
|
(or (> value 1) (< value 0)))
|
||||||
|
|
||||||
|
(defun imalison:safe-change-hsv-value (h s v delta)
|
||||||
|
(let ((new-value (+ v delta)))
|
||||||
|
(if (imalison:new-hsv-value-safe new-value)
|
||||||
|
(let ((other-direction (+ v (* delta -2))))
|
||||||
|
(if (imalison:new-hsv-value-safe other-direction)
|
||||||
|
(user-error "delta %s is too large" delta)
|
||||||
|
(list h s other-direction)))
|
||||||
|
(list h s new-value))))
|
||||||
|
|
||||||
|
(defun imalison:modify-hsv (color fn)
|
||||||
|
(hexrgb-rgb-hex-to-rgb-hex
|
||||||
|
(apply 'hexrgb-hsv-to-hex (apply fn (hexrgb-hex-to-hsv color))) 2))
|
||||||
|
|
||||||
|
(defun imalison:modify-hsv-value-by (color delta)
|
||||||
|
(imalison:modify-hsv color (imalison:build-safe-change-hsv-value delta)))
|
||||||
|
|
||||||
|
(defvar imalison:hsv-value-delta .03)
|
||||||
|
|
||||||
|
(defun imalison:set-highlight-indent-guides-faces (&rest args)
|
||||||
|
(interactive)
|
||||||
|
(let ((bg-color (face-background 'default)))
|
||||||
|
(message "bg-color %s" bg-color)
|
||||||
|
(set-face-background 'highlight-indent-guides-odd-face
|
||||||
|
(imalison:modify-hsv
|
||||||
|
bg-color
|
||||||
|
(imalison:build-safe-change-hsv-value
|
||||||
|
(* -1 imalison:hsv-value-delta))))
|
||||||
|
(set-face-background 'highlight-indent-guides-even-face
|
||||||
|
(imalison:modify-hsv
|
||||||
|
bg-color
|
||||||
|
(imalison:build-safe-change-hsv-value
|
||||||
|
imalison:hsv-value-delta)))))
|
||||||
|
|
||||||
|
;; XXX: This hacks around the fact that (face-background 'default) is nil at
|
||||||
|
;; the time of load-theme
|
||||||
|
(defun imalison:set-highlight-indent-guides-faces-load-theme (&rest args)
|
||||||
|
(if (face-background 'default)
|
||||||
|
(imalison:set-highlight-indent-guides-faces)
|
||||||
|
(run-at-time "1 sec" nil 'imalison:set-highlight-indent-guides-faces-load-theme)))
|
||||||
|
|
||||||
|
(advice-add 'load-theme
|
||||||
|
:after 'imalison:set-highlight-indent-guides-faces-load-theme)
|
||||||
|
|
||||||
|
(add-hook 'prog-mode-hook 'highlight-indent-guides-mode))
|
||||||
:config
|
:config
|
||||||
(progn
|
(progn
|
||||||
(setq highlight-indent-guides-method 'fill)))
|
(setq highlight-indent-guides-method 'fill)))
|
||||||
|
|
||||||
|
(setq lexical-binding t)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
* Keybindings
|
* Keybindings
|
||||||
** god-mode
|
** god-mode
|
||||||
@ -4120,9 +4180,11 @@ I have currently disabled key-chord because it may cause typing lag.
|
|||||||
:commands helm-spotify)
|
:commands helm-spotify)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
** jabber
|
** jabber
|
||||||
|
Disabled because it has its own version of hexrgb which might cause conflicts
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(use-package jabber
|
(use-package jabber
|
||||||
:commands jabber-connect
|
:commands jabber-connect
|
||||||
|
:disabled t
|
||||||
:config
|
:config
|
||||||
(progn
|
(progn
|
||||||
(setq jabber-alert-presence-hooks nil)
|
(setq jabber-alert-presence-hooks nil)
|
||||||
|
Loading…
Reference in New Issue
Block a user