unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Tomi Ollila <tomi.ollila@iki.fi>
To: notmuch@notmuchmail.org
Cc: tomi.ollila@iki.fi
Subject: [PATCH 1/2] emacs: add function to resend message to new recipients
Date: Sat,  7 May 2016 22:03:11 +0300	[thread overview]
Message-ID: <1462647792-25427-2-git-send-email-tomi.ollila@iki.fi> (raw)
In-Reply-To: <1462647792-25427-1-git-send-email-tomi.ollila@iki.fi>

The new function notmuch-show-message-resend re-sends
message to new recipients using #'message-resend.

Recipients are read from minibuffer as a comma-separated
string (with some keyboard support including tab completion).

Final confirmation before sending is asked.
---
 emacs/notmuch-address.el | 19 +++++++++++++++++++
 emacs/notmuch-show.el    |  8 ++++++++
 2 files changed, 27 insertions(+)

diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
index aafbe5fb8328..8b79d3402184 100644
--- a/emacs/notmuch-address.el
+++ b/emacs/notmuch-address.el
@@ -249,6 +249,25 @@ (defun notmuch-address-harvest-trigger ()
 
 ;;
 
+(defun notmuch-address-from-minibuffer (prompt)
+  (if (not notmuch-address-command)
+      (read-string prompt)
+    (let ((rmap (copy-keymap minibuffer-local-map))
+	  (omap minibuffer-local-map))
+      ;; Configure TAB to start completion when executing read-string.
+      ;; "Original" minibuffer keymap is restored just before calling
+      ;; notmuch-address-expand-name as it may also use minibuffer-local-map
+      ;; (completing-read probably does not but if something else is used there).
+      (define-key rmap (kbd "TAB") (lambda ()
+				     (interactive)
+				     (let ((enable-recursive-minibuffers t)
+					   (minibuffer-local-map omap))
+				       (notmuch-address-expand-name))))
+      (let ((minibuffer-local-map rmap))
+	(read-string prompt)))))
+
+;;
+
 (provide 'notmuch-address)
 
 ;;; notmuch-address.el ends here
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 5d9b7b45c557..4b8c66fdb2a1 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1855,6 +1855,14 @@ (defun notmuch-show-forward-open-messages (&optional prompt-for-sender)
       (error "No open messages to forward."))
     (notmuch-mua-new-forward-messages open-messages prompt-for-sender)))
 
+(defun notmuch-show-resend-message (addresses)
+  "Resend the current message."
+  (interactive (list (notmuch-address-from-minibuffer "Resend to: ")))
+  (when (y-or-n-p (concat "Confirm resend to " addresses " "))
+    (notmuch-show-view-raw-message)
+    (message-resend addresses)
+    (notmuch-bury-or-kill-this-buffer)))
+
 (defun notmuch-show-next-message (&optional pop-at-end)
   "Show the next message.
 
-- 
2.6.4

  reply	other threads:[~2016-05-07 19:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-07 19:03 notmuch-show-message-resend v3 Tomi Ollila
2016-05-07 19:03 ` Tomi Ollila [this message]
2016-05-19 11:06   ` [PATCH 1/2] emacs: add function to resend message to new recipients David Bremner
2016-05-07 19:03 ` [PATCH 2/2] emacs: bind notmuch-show-resend-message to 'b' in notmuch-show mode Tomi Ollila

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1462647792-25427-2-git-send-email-tomi.ollila@iki.fi \
    --to=tomi.ollila@iki.fi \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).