From 506c6d88bd7427e40d4e52350a0a2904e11d1c7f Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Sat, 11 May 2013 21:15:44 +0100 Subject: [PATCH] [PATCH 3/3] emacs: mua: allow the user to widen the reply --- 53/dd11c7929781bfee4b15071bb20f167bfc06f5 | 127 ++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 53/dd11c7929781bfee4b15071bb20f167bfc06f5 diff --git a/53/dd11c7929781bfee4b15071bb20f167bfc06f5 b/53/dd11c7929781bfee4b15071bb20f167bfc06f5 new file mode 100644 index 000000000..eeb673c08 --- /dev/null +++ b/53/dd11c7929781bfee4b15071bb20f167bfc06f5 @@ -0,0 +1,127 @@ +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 72ABD431E84 + for ; Sat, 11 May 2013 13:16:02 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0.201 +X-Spam-Level: +X-Spam-Status: No, score=0.201 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001, + RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +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 ScblhjiEpzqJ for ; + Sat, 11 May 2013 13:15:57 -0700 (PDT) +Received: from mail-wi0-f175.google.com (mail-wi0-f175.google.com + [209.85.212.175]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 5321D431FAE + for ; Sat, 11 May 2013 13:15:56 -0700 (PDT) +Received: by mail-wi0-f175.google.com with SMTP id h11so1678133wiv.8 + for ; Sat, 11 May 2013 13:15:55 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to + :references; bh=u/V5lB31ajhoXBFXNTbgEvC7klDoew8Qbg+XBEKhrc0=; + b=hTb648BTkXl7HyR2M/575XJ49Th42UAqb8147o38pEdibz2efiBaerADgldJ8RkYrU + uEmKlmtBQ/V8imqLw5jEg/qD/YwAnwh1CYvpsmkuODT/reqxPpovmCOYCo9ZpzARf3mc + 9fk+lNd+FrfUESPkdCeNVhU1bPYw4qsfswoutuGXD7aMNoEVs1a7Ap6n7SPz7llnso8e + SdTO2g5DnYKqrSxzFxwQfhpp+v6UNwfuBZ8A8S9zaFOCg2+2uk1PC4MzBFlFP2ObU2h+ + bw0GRjxleZIBI9kJyVbWYrAHRZNbm5A3OBGuvqEbLqC8j78LSwrgJatkSaHNU4nHsZ2G + PpZw== +X-Received: by 10.180.82.74 with SMTP id g10mr10445711wiy.10.1368303355265; + Sat, 11 May 2013 13:15:55 -0700 (PDT) +Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31]) + by mx.google.com with ESMTPSA id fu14sm3458079wic.8.2013.05.11.13.15.54 + for + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Sat, 11 May 2013 13:15:54 -0700 (PDT) +From: Mark Walters +To: notmuch@notmuchmail.org +Subject: [PATCH 3/3] emacs: mua: allow the user to widen the reply +Date: Sat, 11 May 2013 21:15:44 +0100 +Message-Id: <1368303344-13713-4-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 1.7.9.1 +In-Reply-To: <1368303344-13713-1-git-send-email-markwalters1009@gmail.com> +References: <1368303344-13713-1-git-send-email-markwalters1009@gmail.com> +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: Sat, 11 May 2013 20:16:02 -0000 + +Emacs message mode already has a widen reply option C-c C-f w (which +obviously doesn't work when used via notmuch). This uses the new +reply-all-recipients output to add a function to make it work in this case. +--- + emacs/notmuch-mua.el | 22 +++++++++++++++++++++- + 1 files changed, 21 insertions(+), 1 deletions(-) + +diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el +index 24eebff..1f28287 100644 +--- a/emacs/notmuch-mua.el ++++ b/emacs/notmuch-mua.el +@@ -74,6 +74,12 @@ list." + :type '(repeat string) + :group 'notmuch-send) + ++;; This is used to store the reply all headers to allow the reply to ++;; be `widened' in the mail compose window. ++(defvar notmuch-mua-reply-all-recipients nil) ++(make-variable-buffer-local 'notmuch-mua-reply-all-recipients) ++(put 'notmuch-mua-reply-all-recipients 'permanent-local t) ++ + ;; + + (defun notmuch-mua-get-switch-function () +@@ -145,6 +151,14 @@ list." + (funcall original-func header references) + (unless (bolp) (insert "\n"))) + ++(defun notmuch-mua-widen-reply () ++ (interactive) ++ (let ((reply-all-headers notmuch-mua-reply-all-recipients)) ++ (message-replace-header "To" (plist-get reply-all-headers :To)) ++ (message-replace-header "Cc" (plist-get reply-all-headers :Cc)) ++ (message-replace-header "Bcc" (plist-get reply-all-headers :Bcc)) ++ (message-sort-headers))) ++ + (defun notmuch-mua-reply (query-string &optional sender reply-all) + (let ((args '("reply" "--format=json" "--format-version=1")) + reply +@@ -165,7 +179,8 @@ list." + + ;; Extract the headers of both the reply and the original message. + (let* ((original-headers (plist-get original :headers)) +- (reply-headers (plist-get reply :reply-headers))) ++ (reply-headers (plist-get reply :reply-headers)) ++ (reply-all-recipients (plist-get reply :reply-all-recipients))) + + ;; If sender is non-nil, set the From: header to its value. + (when sender +@@ -191,6 +206,11 @@ list." + (notmuch-headers-plist-to-alist reply-headers) + nil (notmuch-mua-get-switch-function)))) + ++ ;; Store the JSON for use by the mail compose window for header ++ ;; toggling etc. ++ (setq notmuch-mua-reply-all-recipients reply-all-recipients) ++ (local-set-key "\C-c\C-fw" 'notmuch-mua-widen-reply) ++ + ;; Insert the message body - but put it in front of the signature + ;; if one is present + (goto-char (point-max)) +-- +1.7.9.1 + -- 2.26.2