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>
* org-compat.el (org-compatible-face): Improve macro.
* org.el (org-global-properties-fixed): Add default for
CLOCK_MODELINE_TOTAL.

View File

@ -48,21 +48,25 @@
(defun org-compatible-face (inherits specs)
"Make a compatible face specification.
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.
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
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
((and inherits (facep inherits)
(not (featurep 'xemacs))
(or (> emacs-major-version 22)
(not specs)))
;; In Emacs 23, we use inheritance where possible.
;; We only do this in Emacs 23, because only there the outline
;; faces have been changed to the original org-mode-level-faces.
;; However, if no face specification is present, we also use
;; inheritance in Emacs 22
(>= emacs-major-version 22)
;; do not inherit outline faces before Emacs 23
(or (>= emacs-major-version 23)
(not (string-match "\\`outline-[0-9]+"
(symbol-name inherits)))))
(list (list t :inherit inherits)))
((or (featurep 'xemacs) (< emacs-major-version 22))
;; These do not understand the `min-colors' attribute.