[RFC PATCH] emacs: add notmuch-show-resend-message
authorTomi Ollila <too@guru.guru-group.fi>
Fri, 6 Feb 2015 13:38:31 +0000 (15:38 +0200)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 21:48:00 +0000 (14:48 -0700)
f1/120320a46360d1b60ebeb4adfe15fdd83bfe1d [new file with mode: 0644]

diff --git a/f1/120320a46360d1b60ebeb4adfe15fdd83bfe1d b/f1/120320a46360d1b60ebeb4adfe15fdd83bfe1d
new file mode 100644 (file)
index 0000000..825f1ed
--- /dev/null
@@ -0,0 +1,135 @@
+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 olra.theworths.org (Postfix) with ESMTP id 51120431FC4\r
+       for <notmuch@notmuchmail.org>; Fri,  6 Feb 2015 05:39:09 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 2.438\r
+X-Spam-Level: **\r
+X-Spam-Status: No, score=2.438 tagged_above=-999 required=5\r
+       tests=[DNS_FROM_AHBL_RHSBL=2.438] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id SgHVzWol5WeV for <notmuch@notmuchmail.org>;\r
+       Fri,  6 Feb 2015 05:39:05 -0800 (PST)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+       by olra.theworths.org (Postfix) with ESMTP id 98CA9431FAE\r
+       for <notmuch@notmuchmail.org>; Fri,  6 Feb 2015 05:39:05 -0800 (PST)\r
+Received: by guru.guru-group.fi (Postfix, from userid 501)\r
+       id 53DBC100217; Fri,  6 Feb 2015 15:38:39 +0200 (EET)\r
+From: Tomi Ollila <too@guru.guru-group.fi>\r
+To: notmuch@notmuchmail.org\r
+Subject: [RFC PATCH] emacs: add notmuch-show-resend-message\r
+Date: Fri,  6 Feb 2015 15:38:31 +0200\r
+Message-Id: <1423229911-14784-1-git-send-email-too@guru.guru-group.fi>\r
+X-Mailer: git-send-email 2.0.0\r
+Cc: tomi.ollila@iki.fi\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\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: Fri, 06 Feb 2015 13:39:09 -0000\r
+\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+\r
+Resend 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
+The function is bound to 'b' in notmuch-show buffer.\r
+---\r
+\r
+RFC, largely due to the implementation of notmuch-address-from-minibuffer\r
+(I like how it works! -- I use it with selection-menu so I have not tested\r
+much how the default completion works (some smokes only))\r
+\r
+Also, I don't remember what I was planning in XXX.\r
+\r
+ emacs/notmuch-address.el | 24 +++++++++++++++++++++++-\r
+ emacs/notmuch-show.el    |  9 +++++++++\r
+ 2 files changed, 32 insertions(+), 1 deletion(-)\r
+\r
+diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el\r
+index fa65cd52a318..0cbeed70acc8 100644\r
+--- a/emacs/notmuch-address.el\r
++++ b/emacs/notmuch-address.el\r
+@@ -54,8 +54,11 @@ (defvar notmuch-address-message-alist-member\r
\r
+ (defvar notmuch-address-history nil)\r
\r
++(defsubst notmuch--address-message-insinuated ()\r
++  (memq notmuch-address-message-alist-member message-completion-alist))\r
++\r
+ (defun notmuch-address-message-insinuate ()\r
+-  (unless (memq notmuch-address-message-alist-member message-completion-alist)\r
++  (unless (notmuch--address-message-insinuated)\r
+     (setq message-completion-alist\r
+         (push notmuch-address-message-alist-member message-completion-alist))))\r
\r
+@@ -115,4 +118,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 ((cmap (copy-keymap minibuffer-local-completion-map))\r
++        (rmap (copy-keymap minibuffer-local-map))\r
++        (omap minibuffer-local-map))\r
++      (define-key cmap "," (lambda ()\r
++                           (interactive) (insert ", ") (exit-minibuffer)))\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
++          (minibuffer-local-completion-map cmap))\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 7549fbb2d326..1edda5df48f6 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -1299,6 +1299,7 @@ (defvar notmuch-show-mode-map\r
+     (define-key map (kbd "<backtab>") 'notmuch-show-previous-button)\r
+     (define-key map (kbd "TAB") 'notmuch-show-next-button)\r
+     (define-key map "f" 'notmuch-show-forward-message)\r
++    (define-key map "b" 'notmuch-show-resend-message)\r
+     (define-key map "r" 'notmuch-show-reply-sender)\r
+     (define-key map "R" 'notmuch-show-reply)\r
+     (define-key map "|" 'notmuch-show-pipe-message)\r
+@@ -1715,6 +1716,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))) ;; XXX see possibility to do in message 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