doomemacs/modules/ui/doom/autoload/doom.el
Henrik Lissner 4984a548d1
Refactor DOOM init & add new init hooks
+ Add doom-init-hook and doom-post-init-hook to simplify Emacs init
  hooks into less ambiguous ones.
+ Attach former after-init-hook and emacs-startup-hook hooks to new doom
  init hooks.
+ Vastly improves daemon and tty support: preventing incorrect colors
  from bleeding across face class barriers, and into GUI Emacs and vice
  versa, when spawned with emacsclient.
+ Fix persp-mode breaking Emacs daemon, and ensuring that initialization
  is done properly in terminal Emacs (and emacsclient frames).
2017-06-12 00:37:14 +02:00

28 lines
940 B
EmacsLisp

;;; ui/doom/autoload/doom.el -*- lexical-binding: t; -*-
;;;###autoload
(defun +doom/reset-theme ()
"Reset the color theme currently in use."
(interactive)
(let ((theme (or (car-safe custom-enabled-themes) +doom-theme)))
(when theme
(mapc #'disable-theme custom-enabled-themes))
(load "doom-themes-common.el" nil t)
(+doom|init)
(+doom|refresh-bright-buffers)))
;;;###autoload
(defun +doom|restore-bright-buffers (&rest _)
"Restore `doom-buffer-mode' in buffers when `persp-mode' loads a session."
(dolist (buf (persp-buffer-list))
(with-current-buffer buf
(+doom|buffer-mode-on))))
;;;###autoload
(defun +doom|refresh-bright-buffers ()
"Refresh `doom-buffer-mode', in case of graphical glitches."
(dolist (win (window-list))
(when (buffer-local-value 'doom-buffer-mode (window-buffer win))
(with-selected-window win
(doom-buffer-mode -1)
(doom-buffer-mode +1)))))