>From 00e322ce045ce2b678b28dd71eeb5df3085a4a45 Mon Sep 17 00:00:00 2001 From: Matthias Dahl Date: Wed, 2 Apr 2014 15:32:40 +0200 Subject: [PATCH 3/4] lisp/faces.el: Centralize no-init-from-x-resources check logic Centralize the check for inhibit-x-resources directly in make-face-x-resource-internal and remove all redundant checks. Backwards incompatible change: make-face previously accepted no-init-from-resources as an optional parameter which has now been removed. There were no other users within Emacs itself. And this parameter shouldn't have been there in the first place, imho. --- lisp/faces.el | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/lisp/faces.el b/lisp/faces.el index 8536c08..28205d2 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -149,13 +149,10 @@ REGISTRY, ALTERNATIVE1, ALTERNATIVE2, and etc." "Return a list of all defined faces." (mapcar #'car face-new-frame-defaults)) -(defun make-face (face &optional no-init-from-resources) +(defun make-face (face) "Define a new face with name FACE, a symbol. Do not call this directly from Lisp code; use `defface' instead. - -If NO-INIT-FROM-RESOURCES is non-nil, don't initialize face -attributes from X resources. If FACE is already known as a face, -leave it unmodified. Return FACE." +If FACE is already known as a face, leave it unmodified. Return FACE." (interactive (list (read-from-minibuffer "Make face: " nil nil t 'face-name-history))) (unless (facep face) @@ -166,8 +163,7 @@ leave it unmodified. Return FACE." (when (fboundp 'facemenu-add-new-face) (facemenu-add-new-face face)) ;; Define frame-local faces for all frames from X resources. - (unless no-init-from-resources - (make-face-x-resource-internal face))) + (make-face-x-resource-internal face)) face) (defun make-empty-face (face) @@ -175,7 +171,7 @@ leave it unmodified. Return FACE." Do not call this directly from Lisp code; use `defface' instead." (interactive (list (read-from-minibuffer "Make empty face: " nil nil t 'face-name-history))) - (make-face face 'no-init-from-resources)) + (make-face face)) (defun copy-face (old-face new-face &optional frame new-frame) "Define a face named NEW-FACE, which is a copy of OLD-FACE. @@ -354,11 +350,14 @@ 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 t, this will do nothing." + (unless inhibit-x-resources + (if (null frame) + (dolist (frame (frame-list)) + (set-face-attributes-from-resources face frame)) + (set-face-attributes-from-resources face frame)))) @@ -1661,8 +1660,7 @@ After the reset, the specs are applied from the following sources in this order: (while (get face 'face-alias) (setq face (get face 'face-alias))) (face-spec-reset-face face frame) - (unless inhibit-x-resources - (make-face-x-resource-internal 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)) -- 1.9.1