From 3b2ff876a5b9280a2c634137338cf78cd4ea588c Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Mon, 4 Apr 2011 21:21:52 -0400 Subject: [PATCH] Fix theme and X-resource interactions for the cursor face. * lisp/startup.el (command-line): Save the cursor's theme-face directly, instead of using face-override-spec. * lisp/custom.el (load-theme): Minor optimization in assigning faces. --- lisp/ChangeLog | 7 +++++++ lisp/custom.el | 14 ++++++++++++++ lisp/startup.el | 3 ++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8c978e2b33c..0037d37110e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2011-04-05 Chong Yidong + + * startup.el (command-line): Save the cursor's theme-face + directly, instead of using face-override-spec. + + * custom.el (load-theme): Minor optimization in assigning faces. + 2011-04-04 Juanma Barranquero * help-fns.el (describe-variable): Complete all variables having diff --git a/lisp/custom.el b/lisp/custom.el index 5b5592698d8..964d8d9ea4a 100644 --- a/lisp/custom.el +++ b/lisp/custom.el @@ -1151,6 +1151,20 @@ Return t if THEME was successfully loaded, nil otherwise." (custom-theme-load-confirm hash)) (let ((custom--inhibit-theme-enable t)) (eval-buffer)) + ;; Optimization: if the theme changes the `default' face, put that + ;; entry first. This avoids some `frame-set-background-mode' rigmarole + ;; by assigning the new background immediately. + (let* ((settings (get theme 'theme-settings)) + (tail settings) + found) + (while (and tail (not found)) + (and (eq (nth 0 (car tail)) 'theme-face) + (eq (nth 1 (car tail)) 'default) + (setq found (car tail))) + (setq tail (cdr tail))) + (if found + (put theme 'theme-settings (cons found (delq found settings))))) + ;; Finally, enable the theme. (unless no-enable (enable-theme theme)) t)))) diff --git a/lisp/startup.el b/lisp/startup.el index d2184778212..3285d47f088 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -906,7 +906,8 @@ opening the first frame (e.g. open a connection to an X server).") ;; spec, but mark it as changed outside of Customize. (let ((color (x-get-resource "cursorColor" "CursorColor"))) (when color - (face-spec-set 'cursor `((t (:background ,color)))) + (put 'cursor 'theme-face + `((changed ((t :background ,color))))) (put 'cursor 'face-modified t))))) (frame-initialize)) -- 2.39.2