Remove reload-theme-on-new-display-device feature

The intention for this feature was to ensure the theme always looks as
expected even if you were to open a new frame on a different display
device (e.g. open a GUI frame, start the server, then open a tty frame
from it).

It turned out to be buggier than anticipated. The underlying issue is
that solaire-mode is fundamentally incompatible with tty Emacs.
Terminals uses will need to disable it, as there's no good way to
predict what kind of frames a user will open.

TL;DR Avoid opening a TTY frame from a GUI session. If you must, and you
see odd colors, disable solaire-mode.
This commit is contained in:
Henrik Lissner 2019-05-09 21:39:34 -04:00
parent c1b0ae6ac1
commit 17e337a434
No known key found for this signature in database
GPG Key ID: 5F6C0EA160557395

View File

@ -449,11 +449,6 @@ character that looks like a space that `whitespace-mode' won't affect.")
;;
;;; Theme & font
(defvar doom-last-window-system
(if (daemonp) 'daemon initial-window-system)
"The `window-system' of the last frame. If this doesn't match the current
frame's window-system, the theme will be reloaded.")
(defun doom|init-fonts ()
"Loads fonts.
@ -490,29 +485,6 @@ Fonts are specified by `doom-font', `doom-variable-pitch-font',
(let ((doom--prefer-theme-elc t))
(load-theme doom-theme t))))
(defun doom|reload-theme-maybe (_frame)
"Reloads the theme if the display device has changed."
(unless (cl-find doom-last-window-system (frame-list) :key #'framep-on-display)
(setq doom-last-window-system nil)
(doom|reload-theme-in-frame-maybe (selected-frame))))
(defun doom|reload-theme-in-frame-maybe (frame)
"Reloads the theme if the display device has changed.
Getting themes to remain consistent across GUI Emacs, terminal Emacs and daemon
Emacs is hairy. `doom|init-theme' sorts out the initial GUI frame. Attaching
`doom|reload-theme-in-frame-maybe' to `after-make-frame-functions' sorts out
daemon and emacsclient frames.
There will still be issues with simultaneous gui and terminal (emacsclient)
frames, however. There's always `doom/reload-theme' if you need it!"
(when (and doom-theme
(framep frame)
(not (eq doom-last-window-system (framep-on-display frame))))
(with-selected-frame frame
(load-theme doom-theme t))
(setq doom-last-window-system (framep-on-display frame))))
;;
;;; Bootstrap
@ -524,10 +496,6 @@ frames, however. There's always `doom/reload-theme' if you need it!"
(add-to-list 'kill-buffer-query-functions #'doom|protect-fallback-buffer nil 'eq)
(add-hook 'after-change-major-mode-hook #'doom|highlight-non-default-indentation)
;; Reload theme if the display device has changed
(add-hook 'after-make-frame-functions #'doom|reload-theme-in-frame-maybe)
(add-hook 'after-delete-frame-functions #'doom|reload-theme-maybe)
;; Initialize custom switch-{buffer,window,frame} hooks:
;; + `doom-switch-buffer-hook'
;; + `doom-switch-window-hook'