;; 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 -")))