浏览代码

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.
Achim Gratz 13 年之前
父节点
当前提交
9a71174348
共有 1 个文件被更改,包括 9 次插入7 次删除
  1. 9 7
      lisp/org.el

+ 9 - 7
lisp/org.el

@@ -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 ()