Re: notmuch-mua and jl-encrypt (was: file-error "not a regular file")

2016-01-02 Thread Michal Sojka
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 ( arg)
  (interactive "P")
  (let ((message-fcc-handler-function #'notmuch-fcc-handler))
(jl-message-send-and-exit arg)))
 
(defun jl-notmuch-message-send ( 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
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


notmuch-mua and jl-encrypt (was: file-error "not a regular file")

2015-12-30 Thread fauno
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 hope this info is useful :)

> -Michal
>
> [1] id:1450690875-2111-2-git-send-email-sojk...@fel.cvut.cz

-- 
:D


signature.asc
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch