aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/overlays/kookie/emacs/notmuch/default.el
diff options
context:
space:
mode:
Diffstat (limited to 'infra/libkookie/overlays/kookie/emacs/notmuch/default.el')
-rw-r--r--infra/libkookie/overlays/kookie/emacs/notmuch/default.el47
1 files changed, 47 insertions, 0 deletions
diff --git a/infra/libkookie/overlays/kookie/emacs/notmuch/default.el b/infra/libkookie/overlays/kookie/emacs/notmuch/default.el
new file mode 100644
index 000000000000..ba6b8ac12a2d
--- /dev/null
+++ b/infra/libkookie/overlays/kookie/emacs/notmuch/default.el
@@ -0,0 +1,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 -")))
+
+