.. program:: reply
+.. option:: --duplicate=N
+
+ Reply to duplicate number N. The numbering starts from 1, and
+ matches the order used by :option:`show --duplicate` and
+ :option:`search --output=files <search --output>`.
+
.. option:: --format=(default|json|sexp|headers-only)
default
(if (> file-count 1)
(let ((txt (format "%d/%d\n" duplicate file-count)))
(concat
- (notmuch-show-spaces-n (- (window-width) (+ (current-column) (length txt))))
+ (notmuch-show-spaces-n (max 0 (- (window-width) (+ (current-column) (length txt)))))
txt))
"\n"))
(overlay-put (make-overlay start (point))
notmuch_messages_move_to_next (messages)) {
message = notmuch_messages_get (messages);
- if (mime_node_open (notmuch, message, -1, ¶ms->crypto, &node))
+ if (mime_node_open (notmuch, message, params->duplicate, ¶ms->crypto, &node))
return 1;
reply = create_reply_message (notmuch, message,
/* Start the original */
sp->map_key (sp, "original");
- format_part_sprinter (notmuch, sp, node, -1, true, false);
+ format_part_sprinter (notmuch, sp, node, params->duplicate, true, false);
/* End */
sp->end (sp);
int opt_index;
notmuch_show_params_t params = {
.part = -1,
+ .duplicate = 0,
.crypto = { .decrypt = NOTMUCH_DECRYPT_AUTO },
};
int format = FORMAT_DEFAULT;
{ "auto", NOTMUCH_DECRYPT_AUTO },
{ "true", NOTMUCH_DECRYPT_NOSTASH },
{ 0, 0 } } },
+ { .opt_int = ¶ms.duplicate, .name = "duplicate" },
{ .opt_inherit = notmuch_shared_options },
{ }
};
> Note the Cc: and cc: headers.
OK"
+add_email_corpus duplicate
+
+ID1=debian/2.6.1.dfsg-4-1-g87ea161@87ea161e851dfb1ea324af00e4ecfccc18875e15
+
+test_begin_subtest "format json, --duplicate=2, duplicate key"
+output=$(notmuch reply --format=json --duplicate=2 id:${ID1})
+test_json_nodes <<<"$output" "dup:['original']['duplicate']=2"
+
+test_begin_subtest "format json, subject, --duplicate=1"
+output=$(notmuch reply --format=json --duplicate=1 id:${ID1})
+file=$(notmuch search --output=files id:${ID1} | head -n 1)
+subject=$(sed -n 's/^Subject: \(.*\)$/\1/p' < $file)
+test_json_nodes <<<"$output" "subject:['reply-headers']['Subject']=\"Re: $subject\""
+
+test_begin_subtest "format json, subject, --duplicate=2"
+output=$(notmuch reply --format=json --duplicate=2 id:${ID1})
+file=$(notmuch search --output=files id:${ID1} | tail -n 1)
+subject=$(sed -n 's/^Subject: \(.*\)$/\1/p' < $file)
+test_json_nodes <<<"$output" "subject:['reply-headers']['Subject']=\"Re: $subject\""
+
+ID2=87r2geywh9.fsf@tethera.net
+for dup in {1..2}; do
+ test_begin_subtest "format json, body, --duplicate=${dup}"
+ output=$(notmuch reply --format=json --duplicate=${dup} id:${ID2} | \
+ $NOTMUCH_PYTHON -B "$NOTMUCH_SRCDIR"/test/json_check_nodes.py "body:['original']['body'][0]['content']" | \
+ grep '^# body')
+ test_expect_equal "$output" "# body ${dup}"
+done
+
+ID3=87r2ecrr6x.fsf@zephyr.silentflame.com
+for dup in {1..5}; do
+ test_begin_subtest "format json, --duplicate=${dup}, 'duplicate' key"
+ output=$(notmuch reply --format=json --duplicate=${dup} id:${ID3})
+ test_json_nodes <<<"$output" "dup:['original']['duplicate']=${dup}"
+done
+
test_done