Make sure the functions return a string (not nil)

This commit is contained in:
Matthew L. Fidler 2016-02-22 19:15:16 -06:00
parent d2c9926a8e
commit 3ffef2230f

View file

@ -528,7 +528,7 @@ ICON-SPEC should be a specification from `mode-icons'."
(eval `(propertize (eval `(propertize
,(let ((ro (format-mode-line "%1*")) ,(let ((ro (format-mode-line "%1*"))
icon-spec) icon-spec)
(setq ro (cond (setq ro (or (cond
((string= "%" ro) ((string= "%" ro)
(if (setq icon-spec (mode-icons-get-icon-spec 'read-only)) (if (setq icon-spec (mode-icons-get-icon-spec 'read-only))
(mode-icons-propertize-mode 'read-only icon-spec) (mode-icons-propertize-mode 'read-only icon-spec)
@ -536,7 +536,8 @@ ICON-SPEC should be a specification from `mode-icons'."
(t (t
(if (setq icon-spec (mode-icons-get-icon-spec 'writable)) (if (setq icon-spec (mode-icons-get-icon-spec 'writable))
(mode-icons-propertize-mode 'writable icon-spec) (mode-icons-propertize-mode 'writable icon-spec)
ro)))) ro)))
""))
(when (and mode-icons-read-only-space (when (and mode-icons-read-only-space
(not (string= ro ""))) (not (string= ro "")))
(setq ro (concat ro " "))) (setq ro (concat ro " ")))
@ -553,7 +554,7 @@ ICON-SPEC should be a specification from `mode-icons'."
(eval `(propertize (eval `(propertize
,(let ((mod (format-mode-line "%1+")) ,(let ((mod (format-mode-line "%1+"))
icon-spec) icon-spec)
(setq mod (cond (setq mod (or (cond
((string= "*" mod) ((string= "*" mod)
(if (setq icon-spec (mode-icons-get-icon-spec 'save)) (if (setq icon-spec (mode-icons-get-icon-spec 'save))
(mode-icons-propertize-mode 'save icon-spec) (mode-icons-propertize-mode 'save icon-spec)
@ -561,7 +562,8 @@ ICON-SPEC should be a specification from `mode-icons'."
(t (t
(if (setq icon-spec (mode-icons-get-icon-spec 'saved)) (if (setq icon-spec (mode-icons-get-icon-spec 'saved))
(mode-icons-propertize-mode 'saved icon-spec) (mode-icons-propertize-mode 'saved icon-spec)
mod)))) mod)))
""))
(when (and mode-icons-modified-status-space (when (and mode-icons-modified-status-space
(not (string= mod ""))) (not (string= mod "")))
(setq mod (concat mod " ")))) (setq mod (concat mod " "))))
@ -620,7 +622,7 @@ STRING is the string to modify, or if absent, the value from `mode-line-eol-desc
(props (text-properties-at 0 str)) (props (text-properties-at 0 str))
(lt2 "") (lt2 "")
icon-spec) icon-spec)
(setq str (cond (setq str (or (cond
((string= "(Unix)" str) ((string= "(Unix)" str)
(setq lt2 " LF") (setq lt2 " LF")
(if (setq icon-spec (mode-icons-get-icon-spec 'unix)) (if (setq icon-spec (mode-icons-get-icon-spec 'unix))
@ -642,7 +644,8 @@ STRING is the string to modify, or if absent, the value from `mode-line-eol-desc
(if (setq icon-spec (mode-icons-get-icon-spec 'undecided)) (if (setq icon-spec (mode-icons-get-icon-spec 'undecided))
(mode-icons-propertize-mode 'undecided icon-spec) (mode-icons-propertize-mode 'undecided icon-spec)
str)) str))
(t str))) (t str))
""))
(when mode-icons-eol-text (when mode-icons-eol-text
(setq str (concat str lt2))) (setq str (concat str lt2)))
(when (and mode-icons-eol-space (when (and mode-icons-eol-space