From 22d8e71d0462be77cb1c7999b36713d0bdfd65af Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sat, 14 Aug 2021 15:23:29 +0200 Subject: [PATCH] Make lm-crack-address less strict * lisp/emacs-lisp/lisp-mnt.el (lm-crack-address): Use mail-header-parse-address-lax (bug#50049). --- lisp/emacs-lisp/lisp-mnt.el | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) 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. -- 2.39.5