Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / f1 / 120320a46360d1b60ebeb4adfe15fdd83bfe1d
1 Return-Path: <too@guru-group.fi>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 51120431FC4\r
6         for <notmuch@notmuchmail.org>; Fri,  6 Feb 2015 05:39:09 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 2.438\r
10 X-Spam-Level: **\r
11 X-Spam-Status: No, score=2.438 tagged_above=-999 required=5\r
12         tests=[DNS_FROM_AHBL_RHSBL=2.438] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id SgHVzWol5WeV for <notmuch@notmuchmail.org>;\r
16         Fri,  6 Feb 2015 05:39:05 -0800 (PST)\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
18         by olra.theworths.org (Postfix) with ESMTP id 98CA9431FAE\r
19         for <notmuch@notmuchmail.org>; Fri,  6 Feb 2015 05:39:05 -0800 (PST)\r
20 Received: by guru.guru-group.fi (Postfix, from userid 501)\r
21         id 53DBC100217; Fri,  6 Feb 2015 15:38:39 +0200 (EET)\r
22 From: Tomi Ollila <too@guru.guru-group.fi>\r
23 To: notmuch@notmuchmail.org\r
24 Subject: [RFC PATCH] emacs: add notmuch-show-resend-message\r
25 Date: Fri,  6 Feb 2015 15:38:31 +0200\r
26 Message-Id: <1423229911-14784-1-git-send-email-too@guru.guru-group.fi>\r
27 X-Mailer: git-send-email 2.0.0\r
28 Cc: tomi.ollila@iki.fi\r
29 X-BeenThere: notmuch@notmuchmail.org\r
30 X-Mailman-Version: 2.1.13\r
31 Precedence: list\r
32 List-Id: "Use and development of the notmuch mail system."\r
33         <notmuch.notmuchmail.org>\r
34 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
35         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
36 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
37 List-Post: <mailto:notmuch@notmuchmail.org>\r
38 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
39 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
40         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
41 X-List-Received-Date: Fri, 06 Feb 2015 13:39:09 -0000\r
42 \r
43 From: Tomi Ollila <tomi.ollila@iki.fi>\r
44 \r
45 Resend message to new recipients using #'message-resend.\r
46 \r
47 Recipients are read from minibuffer as a comma-separated\r
48 string (with some keyboard support including tab completion)\r
49 \r
50 Final confirmation before sending is asked.\r
51 \r
52 The function is bound to 'b' in notmuch-show buffer.\r
53 ---\r
54 \r
55 RFC, largely due to the implementation of notmuch-address-from-minibuffer\r
56 (I like how it works! -- I use it with selection-menu so I have not tested\r
57 much how the default completion works (some smokes only))\r
58 \r
59 Also, I don't remember what I was planning in XXX.\r
60 \r
61  emacs/notmuch-address.el | 24 +++++++++++++++++++++++-\r
62  emacs/notmuch-show.el    |  9 +++++++++\r
63  2 files changed, 32 insertions(+), 1 deletion(-)\r
64 \r
65 diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el\r
66 index fa65cd52a318..0cbeed70acc8 100644\r
67 --- a/emacs/notmuch-address.el\r
68 +++ b/emacs/notmuch-address.el\r
69 @@ -54,8 +54,11 @@ (defvar notmuch-address-message-alist-member\r
70  \r
71  (defvar notmuch-address-history nil)\r
72  \r
73 +(defsubst notmuch--address-message-insinuated ()\r
74 +  (memq notmuch-address-message-alist-member message-completion-alist))\r
75 +\r
76  (defun notmuch-address-message-insinuate ()\r
77 -  (unless (memq notmuch-address-message-alist-member message-completion-alist)\r
78 +  (unless (notmuch--address-message-insinuated)\r
79      (setq message-completion-alist\r
80           (push notmuch-address-message-alist-member message-completion-alist))))\r
81  \r
82 @@ -115,4 +118,23 @@ (defun notmuch-address-locate-command (command)\r
83  \r
84  ;;\r
85  \r
86 +(defun notmuch-address-from-minibuffer (prompt)\r
87 +  (if (not (notmuch--address-message-insinuated))\r
88 +      (read-string prompt)\r
89 +    (let ((cmap (copy-keymap minibuffer-local-completion-map))\r
90 +         (rmap (copy-keymap minibuffer-local-map))\r
91 +         (omap minibuffer-local-map))\r
92 +      (define-key cmap "," (lambda ()\r
93 +                            (interactive) (insert ", ") (exit-minibuffer)))\r
94 +      (define-key rmap "\C-i" (lambda () ;; TAB\r
95 +                              (interactive)\r
96 +                              (let ((enable-recursive-minibuffers t)\r
97 +                                    (minibuffer-local-map omap))\r
98 +                                (notmuch-address-expand-name))))\r
99 +      (let ((minibuffer-local-map rmap)\r
100 +           (minibuffer-local-completion-map cmap))\r
101 +       (read-string prompt)))))\r
102 +\r
103 +;;\r
104 +\r
105  (provide 'notmuch-address)\r
106 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
107 index 7549fbb2d326..1edda5df48f6 100644\r
108 --- a/emacs/notmuch-show.el\r
109 +++ b/emacs/notmuch-show.el\r
110 @@ -1299,6 +1299,7 @@ (defvar notmuch-show-mode-map\r
111      (define-key map (kbd "<backtab>") 'notmuch-show-previous-button)\r
112      (define-key map (kbd "TAB") 'notmuch-show-next-button)\r
113      (define-key map "f" 'notmuch-show-forward-message)\r
114 +    (define-key map "b" 'notmuch-show-resend-message)\r
115      (define-key map "r" 'notmuch-show-reply-sender)\r
116      (define-key map "R" 'notmuch-show-reply)\r
117      (define-key map "|" 'notmuch-show-pipe-message)\r
118 @@ -1715,6 +1716,14 @@ (defun notmuch-show-forward-message (&optional prompt-for-sender)\r
119    (with-current-notmuch-show-message\r
120     (notmuch-mua-new-forward-message prompt-for-sender)))\r
121  \r
122 +(defun notmuch-show-resend-message (addresses)\r
123 +  "Resend the current message."\r
124 +  (interactive (list (notmuch-address-from-minibuffer "Resend to: ")))\r
125 +  (when (yes-or-no-p (concat "Confirm resend to " addresses " "))\r
126 +    (notmuch-show-view-raw-message)\r
127 +    (message-resend addresses)\r
128 +    (bury-buffer))) ;; XXX see possibility to do in message buffer.\r
129 +\r
130  (defun notmuch-show-next-message (&optional pop-at-end)\r
131    "Show the next message.\r
132  \r
133 -- \r
134 2.0.0\r
135 \r