]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix theme and X-resource interactions for the cursor face.
authorChong Yidong <cyd@stupidchicken.com>
Tue, 5 Apr 2011 01:21:52 +0000 (21:21 -0400)
committerChong Yidong <cyd@stupidchicken.com>
Tue, 5 Apr 2011 01:21:52 +0000 (21:21 -0400)
* 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
lisp/custom.el
lisp/startup.el

index 8c978e2b33c6ce2570ac7fda57e19c9a2a145d6d..0037d37110e1e3b29c2288269b6b1b3d803abbfc 100644 (file)
@@ -1,3 +1,10 @@
+2011-04-05  Chong Yidong  <cyd@stupidchicken.com>
+
+       * 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  <lekktu@gmail.com>
 
        * help-fns.el (describe-variable): Complete all variables having
index 5b5592698d85058eb060219cf3b7d49f5702dc0b..964d8d9ea4a274997dcd7f4ae2367a838c6db9ab 100644 (file)
@@ -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))))
index d21847782129e9e5de7b7241a8baca396fcf78a0..3285d47f088c969496fad4e4753157c63ab89e73 100644 (file)
@@ -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))