emacs: only strip "re:" in the beginning of subject

Fix notmuch-show-strip-re by matching "re:" only in the beginning of
the input string.
This commit is contained in:
Jani Nikula 2012-06-05 18:42:51 +03:00 committed by David Bremner
parent 627f7b27f9
commit 0ff57e75cf
2 changed files with 1 additions and 2 deletions

View file

@ -819,7 +819,7 @@ message at DEPTH in the current thread."
(make-symbol (concat "notmuch-show-" type))) (make-symbol (concat "notmuch-show-" type)))
(defun notmuch-show-strip-re (string) (defun notmuch-show-strip-re (string)
(replace-regexp-in-string "\\([Rr]e: *\\)+" "" string)) (replace-regexp-in-string "^\\([Rr]e: *\\)+" "" string))
(defvar notmuch-show-previous-subject "") (defvar notmuch-show-previous-subject "")
(make-variable-buffer-local 'notmuch-show-previous-subject) (make-variable-buffer-local 'notmuch-show-previous-subject)

View file

@ -33,7 +33,6 @@ output=$(test_emacs '(notmuch-show-strip-re "re:Re: re: Re: re:subject")')
test_expect_equal "$output" '"subject"' test_expect_equal "$output" '"subject"'
test_begin_subtest "Bare subject #3" test_begin_subtest "Bare subject #3"
test_subtest_known_broken
output=$(test_emacs '(notmuch-show-strip-re "the cure: fix the regexp")') output=$(test_emacs '(notmuch-show-strip-re "the cure: fix the regexp")')
test_expect_equal "$output" '"the cure: fix the regexp"' test_expect_equal "$output" '"the cure: fix the regexp"'