* [PATCH 1/2] Allow replying only to sender
@ 2010-03-01 17:29 Michal Sojka
2010-03-01 17:29 ` [PATCH 2/2] Emacs code for replying only to sender (bound to 'R' key) Michal Sojka
0 siblings, 1 reply; 2+ messages in thread
From: Michal Sojka @ 2010-03-01 17:29 UTC (permalink / raw)
To: notmuch
This adds --sender-only option to reply command, which makes the reply
go only to the original sender.
Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
---
notmuch-reply.c | 9 +++++++--
notmuch.1 | 6 ++++++
notmuch.c | 3 +++
3 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/notmuch-reply.c b/notmuch-reply.c
index 98f6442..5814313 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -23,6 +23,8 @@
#include "notmuch-client.h"
#include "gmime-filter-reply.h"
+static notmuch_bool_t sender_only = FALSE;
+
static void
reply_part_content (GMimeObject *part)
{
@@ -246,6 +248,7 @@ add_recipients_from_message (GMimeMessage *reply,
};
const char *from_addr = NULL;
unsigned int i;
+ unsigned int max;
/* Some mailing lists munge the Reply-To header despite it being A Bad
* Thing, see http://www.unicom.com/pw/reply-to-harmful.html
@@ -262,8 +265,8 @@ add_recipients_from_message (GMimeMessage *reply,
reply_to_map[0].header = "from";
reply_to_map[0].fallback = NULL;
}
-
- for (i = 0; i < ARRAY_SIZE (reply_to_map); i++) {
+ max = sender_only ? 1 : ARRAY_SIZE (reply_to_map);
+ for (i = 0; i < max; i++) {
const char *addr, *recipients;
recipients = notmuch_message_get_header (message,
@@ -443,6 +446,8 @@ notmuch_reply_command (void *ctx, int argc, char *argv[])
fprintf (stderr, "Invalid value for --format: %s\n", opt);
return 1;
}
+ } else if (STRNCMP_LITERAL (argv[i], "--sender-only") == 0) {
+ sender_only = TRUE;
} else {
fprintf (stderr, "Unrecognized option: %s\n", argv[i]);
return 1;
diff --git a/notmuch.1 b/notmuch.1
index 282ad98..7220145 100644
--- a/notmuch.1
+++ b/notmuch.1
@@ -258,6 +258,12 @@ Includes subject and quoted message body.
.BR headers-only
Only produces In-Reply-To, References, To, Cc, and Bcc headers.
.RE
+.TP 4
+.B \-\-sender\-only
+
+Only setup the To: header as described above, not the additional Cc
+headers.
+.RE
See the
.B "SEARCH SYNTAX"
diff --git a/notmuch.c b/notmuch.c
index 87479f8..13df953 100644
--- a/notmuch.c
+++ b/notmuch.c
@@ -233,6 +233,9 @@ command_t commands[] = {
"\t\t\t\tOnly produces In-Reply-To, References, To\n"
"\t\t\t\tCc, and Bcc headers.\n"
"\n"
+ "\t\t--sender-only\n"
+ "\t\t\tReply only to sender.\n"
+ "\n"
"\t\tSee \"notmuch help search-terms\" for details of the search\n"
"\t\tterms syntax." },
{ "tag", notmuch_tag_command,
--
1.7.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 2/2] Emacs code for replying only to sender (bound to 'R' key)
2010-03-01 17:29 [PATCH 1/2] Allow replying only to sender Michal Sojka
@ 2010-03-01 17:29 ` Michal Sojka
0 siblings, 0 replies; 2+ messages in thread
From: Michal Sojka @ 2010-03-01 17:29 UTC (permalink / raw)
To: notmuch
This is probably a very stupid implementation. I do not know elisp
well, so I appreciate advises on how to avoid code duplication.
Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
---
notmuch.el | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/notmuch.el b/notmuch.el
index 6482170..fb567f2 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -79,6 +79,7 @@
(define-key map "m" 'message-mail)
(define-key map "f" 'notmuch-show-forward-current)
(define-key map "r" 'notmuch-show-reply)
+ (define-key map "R" 'notmuch-show-reply-to-sender)
(define-key map "|" 'notmuch-show-pipe-message)
(define-key map "w" 'notmuch-show-save-attachments)
(define-key map "V" 'notmuch-show-view-raw-message)
@@ -479,6 +480,23 @@ buffer."
(let ((message-id (notmuch-show-get-message-id)))
(notmuch-reply message-id)))
+(defun notmuch-reply-to-sender (query-string)
+ (switch-to-buffer (generate-new-buffer "notmuch-draft"))
+ (call-process notmuch-command nil t nil "reply" "--sender-only" query-string)
+ (message-insert-signature)
+ (goto-char (point-min))
+ (if (re-search-forward "^$" nil t)
+ (progn
+ (insert "--text follows this line--")
+ (forward-line)))
+ (message-mode))
+
+(defun notmuch-show-reply-to-sender ()
+ "Begin composing a reply to the sender of the current message in a new buffer."
+ (interactive)
+ (let ((message-id (notmuch-show-get-message-id)))
+ (notmuch-reply-to-sender message-id)))
+
(defun notmuch-show-forward-current ()
"Forward the current message."
(interactive)
--
1.7.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-03-01 17:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-01 17:29 [PATCH 1/2] Allow replying only to sender Michal Sojka
2010-03-01 17:29 ` [PATCH 2/2] Emacs code for replying only to sender (bound to 'R' key) Michal Sojka
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).