Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 1FDA240DAD6 for ; Mon, 8 Nov 2010 11:18:49 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -4.2 X-Spam-Level: X-Spam-Status: No, score=-4.2 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3] autolearn=ham Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DM50PXqkJJg7 for ; Mon, 8 Nov 2010 11:18:37 -0800 (PST) Received: from mail2.tyndall.ie (tyndall.ucc.ie [143.239.64.1]) by olra.theworths.org (Postfix) with ESMTP id 4C51940DAE7 for ; Mon, 8 Nov 2010 11:18:37 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by mail2.tyndall.ie (Postfix) with ESMTP id 38785B20C2 for ; Mon, 8 Nov 2010 19:18:35 +0000 (GMT) X-Virus-Scanned: Debian amavisd-new at mail.tyndall.ie Received: from mail2.tyndall.ie ([127.0.0.1]) by localhost (bastion2.tyndall.ie [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CYY9xZC6IIO4 for ; Mon, 8 Nov 2010 19:18:35 +0000 (GMT) Received: from unixmail.tyndall.ie (unknown [10.1.64.22]) by mail2.tyndall.ie (Postfix) with ESMTP id 14A24B20C1 for ; Mon, 8 Nov 2010 19:18:35 +0000 (GMT) Received: from localhost (localhost [127.0.0.1]) by unixmail.tyndall.ie (Postfix) with ESMTP id 13F06349E0 for ; Mon, 8 Nov 2010 19:18:35 +0000 (GMT) X-Virus-Scanned: amavisd-new at tyndall.ie Received: from unixmail.tyndall.ie ([127.0.0.1]) by localhost (unixmail.tyndall.ie [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yHBpe-zEt1e9 for ; Mon, 8 Nov 2010 19:18:29 +0000 (GMT) Received: from localhost6.localdomain6 (lnx0015f24b24d0.nmrc.ucc.ie [10.1.65.104]) by unixmail.tyndall.ie (Postfix) with ESMTP id 36A7634938 for ; Mon, 8 Nov 2010 19:18:29 +0000 (GMT) Received: from localhost6.localdomain6 (localhost.localdomain [127.0.0.1]) by localhost6.localdomain6 (8.14.4/8.14.4) with ESMTP id oA8JLqEM010483 for ; Mon, 8 Nov 2010 19:21:52 GMT Received: (from aamann@localhost) by localhost6.localdomain6 (8.14.4/8.14.4/Submit) id oA8JLoWx010481; Mon, 8 Nov 2010 19:21:50 GMT X-Authentication-Warning: localhost6.localdomain6: aamann set sender to andreas.amann@tyndall.ie using -f From: Andreas Amann To: notmuch@notmuchmail.org Subject: Re: Notmuch Ruby bindings In-Reply-To: <87iq07n16w.fsf@yoom.home.cworth.org> References: <8639xkv1kz.fsf@harikalardiyari.ev> <87vd47n20a.fsf@yoom.home.cworth.org> <87sjzbn1w8.fsf@yoom.home.cworth.org> <87iq07n16w.fsf@yoom.home.cworth.org> User-Agent: Notmuch/0.3.1-133-gc212382 (http://notmuchmail.org) Emacs/24.0.50.1 (x86_64-unknown-linux-gnu) Date: Mon, 08 Nov 2010 19:21:50 +0000 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Mailman-Approved-At: Mon, 08 Nov 2010 18:16:30 -0800 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 19:18:49 -0000 --=-=-= Content-Type: text/plain On Mon, 08 Nov 2010 10:02:31 -0800, Carl Worth wrote: > Now, where was that patch adding a "reply to sender only" binding... > After a number of embarrassing mails I use the attached patch, which changes the default behaviour of "r" to "reply to sender only". Usual reply to everybody is "R". Maybe you prefer reversed binding? Andreas --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Add-reply-to-sender-only-functionality.patch Add reply to sender only functionality This changes the default keybinding "r" in notmuch emacs interface to mean "reply to sender only". This is an adapted version of a patch by Michal Sojka. --- emacs/notmuch-mua.el | 2 +- emacs/notmuch-show.el | 10 ++++++++-- emacs/notmuch.el | 12 ++++++++++-- notmuch-reply.c | 9 +++++++-- notmuch.1 | 6 ++++++ notmuch.c | 3 +++ 6 files changed, 35 insertions(+), 7 deletions(-) diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index dc7b386..2cf846e 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -75,7 +75,7 @@ list." ;; really only that the headers come first followed by a blank ;; line and then the body. (with-temp-buffer - (call-process notmuch-command nil t nil "reply" query-string) + (apply 'call-process (append (list notmuch-command nil t nil "reply") query-string)) (goto-char (point-min)) (if (re-search-forward "^$" nil t) (save-excursion diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 98a2fbc..b634b8d 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -563,7 +563,8 @@ function is used. " (define-key map "s" 'notmuch-search) (define-key map "m" 'notmuch-mua-mail) (define-key map "f" 'notmuch-show-forward-message) - (define-key map "r" 'notmuch-show-reply) + (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) @@ -870,7 +871,12 @@ any effects from previous calls to (defun notmuch-show-reply () "Reply to the current message." (interactive) - (notmuch-mua-reply (notmuch-show-get-message-id))) + (notmuch-mua-reply (list (notmuch-show-get-message-id)))) + +(defun notmuch-show-reply-to-sender () + "Reply to the current message (only to the sender)." + (interactive) + (notmuch-mua-reply (list "--sender-only" (notmuch-show-get-message-id)))) (defun notmuch-show-forward-message () "Forward the current message." diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 2a87ab9..8897d09 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -203,7 +203,8 @@ For a mouse binding, return nil." (define-key map ">" 'notmuch-search-last-thread) (define-key map "p" 'notmuch-search-previous-thread) (define-key map "n" 'notmuch-search-next-thread) - (define-key map "r" 'notmuch-search-reply-to-thread) + (define-key map "R" 'notmuch-search-reply-to-thread) + (define-key map "r" 'notmuch-search-reply-to-thread-sender) (define-key map "m" 'notmuch-mua-mail) (define-key map "s" 'notmuch-search) (define-key map "o" 'notmuch-search-toggle-order) @@ -427,7 +428,14 @@ Complete list of currently available key bindings: "Begin composing a reply to the entire current thread in a new buffer." (interactive) (let ((message-id (notmuch-search-find-thread-id))) - (notmuch-mua-reply message-id))) + (notmuch-mua-reply (list message-id)))) + +(defun notmuch-search-reply-to-thread-sender () + "Begin composing a reply to the sender only of the current thread in a new buffer." + (interactive) + (let ((message-id (notmuch-search-find-thread-id))) + (notmuch-mua-reply (list "--sender-only" message-id)))) + (defun notmuch-call-notmuch-process (&rest args) "Synchronously invoke \"notmuch\" with the given list of arguments. diff --git a/notmuch-reply.c b/notmuch-reply.c index 23d04b8..886157a 100644 --- a/notmuch-reply.c +++ b/notmuch-reply.c @@ -24,6 +24,8 @@ #include "gmime-filter-reply.h" #include "gmime-filter-headers.h" +static notmuch_bool_t sender_only = FALSE; + static void reply_part_content (GMimeObject *part) { @@ -272,6 +274,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 @@ -288,8 +291,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, @@ -595,6 +598,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 2c33749..6bd5dc0 100644 --- a/notmuch.1 +++ b/notmuch.1 @@ -353,6 +353,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 030e494..1780dbe 100644 --- a/notmuch.c +++ b/notmuch.c @@ -297,6 +297,9 @@ command_t commands[] = { "\t\t\tOnly produces In-Reply-To, References, To\n" "\t\t\tCc, and Bcc headers.\n" "\n" + "\t\t--sender-only\n" + "\t\t\tReply only to sender.\n" + "\n" "\tSee \"notmuch help search-terms\" for details of the search\n" "\tterms syntax." }, { "tag", notmuch_tag_command, -- 1.7.2.3 --=-=-=--