Better treatment of face inheritance.

This commit is contained in:
Carsten Dominik 2009-06-02 14:50:19 +02:00
parent 1db461321a
commit b95c2a5e9a
2 changed files with 14 additions and 8 deletions

View File

@ -1,5 +1,7 @@
2009-06-02 Carsten Dominik <carsten.dominik@gmail.com> 2009-06-02 Carsten Dominik <carsten.dominik@gmail.com>
* org-compat.el (org-compatible-face): Improve macro.
* org.el (org-global-properties-fixed): Add default for * org.el (org-global-properties-fixed): Add default for
CLOCK_MODELINE_TOTAL. CLOCK_MODELINE_TOTAL.

View File

@ -48,21 +48,25 @@
(defun org-compatible-face (inherits specs) (defun org-compatible-face (inherits specs)
"Make a compatible face specification. "Make a compatible face specification.
If INHERITS is an existing face and if the Emacs version supports it, If INHERITS is an existing face and if the Emacs version supports it,
just inherit the face. If not, use SPECS to define the face. just inherit the face. If INHERITS is set and the Emacs version does
not support it, copy the face specification from the inheritance face.
If INHERITS is not given and SPECS is, use SPECS to define the face.
XEmacs and Emacs 21 do not know about the `min-colors' attribute. XEmacs and Emacs 21 do not know about the `min-colors' attribute.
For them we convert a (min-colors 8) entry to a `tty' entry and move it For them we convert a (min-colors 8) entry to a `tty' entry and move it
to the top of the list. The `min-colors' attribute will be removed from to the top of the list. The `min-colors' attribute will be removed from
any other entries, and any resulting duplicates will be removed entirely." any other entries, and any resulting duplicates will be removed entirely."
(when (and inherits (facep inherits) (not specs))
(setq specs (or specs
(get inherits 'saved-face)
(get inherits 'face-defface-spec))))
(cond (cond
((and inherits (facep inherits) ((and inherits (facep inherits)
(not (featurep 'xemacs)) (not (featurep 'xemacs))
(or (> emacs-major-version 22) (>= emacs-major-version 22)
(not specs))) ;; do not inherit outline faces before Emacs 23
;; In Emacs 23, we use inheritance where possible. (or (>= emacs-major-version 23)
;; We only do this in Emacs 23, because only there the outline (not (string-match "\\`outline-[0-9]+"
;; faces have been changed to the original org-mode-level-faces. (symbol-name inherits)))))
;; However, if no face specification is present, we also use
;; inheritance in Emacs 22
(list (list t :inherit inherits))) (list (list t :inherit inherits)))
((or (featurep 'xemacs) (< emacs-major-version 22)) ((or (featurep 'xemacs) (< emacs-major-version 22))
;; These do not understand the `min-colors' attribute. ;; These do not understand the `min-colors' attribute.