diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2021-08-14 15:23:29 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2021-08-14 15:23:29 +0200 |
commit | 22d8e71d0462be77cb1c7999b36713d0bdfd65af (patch) | |
tree | fc2f0ce0c7d0326969ba44105a5f6e2dc9139773 /lisp/emacs-lisp | |
parent | e91b574bf8b14c0d8cc33242570bffa8ddc38760 (diff) | |
download | emacs-22d8e71d0462be77cb1c7999b36713d0bdfd65af.tar.gz emacs-22d8e71d0462be77cb1c7999b36713d0bdfd65af.tar.bz2 emacs-22d8e71d0462be77cb1c7999b36713d0bdfd65af.zip |
Make lm-crack-address less strict
* lisp/emacs-lisp/lisp-mnt.el (lm-crack-address): Use
mail-header-parse-address-lax (bug#50049).
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/lisp-mnt.el | 18 |
1 files 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. |