Backwards compatibility: check for possibly undefined variables in org-find-invisible-foreground

* lisp/org.el (org-find-invisible-foreground): Do not use the value of
  variables `default-frame-alist´, `initial-frame-alist´ and
  `window-system-default-frame-alist´ when their symbol is not bound.

This avoids an error with Emacs 22, which does not define
`window-system-default-frame-alist´, that prevents the test suite from
even starting, the other variables are treated the same as a defensive
measure.
This commit is contained in:
Achim Gratz 2012-12-19 11:04:22 +01:00
parent db28a7a0ab
commit 9a71174348
1 changed files with 9 additions and 7 deletions

View File

@ -5007,13 +5007,15 @@ The following commands are available:
(defun org-find-invisible-foreground ()
(let ((candidates (remove
"unspecified-bg"
(list
(face-background 'default)
(face-background 'org-default)
(cdr (assoc 'background-color default-frame-alist))
(cdr (assoc 'background-color initial-frame-alist))
(cdr (assoc 'background-color window-system-default-frame-alist))
(face-foreground 'org-hide)))))
(nconc
(list (face-background 'default)
(face-background 'org-default))
(mapcar
(lambda (alist)
(when (boundp alist)
(cdr (assoc 'background-color (symbol-value alist)))))
'(default-frame-alist initial-frame-alist window-system-default-frame-alist))
(list (face-foreground 'org-hide))))))
(car (remove nil candidates))))
(defun org-current-time ()