[PATCH 0/6] Use notmuch insert for fcc
[notmuch-archives.git] / 0c / 522128ed1859b7dd35b3d9edd05ea82e3b7340
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 103A96DE19F0\r
6  for <notmuch@notmuchmail.org>; Sat,  2 Jan 2016 13:24:36 -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.737\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-1.737 tagged_above=-999 required=5 tests=[AWL=1.113,\r
12   RCVD_IN_DNSWL_MED=-2.3, RP_MATCHES_RCVD=-0.55] autolearn=disabled\r
13 Received: from arlo.cworth.org ([127.0.0.1])\r
14  by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
15  with ESMTP id ySoJoGM-bYfj for <notmuch@notmuchmail.org>;\r
16  Sat,  2 Jan 2016 13:24:33 -0800 (PST)\r
17 Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36])\r
18  by arlo.cworth.org (Postfix) with ESMTP id 8AB336DE19E9\r
19  for <notmuch@notmuchmail.org>; Sat,  2 Jan 2016 13:24:32 -0800 (PST)\r
20 Received: from localhost (unknown [192.168.200.7])\r
21  by max.feld.cvut.cz (Postfix) with ESMTP id A6E4219F48FD;\r
22  Sat,  2 Jan 2016 22:24:31 +0100 (CET)\r
23 X-Virus-Scanned: IMAP STYX AMAVIS\r
24 Received: from max.feld.cvut.cz ([192.168.200.1])\r
25  by localhost (styx.feld.cvut.cz [192.168.200.7]) (amavisd-new, port 10044)\r
26  with ESMTP id RB3W74fXPKXR; Sat,  2 Jan 2016 22:24:29 +0100 (CET)\r
27 Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34])\r
28  by max.feld.cvut.cz (Postfix) with ESMTP id AE97319F474E;\r
29  Sat,  2 Jan 2016 22:24:28 +0100 (CET)\r
30 Received: from wsh by steelpick.2x.cz with local (Exim 4.86)\r
31  (envelope-from <sojkam1@fel.cvut.cz>)\r
32  id 1aFTf0-0002J7-N3; Sat, 02 Jan 2016 22:24:26 +0100\r
33 From: Michal Sojka <sojkam1@fel.cvut.cz>\r
34 To: fauno <fauno@kiwwwi.com.ar>, notmuch@notmuchmail.org\r
35 Subject: Re: notmuch-mua and jl-encrypt (was: file-error "not a regular file")\r
36 In-Reply-To: <87k2nw6n2j.fsf@endefensadelsl.org>\r
37 References:\r
38  <CAE+_6Tw18LY954NZt+koH-mn=nniubVdk4tR8TSitDy_6wJB2Q@mail.gmail.com>\r
39  <87wprzb4sj.fsf@endefensadelsl.org> <87ege6d41j.fsf@zancas.localnet>\r
40  <878u4e9jkx.fsf@endefensadelsl.org> <8737ukcm41.fsf@steelpick.2x.cz>\r
41  <87k2nw6n2j.fsf@endefensadelsl.org>\r
42 User-Agent: Notmuch/0.21+30~g55c056a (http://notmuchmail.org) Emacs/24.5.1\r
43  (x86_64-pc-linux-gnu)\r
44 Date: Sat, 02 Jan 2016 22:24:26 +0100\r
45 Message-ID: <871t9zektx.fsf@steelpick.2x.cz>\r
46 MIME-Version: 1.0\r
47 Content-Type: text/plain\r
48 X-BeenThere: notmuch@notmuchmail.org\r
49 X-Mailman-Version: 2.1.20\r
50 Precedence: list\r
51 List-Id: "Use and development of the notmuch mail system."\r
52  <notmuch.notmuchmail.org>\r
53 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
54  <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
55 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
56 List-Post: <mailto:notmuch@notmuchmail.org>\r
57 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
58 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
59  <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
60 X-List-Received-Date: Sat, 02 Jan 2016 21:24:36 -0000\r
61 \r
62 Hi fauno,\r
63 \r
64 On Wed, Dec 30 2015, fauno wrote:\r
65 > Michal Sojka <sojkam1@fel.cvut.cz> writes:\r
66 >> can you share more details about how do you use jl-encrypt and which\r
67 >> functions do not work? Recently, I posted a few patches that fix some\r
68 >> problems related to the replacing message-mode with\r
69 >> notmuch-message-mode. Maybe, there is more what we can do to not break\r
70 >> user's setups.\r
71 >\r
72 > i've been using jl-encrypt unmodified with notmuch for a while now.  i\r
73 > just require it on my .emacs\r
74 >\r
75 > since 0.21, i had to rebind notmuch-message-mode C-c C-c and C-s C-s\r
76 > keys:\r
77 >\r
78 > (define-key notmuch-message-mode-map (kbd "C-c C-c") 'jl-message-send-and-exit)\r
79 > (define-key notmuch-message-mode-map (kbd "C-c C-s") 'jl-message-send)\r
80 >\r
81 > and solved the issue of fcc by setting notmuch-fcc-dirs to nil and\r
82 > making my mta send me bcc of my own email.\r
83 >\r
84 > this has worked correctly for the last week.\r
85 >\r
86 >> From a brief look at jl-encrypt, it seems it is tightly bound to gnus,\r
87 >> because it uses gnus-message-setup-hook. Maybe it will work again with\r
88 >> notmuch if you use my patch [1] and run\r
89 >>\r
90 >>     (add-hook 'message-setup-hook 'jl-encrypt-if-possible)\r
91 >\r
92 > i applied your patch to the 0.21 release and byte-compiled notmuch-mua.el\r
93 >\r
94 > the message is sent unencrypted unless i rebind C-c C-c as before.  the\r
95 > email is encrypted but it asks for the recipient, which i'm guessing\r
96 > emacs can't figure out for itself anymore?\r
97 >\r
98 > also tested with `emacs -q` and loading this file, and jl-encrypt never\r
99 > asks to encrypt the email when possible:\r
100 >\r
101 > # /tmp/emacs\r
102 >\r
103 > (require 'notmuch)\r
104 > (add-to-list 'load-path "~/.emacs.d/lisp/")\r
105 > (require 'jl-encrypt)\r
106 > (add-hook 'message-setup-hook 'jl-encrypt-if-possible)\r
107 > (add-hook 'message-setup-hook 'mml-secure-message-sign-pgpmime)\r
108 >\r
109 > by adding the C-c C-c rebind, it gets to encrypt, but asks for recipient\r
110 > again.\r
111 \r
112 I looked into this and I think that the following workaround could work\r
113 for you:\r
114 \r
115     (defun jl-notmuch-message-send-and-exit (&optional arg)\r
116       (interactive "P")\r
117       (let ((message-fcc-handler-function #'notmuch-fcc-handler))\r
118         (jl-message-send-and-exit arg)))\r
119      \r
120     (defun jl-notmuch-message-send (&optional arg)\r
121       (interactive "P")\r
122       (let ((message-fcc-handler-function #'notmuch-fcc-handler))\r
123         (jl-message-send arg)))\r
124      \r
125     (define-key notmuch-message-mode-map (kbd "C-c C-c") 'jl-notmuch-message-send-and-exit)\r
126     (define-key notmuch-message-mode-map (kbd "C-c C-s") 'jl-notmuch-message-send)\r
127 \r
128 Unfortunately, I couldn't find a less intrusive solution for now,\r
129 because notmuch uses the same "trick" (remapping keyboard shortcuts) as\r
130 jl-encrypt to override message sending from message.el. This means that\r
131 either jl-encrypt or notmuch can be bound to these keys but not both.\r
132 \r
133 Notmuch has to use this mechanism until the bug [1] is fixed in Emacs.\r
134 \r
135 Another possibility would be to introduce something like\r
136 notmuch-send-hook which would allow other packages to hook into notmuch\r
137 sending process, but this could be even more complex that the above\r
138 workaround, so I don't think it is worth the effort.\r
139 \r
140 Best regards,\r
141 -Michal\r
142 \r
143 [1] http://debbugs.gnu.org/cgi/bugreport.cgi?bug=21174\r