• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10/emacs-93/emacs/lisp/

Lines Matching +defs:face +defs:or +defs:list

11 ;; GNU Emacs is free software; you can redistribute it and/or modify
13 ;; the Free Software Foundation; either version 2, or (at your option)
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
43 "Influencing face font selection."
47 (defcustom face-font-selection-order
49 "*A list specifying how face font selection chooses fonts.
51 must appear once in the list, and the list must not contain any other
53 those face attributes first that appear first in the list. For
58 :type '(list symbol symbol symbol symbol)
66 (defcustom face-font-family-alternatives
82 (defcustom face-font-registry-alternatives
114 (defun face-list ()
115 "Return a list of all defined face names."
116 (mapcar #'car face-new-frame-defaults))
121 (defun make-face (face &optional no-init-from-resources)
122 "Define a new face with name FACE, a symbol.
125 in the global variable `face-x-resources'.) If FACE is already known
126 as a face, leave it unmodified. Value is FACE."
127 (interactive "SMake face: ")
128 (unless (facep face)
130 (dolist (frame (frame-list))
131 (internal-make-lisp-face face frame))
132 ;; Add the face to the face menu.
133 (when (fboundp 'facemenu-add-new-face)
134 (facemenu-add-new-face face))
137 (make-face-x-resource-internal face)))
138 face)
141 (defun make-empty-face (face)
142 "Define a new, empty face with name FACE.
143 If the face already exists, it is left unmodified. Value is FACE."
144 (interactive "SMake empty face: ")
145 (make-face face 'no-init-from-resources))
148 (defun copy-face (old-face new-face &optional frame new-frame)
149 "Define a face just like OLD-FACE, with name NEW-FACE.
151 If NEW-FACE already exists as a face, it is modified to be like
162 copy the information from face OLD-FACE on frame FRAME
167 (dolist (frame (frame-list))
168 (copy-face old-face new-face frame))
169 (copy-face old-face new-face t))
170 (internal-copy-lisp-face old-face new-face frame new-frame))
171 new-face))
182 ;; private to the face implementation.
184 (defun internal-find-face (name &optional frame)
185 "Retrieve the face named NAME.
186 Return nil if there is no such face.
187 If NAME is already a face, it is simply returned.
190 (make-obsolete 'internal-find-face 'facep "21.1")
193 (defun internal-get-face (name &optional frame)
194 "Retrieve the face named NAME; error if there is none.
195 If NAME is already a face, it is simply returned.
197 (or (facep name)
198 (check-face name)))
199 (make-obsolete 'internal-get-face "see `facep' and `check-face'." "21.1")
207 (defun facep (face)
208 "Return non-nil if FACE is a face name or internal face object.
209 Return nil otherwise. A face name can be a string or a symbol.
210 An internal face object is a vector of the kind used internally
211 to record face data."
212 (internal-lisp-face-p face))
215 (defun check-face (face)
216 "Signal an error if FACE doesn't name a face.
218 (unless (facep face)
219 (error "Not a face: %s" face))
220 face)
227 (defun face-id (face &optional frame)
228 "Return the internal ID of face with name FACE.
229 The optional argument FRAME is ignored, since the internal face ID
230 of a face name is the same for all frames."
231 (check-face face)
232 (get face 'face))
235 (defun face-equal (face1 face2 &optional frame)
240 If FRAME is omitted or nil, use the selected frame."
241 (internal-lisp-face-equal-p face1 face2 frame))
244 (defun face-differs-from-default-p (face &optional frame)
245 "Return non-nil if FACE displays differently from the default face.
246 If the optional argument FRAME is given, report on face FACE in that frame.
247 If FRAME is t, report on the defaults for face FACE (for new frames).
248 If FRAME is omitted or nil, use the selected frame."
256 (attr-val (face-attribute face attr frame t)))
259 (display-supports-face-attributes-p (list attr attr-val)
265 (defun face-nontrivial-p (face &optional frame)
266 "True if face FACE has some non-nil attribute.
267 If the optional argument FRAME is given, report on face FACE in that frame.
268 If FRAME is t, report on the defaults for face FACE (for new frames).
269 If FRAME is omitted or nil, use the selected frame."
270 (not (internal-lisp-face-empty-p face frame)))
276 ;;; Setting face attributes from X resources.
279 (defcustom face-x-resources
299 "*List of X resources and classes for face attributes.
301 the name of a face attribute, and each ENTRY is a cons of the form
308 (defun set-face-attribute-from-resource (face attribute resource class frame)
310 Value is the attribute value specified by the resource, or nil
313 (let* ((face-name (face-name face))
314 (value (internal-face-x-get-resource (concat face-name resource)
318 (internal-set-lisp-face-attribute-from-resource
319 face attribute (downcase value) frame)
322 face-name frame attribute value))))
326 (defun set-face-attributes-from-resources (face frame)
329 (dolist (definition face-x-resources)
332 (set-face-attribute-from-resource face attribute (car entry)
336 (defun make-face-x-resource-internal (face &optional frame)
338 FRAME nil or not specified means do it for all frames."
340 (dolist (frame (frame-list))
341 (set-face-attributes-from-resources face frame))
342 (set-face-attributes-from-resources face frame)))
348 ;;; Retrieving face attributes.
351 (defun face-name (face)
352 "Return the name of face FACE."
353 (symbol-name (check-face face)))
356 (defun face-attribute (face attribute &optional frame inherit)
358 If the optional argument FRAME is given, report on face FACE in that frame.
359 If FRAME is t, report on the defaults for face FACE (for new frames).
360 If FRAME is omitted or nil, use the selected frame.
363 so the return value may be `unspecified', or a relative value.
366 may still be `unspecified' or relative.
367 If INHERIT is a face or a list of faces, then the result is further merged
368 with that face (or faces), until it becomes specified and absolute.
371 value of `default' for INHERIT; this will resolve any unspecified or
372 relative values by merging with the `default' face (which is always
374 (let ((value (internal-get-lisp-face-attribute face attribute frame)))
375 (when (and inherit (face-attribute-relative-p attribute value))
377 (let ((inh-from (face-attribute face :inherit frame)))
378 (unless (or (null inh-from) (eq inh-from 'unspecified))
381 (face-attribute-merged-with attribute value inh-from frame))
386 (face-attribute-relative-p attribute value))
388 (setq value (face-attribute-merged-with attribute value inherit frame)))
391 (defun face-attribute-merged-with (attribute value faces &optional frame)
393 FACES may be either a single face or a list of faces.
395 (cond ((not (face-attribute-relative-p attribute value))
400 (face-attribute-merged-with
402 (face-attribute-merged-with attribute value (car faces) frame)
406 (merge-face-attribute attribute
408 (face-attribute faces attribute frame t)))))
411 (defmacro face-attribute-specified-or (value &rest body)
419 (defun face-foreground (face &optional frame inherit)
420 "Return the foreground color name of FACE, or nil if unspecified.
421 If the optional argument FRAME is given, report on face FACE in that frame.
422 If FRAME is t, report on the defaults for face FACE (for new frames).
423 If FRAME is omitted or nil, use the selected frame.
430 If INHERIT is a face or a list of faces, then it is used to try to
435 merging with the `default' face (which is always completely specified)."
436 (face-attribute-specified-or (face-attribute face :foreground frame inherit)
439 (defun face-background (face &optional frame inherit)
440 "Return the background color name of FACE, or nil if unspecified.
441 If the optional argument FRAME is given, report on face FACE in that frame.
442 If FRAME is t, report on the defaults for face FACE (for new frames).
443 If FRAME is omitted or nil, use the selected frame.
450 If INHERIT is a face or a list of faces, then it is used to try to
455 merging with the `default' face (which is always completely specified)."
456 (face-attribute-specified-or (face-attribute face :background frame inherit)
459 (defun face-stipple (face &optional frame inherit)
460 "Return the stipple pixmap name of FACE, or nil if unspecified.
461 If the optional argument FRAME is given, report on face FACE in that frame.
462 If FRAME is t, report on the defaults for face FACE (for new frames).
463 If FRAME is omitted or nil, use the selected frame.
470 If INHERIT is a face or a list of faces, then it is used to try to
473 To ensure that a valid stipple or nil is always returned, use a value of
475 with the `default' face (which is always completely specified)."
476 (face-attribute-specified-or (face-attribute face :stipple frame inherit)
480 (defalias 'face-background-pixmap 'face-stipple)
483 (defun face-underline-p (face &optional frame)
485 If the optional argument FRAME is given, report on face FACE in that frame.
486 If FRAME is t, report on the defaults for face FACE (for new frames).
487 If FRAME is omitted or nil, use the selected frame."
488 (eq (face-attribute face :underline frame) t))
491 (defun face-inverse-video-p (face &optional frame)
493 If the optional argument FRAME is given, report on face FACE in that frame.
494 If FRAME is t, report on the defaults for face FACE (for new frames).
495 If FRAME is omitted or nil, use the selected frame."
496 (eq (face-attribute face :inverse-video frame) t))
499 (defun face-bold-p (face &optional frame)
501 If the optional argument FRAME is given, report on face FACE in that frame.
502 If FRAME is t, report on the defaults for face FACE (for new frames).
503 If FRAME is omitted or nil, use the selected frame.
504 Use `face-attribute' for finer control."
505 (let ((bold (face-attribute face :weight frame)))
509 (defun face-italic-p (face &optional frame)
511 If the optional argument FRAME is given, report on face FACE in that frame.
512 If FRAME is t, report on the defaults for face FACE (for new frames).
513 If FRAME is omitted or nil, use the selected frame.
514 Use `face-attribute' for finer control."
515 (let ((italic (face-attribute face :slant frame)))
525 (defun face-documentation (face)
527 If FACE is a face-alias, get the documentation for the target face."
528 (let ((alias (get face 'face-alias))
532 (setq doc (get alias 'face-documentation))
533 (format "%s is an alias for the face `%s'.%s" face alias
536 (get face 'face-documentation))))
539 (defun set-face-documentation (face string)
542 (put face 'face-documentation (purecopy string)))
545 (defalias 'face-doc-string 'face-documentation)
546 (defalias 'set-face-doc-string 'set-face-documentation)
552 ;; Setting face attributes.
556 (defvar inhibit-face-set-after-frame-default nil
557 "If non-nil, that tells `face-set-after-frame-default' to do nothing.")
559 (defun set-face-attribute (face frame &rest args)
567 face attribute name. All attributes can be set to `unspecified';
575 or a fontset alias name. If a font family is specified, wild-cards `*'
583 `extra-expanded', or `ultra-expanded'.
589 scale any underlying face, or a function, which is called with the old
590 height (from the underlying face), and should return the new height.
601 symbols `italic', `oblique', `normal', `reverse-italic', or
611 VALUE is t, underline with foreground color of the face. If VALUE is
618 VALUE is t, overline with foreground color of the face. If VALUE is a
626 face. If VALUE is a string, strike-through with that color. If VALUE
634 of the face. If VALUE is a string, the string must be a color name,
636 VALUE must be a property list of the form `(:line-width WIDTH
638 the property list, a default value will be used for the value, as
643 the foreground color of the face for simple boxes, and the background
644 color of the face for 3D boxes. STYLE specifies whether a 3D box
648 the property list doesn't contain a style specification, draw a 2D
654 inverse video. VALUE must be one of t or nil.
660 searched. Alternatively, VALUE may be a list of the form (WIDTH
670 Set font-related face attributes from VALUE. VALUE must be a valid
675 be used to specify that a bold or italic font should be used. VALUE
676 must be t or nil in that case. A value of `unspecified' is not allowed.
680 VALUE is the name of a face from which to inherit attributes, or a list
681 of face names. Attributes from inherited faces are merged into the face
682 like an underlying face would be, with higher priority than underlying faces."
685 ;; If we set the new-frame defaults, this face is modified outside Custom.
687 (put (or (get face 'face-alias) face) 'face-modified t))
691 (let ((inhibit-face-set-after-frame-default t))
692 (internal-set-lisp-face-attribute face (car args)
698 (defun make-face-bold (face &optional frame noerror)
700 FRAME nil or not specified means change face on all frames.
702 Use `set-face-attribute' for finer control of the font weight."
703 (interactive (list (read-face-name "Make which face bold")))
704 (set-face-attribute face frame :weight 'bold))
707 (defun make-face-unbold (face &optional frame noerror)
709 FRAME nil or not specified means change face on all frames.
711 (interactive (list (read-face-name "Make which face non-bold")))
712 (set-face-attribute face frame :weight 'normal))
715 (defun make-face-italic (face &optional frame noerror)
717 FRAME nil or not specified means change face on all frames.
719 Use `set-face-attribute' for finer control of the font slant."
720 (interactive (list (read-face-name "Make which face italic")))
721 (set-face-attribute face frame :slant 'italic))
724 (defun make-face-unitalic (face &optional frame noerror)
726 FRAME nil or not specified means change face on all frames.
728 (interactive (list (read-face-name "Make which face non-italic")))
729 (set-face-attribute face frame :slant 'normal))
732 (defun make-face-bold-italic (face &optional frame noerror)
734 FRAME nil or not specified means change face on all frames.
736 Use `set-face-attribute' for finer control of font weight and slant."
737 (interactive (list (read-face-name "Make which face bold-italic")))
738 (set-face-attribute face frame :weight 'bold :slant 'italic))
741 (defun set-face-font (face font &optional frame)
743 FRAME nil or not specified means change face on all frames.
745 and `:slant'. When called interactively, prompt for the face and font."
746 (interactive (read-face-and-attribute :font))
747 (set-face-attribute face frame :font font))
751 ;; stipple pattern is now part of the face realization process, and is
752 ;; done in C depending on the frame on which the face is realized.
754 (defun set-face-background (face color &optional frame)
755 "Change the background color of face FACE to COLOR (a string).
756 FRAME nil or not specified means change face on all frames.
757 COLOR can be a system-defined color name (see `list-colors-display')
758 or a hex spec of the form #RRGGBB.
759 When called interactively, prompts for the face and color."
760 (interactive (read-face-and-attribute :background))
761 (set-face-attribute face frame :background (or color 'unspecified)))
764 (defun set-face-foreground (face color &optional frame)
765 "Change the foreground color of face FACE to COLOR (a string).
766 FRAME nil or not specified means change face on all frames.
767 COLOR can be a system-defined color name (see `list-colors-display')
768 or a hex spec of the form #RRGGBB.
769 When called interactively, prompts for the face and color."
770 (interactive (read-face-and-attribute :foreground))
771 (set-face-attribute face frame :foreground (or color 'unspecified)))
774 (defun set-face-stipple (face stipple &optional frame)
775 "Change the stipple pixmap of face FACE to STIPPLE.
776 FRAME nil or not specified means change face on all frames.
780 Alternatively, STIPPLE may be a list of the form (WIDTH HEIGHT DATA)
783 (interactive (read-face-and-attribute :stipple))
784 (set-face-attribute face frame :stipple (or stipple 'unspecified)))
787 (defun set-face-underline-p (face underline &optional frame)
788 "Specify whether face FACE is underlined.
793 FRAME nil or not specified means change face on all frames.
794 Use `set-face-attribute' to ``unspecify'' underlining."
796 (let ((list (read-face-and-attribute :underline)))
797 (list (car list) (eq (car (cdr list)) t))))
798 (set-face-attribute face frame :underline underline))
800 (define-obsolete-function-alias 'set-face-underline
801 'set-face-underline-p "22.1")
804 (defun set-face-inverse-video-p (face inverse-video-p &optional frame)
805 "Specify whether face FACE is in inverse video.
808 FRAME nil or not specified means change face on all frames.
809 Use `set-face-attribute' to ``unspecify'' the inverse video attribute."
811 (let ((list (read-face-and-attribute :inverse-video)))
812 (list (car list) (eq (car (cdr list)) t))))
813 (set-face-attribute face frame :inverse-video inverse-video-p))
816 (defun set-face-bold-p (face bold-p &optional frame)
817 "Specify whether face FACE is bold.
820 FRAME nil or not specified means change face on all frames.
821 Use `set-face-attribute' or `modify-face' for finer control."
823 (make-face-unbold face frame)
824 (make-face-bold face frame)))
827 (defun set-face-italic-p (face italic-p &optional frame)
828 "Specify whether face FACE is italic.
831 FRAME nil or not specified means change face on all frames.
832 Use `set-face-attribute' or `modify-face' for finer control."
834 (make-face-unitalic face frame)
835 (make-face-italic face frame)))
838 (defalias 'set-face-background-pixmap 'set-face-stipple)
841 (defun invert-face (face &optional frame)
843 If FRAME is omitted or nil, it means change face on all frames.
846 of the default face. Value is FACE."
847 (interactive (list (read-face-name "Invert face")))
848 (let ((fg (face-attribute face :foreground frame))
849 (bg (face-attribute face :background frame)))
851 (set-face-attribute face frame :foreground bg :background fg)
852 (set-face-attribute face frame
854 (face-attribute 'default :background frame)
856 (face-attribute 'default :foreground frame))))
857 face)
865 (defun read-face-name (prompt &optional string-describing-default multiple)
866 "Read a face, defaulting to the face or faces on the char after point.
867 If it has the property `read-face-name', that overrides the `face' property.
868 PROMPT should be a string that describes what the caller will do with the face;
872 If MULTIPLE is non-nil, return a list of faces (possibly only one).
873 Otherwise, return a single face."
874 (let ((faceprop (or (get-char-property (point) 'read-face-name)
875 (get-char-property (point) 'face)))
879 ;; Try to get a face name from the buffer.
880 (if (memq (intern-soft (thing-at-point 'symbol)) (face-list))
881 (setq faces (list (intern-soft (thing-at-point 'symbol)))))
882 ;; Add the named faces that the `face' property uses.
884 ;; Don't treat an attribute spec as a list of faces.
897 (if (get s 'face-alias)
905 (setq faces (list (car faces)))))
910 (if (or faces string-describing-default)
920 (cond ((or (equal input "") (equal input '("")))
927 ;; Return either a list of faces or just one face.
933 (defun face-valid-attribute-values (attribute &optional frame)
934 "Return valid values for face attribute ATTRIBUTE.
936 and colors. If it is nil or not specified, the selected frame is
945 (x-font-family-list))
947 (list (cons "default" "default"))))
950 (internal-lisp-face-attribute-values attribute)))
954 (internal-lisp-face-attribute-values attribute))
958 (internal-lisp-face-attribute-values attribute))))
966 (mapcar #'list
976 (face-list))))
980 (nconc (list (cons "unspecified" 'unspecified)) valid)
984 (defvar face-attribute-name-alist
999 "An alist of descriptive names for face attributes.
1001 ATTRIBUTE-NAME is a face attribute name (a keyword symbol), and
1005 (defun face-descriptive-attribute-name (attribute)
1007 (cdr (assq attribute face-attribute-name-alist)))
1010 (defun face-read-string (face default name &optional completion-alist)
1011 "Interactively read a face attribute string value.
1012 FACE is the face whose attribute is read. If non-nil, DEFAULT is the
1025 (format "%s for face `%s' (default %s): "
1026 name face default)
1027 (format "%s for face `%s': " name face))
1032 (defun face-read-integer (face default name)
1033 "Interactively read an integer face attribute value.
1034 FACE is the face whose attribute is read. DEFAULT is the default
1038 (face-read-string face
1041 (list (cons "unspecified" 'unspecified)))))
1050 (defun read-face-attribute (face attribute &optional frame)
1052 Optional argument FRAME nil or unspecified means read an attribute value
1053 of a global face. Value is the new attribute value."
1054 (let* ((old-value (face-attribute face attribute frame))
1055 (attribute-name (face-descriptive-attribute-name attribute))
1056 (valid (face-valid-attribute-values attribute frame))
1060 ;; a list `(:width WIDTH :color COLOR)' or `(:width WIDTH :shadow
1062 (when (and (or (eq attribute :stipple)
1064 (or (consp old-value)
1069 (or (car (rassoc old-value valid))
1072 (face-read-string face default attribute-name valid))
1091 (setq new-value (face-read-integer face old-value attribute-name)))
1093 ;; Convert stipple and box value text we read back to a list or
1096 (when (and (or (eq attribute :stipple)
1104 (defun read-face-font (face &optional frame)
1106 If optional argument FRAME is nil or omitted, use the selected frame."
1108 (completing-read (format "Set font attributes of face `%s' from font: " face)
1109 (x-list-fonts "*" nil frame))))
1112 (defun read-all-face-attributes (face &optional frame)
1114 If optional argument FRAME is nil or omitted, use the selected frame.
1115 Value is a property list of attribute names and new values."
1117 (dolist (attribute face-attribute-name-alist result)
1119 (cons (read-face-attribute face (car attribute) frame)
1122 (defun modify-face (&optional face foreground background stipple
1125 If optional argument FRAME is nil or omitted, modify the face used
1126 for newly created frame, i.e. the global face.
1127 For non-interactive use, `set-face-attribute' is preferred.
1129 and the face and its settings are obtained by querying the user."
1131 (if face
1132 (set-face-attribute face frame
1133 :foreground (or foreground 'unspecified)
1134 :background (or background 'unspecified)
1140 (setq face (read-face-name "Modify face"))
1141 (apply #'set-face-attribute face frame
1142 (read-all-face-attributes face frame))))
1144 (defun read-face-and-attribute (attribute &optional frame)
1145 "Read face name and face attribute value.
1147 FRAME nil or unspecified means read attribute value of global face.
1148 Value is a list (FACE NEW-VALUE) where FACE is the face read
1151 (let* ((prompt "Set font-related attributes of face")
1152 (face (read-face-name prompt))
1153 (font (read-face-font face frame)))
1154 (list face font)))
1156 (let* ((attribute-name (face-descriptive-attribute-name attribute))
1157 (prompt (format "Set %s of face" attribute-name))
1158 (face (read-face-name prompt))
1159 (new-value (read-face-attribute face attribute frame)))
1160 (list face new-value)))))
1169 (defvar list-faces-sample-text
1171 "*Text string to display as the sample text for `list-faces-display'.")
1174 ;; The name list-faces would be more consistent, but let's avoid a
1178 (defun list-faces-display (&optional regexp)
1181 `list-faces-sample-text'.
1183 If REGEXP is non-nil, list only those faces with names matching
1186 (interactive (list (and current-prefix-arg
1192 disp-frame window face-name)
1198 (when (or all-faces (string-match regexp s))
1201 (sort (face-list) #'string-lessp))))
1214 (if (display-mouse-p) "\\[help-follow-mouse] or ")
1215 "\\[help-follow] on a face name to customize it\n"
1216 "or on its sample text for a description of the face.\n\n")))
1218 (dolist (face faces)
1219 (setq face-name (symbol-name face))
1220 (insert (format line-format face-name))
1221 ;; Hyperlink to a customization buffer for the face. Using
1225 (search-backward face-name)
1226 (setq help-xref-stack-item `(list-faces-display ,regexp))
1227 (help-xref-button 0 'help-customize-face face)))
1230 (insert list-faces-sample-text)
1231 ;; Hyperlink to a help buffer for the face.
1234 (search-backward list-faces-sample-text)
1235 (help-xref-button 0 'help-face face)))
1237 (put-text-property beg (1- (point)) 'face face)
1238 ;; Make all face commands default to the proper face
1240 (put-text-property line-beg (1- (point)) 'read-face-name face)
1250 ;; copy all the face definitions from FRAME,
1254 (car (frame-list))))
1255 (or (eq frame disp-frame)
1256 (let ((faces (face-list)))
1258 (copy-face (car faces) (car faces) frame disp-frame)
1262 (defun describe-face (face &optional frame)
1263 "Display the properties of face FACE on FRAME.
1267 If the optional argument FRAME is given, report on face FACE in that frame.
1268 If FRAME is t, report on the defaults for face FACE (for new frames).
1269 If FRAME is omitted or nil, use the selected frame."
1270 (interactive (list (read-face-name "Describe face" "= `default' face" t)))
1284 (:font . "Font or fontset")
1288 (help-setup-xref (list #'describe-face face) (interactive-p))
1289 (unless face
1290 (setq face 'default))
1291 (if (not (listp face))
1292 (setq face (list face)))
1296 (dolist (f face)
1299 (insert " undefined face.\n")
1300 (let ((customize-label "customize this face")
1302 (insert (concat " (" (propertize "sample" 'font-lock-face f) ")"))
1305 (or (face-documentation f)
1306 "Not documented as a face.")
1312 (help-xref-button 1 'help-customize-face f)))
1324 (help-xref-button 1 'help-face-def f file-name))
1329 (let ((attr (face-attribute f (car a) frame)))
1334 ;; Make a hyperlink to the parent face.
1337 (help-xref-button 1 'help-face attr)))
1349 ;; face implementation.
1351 (defun face-attr-construct (face &optional frame)
1352 "Return a `defface'-style attribute list for FACE on FRAME.
1353 Value is a property list of pairs ATTRIBUTE VALUE for all specified
1354 face attributes of FACE where ATTRIBUTE is the attribute name and
1357 (dolist (entry face-attribute-name-alist result)
1359 (value (face-attribute face attribute)))
1361 (setq result (nconc (list attribute value) result)))))))
1364 (defun face-spec-set-match-display (display frame)
1381 (or (memq window-system options)
1408 (display-supports-face-attributes-p options frame))
1414 (defun face-spec-choose (spec &optional frame)
1429 ;; Old-style entry, the attribute list is the
1439 (when (face-spec-set-match-display display frame)
1445 (defun face-spec-reset-face (face &optional frame)
1447 (let ((attrs face-attribute-name-alist))
1450 (set-face-attribute face frame (car attr-and-name) 'unspecified))
1454 (defun face-spec-set (face spec &optional frame)
1456 FRAME is the frame whose frame-local face is set. FRAME nil means
1459 (let ((attrs (face-spec-choose spec frame)))
1461 (face-spec-reset-face face frame))
1470 ;; Compatibility with 20.x. Some bogus face specs seem to
1473 (t (unless (assq attribute face-x-resources)
1476 (set-face-attribute face frame attribute value)))
1478 ;; When we reset the face based on its spec, then it is unmodified
1481 (put (or (get face 'face-alias) face) 'face-modified nil)))
1484 (defun face-attr-match-p (face attrs &optional frame)
1487 is used. If nil or omitted, use the selected frame."
1490 (let ((list face-attribute-name-alist)
1492 (while (and match (not (null list)))
1493 (let* ((attr (car (car list)))
1498 (value-now (face-attribute face attr frame)))
1500 (setq list (cdr list))))
1503 (defun face-spec-match-p (face spec &optional frame)
1505 (face-attr-match-p face (face-spec-choose spec frame) frame))
1507 (defsubst face-default-spec (face)
1508 "Return the default face-spec for FACE, ignoring any user customization.
1510 (get face 'face-defface-spec))
1512 (defsubst face-user-default-spec (face)
1513 "Return the user's customized face-spec for FACE, or the default if none.
1515 (or (get face 'customized-face)
1516 (get face 'saved-face)
1517 (face-default-spec face)))
1527 "Return a list of colors supported for a particular frame.
1532 (if (memq (framep (or frame (selected-frame))) '(x w32 mac))
1539 If FRAME is omitted or nil, use the selected frame.
1540 If COLOR is the symbol `unspecified' or one of the strings
1541 \"unspecified-fg\" or \"unspecified-bg\", the value is nil."
1544 (if (member (framep (or frame (selected-frame))) '(x w32 mac))
1551 The value is a list of integer RGB values--(RED GREEN BLUE).
1552 These values appear to range from 0 to 65280 or 65535, depending
1553 on the system; white is \(65280 65280 65280\) or \(65535 65535 65535\).
1554 If FRAME is omitted or nil, use the selected frame.
1556 If COLOR is the symbol `unspecified' or one of the strings
1557 \"unspecified-fg\" or \"unspecified-bg\", the value is nil."
1560 (if (memq (framep (or frame (selected-frame))) '(x w32 mac))
1568 DISPLAY should be either a frame or a display name (a string).
1569 If omitted or nil, that stands for the selected frame's display."
1593 `light' if your background is light, or nil (automatic by default)
1599 (mapc 'frame-set-background-mode (frame-list)))
1609 mode from `xterm' or a similar terminal emulator, the value is
1627 (or default-frame-background-mode 'dark))
1631 (or default-frame-background-mode 'dark))
1656 ;; Before modifying the frame parameters, we collect a list of
1657 ;; faces that don't match what their face-spec says they should
1659 ;; negative list is used on the assumption that most faces will
1661 (dolist (face (face-list))
1662 (when (not (face-spec-match-p face
1663 (face-user-default-spec face)
1665 (push face locally-modified-faces)))
1668 (list (cons 'background-mode bg-mode)
1670 ;; For all named faces, choose face specs matching the new frame
1672 (dolist (face (face-list))
1673 (unless (memq face locally-modified-faces)
1674 (face-spec-set face (face-user-default-spec face) frame)))))))
1683 "Add geometry parameters for a named frame to parameter list PARAMETERS.
1684 Value is the new parameter list."
1685 (let* ((name (or (cdr (assq 'name parameters))
1693 (when (or (assq 'top parsed)
1705 (when (cdr (or (assq 'reverse parameters)
1716 (list (cons 'foreground-color fg)
1720 (list (cons 'border-color fg))))
1723 (list (cons 'mouse-color fg))))
1726 (list (cons 'cursor-color fg)))))))
1734 or `default-frame-alist' contains a `reverse' parameter, or
1739 (frame-list (frame-list))
1746 (face-set-after-frame-default frame)
1747 (if (or (null frame-list) (null visibility-spec))
1749 (modify-frame-parameters frame (list visibility-spec)))
1755 (defun face-set-after-frame-default (frame)
1756 "Set frame-local faces of FRAME from face specs and resources.
1758 (unless inhibit-face-set-after-frame-default
1759 (if (face-attribute 'default :font t)
1760 (set-face-attribute 'default frame :font
1761 (face-attribute 'default :font t))
1762 (set-face-attribute 'default frame :family
1763 (face-attribute 'default :family t))
1764 (set-face-attribute 'default frame :height
1765 (face-attribute 'default :height t))
1766 (set-face-attribute 'default frame :slant
1767 (face-attribute 'default :slant t))
1768 (set-face-attribute 'default frame :weight
1769 (face-attribute 'default :weight t))
1770 (set-face-attribute 'default frame :width
1771 (face-attribute 'default :width t))))
1773 (let ((face-params '((foreground-color default :foreground)
1781 (dolist (param face-params)
1783 (face (nth 1 param))
1785 (default-value (face-attribute face attr t)))
1786 ;; Compile a list of face attributes to set, but don't set
1787 ;; them yet. The call to make-face-x-resource-internal,
1791 ;; The face spec does not specify a new-frame value for
1795 (push (list face frame attr value) apply-params))
1796 ;; The face spec specifies a value for this attribute, to be
1797 ;; applied to the face on all new frames.
1798 (push (list face frame attr default-value) apply-params))))
1799 ;; Initialize faces from face specs and X resources. The
1802 (dolist (face (delq 'default (face-list)))
1805 (face-spec-set face (face-user-default-spec face) frame)
1807 (make-face-x-resource-internal face frame))
1808 (internal-merge-in-global-face face frame))
1811 ;; rewrites parameters changed by make-face-x-resource-internal
1813 (apply 'set-face-attribute param))))
1817 (when (cdr (or (assq 'reverse parameters)
1823 (list (cons 'foreground-color fg)
1827 (list (cons 'mouse-color fg))))
1830 (list (cons 'cursor-color fg)))))))
1836 `default-frame-alist'. If either PARAMETERS or `default-frame-alist'
1845 (face-set-after-frame-default frame)
1858 (face-set-after-frame-default frame)))
1876 (define-obsolete-function-alias 'frame-update-face-colors
1891 "Basic default face."
1896 "Basic bold face."
1909 "Basic italic face."
1914 "Basic bold-italic face."
1923 "Basic underlined face."
1928 "The basic fixed-pitch face."
1933 "The basic variable-pitch face."
1945 "Basic face for shadowed text."
1959 "Basic face for unvisited links."
1967 "Basic face for visited links."
1983 "Basic face for highlighting."
2000 "Basic face for highlighting the region."
2016 "Basic face for displaying the secondary selection."
2025 "Basic face for highlighting trailing whitespace."
2038 "Face for characters displayed as sequences using `^' or `\\'."
2062 "Basic mode line face for selected window."
2078 "Basic mode line face for non-selected windows."
2088 "Basic mode line face for highlighting."
2101 (put 'modeline 'face-alias 'mode-line)
2102 (put 'modeline-inactive 'face-alias 'mode-line-inactive)
2103 (put 'modeline-highlight 'face-alias 'mode-line-highlight)
2104 (put 'modeline-buffer-id 'face-alias 'mode-line-buffer-id)
2113 ;; the window-system face variants, which deemphasize the
2114 ;; header-line in relation to the mode-line face. If a terminal
2137 "Basic header-line face."
2154 By default, Emacs automatically adds this face to the value of
2155 `minibuffer-prompt-properties', which is a list of text properties
2161 (append minibuffer-prompt-properties (list 'face 'minibuffer-prompt)))
2170 "Basic face for the fringes to the left and right of windows under X."
2176 "Basic face for the scroll bar colors under X."
2182 "Basic face for the frame border under X."
2188 "Basic face for the cursor color under X.
2189 Note: Other faces cannot inherit from the cursor face."
2194 (put 'cursor 'face-no-inherit t)
2197 "Basic face for the mouse color under X."
2210 "Basic tool-bar face."
2221 "Basic face for the font and colors of the menu bar and popup menus."
2234 ;; functions are not used in the face implementation itself.
2284 (defun x-resolve-font-name (pattern &optional face frame)
2290 also the same size as FACE on FRAME, or fail."
2291 (or (symbolp face)
2292 (setq face (face-name face)))
2296 ;; Note that x-list-fonts has code to handle a face with nil as its font.
2297 (let ((fonts (x-list-fonts pattern face frame 1)))
2298 (or fonts
2299 (if face
2301 (if (null (face-font face))
2303 (error "No matching fonts are the same height as face `%s'" face))
2304 (if (null (face-font face))
2307 (error "Height of font `%s' doesn't match face `%s'"
2308 pattern face)))
2333 (make-obsolete 'x-frob-font-weight 'make-face-... "21.1")
2354 (make-obsolete 'x-frob-font-slant 'make-face-... "21.1")
2365 (make-obsolete 'x-make-font-bold 'make-face-bold "21.1")
2371 (make-obsolete 'x-make-font-demibold 'make-face-bold "21.1")
2377 (make-obsolete 'x-make-font-unbold 'make-face-unbold "21.1")
2383 (make-obsolete 'x-make-font-italic 'make-face-italic "21.1")
2389 (make-obsolete 'x-make-font-oblique 'make-face-italic "21.1")
2395 (make-obsolete 'x-make-font-unitalic 'make-face-unitalic "21.1")
2402 (make-obsolete 'x-make-font-bold-italic 'make-face-bold-italic "21.1")