* [PATCH 1/2] test: add test for emacs notmuch-show-strip-re function
@ 2012-06-05 15:42 Jani Nikula
2012-06-05 15:42 ` [PATCH 2/2] emacs: only strip "re:" in the beginning of subject Jani Nikula
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jani Nikula @ 2012-06-05 15:42 UTC (permalink / raw)
To: notmuch
The function is used for stripping "re:" from subjects to generate
"bare subjects". Include broken test for having "re:" in the middle of
the subject.
---
test/emacs-show | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/test/emacs-show b/test/emacs-show
index 2498564..1ddb28e 100755
--- a/test/emacs-show
+++ b/test/emacs-show
@@ -24,4 +24,17 @@ test_emacs "(notmuch-show \"id:$message_id\")
(test-visible-output)"
test_expect_equal_file OUTPUT EXPECTED
+test_begin_subtest "Bare subject #1"
+output=$(test_emacs '(notmuch-show-strip-re "Re: subject")')
+test_expect_equal "$output" '"subject"'
+
+test_begin_subtest "Bare subject #2"
+output=$(test_emacs '(notmuch-show-strip-re "re:Re: re: Re: re:subject")')
+test_expect_equal "$output" '"subject"'
+
+test_begin_subtest "Bare subject #3"
+test_subtest_known_broken
+output=$(test_emacs '(notmuch-show-strip-re "the cure: fix the regexp")')
+test_expect_equal "$output" '"the cure: fix the regexp"'
+
test_done
--
1.7.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] emacs: only strip "re:" in the beginning of subject
2012-06-05 15:42 [PATCH 1/2] test: add test for emacs notmuch-show-strip-re function Jani Nikula
@ 2012-06-05 15:42 ` Jani Nikula
2012-06-05 17:40 ` [PATCH 1/2] test: add test for emacs notmuch-show-strip-re function Tomi Ollila
2012-06-08 2:35 ` David Bremner
2 siblings, 0 replies; 4+ messages in thread
From: Jani Nikula @ 2012-06-05 15:42 UTC (permalink / raw)
To: notmuch
Fix notmuch-show-strip-re by matching "re:" only in the beginning of
the input string.
---
emacs/notmuch-show.el | 2 +-
test/emacs-show | 1 -
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index d318430..36cad93 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -819,7 +819,7 @@ message at DEPTH in the current thread."
(make-symbol (concat "notmuch-show-" type)))
(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 "")
(make-variable-buffer-local 'notmuch-show-previous-subject)
diff --git a/test/emacs-show b/test/emacs-show
index 1ddb28e..e9a714f 100755
--- a/test/emacs-show
+++ b/test/emacs-show
@@ -33,7 +33,6 @@ output=$(test_emacs '(notmuch-show-strip-re "re:Re: re: Re: re:subject")')
test_expect_equal "$output" '"subject"'
test_begin_subtest "Bare subject #3"
-test_subtest_known_broken
output=$(test_emacs '(notmuch-show-strip-re "the cure: fix the regexp")')
test_expect_equal "$output" '"the cure: fix the regexp"'
--
1.7.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] test: add test for emacs notmuch-show-strip-re function
2012-06-05 15:42 [PATCH 1/2] test: add test for emacs notmuch-show-strip-re function Jani Nikula
2012-06-05 15:42 ` [PATCH 2/2] emacs: only strip "re:" in the beginning of subject Jani Nikula
@ 2012-06-05 17:40 ` Tomi Ollila
2012-06-08 2:35 ` David Bremner
2 siblings, 0 replies; 4+ messages in thread
From: Tomi Ollila @ 2012-06-05 17:40 UTC (permalink / raw)
To: Jani Nikula, notmuch
On Tue, Jun 05 2012, Jani Nikula <jani@nikula.org> wrote:
> The function is used for stripping "re:" from subjects to generate
> "bare subjects". Include broken test for having "re:" in the middle of
> the subject.
LGTM
Tomi
> ---
> test/emacs-show | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/test/emacs-show b/test/emacs-show
> index 2498564..1ddb28e 100755
> --- a/test/emacs-show
> +++ b/test/emacs-show
> @@ -24,4 +24,17 @@ test_emacs "(notmuch-show \"id:$message_id\")
> (test-visible-output)"
> test_expect_equal_file OUTPUT EXPECTED
>
> +test_begin_subtest "Bare subject #1"
> +output=$(test_emacs '(notmuch-show-strip-re "Re: subject")')
> +test_expect_equal "$output" '"subject"'
> +
> +test_begin_subtest "Bare subject #2"
> +output=$(test_emacs '(notmuch-show-strip-re "re:Re: re: Re: re:subject")')
> +test_expect_equal "$output" '"subject"'
> +
> +test_begin_subtest "Bare subject #3"
> +test_subtest_known_broken
> +output=$(test_emacs '(notmuch-show-strip-re "the cure: fix the regexp")')
> +test_expect_equal "$output" '"the cure: fix the regexp"'
> +
> test_done
> --
> 1.7.9.5
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] test: add test for emacs notmuch-show-strip-re function
2012-06-05 15:42 [PATCH 1/2] test: add test for emacs notmuch-show-strip-re function Jani Nikula
2012-06-05 15:42 ` [PATCH 2/2] emacs: only strip "re:" in the beginning of subject Jani Nikula
2012-06-05 17:40 ` [PATCH 1/2] test: add test for emacs notmuch-show-strip-re function Tomi Ollila
@ 2012-06-08 2:35 ` David Bremner
2 siblings, 0 replies; 4+ messages in thread
From: David Bremner @ 2012-06-08 2:35 UTC (permalink / raw)
To: Jani Nikula, notmuch
Jani Nikula <jani@nikula.org> writes:
> The function is used for stripping "re:" from subjects to generate
> "bare subjects". Include broken test for having "re:" in the middle of
> the subject.
pushed both.
d
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-06-08 2:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-05 15:42 [PATCH 1/2] test: add test for emacs notmuch-show-strip-re function Jani Nikula
2012-06-05 15:42 ` [PATCH 2/2] emacs: only strip "re:" in the beginning of subject Jani Nikula
2012-06-05 17:40 ` [PATCH 1/2] test: add test for emacs notmuch-show-strip-re function Tomi Ollila
2012-06-08 2:35 ` David Bremner
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).