Automatically fix themes that set ansi-term-color-vector to old version

Fixes `face-attribute: Invalid face: unspecified`
This commit is contained in:
Ivan Malison 2015-08-31 01:09:43 -07:00
parent 172e7065ca
commit dc4dd6db74

View File

@ -2119,17 +2119,29 @@ window is active in the perspective."
(setq left-margin-width 0) (setq left-margin-width 0)
(defvar-setq hl-line-mode nil)) (defvar-setq hl-line-mode nil))
(defun imalison:after-load-theme (&rest args)
(when (fboundp 'powerline-reset)
(powerline-reset))
(imalison:restore-ansi-term-color-vector))
(when t (when t
(if (emacs24_4-p) (if (emacs24_4-p)
(advice-add 'load-theme :after #'(lambda (&rest args) (advice-add 'load-theme :after #'imalison:after-load-theme)
(when (fboundp 'powerline-reset)
(powerline-reset))))
(defadvice load-theme (after name activate) (defadvice load-theme (after name activate)
(when (fboundp 'powerline-reset) (imalison:after-load-theme))))
(powerline-reset)))))
(when (file-exists-p custom-after-file) (load custom-after-file)) (when (file-exists-p custom-after-file) (load custom-after-file))
(defvar imalison:ansi-term-color-vector ansi-term-color-vector)
(defun imalison:ansi-term-color-vector-broken? ()
(--some (or (eq it 'unspecified) (not (symbolp it)))
(append ansi-term-color-vector nil)))
(defun imalison:restore-ansi-term-color-vector (&optional force)
(when (or force (imalison:ansi-term-color-vector-broken?))
(setq ansi-term-color-vector imalison:ansi-term-color-vector)))
(defun imalison:appearance (&optional frame) (defun imalison:appearance (&optional frame)
(interactive) (interactive)
(message "called set appearance") (message "called set appearance")