ui/doom-modeline: silent xpm errors in tty emacs

This commit is contained in:
Henrik Lissner 2018-01-31 05:00:08 -05:00
parent c97c460ce2
commit 6b453962d7
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -180,25 +180,26 @@ active."
(let ((data (make-list (or height +doom-modeline-height) (let ((data (make-list (or height +doom-modeline-height)
(make-list (or width +doom-modeline-bar-width) 1))) (make-list (or width +doom-modeline-bar-width) 1)))
(color (or (face-background face nil t) "None"))) (color (or (face-background face nil t) "None")))
(create-image (ignore-errors
(concat (create-image
(format "/* XPM */\nstatic char * percent[] = {\n\"%i %i 2 1\",\n\". c %s\",\n\" c %s\"," (concat
(length (car data)) (format "/* XPM */\nstatic char * percent[] = {\n\"%i %i 2 1\",\n\". c %s\",\n\" c %s\","
(length data) (length (car data))
color (length data)
color) color
(apply #'concat color)
(cl-loop with idx = 0 (apply #'concat
with len = (length data) (cl-loop with idx = 0
for dl in data with len = (length data)
do (cl-incf idx) for dl in data
collect do (cl-incf idx)
(concat "\"" collect
(cl-loop for d in dl (concat "\""
if (= d 0) collect (string-to-char " ") (cl-loop for d in dl
else collect (string-to-char ".")) if (= d 0) collect (string-to-char " ")
(if (eq idx len) "\"};" "\",\n"))))) else collect (string-to-char "."))
'xpm t :ascent 'center)))) (if (eq idx len) "\"};" "\",\n")))))
'xpm t :ascent 'center)))))
(defun +doom-modeline-buffer-file-name () (defun +doom-modeline-buffer-file-name ()
"Propertized `buffer-file-name' based on `+doom-modeline-buffer-file-name-style'." "Propertized `buffer-file-name' based on `+doom-modeline-buffer-file-name-style'."