Permalink
Browse files

Add resilience against zero-length, non-nil DISPLAY

  • Loading branch information...
1 parent 3cc572d commit 6a618594f027e1e56842da87718cc2debd3b1359 @candera committed Jan 10, 2013
Showing with 8 additions and 1 deletion.
  1. +8 −1 colors.el
View
@@ -12,6 +12,13 @@
(set-face-background 'default "black")
(set-face-foreground 'default "white"))
+(defun get-display ()
+ (let ((display-env (getenv "DISPLAY")))
+ (cond
+ ((not display-env) nil)
+ ((zerop (length display-env)) nil)
+ (display-env))))
+
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
@@ -32,7 +39,7 @@
;; display back to Windows, so we look to see if DISPLAY
;; is something like :0.0. But on Cygwin, we stick with 140
:height ,(if (eq system-type 'cygwin) 140
- (if (string= (substring (or (getenv "DISPLAY") ":") 0 1) ":") 120 140))
+ (if (string= (substring (or (get-display) ":") 0 1) ":") 120 140))
:width normal))))))
;; '(mode-line ((((class color) (min-colors 88)) (:background "#8888ff" :foreground "black" :box (:line-width -1 :style released-button)))))
;; '(cursor ((t (:background "red"))))

0 comments on commit 6a61859

Please sign in to comment.