From: Lars Ingebrigtsen Date: Sat, 14 Aug 2021 13:23:29 +0000 (+0200) Subject: Make lm-crack-address less strict X-Git-Tag: emacs-28.0.90~1510 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=22d8e71d0462be77cb1c7999b36713d0bdfd65af;p=emacs.git Make lm-crack-address less strict * lisp/emacs-lisp/lisp-mnt.el (lm-crack-address): Use mail-header-parse-address-lax (bug#50049). --- diff --git a/lisp/emacs-lisp/lisp-mnt.el b/lisp/emacs-lisp/lisp-mnt.el index 4d1b42e43fa..df14a5cd499 100644 --- a/lisp/emacs-lisp/lisp-mnt.el +++ b/lisp/emacs-lisp/lisp-mnt.el @@ -111,6 +111,8 @@ ;;; 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.