[PATCH 0/2] scaffolding for autocrypt support

classic Classic list List threaded Threaded
4 messages Options
David Edmondson David Edmondson
Reply | Threaded
Open this post in threaded view
|

[PATCH 0/2] scaffolding for autocrypt support

I started looking at how to add autocrypt support based on
https://git.sr.ht/~zge/autocrypt.

Sending seems straightforward, as far as I understand autocrypt, at
least.

Dealing with inbound messages requires a few framework changes in the
existing notmuch emacs code, which is these two patches. They are not
autocrypt specific, and could be generally useful.

I'll send autocrypt patches after some more testing and
improvement. Currently things are pretty inefficient -
autocrypt-notmuch-header will request the raw message on every call,
which is expensive if the message is large.

David Edmondson (2):
  emacs: with-current-notmuch-show-message should return the result of
    body
  emacs: Add notmuch-show-insert-msg-hook

 emacs/notmuch-show.el | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

--
2.29.2
_______________________________________________
notmuch mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]
David Edmondson David Edmondson
Reply | Threaded
Open this post in threaded view
|

[PATCH 1/2] emacs: with-current-notmuch-show-message should return the result of body

Rather than returning the result of kill-buffer,
with-current-notmuch-show-message should return the result of calling
the passed body.
---
 emacs/notmuch-show.el | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index b08ceb97..222c9dae 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -272,11 +272,12 @@ position of the message in the thread."
   `(save-excursion
      (let ((id (notmuch-show-get-message-id)))
        (let ((buf (generate-new-buffer (concat "*notmuch-msg-" id "*"))))
- (with-current-buffer buf
-   (let ((coding-system-for-read 'no-conversion))
-     (call-process notmuch-command nil t nil "show" "--format=raw" id))
-   ,@body)
- (kill-buffer buf)))))
+ (prog1
+  (with-current-buffer buf
+    (let ((coding-system-for-read 'no-conversion))
+      (call-process notmuch-command nil t nil "show" "--format=raw" id))
+    ,@body)
+  (kill-buffer buf))))))
 
 (defun notmuch-show-turn-on-visual-line-mode ()
   "Enable Visual Line mode."
--
2.29.2
_______________________________________________
notmuch mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]
David Edmondson David Edmondson
Reply | Threaded
Open this post in threaded view
|

[PATCH 2/2] emacs: Add notmuch-show-insert-msg-hook

In reply to this post by David Edmondson
Add a hook called after inserting each message into the buffer showing
messages.
---
 emacs/notmuch-show.el | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 222c9dae..292677bc 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -111,6 +111,12 @@ visible for any given message."
   :group 'notmuch-show
   :group 'notmuch-hooks)
 
+(defcustom notmuch-show-insert-msg-hook nil
+  "Functions called after inserting a message."
+  :type 'hook
+  :group 'notmuch-show
+  :group 'notmuch-hooks)
+
 (defcustom notmuch-show-max-text-part-size 100000
   "Maximum size of a text part to be shown by default in characters.
 
@@ -1104,7 +1110,9 @@ is t, hide the part initially and show the button."
     ;; Message visibility depends on whether it matched the search
     ;; criteria.
     (notmuch-show-message-visible msg (and (plist-get msg :match)
-   (not (plist-get msg :excluded))))))
+   (not (plist-get msg :excluded))))
+
+    (run-hooks 'notmuch-show-insert-msg-hook)))
 
 (defun notmuch-show-toggle-process-crypto ()
   "Toggle the processing of cryptographic MIME parts."
--
2.29.2
_______________________________________________
notmuch mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 2/2] emacs: Add notmuch-show-insert-msg-hook

David Edmondson <[hidden email]> writes:

> Add a hook called after inserting each message into the buffer showing
> messages.

first patch is fine, second no longer applies.

d
_______________________________________________
notmuch mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]