comparison lisp/faces.el @ 371:cc15677e0335 r21-2b1

Import from CVS: tag r21-2b1
author cvs
date Mon, 13 Aug 2007 11:03:08 +0200
parents a4f53d9b3154
children 6240c7796c7a
comparison
equal deleted inserted replaced
370:bd866891f083 371:cc15677e0335
1207 (reset-face face frame) 1207 (reset-face face frame)
1208 (face-display-set face spec frame) 1208 (face-display-set face spec frame)
1209 (init-face-from-resources face frame)) 1209 (init-face-from-resources face frame))
1210 (let ((frames (relevant-custom-frames))) 1210 (let ((frames (relevant-custom-frames)))
1211 (reset-face face) 1211 (reset-face face)
1212 (if (and (eq 'default face) (featurep 'x))
1213 (x-init-global-faces))
1214 (face-display-set face spec) 1212 (face-display-set face spec)
1215 (while frames 1213 (while frames
1216 (face-display-set face spec (car frames)) 1214 (face-display-set face spec (car frames))
1217 (pop frames)) 1215 (pop frames))
1218 (init-face-from-resources face)))) 1216 (init-face-from-resources face))))
1233 (put face 'custom-face-display display)) 1231 (put face 'custom-face-display display))
1234 (setq spec nil))))) 1232 (setq spec nil)))))
1235 1233
1236 (defvar default-custom-frame-properties nil 1234 (defvar default-custom-frame-properties nil
1237 "The frame properties used for the global faces. 1235 "The frame properties used for the global faces.
1238 Frames not matching these properties should have frame local faces. 1236 Frames not matching these propertiess should have frame local faces.
1239 The value should be nil, if uninitialized, or a plist otherwise. 1237 The value should be nil, if uninitialized, or a plist otherwise.
1240 See `defface' for a list of valid keys and values for the plist.") 1238 See `defface' for a list of valid keys and values for the plist.")
1241 1239
1242 (defun get-custom-frame-properties (&optional frame) 1240 (defun get-custom-frame-properties (&optional frame)
1243 "Return a plist with the frame properties of FRAME used by custom. 1241 "Return a plist with the frame properties of FRAME used by custom.
1249 ;; Oh well, get it then. 1247 ;; Oh well, get it then.
1250 (setq cache (extract-custom-frame-properties frame)) 1248 (setq cache (extract-custom-frame-properties frame))
1251 ;; and cache it... 1249 ;; and cache it...
1252 (set-frame-property frame 'custom-properties cache)) 1250 (set-frame-property frame 'custom-properties cache))
1253 cache)) 1251 cache))
1254 (default-custom-frame-properties) 1252 ;; We avoid this cache, because various frame and device
1253 ;; properties can change.
1254 ;;(default-custom-frame-properties)
1255 (t 1255 (t
1256 (setq default-custom-frame-properties 1256 (setq default-custom-frame-properties
1257 (extract-custom-frame-properties (selected-frame)))))) 1257 (extract-custom-frame-properties (selected-frame))))))
1258
1259 (defun face-spec-update-all-matching (spec display plist)
1260 "Update all entries in the face spec that could match display to
1261 have the entries from the new plist and return the new spec"
1262 (mapcar
1263 (lambda (e)
1264 (let ((entries (car e))
1265 (options (cadr e))
1266 (match t)
1267 dplist
1268 (new-options plist)
1269 )
1270 (unless (eq display t)
1271 (mapc (lambda (arg)
1272 (setq dplist (plist-put dplist (car arg) (cadr arg))))
1273 display))
1274 (unless (eq entries t)
1275 (mapc (lambda (arg)
1276 (setq match (and match (eq (cadr arg)
1277 (plist-get
1278 dplist (car arg)
1279 (cadr arg))))))
1280 entries))
1281 (if (not match)
1282 e
1283 (while new-options
1284 (setq options
1285 (plist-put options (car new-options) (cadr new-options)))
1286 (setq new-options (cddr new-options)))
1287 (list entries options))))
1288 (copy-sequence spec)))
1289
1290
1291 1258
1292 (defun face-spec-set-match-display (display &optional frame) 1259 (defun face-spec-set-match-display (display &optional frame)
1293 "Return non-nil if DISPLAY matches FRAME. 1260 "Return non-nil if DISPLAY matches FRAME.
1294 DISPLAY is part of a spec such as can be used in `defface'. 1261 DISPLAY is part of a spec such as can be used in `defface'.
1295 If FRAME is nil or omitted, the selected frame is used." 1262 If FRAME is nil or omitted, the selected frame is used."