(defun load-theme-buffer-local (theme) (interactive (list (intern (completing-read "Load custom theme: " (mapcar 'symbol-name (custom-available-themes)))))) (require 'cl) ;; load the theme; but don't enable it (load-theme theme t t) (loop for (theme-face face-name theme spec) in (get theme 'theme-settings) ;; ,---- ;; | (custom-theme-set-variables ;; | 'tango ;; | `(ansi-color-names-vector [,alum-6 ,red-3 ,cham-3 ,butter-3 ;; | ,blue-3 ,plum-3 ,blue-1 ,alum-1])) ;; `---- when (listp spec) ; FIXME: tango-theme.el has ; the above form which is not ; a face spec. Use this test ; as to guard against an error ; when tango-theme is loaded. collecting (cons face-name (face-spec-choose spec)) into remapping-alist finally (set (make-local-variable 'face-remapping-alist) remapping-alist)))