[PATCH 2/2] emacs: add function to resend message to new recipients
authorTomi Ollila <tomi.ollila@iki.fi>
Wed, 26 Aug 2015 20:07:06 +0000 (23:07 +0300)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 21:49:25 +0000 (14:49 -0700)
01/475869b1efc048dcc1542b6b861c5773c5c7b0 [new file with mode: 0644]

diff --git a/01/475869b1efc048dcc1542b6b861c5773c5c7b0 b/01/475869b1efc048dcc1542b6b861c5773c5c7b0
new file mode 100644 (file)
index 0000000..6c4b4a1
--- /dev/null
@@ -0,0 +1,123 @@
+Return-Path: <too@guru-group.fi>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 78D616DE02C9\r
+ for <notmuch@notmuchmail.org>; Wed, 26 Aug 2015 13:08:41 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.255\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.255 tagged_above=-999 required=5 tests=[AWL=0.795, \r
+ RP_MATCHES_RCVD=-0.55, T_HEADER_FROM_DIFFERENT_DOMAINS=0.01]\r
+ autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id Xp2ywlV0asBl for <notmuch@notmuchmail.org>;\r
+ Wed, 26 Aug 2015 13:08:39 -0700 (PDT)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by arlo.cworth.org (Postfix) with ESMTP id A3F686DE0275\r
+ for <notmuch@notmuchmail.org>; Wed, 26 Aug 2015 13:08:39 -0700 (PDT)\r
+Received: by guru.guru-group.fi (Postfix, from userid 501)\r
+ id E6AD710023D; Wed, 26 Aug 2015 23:07:08 +0300 (EEST)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 2/2] emacs: add function to resend message to new recipients\r
+Date: Wed, 26 Aug 2015 23:07:06 +0300\r
+Message-Id: <1440619626-18768-2-git-send-email-tomi.ollila@iki.fi>\r
+X-Mailer: git-send-email 2.0.0\r
+In-Reply-To: <1440619626-18768-1-git-send-email-tomi.ollila@iki.fi>\r
+References: <1440619626-18768-1-git-send-email-tomi.ollila@iki.fi>\r
+Cc: tomi.ollila@iki.fi\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.18\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 26 Aug 2015 20:08:41 -0000\r
+\r
+The new function notmuch-show-message-resend re-sends\r
+message to new recipients using #'message-resend.\r
+\r
+Recipients are read from minibuffer as a comma-separated\r
+string (with some keyboard support including tab completion).\r
+\r
+Final confirmation before sending is asked.\r
+---\r
+\r
+Note that notmuch-show-message-resend is not (yet) bound to any\r
+keybindings in notmuch-show-mode-map (nor notmuch-tree-mode-map!).\r
+\r
+I remember that Emacs VM might have had 'b' bound to this functionality\r
+but I cannot be sure. A few weeks ago I looked gnus, rmail & mh-e to\r
+figure out whether 'b' would have been bound to similar functionality\r
+there but I cannot find it...\r
+\r
+A future patch will be done when we've decide where to bind this.\r
+\r
+Also, I "simplified" keybindings in notmuch-address-from-minibuffer --\r
+latest version used to bind ',' in both minibuffer-local-map and\r
+minibuffer-local-completion-map to do some magic. I'll send an RFC\r
+patch having that later.\r
+\r
+ emacs/notmuch-address.el | 19 +++++++++++++++++++\r
+ emacs/notmuch-show.el    |  8 ++++++++\r
+ 2 files changed, 27 insertions(+)\r
+\r
+diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el\r
+index 6c93b2a7a820..b08a78f2db46 100644\r
+--- a/emacs/notmuch-address.el\r
++++ b/emacs/notmuch-address.el\r
+@@ -119,4 +119,23 @@ (defun notmuch-address-locate-command (command)\r
\r
+ ;;\r
\r
++(defun notmuch-address-from-minibuffer (prompt)\r
++  (if (not (notmuch-address--message-insinuated))\r
++      (read-string prompt)\r
++    (let ((rmap (copy-keymap minibuffer-local-map))\r
++        (omap minibuffer-local-map))\r
++      ;; Configure TAB to start completion when executing read-string.\r
++      ;; "Original" minibuffer keymap is restored just before calling\r
++      ;; notmuch-address-expand-name as it may also use minibuffer-local-map\r
++      ;; (completing-read probably does not but if something else is used there).\r
++      (define-key rmap "\C-i" (lambda () ;; TAB\r
++                             (interactive)\r
++                             (let ((enable-recursive-minibuffers t)\r
++                                   (minibuffer-local-map omap))\r
++                               (notmuch-address-expand-name))))\r
++      (let ((minibuffer-local-map rmap))\r
++      (read-string prompt)))))\r
++\r
++;;\r
++\r
+ (provide 'notmuch-address)\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index 848ec2c870c4..62aa696224ca 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -1806,6 +1806,14 @@ (defun notmuch-show-forward-message (&optional prompt-for-sender)\r
+   (with-current-notmuch-show-message\r
+    (notmuch-mua-new-forward-message prompt-for-sender)))\r
\r
++(defun notmuch-show-resend-message (addresses)\r
++  "Resend the current message."\r
++  (interactive (list (notmuch-address-from-minibuffer "Resend to: ")))\r
++  (when (yes-or-no-p (concat "Confirm resend to " addresses " "))\r
++    (notmuch-show-view-raw-message)\r
++    (message-resend addresses)\r
++    (bury-buffer)))\r
++\r
+ (defun notmuch-show-next-message (&optional pop-at-end)\r
+   "Show the next message.\r
\r
+-- \r
+2.0.0\r
+\r