handle the case where phrase is empty

This commit is contained in:
joost
2013-06-05 10:19:08 +02:00
parent bd12c4bb36
commit aefa144421

View File

@ -553,13 +553,14 @@ process."
(defun mu4e~rfc822-phrase-type (ph) (defun mu4e~rfc822-phrase-type (ph)
"Return either atom, quoted-string, a corner-case or nil. This "Return either atom, quoted-string, a corner-case or nil. This
checks for quotes around the phrase first checks for empty string first. Then quotes around the phrase
(returning 'rfc822-quoted-string). Then whether there is a quote (returning 'rfc822-quoted-string). Then whether there is a quote
inside the phrase (returning 'rfc822-containing-quote). inside the phrase (returning 'rfc822-containing-quote).
The reverse of the RFC atext definition is then tested. The reverse of the RFC atext definition is then tested.
If it matches, nil is returned, if not, it is an 'rfc822-atom, which If it matches, nil is returned, if not, it is an 'rfc822-atom, which
is returned." is returned."
(cond (cond
((= (length ph) 0) 'rfc822-empty)
((= (aref ph 0) ?\") ((= (aref ph 0) ?\")
(if (string-match "\"\\([^\"\\\n]\\|\\\\.\\|\\\\\n\\)*\"" ph) (if (string-match "\"\\([^\"\\\n]\\|\\\\.\\|\\\\\n\\)*\"" ph)
'rfc822-quoted-string 'rfc822-quoted-string