diff options
author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2016-06-26 14:43:20 +0200 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2016-06-26 14:43:20 +0200 |
commit | d4408684e1e2f508dce2ae8c71d2db827d2671c6 (patch) | |
tree | 6b64d56c001e87daa0a5e7ce56b9f19392931ab5 | |
parent | 2f90a60bd8a93f7177c56cc7fdfce04e65902f22 (diff) | |
download | org-mode-d4408684e1e2f508dce2ae8c71d2db827d2671c6.tar.gz |
org-compat: Small refactoring
* lisp/org-compat.el (org-compatible-face): Small refactoring. Remove
Emacs 22 related part of the code.
-rw-r--r-- | lisp/org-compat.el | 39 |
1 files changed, 7 insertions, 32 deletions
diff --git a/lisp/org-compat.el b/lisp/org-compat.el index 828d4bf..c2a67b7 100644 --- a/lisp/org-compat.el +++ b/lisp/org-compat.el @@ -107,38 +107,13 @@ (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 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." - (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) - (>= 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))) - ((< emacs-major-version 22) - ;; These do not understand the `min-colors' attribute. - (let (r e a) - (while (setq e (pop specs)) - (cond - ((memq (car e) '(t default)) (push e r)) - ((setq a (member '(min-colors 8) (car e))) - (nconc r (list (cons (cons '(type tty) (delq (car a) (car e))) - (cdr e))))) - ((setq a (assq 'min-colors (car e))) - (setq e (cons (delq a (car e)) (cdr e))) - (or (assoc (car e) r) (push e r))) - (t (or (assoc (car e) r) (push e r))))) - (nreverse r))) - (t specs))) -(put 'org-compatible-face 'lisp-indent-function 1) +If INHERITS is an existing face and if the Emacs version supports +it, just inherit the face. If INHERITS is not given and SPECS +is, use SPECS to define the face." + (declare (indent 1)) + (if (facep inherits) + (list (list t :inherit inherits)) + specs)) (defun org-version-check (version feature level) (let* ((v1 (mapcar 'string-to-number (split-string version "[.]"))) |