diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2021-08-12 13:55:38 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2021-08-12 13:55:38 -0400 |
commit | 5809728bc502d58f4fe96e98b472c569da3d8879 (patch) | |
tree | ee63cf25728621f1166e9483f9e9cb35c09d23fb /lisp/emacs-lisp/lisp-mnt.el | |
parent | 1d60a25541616b1d9bbf22b21c9749cc108848de (diff) | |
download | emacs-5809728bc502d58f4fe96e98b472c569da3d8879.tar.gz emacs-5809728bc502d58f4fe96e98b472c569da3d8879.tar.bz2 emacs-5809728bc502d58f4fe96e98b472c569da3d8879.zip |
* lisp/emacs-lisp/lisp-mnt.el (lm-crack-address): Handle multi-addresses
(lm-authors, lm-maintainers): Adjust accordingly.
Diffstat (limited to 'lisp/emacs-lisp/lisp-mnt.el')
-rw-r--r-- | lisp/emacs-lisp/lisp-mnt.el | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/lisp/emacs-lisp/lisp-mnt.el b/lisp/emacs-lisp/lisp-mnt.el index d6a6a5f0442..4d1b42e43fa 100644 --- a/lisp/emacs-lisp/lisp-mnt.el +++ b/lisp/emacs-lisp/lisp-mnt.el @@ -357,18 +357,21 @@ Return argument is of the form (\"HOLDER\" \"YEAR1\" ... \"YEARN\")" summary))))) (defun lm-crack-address (x) - "Split up an email address X into full name and real email address. -The value is a cons of the form (FULLNAME . ADDRESS)." - (cond ((string-match "\\(.+\\) [(<]\\(\\S-+@\\S-+\\)[>)]" x) - (cons (string-trim-right (match-string 1 x)) - (match-string 2 x))) - ((string-match "\\(\\S-+@\\S-+\\) [(<]\\(.*\\)[>)]" x) - (cons (string-trim-right (match-string 2 x)) - (match-string 1 x))) - ((string-match "\\S-+@\\S-+" x) - (cons nil x)) - (t - (cons x nil)))) + "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))))) (defun lm-authors (&optional file) "Return the author list of file FILE, or current buffer if FILE is nil. @@ -376,7 +379,7 @@ Each element of the list is a cons; the car is the full name, the cdr is an email address." (lm-with-file file (let ((authorlist (lm-header-multiline "author"))) - (mapcar #'lm-crack-address authorlist)))) + (mapcan #'lm-crack-address authorlist)))) (defun lm-maintainers (&optional file) "Return the maintainer list of file FILE, or current buffer if FILE is nil. @@ -384,7 +387,7 @@ If the maintainers are unspecified, then return the authors. Each element of the list is a cons; the car is the full name, the cdr is an email address." (lm-with-file file - (mapcar #'lm-crack-address + (mapcan #'lm-crack-address (or (lm-header-multiline "maintainer") (lm-header-multiline "author"))))) |