branch: externals/nano-modeline
commit 049437b8b0f85f4d3c8dbf835b40fbb09de37a99
Author: Nicolas P. Rougier <nicolas.roug...@inria.fr>
Commit: Nicolas P. Rougier <nicolas.roug...@inria.fr>

    More robust mu4e mode
---
 nano-modeline.el | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/nano-modeline.el b/nano-modeline.el
index 1ac74bf9d6..a83c7ab0b7 100644
--- a/nano-modeline.el
+++ b/nano-modeline.el
@@ -656,7 +656,9 @@ delay needs to be set to 0."
                          (downcase (plist-get item :email)))
                        (plist-get msg :to)))
            (to-names (mapcar (lambda (item)
-                               (capitalize (downcase (plist-get item :name))))
+                               (if (stringp (plist-get item :name))
+                                   (capitalize (downcase (plist-get item 
:name)))
+                                 (plist-get item :email)))
                              (plist-get msg :to)))
            (all (cl-union to cc))  
            (me (mapcar #'downcase (mu4e-personal-addresses)))
@@ -678,12 +680,15 @@ delay needs to be set to 0."
   
   (with-current-buffer "*mu4e-headers*"
     (let* ((msg (mu4e-message-at-point))
+           (me (mapcar #'downcase (mu4e-personal-addresses)))
            (from (mu4e-message-field msg :from))
-           (from-name (capitalize (downcase (plist-get (car from) :name))))
-           (from-email (plist-get (car from) :email))
-           (me (mapcar #'downcase (mu4e-personal-addresses))))
-      (if (member from-email me) "Me"from-name))))
+           (from-name (plist-get (car from) :name))
+           (from-email (plist-get (car from) :email)))
+      (cond ((member from-email me) "Me")
+            ((stringp from-name)    (capitalize (downcase from-name)))
+            (t                      from-email)))))
 
+           
 (defun nano-modeline-mu4e-view-in-xwidget ()
   (interactive)
   (with-current-buffer "*mu4e-headers*"

Reply via email to