org-compat: Small refactoring

* lisp/org-compat.el (org-compatible-face): Small refactoring.  Remove
  Emacs 22 related part of the code.
This commit is contained in:
Nicolas Goaziou 2016-06-26 14:43:20 +02:00
parent 2f90a60bd8
commit d4408684e1
1 changed files with 7 additions and 32 deletions

View File

@ -107,38 +107,13 @@
(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
just inherit the face. If INHERITS is set and the Emacs version does it, just inherit the face. If INHERITS is not given and SPECS
not support it, copy the face specification from the inheritance face. is, use SPECS to define the face."
If INHERITS is not given and SPECS is, use SPECS to define the face." (declare (indent 1))
(when (and inherits (facep inherits) (not specs)) (if (facep inherits)
(setq specs (or specs (list (list t :inherit inherits))
(get inherits 'saved-face) specs))
(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)
(defun org-version-check (version feature level) (defun org-version-check (version feature level)
(let* ((v1 (mapcar 'string-to-number (split-string version "[.]"))) (let* ((v1 (mapcar 'string-to-number (split-string version "[.]")))