From 7b2bd3811bb184f0eaf66273cafdf4c37d6135b0 Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Sat, 2 Jan 2016 22:24:26 +0100 Subject: [PATCH] Re: notmuch-mua and jl-encrypt (was: file-error "not a regular file") --- 0c/522128ed1859b7dd35b3d9edd05ea82e3b7340 | 143 ++++++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 0c/522128ed1859b7dd35b3d9edd05ea82e3b7340 diff --git a/0c/522128ed1859b7dd35b3d9edd05ea82e3b7340 b/0c/522128ed1859b7dd35b3d9edd05ea82e3b7340 new file mode 100644 index 000000000..a59703215 --- /dev/null +++ b/0c/522128ed1859b7dd35b3d9edd05ea82e3b7340 @@ -0,0 +1,143 @@ +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 103A96DE19F0 + for ; Sat, 2 Jan 2016 13:24:36 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -1.737 +X-Spam-Level: +X-Spam-Status: No, score=-1.737 tagged_above=-999 required=5 tests=[AWL=1.113, + RCVD_IN_DNSWL_MED=-2.3, RP_MATCHES_RCVD=-0.55] 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 ySoJoGM-bYfj for ; + Sat, 2 Jan 2016 13:24:33 -0800 (PST) +Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36]) + by arlo.cworth.org (Postfix) with ESMTP id 8AB336DE19E9 + for ; Sat, 2 Jan 2016 13:24:32 -0800 (PST) +Received: from localhost (unknown [192.168.200.7]) + by max.feld.cvut.cz (Postfix) with ESMTP id A6E4219F48FD; + Sat, 2 Jan 2016 22:24:31 +0100 (CET) +X-Virus-Scanned: IMAP STYX AMAVIS +Received: from max.feld.cvut.cz ([192.168.200.1]) + by localhost (styx.feld.cvut.cz [192.168.200.7]) (amavisd-new, port 10044) + with ESMTP id RB3W74fXPKXR; Sat, 2 Jan 2016 22:24:29 +0100 (CET) +Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34]) + by max.feld.cvut.cz (Postfix) with ESMTP id AE97319F474E; + Sat, 2 Jan 2016 22:24:28 +0100 (CET) +Received: from wsh by steelpick.2x.cz with local (Exim 4.86) + (envelope-from ) + id 1aFTf0-0002J7-N3; Sat, 02 Jan 2016 22:24:26 +0100 +From: Michal Sojka +To: fauno , notmuch@notmuchmail.org +Subject: Re: notmuch-mua and jl-encrypt (was: file-error "not a regular file") +In-Reply-To: <87k2nw6n2j.fsf@endefensadelsl.org> +References: + + <87wprzb4sj.fsf@endefensadelsl.org> <87ege6d41j.fsf@zancas.localnet> + <878u4e9jkx.fsf@endefensadelsl.org> <8737ukcm41.fsf@steelpick.2x.cz> + <87k2nw6n2j.fsf@endefensadelsl.org> +User-Agent: Notmuch/0.21+30~g55c056a (http://notmuchmail.org) Emacs/24.5.1 + (x86_64-pc-linux-gnu) +Date: Sat, 02 Jan 2016 22:24:26 +0100 +Message-ID: <871t9zektx.fsf@steelpick.2x.cz> +MIME-Version: 1.0 +Content-Type: text/plain +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.20 +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: Sat, 02 Jan 2016 21:24:36 -0000 + +Hi fauno, + +On Wed, Dec 30 2015, fauno wrote: +> Michal Sojka writes: +>> can you share more details about how do you use jl-encrypt and which +>> functions do not work? Recently, I posted a few patches that fix some +>> problems related to the replacing message-mode with +>> notmuch-message-mode. Maybe, there is more what we can do to not break +>> user's setups. +> +> i've been using jl-encrypt unmodified with notmuch for a while now. i +> just require it on my .emacs +> +> since 0.21, i had to rebind notmuch-message-mode C-c C-c and C-s C-s +> keys: +> +> (define-key notmuch-message-mode-map (kbd "C-c C-c") 'jl-message-send-and-exit) +> (define-key notmuch-message-mode-map (kbd "C-c C-s") 'jl-message-send) +> +> and solved the issue of fcc by setting notmuch-fcc-dirs to nil and +> making my mta send me bcc of my own email. +> +> this has worked correctly for the last week. +> +>> From a brief look at jl-encrypt, it seems it is tightly bound to gnus, +>> because it uses gnus-message-setup-hook. Maybe it will work again with +>> notmuch if you use my patch [1] and run +>> +>> (add-hook 'message-setup-hook 'jl-encrypt-if-possible) +> +> i applied your patch to the 0.21 release and byte-compiled notmuch-mua.el +> +> the message is sent unencrypted unless i rebind C-c C-c as before. the +> email is encrypted but it asks for the recipient, which i'm guessing +> emacs can't figure out for itself anymore? +> +> also tested with `emacs -q` and loading this file, and jl-encrypt never +> asks to encrypt the email when possible: +> +> # /tmp/emacs +> +> (require 'notmuch) +> (add-to-list 'load-path "~/.emacs.d/lisp/") +> (require 'jl-encrypt) +> (add-hook 'message-setup-hook 'jl-encrypt-if-possible) +> (add-hook 'message-setup-hook 'mml-secure-message-sign-pgpmime) +> +> by adding the C-c C-c rebind, it gets to encrypt, but asks for recipient +> again. + +I looked into this and I think that the following workaround could work +for you: + + (defun jl-notmuch-message-send-and-exit (&optional arg) + (interactive "P") + (let ((message-fcc-handler-function #'notmuch-fcc-handler)) + (jl-message-send-and-exit arg))) + + (defun jl-notmuch-message-send (&optional arg) + (interactive "P") + (let ((message-fcc-handler-function #'notmuch-fcc-handler)) + (jl-message-send arg))) + + (define-key notmuch-message-mode-map (kbd "C-c C-c") 'jl-notmuch-message-send-and-exit) + (define-key notmuch-message-mode-map (kbd "C-c C-s") 'jl-notmuch-message-send) + +Unfortunately, I couldn't find a less intrusive solution for now, +because notmuch uses the same "trick" (remapping keyboard shortcuts) as +jl-encrypt to override message sending from message.el. This means that +either jl-encrypt or notmuch can be bound to these keys but not both. + +Notmuch has to use this mechanism until the bug [1] is fixed in Emacs. + +Another possibility would be to introduce something like +notmuch-send-hook which would allow other packages to hook into notmuch +sending process, but this could be even more complex that the above +workaround, so I don't think it is worth the effort. + +Best regards, +-Michal + +[1] http://debbugs.gnu.org/cgi/bugreport.cgi?bug=21174 -- 2.26.2