Re: [feature request] emacs: use `notmuch insert` for FCC
[notmuch-archives.git] / 26 / 75d0dbc32bdd6e8f6f8d6ed2a447b091ca0644
1 Return-Path: <sojkam1@fel.cvut.cz>\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 arlo.cworth.org (Postfix) with ESMTP id A8B196DE19CB\r
6  for <notmuch@notmuchmail.org>; Sat,  2 Jan 2016 08:48:02 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -1.61\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-1.61 tagged_above=-999 required=5 tests=[AWL=1.240, \r
12  RCVD_IN_DNSWL_MED=-2.3,\r
13  RP_MATCHES_RCVD=-0.55] autolearn=disabled\r
14 Received: from arlo.cworth.org ([127.0.0.1])\r
15  by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
16  with ESMTP id FC-srW3xjxo1 for <notmuch@notmuchmail.org>;\r
17  Sat,  2 Jan 2016 08:48:01 -0800 (PST)\r
18 Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36])\r
19  by arlo.cworth.org (Postfix) with ESMTP id 80A0A6DE191A\r
20  for <notmuch@notmuchmail.org>; Sat,  2 Jan 2016 08:47:58 -0800 (PST)\r
21 Received: from localhost (unknown [192.168.200.7])\r
22  by max.feld.cvut.cz (Postfix) with ESMTP id F311019F48F6\r
23  for <notmuch@notmuchmail.org>; Sat,  2 Jan 2016 17:47:55 +0100 (CET)\r
24 X-Virus-Scanned: IMAP STYX AMAVIS\r
25 Received: from max.feld.cvut.cz ([192.168.200.1])\r
26  by localhost (styx.feld.cvut.cz [192.168.200.7]) (amavisd-new, port 10044)\r
27  with ESMTP id 1JkxRsIzWXnD for <notmuch@notmuchmail.org>;\r
28  Sat,  2 Jan 2016 17:47:54 +0100 (CET)\r
29 Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34])\r
30  by max.feld.cvut.cz (Postfix) with ESMTP id 821E919F48E1\r
31  for <notmuch@notmuchmail.org>; Sat,  2 Jan 2016 17:47:53 +0100 (CET)\r
32 Received: from wsh by steelpick.2x.cz with local (Exim 4.86)\r
33  (envelope-from <sojkam1@fel.cvut.cz>)\r
34  id 1aFPLM-0007BN-8F; Sat, 02 Jan 2016 17:47:52 +0100\r
35 From: Michal Sojka <sojkam1@fel.cvut.cz>\r
36 To: notmuch@notmuchmail.org\r
37 Subject: [PATCH 3/3] emacs: Handle switch-function argument of\r
38  notmuch-mua-mail\r
39 Date: Sat,  2 Jan 2016 17:47:45 +0100\r
40 Message-Id: <1451753265-26713-4-git-send-email-sojkam1@fel.cvut.cz>\r
41 X-Mailer: git-send-email 2.6.4\r
42 In-Reply-To: <1451753265-26713-1-git-send-email-sojkam1@fel.cvut.cz>\r
43 References: <1451753265-26713-1-git-send-email-sojkam1@fel.cvut.cz>\r
44 X-BeenThere: notmuch@notmuchmail.org\r
45 X-Mailman-Version: 2.1.20\r
46 Precedence: list\r
47 List-Id: "Use and development of the notmuch mail system."\r
48  <notmuch.notmuchmail.org>\r
49 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
50  <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
51 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
52 List-Post: <mailto:notmuch@notmuchmail.org>\r
53 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
54 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
55  <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
56 X-List-Received-Date: Sat, 02 Jan 2016 16:48:02 -0000\r
57 \r
58 notmuch-mua-mail ignored the switch-function argument and always used\r
59 the function returned by notmuch-mua-get-switch-function instead. In\r
60 order to support standard emacs interfaces (compose-mail in this\r
61 case), this commit changes notmuch-mua-mail to use the switch-function\r
62 argument if it is non-nil and notmuch-mua-get-switch-function\r
63 otherwise.\r
64 ---\r
65  emacs/notmuch-mua.el | 9 +++++----\r
66  1 file changed, 5 insertions(+), 4 deletions(-)\r
67 \r
68 diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
69 index 2d6825d..45a6daa 100644\r
70 --- a/emacs/notmuch-mua.el\r
71 +++ b/emacs/notmuch-mua.el\r
72 @@ -278,7 +278,7 @@ Note that these functions use `mail-citation-hook' if that is non-nil."\r
73  (define-key notmuch-message-mode-map (kbd "C-c C-c") #'notmuch-mua-send-and-exit)\r
74  (define-key notmuch-message-mode-map (kbd "C-c C-s") #'notmuch-mua-send)\r
75  \r
76 -(defun notmuch-mua-pop-to-buffer (name)\r
77 +(defun notmuch-mua-pop-to-buffer (name switch-function)\r
78    "Pop to buffer NAME, and warn if it already exists and is\r
79  modified. This function is notmuch addaptation of\r
80  `message-pop-to-buffer'."\r
81 @@ -291,7 +291,7 @@ modified. This function is notmuch addaptation of\r
82               (progn\r
83                 (gnus-select-frame-set-input-focus (window-frame window))\r
84                 (select-window window))\r
85 -           (funcall (notmuch-mua-get-switch-function) buffer)\r
86 +           (funcall switch-function buffer)\r
87             (set-buffer buffer))\r
88           (when (and (buffer-modified-p)\r
89                      (not (prog1\r
90 @@ -299,7 +299,7 @@ modified. This function is notmuch addaptation of\r
91                                "Message already being composed; erase? ")\r
92                             (message nil))))\r
93             (error "Message being composed")))\r
94 -      (funcall (notmuch-mua-get-switch-function) name)\r
95 +      (funcall switch-function name)\r
96        (set-buffer name))\r
97      (erase-buffer)\r
98      (notmuch-message-mode)))\r
99 @@ -319,7 +319,8 @@ modified. This function is notmuch addaptation of\r
100      (push (cons 'From (concat\r
101                        (notmuch-user-name) " <" (notmuch-user-primary-email) ">")) other-headers))\r
102  \r
103 -  (notmuch-mua-pop-to-buffer (message-buffer-name "mail" to))\r
104 +  (notmuch-mua-pop-to-buffer (message-buffer-name "mail" to)\r
105 +                            (or switch-function (notmuch-mua-get-switch-function)))\r
106    (let ((headers\r
107          ;; The following sexp is copied from `message-mail'\r
108          (nconc\r
109 -- \r
110 2.6.4\r
111 \r