diff options
author | David Edmondson <dme@dme.org> | 2012-01-30 14:59:54 +0000 |
---|---|---|
committer | David Bremner <bremner@debian.org> | 2012-02-03 21:24:48 -0400 |
commit | 32d7b3aabd4cdba0fcf80e95a701bb64d3bf4980 (patch) | |
tree | b4c21449edfaa9c5888c8fbd43449dd9c2d5dc13 /emacs | |
parent | 6bd3d8af5431542f352f084b6366e88b98b019a1 (diff) |
emacs: More address cleaning.
Remove outer single-quotes from the mailbox part. Allow for multiple
sets of nested single and double quotes.
Add more tests.
Diffstat (limited to 'emacs')
-rw-r--r-- | emacs/notmuch-show.el | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 3a1a8c89..26cd2213 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -316,15 +316,25 @@ unchanged ADDRESS if parsing fails." (t (setq p-address address))) - ;; Remove elements of the mailbox part that are not relevant for - ;; display, even if they are required during transport. (when p-name - ;; Outer double quotes. - (when (string-match "^\"\\(.*\\)\"$" p-name) - (setq p-name (match-string 1 p-name))) - + ;; Remove elements of the mailbox part that are not relevant for + ;; display, even if they are required during transport: + ;; ;; Backslashes. - (setq p-name (replace-regexp-in-string "\\\\" "" p-name))) + (setq p-name (replace-regexp-in-string "\\\\" "" p-name)) + + ;; Outer single and double quotes, which might be nested. + (loop + with start-of-loop + do (setq start-of-loop p-name) + + when (string-match "^\"\\(.*\\)\"$" p-name) + do (setq p-name (match-string 1 p-name)) + + when (string-match "^'\\(.*\\)'$" p-name) + do (setq p-name (match-string 1 p-name)) + + until (string= start-of-loop p-name))) ;; If the address is 'foo@bar.com <foo@bar.com>' then show just ;; 'foo@bar.com'. |