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