]> git.eshelyaron.com Git - emacs.git/commitdiff
Make lm-crack-address less strict
authorLars Ingebrigtsen <larsi@gnus.org>
Sat, 14 Aug 2021 13:23:29 +0000 (15:23 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Sat, 14 Aug 2021 13:23:29 +0000 (15:23 +0200)
* lisp/emacs-lisp/lisp-mnt.el (lm-crack-address): Use
mail-header-parse-address-lax (bug#50049).

lisp/emacs-lisp/lisp-mnt.el

index 4d1b42e43fab3cecf3eea5acd806c9930a49ca11..df14a5cd499b5b33ff150a3b81c585ea8b3f82cc 100644 (file)
 
 ;;; Code:
 
+(require 'mail-parse)
+
 ;;; Variables:
 
 (defgroup lisp-mnt nil
@@ -359,19 +361,9 @@ Return argument is of the form (\"HOLDER\" \"YEAR1\" ... \"YEARN\")"
 (defun lm-crack-address (x)
   "Split up email address(es) X into full name and real email address.
 The value is a list of elements of the form (FULLNAME . ADDRESS)."
-  (cond ((string-match
-         (concat "[,\s\t]*\\(?:"
-                 "\\(.+?\\) +[(<]\\(\\S-+@\\S-+\\)[>)]"
-                 "\\|"
-                 "\\(?2:\\S-+@\\S-+\\) +[(<]\\(?1:[^,]*\\)[>)]"
-                 "\\|"
-                 "\\(?2:\\S-+@\\S-+\\)"
-                 "\\)")
-         x)
-        `((,(string-trim-right (match-string 1 x)) . ,(match-string 2 x))
-          . ,(lm-crack-address (substring x (match-end 0)))))
-       ((string-match "\\`[,\s\t]*\\'" x) nil)
-       (t `((,x)))))
+  (mapcar (lambda (elem)
+            (cons (cdr elem) (car elem)))
+          (mail-header-parse-addresses-lax x)))
 
 (defun lm-authors (&optional file)
   "Return the author list of file FILE, or current buffer if FILE is nil.