1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Merge from emacs-24; up to 2014-04-01T20:18:12Z!eggert@cs.ucla.edu

This commit is contained in:
Daniel Colascione 2014-04-07 13:54:16 -07:00
commit 7e31acf6b8
37 changed files with 807 additions and 223 deletions

View file

@ -354,11 +354,16 @@ specifies an invalid attribute."
(defun make-face-x-resource-internal (face &optional frame)
"Fill frame-local FACE on FRAME from X resources.
FRAME nil or not specified means do it for all frames."
(if (null frame)
(dolist (frame (frame-list))
(set-face-attributes-from-resources face frame))
(set-face-attributes-from-resources face frame)))
FRAME nil or not specified means do it for all frames.
If `inhibit-x-resources' is non-nil, this function does nothing."
(unless inhibit-x-resources
(dolist (frame (if (null frame) (frame-list) (list frame)))
;; `x-create-frame' already took care of correctly handling
;; the reverse video case-- do _not_ touch the default face
(unless (and (eq face 'default)
(frame-parameter frame 'reverse))
(set-face-attributes-from-resources face frame)))))
@ -1532,13 +1537,15 @@ If FRAME is nil, the current FRAME is used."
match))
(defun face-spec-choose (spec &optional frame)
"Choose the proper attributes for FRAME, out of SPEC.
If SPEC is nil, return nil."
(defun face-spec-choose (spec &optional frame no-match-retval)
"Return the proper attributes for FRAME, out of SPEC.
If no match is found or SPEC is nil, return nil, unless NO-MATCH-RETVAL
is given, in which case return its value instead."
(unless frame
(setq frame (selected-frame)))
(let ((tail spec)
result defaults)
result defaults match-found)
(while tail
(let* ((entry (pop tail))
(display (car entry))
@ -1558,9 +1565,18 @@ If SPEC is nil, return nil."
(setq defaults thisval)
;; Otherwise, if it matches, use it.
(when (face-spec-set-match-display display frame)
(setq result thisval)
(setq tail nil)))))
(if defaults (append result defaults) result)))
(setq result thisval
tail nil
match-found t)))))
;; If defaults have been found, it's safe to just append those to the result
;; list (which at this point will be either nil or contain actual specs) and
;; return it to the caller. Since there will most definitely be something to
;; return in this case, there's no need to know/check if a match was found.
(if defaults
(append result defaults)
(if match-found
result
no-match-retval))))
(defun face-spec-reset-face (face &optional frame)
@ -1639,19 +1655,27 @@ function for its other effects."
(defun face-spec-recalc (face frame)
"Reset the face attributes of FACE on FRAME according to its specs.
This applies the defface/custom spec first, then the custom theme specs,
then the override spec."
After the reset, the specs are applied from the following sources in this order:
X resources (if applicable)
|
(theme and user customization)
or, if nonexistent or does not match the current frame,
(defface default spec)
|
defface override spec"
(while (get face 'face-alias)
(setq face (get face 'face-alias)))
(face-spec-reset-face face frame)
(make-face-x-resource-internal face frame)
;; If FACE is customized or themed, set the custom spec from
;; `theme-face' records.
(let ((theme-faces (get face 'theme-face))
(no-match-found 0)
spec theme-face-applied)
(if theme-faces
(dolist (elt (reverse theme-faces))
(setq spec (face-spec-choose (cadr elt) frame))
(when spec
(setq spec (face-spec-choose (cadr elt) frame no-match-found))
(unless (eq spec no-match-found)
(face-spec-set-2 face frame spec)
(setq theme-face-applied t))))
;; If there was a spec applicable to FRAME, that overrides the
@ -1661,8 +1685,7 @@ then the override spec."
(setq spec (face-spec-choose (face-default-spec face) frame))
(face-spec-set-2 face frame spec))
(setq spec (face-spec-choose (get face 'face-override-spec) frame))
(face-spec-set-2 face frame spec))
(make-face-x-resource-internal face frame))
(face-spec-set-2 face frame spec)))
(defun face-spec-set-2 (face frame spec)
"Set the face attributes of FACE on FRAME according to SPEC."
@ -2046,10 +2069,6 @@ frame parameters in PARAMETERS."
(progn
;; Initialize faces from face spec and custom theme.
(face-spec-recalc face frame)
;; X resources for the default face are applied during
;; `x-create-frame'.
(and (not (eq face 'default)) window-system-p
(make-face-x-resource-internal face frame))
;; Apply attributes specified by face-new-frame-defaults
(internal-merge-in-global-face face frame))
;; Don't let invalid specs prevent frame creation.