[PATCH 3/3] emacs: Another special case for `notmuch-show-clean-address'.
Remove backslashes. --- emacs/notmuch-show.el | 14 +- test/emacs-address-cleaning.el |6 -- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 1fd2524..c849e84 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -310,11 +310,15 @@ unchanged ADDRESS if parsing fails." (t (setq p-address address))) - ;; Remove outer double quotes. They might be required during - ;; transport, but we don't need to see them. - (when (and p-name -(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. + (when p-name + ;; Outer double quotes. + (when (string-match "^\"\\(.*\\)\"$" p-name) + (setq p-name (match-string 1 p-name))) + + ;; Backslashes. + (setq p-name (replace-regexp-in-string "" "" p-name))) ;; If the address is 'foo at bar.com ' then show just ;; 'foo at bar.com'. diff --git a/test/emacs-address-cleaning.el b/test/emacs-address-cleaning.el index 19e9e05..3b0b109 100644 --- a/test/emacs-address-cleaning.el +++ b/test/emacs-address-cleaning.el @@ -20,10 +20,12 @@ (let* ((input '("?? " "foo (at home) " "foo [at home] " - "Foo Bar")) + "Foo Bar" + "Fred Dibna \\[extraordinaire\\] ")) (expected '("?? " "foo (at home) " "foo [at home] " -"Foo Bar")) +"Foo Bar" +"Fred Dibna [extraordinaire] ")) (output (mapcar #'notmuch-show-clean-address input))) (notmuch-test-expect-equal output expected))) -- 1.7.8.3
[PATCH 3/3] emacs: Another special case for `notmuch-show-clean-address'.
Remove backslashes. --- emacs/notmuch-show.el | 14 +- test/emacs-address-cleaning.el |6 -- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 1fd2524..c849e84 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -310,11 +310,15 @@ unchanged ADDRESS if parsing fails. (t (setq p-address address))) - ;; Remove outer double quotes. They might be required during - ;; transport, but we don't need to see them. - (when (and p-name -(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. + (when p-name + ;; Outer double quotes. + (when (string-match ^\\\(.*\\)\$ p-name) + (setq p-name (match-string 1 p-name))) + + ;; Backslashes. + (setq p-name (replace-regexp-in-string p-name))) ;; If the address is 'f...@bar.com f...@bar.com' then show just ;; 'f...@bar.com'. diff --git a/test/emacs-address-cleaning.el b/test/emacs-address-cleaning.el index 19e9e05..3b0b109 100644 --- a/test/emacs-address-cleaning.el +++ b/test/emacs-address-cleaning.el @@ -20,10 +20,12 @@ (let* ((input '(ДБ db-uk...@stop.me.uk foo (at home) f...@bar.com foo [at home] f...@bar.com - Foo Bar)) + Foo Bar + Fred Dibna \\[extraordinaire\\] f...@dibna.com)) (expected '(ДБ db-uk...@stop.me.uk foo (at home) f...@bar.com foo [at home] f...@bar.com -Foo Bar)) +Foo Bar +Fred Dibna [extraordinaire] f...@dibna.com)) (output (mapcar #'notmuch-show-clean-address input))) (notmuch-test-expect-equal output expected))) -- 1.7.8.3 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch