aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomi Ollila <tomi.ollila@iki.fi>2016-05-07 22:03:11 +0300
committerDavid Bremner <david@tethera.net>2016-05-19 07:53:40 -0300
commitc13ff402c42143941010cd03bd57658d42f0df7d (patch)
treea5dc638d0c90a2af7dbf2a84d0ce94f682c9991a
parenteac29763896e457a738f811b2c2ba8f877498e62 (diff)
emacs: add function to resend message to new recipients
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.
-rw-r--r--emacs/notmuch-address.el19
-rw-r--r--emacs/notmuch-show.el8
2 files changed, 27 insertions, 0 deletions
diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
index aafbe5fb..8b79d340 100644
--- a/emacs/notmuch-address.el
+++ b/emacs/notmuch-address.el
@@ -249,6 +249,25 @@ called when harvesting finishes."
;;
+(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 5d9b7b45..4b8c66fd 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1855,6 +1855,14 @@ any effects from previous calls to
(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.