diff lisp/faces.el @ 314:341dac730539 r21-0b55

Import from CVS: tag r21-0b55
author cvs
date Mon, 13 Aug 2007 10:44:22 +0200
parents 70ad99077275
children 19dcec799385
line wrap: on
line diff
--- a/lisp/faces.el	Mon Aug 13 10:43:56 2007 +0200
+++ b/lisp/faces.el	Mon Aug 13 10:44:22 2007 +0200
@@ -1256,6 +1256,39 @@
 	 (setq default-custom-frame-properties
 	       (extract-custom-frame-properties (selected-frame))))))
 
+(defun face-spec-update-all-matching (spec display plist)
+  "Update all entries in the face spec that could match display to
+have the entries from the new plist and return the new spec"
+  (mapcar
+   (lambda (e)
+     (let ((entries (car e))
+	   (options (cadr e))
+	   (match t)
+	   dplist
+	   (new-options plist)
+	   )
+       (unless (eq display t)
+	 (mapc (lambda (arg)
+		 (setq dplist (plist-put dplist (car arg) (cadr arg))))
+	       display))
+       (unless (eq entries t)
+	 (mapc (lambda (arg)
+		 (setq match (and match (eq (cadr arg)
+					    (plist-get
+					      dplist (car arg)
+					      (cadr arg))))))
+	       entries))
+       (if (not match)
+	   e
+	 (while new-options
+	   (setq options
+		 (plist-put options (car new-options) (cadr new-options)))
+	   (setq new-options (cddr new-options)))
+	 (list entries options))))
+   (copy-sequence spec)))
+       
+		    
+
 (defun face-spec-set-match-display (display &optional frame)
   "Return non-nil if DISPLAY matches FRAME.
 DISPLAY is part of a spec such as can be used in `defface'.