aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/overlays/kookie/emacs/notmuch/default.el
blob: ba6b8ac12a2d8e16101852892dea5c0b85784587 (plain)
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
;; magit.el
;;   Configure magit utilities to apply mail patches
;;
;; This module depends on notmuch mail handling.
;;
;;
;; This file is part of LIBKOOKIE, a collection of nix expressions.
;; LIBKOOKIE is licensed under the GPL-3.0 (or later) -- see LICENSE

(provide 'kookie-notmuch)

(require 'magit)

;;; Configure notmuch 
(autoload 'notmuch "notmuch" "notmuch mail" t)
(setq notmuch-search-oldest-first nil)
(setq mml-secure-openpgp-encrypt-to-self t)
(setq mml-secure-smime-encrypt-to-self t)

(add-hook 'message-setup-hook 'mml-secure-message-sign-pgpmime)
(add-hook 'notmuch-hello-refresh-hook
          (lambda ()
            (if (and (eq (point) (point-min))
                     (search-forward "Saved searches:" nil t))
                (progn
                  (forward-line)
                  (widget-forward 1))
              (if (eq (widget-type (widget-at)) 'editable-field)
                  (beginning-of-line)))))

(define-transient-command notmuch-apply-email ()
  "Apply patches received by email."
  ["Arguments"
   ("-s" "Sign off on patches" ("-s" "--signoff"))
   ("-r" "Set this reject thingy" ("-r" "--reject"))
   ("-o" "Skip cover letter automatically" ("-o" "--skip-coverletter"))]
  ["Method"
   ("p" "patchset" notmuch--apply-email)])

(defun notmuch--apply-email ()
  "Apply a patch directly from a notmuch frame."
  (interactive)
  (let ((repository (read-directory-name "Select repository")))
    (cd repository)
    (notmuch-show-pipe-message t "git am -3 -")))