doomemacs/modules/ui/doom/config.el

144 lines
4.8 KiB
EmacsLisp
Raw Normal View History

;;; ui/doom/config.el -*- lexical-binding: t; -*-
2017-01-17 00:20:59 -05:00
(defvar +doom-theme 'doom-one
"The color theme to use.")
2017-01-17 00:20:59 -05:00
2017-01-31 05:09:20 -05:00
(defvar +doom-font
(font-spec :family "Fira Mono" :size 12)
"The font currently in use.")
2017-01-17 00:20:59 -05:00
2017-01-31 05:09:20 -05:00
(defvar +doom-variable-pitch-font
2017-05-29 00:58:12 +02:00
(font-spec :family "Fira Sans" :size 12)
2017-01-31 05:09:20 -05:00
"The font currently in use.")
2017-01-17 00:20:59 -05:00
2017-01-31 05:09:20 -05:00
(defvar +doom-unicode-font
(font-spec :family "DejaVu Sans Mono" :size 12)
"Fallback font for unicode glyphs. Is ignored if :feature unicode is active.")
2017-01-17 00:20:59 -05:00
2017-02-03 19:44:14 -05:00
;; Getting themes to remain consistent across GUI Emacs, terminal Emacs and
;; daemon Emacs is hairy.
;;
;; + Running `+doom|init' directly sorts out the initial GUI frame.
;; + Attaching it to `after-make-frame-functions' sorts out daemon Emacs.
;; + Terminal Emacs is a bit of a wildcard.
(defun +doom|init (&optional frame)
"Set the theme and load the font, in that order."
(load-theme +doom-theme t)
2017-01-31 05:09:20 -05:00
(with-demoted-errors "FONT ERROR: %s"
(set-frame-font +doom-font nil (if frame (list frame) t))
2017-01-31 05:09:20 -05:00
;; Fallback to `doom-unicode-font' for Unicode characters
2017-06-08 14:27:06 +02:00
(unless (featurep! :ui unicode)
(when +doom-unicode-font
(set-fontset-font t 'unicode +doom-unicode-font frame)))
2017-01-31 05:09:20 -05:00
;; ...and for variable-pitch mode
(when +doom-variable-pitch-font
(set-face-attribute 'variable-pitch frame :font +doom-variable-pitch-font))))
(defun +doom|init-daemon (frame)
(when (or (daemonp) (not (display-graphic-p)))
(with-selected-frame frame
(run-with-timer 0 nil #'+doom|init))))
(add-hook 'after-make-frame-functions #'+doom|init)
(add-hook 'after-make-frame-functions #'+doom|init-daemon)
2017-01-31 05:09:20 -05:00
2017-02-19 18:52:26 -05:00
;; doom-one: gives Emacs a look inspired by Dark One in Atom.
2017-01-31 05:09:20 -05:00
;; <https://github.com/hlissner/emacs-doom-theme>
2017-06-05 03:12:49 +02:00
(def-package! doom-themes
:demand t
2017-02-03 19:44:14 -05:00
:config
(+doom|init)
;; blink mode-line on errors
(add-hook 'doom-post-init-hook #'doom-themes-visual-bell-config)
2017-05-15 21:00:33 +02:00
;; Add file icons to doom-neotree
(add-hook 'doom-post-init-hook #'doom-themes-neotree-config)
2017-05-15 21:00:33 +02:00
(setq doom-neotree-enable-variable-pitch t
doom-neotree-file-icons 'simple
doom-neotree-line-spacing 2)
(after! neotree
(defun +doom|neotree-fix-popup ()
"Ensure the fringe settings are maintained on popup restore."
(neo-global--when-window
(doom--neotree-no-fringes)))
2017-06-14 21:03:20 +02:00
(add-hook 'doom-popup-mode-hook #'+doom|neotree-fix-popup)))
2017-01-31 05:09:20 -05:00
2017-06-05 03:13:24 +02:00
(def-package! solaire-mode
:commands (solaire-mode turn-on-solaire-mode turn-off-solaire-mode)
:init
(add-hook 'after-change-major-mode-hook #'turn-on-solaire-mode)
(add-hook 'doom-popup-mode-hook #'turn-off-solaire-mode)
:config
(setq solaire-mode-real-buffer-fn #'doom-real-buffer-p)
;; Prevent color glitches when reloading either DOOM or the theme
(defun +doom|reset-solaire-mode (&rest _) (solaire-mode-reset))
(advice-add #'load-theme :after #'+doom|reset-solaire-mode)
(add-hook 'doom-reload-hook #'solaire-mode-reset)
2017-06-05 03:13:24 +02:00
;; Extra modes to activate doom-buffer-mode in
(add-hook! (gist-mode
twittering-mode
mu4e-view-mode
org-tree-slide-mode
+regex-mode)
#'solaire-mode))
(after! hideshow
2017-05-15 21:00:33 +02:00
(defface +doom-folded-face
`((((background dark))
(:inherit font-lock-comment-face :background ,(doom-color 'base0)))
2017-05-15 21:00:33 +02:00
(((background light))
(:inherit font-lock-comment-face :background ,(doom-color 'base3))))
2017-05-15 21:00:33 +02:00
"Face to hightlight `hideshow' overlays."
:group 'doom)
;; Nicer code-folding overlays (with fringe indicators)
2017-01-31 05:09:20 -05:00
(setq hs-set-up-overlay
(lambda (ov)
(when (eq 'code (overlay-get ov 'hs))
2017-05-15 20:20:06 +02:00
(when (featurep 'vimish-fold)
(overlay-put
ov 'before-string
(propertize "" 'display
(list vimish-fold-indication-mode
'empty-line
'vimish-fold-fringe))))
2017-01-31 05:09:20 -05:00
(overlay-put
2017-02-20 00:10:10 -05:00
ov 'display (propertize " [...] " 'face '+doom-folded-face))))))
2017-01-31 05:09:20 -05:00
2017-02-19 18:39:54 -05:00
2017-06-09 00:32:49 +02:00
;; NOTE Adjust these bitmaps if you change `doom-ui-fringe-size'
(after! flycheck
;; because git-gutter is in the left fringe
(setq flycheck-indication-mode 'right-fringe)
;; A non-descript, left-pointing arrow
(fringe-helper-define 'flycheck-fringe-bitmap-double-arrow 'center
"...X...."
"..XX...."
".XXX...."
"XXXX...."
".XXX...."
"..XX...."
"...X...."))
;; subtle diff indicators in the fringe
(after! git-gutter-fringe
;; places the git gutter outside the margins.
(setq-default fringes-outside-margins t)
;; thin fringe bitmaps
(fringe-helper-define 'git-gutter-fr:added '(center repeated)
"XXX.....")
(fringe-helper-define 'git-gutter-fr:modified '(center repeated)
"XXX.....")
(fringe-helper-define 'git-gutter-fr:deleted 'bottom
"X......."
"XX......"
"XXX....."
"XXXX...."))