~pkal/autocrypt

ref: a5d67301c160ee37117ce4d321b4095bf9af95ae autocrypt/autocrypt-mu4e.el -rw-r--r-- 1.4 KiB
a5d67301Philip Kaludercic Revert to custom generic backend system 10 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
;;; autocrypt-mu4e.el --- Autocrypt for mu4e -*- lexical-binding:t -*-

;; Author: Philip K. <philip@warpmail.net>
;; Version: 0.4.0
;; Keywords: comm
;; Package-Requires: ((emacs "25.1"))
;; URL: https://git.sr.ht/~zge/autocrypt

;; This file is NOT part of Emacs.
;;
;; This file is in the public domain, to the extent possible under law,
;; published under the CC0 1.0 Universal license.
;;
;; For a full copy of the CC0 license see
;; https://creativecommons.org/publicdomain/zero/1.0/legalcode

;;; Commentary:

;; MUA specific functions for mu4e
;;
;; Setup with (add-hook 'mu4e-main-mode-hook #'autocrypt-mode)

;;; Code:

(require 'autocrypt)

(declare-function mu4e-view-raw-message "mu4e" ())

;;;###autocrypt
(defun autocrypt-mu4e--install ()
  "Install autocrypt hooks for mu4e."
  (add-hook 'mu4e-view-mode-hook #'autocrypt-process-header nil t)
  (add-hook 'mu4e-compose-mode-hook #'autocrypt-compose-setup nil t))

(defun autocrypt-mu4e--uninstall ()
  "Remove autocrypt hooks for mu4e."
  (remove-hook 'mu4e-view-mode-hook #'autocrypt-process-header)
  (remove-hook 'mu4e-compose-mode-hook #'autocrypt-compose-setup))

(defun autocrypt-mu4e--get-header (header)
  "Ask mu4e to return HEADER."
  (save-window-excursion
    (with-current-buffer (mu4e-view-raw-message)
      (prog1 (mail-fetch-field header)
        (kill-buffer (current-buffer))))))

(provide 'autocrypt-mu4e)

;;; autocrypt-mu4e.el ends here