diff options
author | David Edmondson <dme@dme.org> | 2012-01-25 13:54:00 +0000 |
---|---|---|
committer | David Bremner <bremner@debian.org> | 2012-01-27 07:59:40 -0400 |
commit | cd03f214470996ec03b126f86afafef5296fd879 (patch) | |
tree | d12c3749f2d70a241280b715a979410ccb8c7e19 | |
parent | 50d65de394cd78bd215918e251646c32eb0c0e52 (diff) |
emacs: Another special case for `notmuch-show-clean-address'.
Remove backslashes.
-rw-r--r-- | emacs/notmuch-show.el | 14 | ||||
-rw-r--r-- | 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 acc2f5e1..84ac6249 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -315,11 +315,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@bar.com <foo@bar.com>' then show just ;; 'foo@bar.com'. diff --git a/test/emacs-address-cleaning.el b/test/emacs-address-cleaning.el index 19e9e055..3b0b109b 100644 --- a/test/emacs-address-cleaning.el +++ b/test/emacs-address-cleaning.el @@ -20,10 +20,12 @@ (let* ((input '("ДБ <db-uknot@stop.me.uk>" "foo (at home) <foo@bar.com>" "foo [at home] <foo@bar.com>" - "Foo Bar")) + "Foo Bar" + "Fred Dibna \\[extraordinaire\\] <fred@dibna.com>")) (expected '("ДБ <db-uknot@stop.me.uk>" "foo (at home) <foo@bar.com>" "foo [at home] <foo@bar.com>" - "Foo Bar")) + "Foo Bar" + "Fred Dibna [extraordinaire] <fred@dibna.com>")) (output (mapcar #'notmuch-show-clean-address input))) (notmuch-test-expect-equal output expected))) |