summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2009-06-02 14:50:19 +0200
committerCarsten Dominik <carsten.dominik@gmail.com>2009-06-02 14:50:19 +0200
commitb95c2a5e9acb6fcb9aee4167cc326d918195465e (patch)
treefecffbb37595e85c42056c9e4aa59c116a23d78e
parent1db461321a4dfad6efcb540ba76ac401f6643066 (diff)
downloadorg-mode-b95c2a5e9acb6fcb9aee4167cc326d918195465e.tar.gz
Better treatment of face inheritance.
-rwxr-xr-xlisp/ChangeLog2
-rw-r--r--lisp/org-compat.el20
2 files changed, 14 insertions, 8 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 27f9c3b..5adf598 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -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.
diff --git a/lisp/org-compat.el b/lisp/org-compat.el
index 082eaac..5d26727 100644
--- a/lisp/org-compat.el
+++ b/lisp/org-compat.el
@@ -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.