From: Tomi Ollila Date: Wed, 26 Aug 2015 20:07:06 +0000 (+0300) Subject: [PATCH 2/2] emacs: add function to resend message to new recipients X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e4580a83e3a2b85360a51f597e0df0608ac39da4;p=notmuch-archives.git [PATCH 2/2] emacs: add function to resend message to new recipients --- diff --git a/01/475869b1efc048dcc1542b6b861c5773c5c7b0 b/01/475869b1efc048dcc1542b6b861c5773c5c7b0 new file mode 100644 index 000000000..6c4b4a1aa --- /dev/null +++ b/01/475869b1efc048dcc1542b6b861c5773c5c7b0 @@ -0,0 +1,123 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id 78D616DE02C9 + for ; Wed, 26 Aug 2015 13:08:41 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: 0.255 +X-Spam-Level: +X-Spam-Status: No, score=0.255 tagged_above=-999 required=5 tests=[AWL=0.795, + RP_MATCHES_RCVD=-0.55, T_HEADER_FROM_DIFFERENT_DOMAINS=0.01] + autolearn=disabled +Received: from arlo.cworth.org ([127.0.0.1]) + by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id Xp2ywlV0asBl for ; + Wed, 26 Aug 2015 13:08:39 -0700 (PDT) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by arlo.cworth.org (Postfix) with ESMTP id A3F686DE0275 + for ; Wed, 26 Aug 2015 13:08:39 -0700 (PDT) +Received: by guru.guru-group.fi (Postfix, from userid 501) + id E6AD710023D; Wed, 26 Aug 2015 23:07:08 +0300 (EEST) +From: Tomi Ollila +To: notmuch@notmuchmail.org +Subject: [PATCH 2/2] emacs: add function to resend message to new recipients +Date: Wed, 26 Aug 2015 23:07:06 +0300 +Message-Id: <1440619626-18768-2-git-send-email-tomi.ollila@iki.fi> +X-Mailer: git-send-email 2.0.0 +In-Reply-To: <1440619626-18768-1-git-send-email-tomi.ollila@iki.fi> +References: <1440619626-18768-1-git-send-email-tomi.ollila@iki.fi> +Cc: tomi.ollila@iki.fi +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.18 +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: Wed, 26 Aug 2015 20:08:41 -0000 + +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. +--- + +Note that notmuch-show-message-resend is not (yet) bound to any +keybindings in notmuch-show-mode-map (nor notmuch-tree-mode-map!). + +I remember that Emacs VM might have had 'b' bound to this functionality +but I cannot be sure. A few weeks ago I looked gnus, rmail & mh-e to +figure out whether 'b' would have been bound to similar functionality +there but I cannot find it... + +A future patch will be done when we've decide where to bind this. + +Also, I "simplified" keybindings in notmuch-address-from-minibuffer -- +latest version used to bind ',' in both minibuffer-local-map and +minibuffer-local-completion-map to do some magic. I'll send an RFC +patch having that later. + + 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 6c93b2a7a820..b08a78f2db46 100644 +--- a/emacs/notmuch-address.el ++++ b/emacs/notmuch-address.el +@@ -119,4 +119,23 @@ (defun notmuch-address-locate-command (command) + + ;; + ++(defun notmuch-address-from-minibuffer (prompt) ++ (if (not (notmuch-address--message-insinuated)) ++ (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 "\C-i" (lambda () ;; TAB ++ (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) +diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +index 848ec2c870c4..62aa696224ca 100644 +--- a/emacs/notmuch-show.el ++++ b/emacs/notmuch-show.el +@@ -1806,6 +1806,14 @@ (defun notmuch-show-forward-message (&optional prompt-for-sender) + (with-current-notmuch-show-message + (notmuch-mua-new-forward-message prompt-for-sender))) + ++(defun notmuch-show-resend-message (addresses) ++ "Resend the current message." ++ (interactive (list (notmuch-address-from-minibuffer "Resend to: "))) ++ (when (yes-or-no-p (concat "Confirm resend to " addresses " ")) ++ (notmuch-show-view-raw-message) ++ (message-resend addresses) ++ (bury-buffer))) ++ + (defun notmuch-show-next-message (&optional pop-at-end) + "Show the next message. + +-- +2.0.0 +