2018-01-07 04:50:52 +00:00
|
|
|
;;; packages.el --- Notmuch Layer packages File for Spacemacs
|
2017-08-11 18:46:41 +00:00
|
|
|
;;
|
2021-03-22 20:11:29 +00:00
|
|
|
;; Copyright (c) 2012-2021 Sylvain Benner & Contributors
|
2017-08-11 18:46:41 +00:00
|
|
|
;;
|
|
|
|
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
2021-03-24 03:31:44 +00:00
|
|
|
;; This program is free software; you can redistribute it and/or modify
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
|
|
|
;;
|
|
|
|
;; This program is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
;;
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
|
|
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2017-08-11 18:46:41 +00:00
|
|
|
|
2020-06-27 21:37:47 +00:00
|
|
|
(defconst notmuch-packages
|
|
|
|
'(
|
|
|
|
(counsel-notmuch :requires ivy)
|
|
|
|
(helm-notmuch :requires helm)
|
|
|
|
notmuch
|
|
|
|
org
|
|
|
|
persp-mode
|
|
|
|
window-purpose))
|
2020-03-15 22:58:23 +00:00
|
|
|
|
2017-08-11 18:46:41 +00:00
|
|
|
|
2018-01-07 04:50:52 +00:00
|
|
|
(defun notmuch/init-counsel-notmuch ()
|
|
|
|
(use-package counsel-notmuch
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2020-07-06 21:13:52 +00:00
|
|
|
:init (spacemacs/set-leader-keys "aenn" 'counsel-notmuch)))
|
2018-01-07 04:50:52 +00:00
|
|
|
|
|
|
|
(defun notmuch/init-helm-notmuch ()
|
|
|
|
(use-package helm-notmuch
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2020-07-06 21:13:52 +00:00
|
|
|
:init (spacemacs/set-leader-keys "aenn" 'helm-notmuch)))
|
2018-01-07 04:50:52 +00:00
|
|
|
|
2017-08-11 18:46:41 +00:00
|
|
|
(defun notmuch/init-notmuch ()
|
|
|
|
(use-package notmuch
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2018-01-10 21:23:06 +00:00
|
|
|
:commands notmuch
|
2017-08-11 18:46:41 +00:00
|
|
|
:init
|
|
|
|
(progn
|
2020-06-28 21:25:04 +00:00
|
|
|
(spacemacs/declare-prefix "aen" "notmuch")
|
2018-01-07 04:50:52 +00:00
|
|
|
(spacemacs/set-leader-keys
|
2020-06-28 21:25:04 +00:00
|
|
|
"aenN" 'notmuch
|
|
|
|
"aeni" 'spacemacs/notmuch-inbox
|
|
|
|
"aenj" 'notmuch-jump-search
|
|
|
|
"aens" 'notmuch-search))
|
2017-08-11 18:46:41 +00:00
|
|
|
:config
|
|
|
|
(progn
|
|
|
|
(dolist (prefix '(("ms" . "stash")
|
|
|
|
("mp" . "part")
|
|
|
|
("mP" . "patch")))
|
|
|
|
(spacemacs/declare-prefix-for-mode 'notmuch-show-mode
|
2018-01-07 04:50:52 +00:00
|
|
|
(car prefix) (cdr prefix)))
|
|
|
|
;; key bindings
|
|
|
|
(evil-define-key 'visual notmuch-search-mode-map
|
|
|
|
"*" 'notmuch-search-tag-all
|
|
|
|
"a" 'notmuch-search-archive-thread
|
|
|
|
"-" 'notmuch-search-remove-tag
|
|
|
|
"+" 'notmuch-search-add-tag)
|
2017-08-11 18:46:41 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'notmuch-show-mode
|
|
|
|
"a" 'notmuch-show-save-attachments
|
|
|
|
;; part
|
|
|
|
"pm" 'notmuch-show-choose-mime-of-part
|
2018-05-25 19:35:35 +00:00
|
|
|
"pp" 'spacemacs/notmuch-show-as-patch
|
2017-08-11 18:46:41 +00:00
|
|
|
"p|" 'notmuch-show-pipe-part
|
|
|
|
"po" 'notmuch-show-interactively-view-part
|
|
|
|
"pv" 'notmuch-show-view-part
|
|
|
|
"ps" 'notmuch-show-save-part
|
|
|
|
;; stash
|
|
|
|
"sG" 'notmuch-show-stash-git-send-email
|
|
|
|
"sL" 'notmuch-show-stash-mlarchive-link-and-go
|
|
|
|
"sl" 'notmuch-show-stash-mlarchive-link
|
|
|
|
"st" 'notmuch-show-stash-to
|
|
|
|
"sT" 'notmuch-show-stash-tags
|
|
|
|
"ss" 'notmuch-show-stash-subject
|
|
|
|
"sI" 'notmuch-show-stash-message-id-stripped
|
|
|
|
"si" 'notmuch-show-stash-message-id
|
|
|
|
"sf" 'notmuch-show-stash-from
|
|
|
|
"sF" 'notmuch-show-stash-filename
|
|
|
|
"sd" 'notmuch-show-stash-date
|
|
|
|
"sc" 'notmuch-show-stash-cc
|
|
|
|
;; patch
|
|
|
|
"Po" 'spacemacs/notmuch-show-open-github-patch
|
|
|
|
"Pa" 'spacemacs/notmuch-git-apply-patch
|
2018-01-07 04:50:52 +00:00
|
|
|
"PA" 'spacemacs/notmuch-git-apply-patch-part)
|
2020-03-15 22:58:23 +00:00
|
|
|
;; Evilify notmuch modes
|
|
|
|
;; Use normal mode map to allow proper editing capabilities
|
|
|
|
;; for the embedded search field in `notmuch-hello-mode`
|
|
|
|
(evil-set-initial-state 'notmuch-hello-mode 'normal)
|
|
|
|
(evil-define-key 'normal notmuch-hello-mode-map
|
|
|
|
"C-tab" #'widget-backward
|
|
|
|
"S-tab" #'widget-backward
|
|
|
|
"=" #'notmuch-refresh-this-buffer
|
|
|
|
"?" #'notmuch-help
|
|
|
|
"G" #'notmuch-poll-and-refresh-this-buffer
|
|
|
|
"g" #'notmuch-refresh-this-buffer
|
|
|
|
"J" #'notmuch-jump-search
|
|
|
|
"m" #'notmuch-mua-new-mail
|
|
|
|
"q" #'notmuch-bury-or-kill-this-buffer
|
|
|
|
"s" #'notmuch-search
|
|
|
|
"v" #'notmuch-hello-versions
|
|
|
|
"z" #'notmuch-tree
|
|
|
|
"M-=" #'notmuch-refresh-all-buffers)
|
2020-03-17 07:40:02 +00:00
|
|
|
;; Make notmuch message mode closable via q
|
2020-03-15 22:58:23 +00:00
|
|
|
(evil-define-key 'normal notmuch-message-mode-map
|
|
|
|
"q" #'message-kill-buffer)
|
2017-08-11 18:46:41 +00:00
|
|
|
(evilified-state-evilify-map notmuch-show-mode-map
|
|
|
|
:mode notmuch-show-mode
|
|
|
|
:bindings
|
2019-11-18 00:01:21 +00:00
|
|
|
(kbd "N") 'notmuch-show-next-message
|
|
|
|
(kbd "P") 'notmuch-show-previous-message
|
|
|
|
(kbd "p") 'notmuch-show-previous-open-message
|
2017-08-11 18:46:41 +00:00
|
|
|
(kbd "n") 'notmuch-show-next-open-message
|
|
|
|
(kbd "o") 'notmuch-show-open-or-close-all
|
2018-01-07 04:50:52 +00:00
|
|
|
(kbd "O") 'spacemacs/notmuch-show-close-all)
|
2017-08-11 18:46:41 +00:00
|
|
|
(evilified-state-evilify-map notmuch-tree-mode-map
|
|
|
|
:mode notmuch-tree-mode
|
|
|
|
:bindings
|
2019-11-18 00:01:21 +00:00
|
|
|
(kbd "N") 'notmuch-tree-next-message
|
|
|
|
(kbd "P") 'notmuch-tree-prev-message
|
2021-03-31 10:21:37 +00:00
|
|
|
(kbd "d") 'spacemacs/notmuch-tree-message-delete-down
|
|
|
|
(kbd "D") 'spacemacs/notmuch-tree-message-delete-up
|
2019-11-17 23:43:57 +00:00
|
|
|
(kbd "n") 'notmuch-tree-next-matching-message
|
|
|
|
(kbd "p") 'notmuch-tree-prev-matching-message
|
2021-07-30 10:20:47 +00:00
|
|
|
(kbd "M-d") 'notmuch-tree-scroll-message-window
|
|
|
|
(kbd "M-u") 'notmuch-tree-scroll-message-window-back
|
2017-08-11 18:46:41 +00:00
|
|
|
(kbd "M") 'compose-mail-other-frame)
|
|
|
|
(evilified-state-evilify-map notmuch-search-mode-map
|
|
|
|
:mode notmuch-search-mode
|
|
|
|
:bindings
|
|
|
|
(kbd "a") 'spacemacs/notmuch-search-archive-thread-down
|
|
|
|
(kbd "A") 'spacemacs/notmuch-search-archive-thread-up
|
2021-03-31 10:21:37 +00:00
|
|
|
(kbd "d") 'spacemacs/notmuch-search-message-delete-down
|
|
|
|
(kbd "D") 'spacemacs/notmuch-search-message-delete-up
|
2017-08-11 18:46:41 +00:00
|
|
|
(kbd "J") 'notmuch-jump-search
|
|
|
|
(kbd "L") 'notmuch-search-filter
|
|
|
|
(kbd "gg") 'notmuch-search-first-thread
|
|
|
|
(kbd "gr") 'notmuch-refresh-this-buffer
|
|
|
|
(kbd "gR") 'notmuch-refresh-all-buffers
|
|
|
|
(kbd "G") 'notmuch-search-last-thread
|
2018-01-07 04:50:52 +00:00
|
|
|
(kbd "M") 'compose-mail-other-frame))))
|
2017-08-11 18:46:41 +00:00
|
|
|
|
2018-01-07 04:50:52 +00:00
|
|
|
(defun notmuch/pre-init-org ()
|
|
|
|
(spacemacs|use-package-add-hook org
|
2020-01-03 09:38:40 +00:00
|
|
|
:post-config (require 'ol-notmuch)))
|
2018-01-07 05:44:50 +00:00
|
|
|
|
2018-01-10 04:01:34 +00:00
|
|
|
(defun notmuch/pre-init-persp-mode ()
|
|
|
|
(spacemacs|use-package-add-hook persp-mode
|
|
|
|
:post-config
|
2018-01-07 05:44:50 +00:00
|
|
|
(progn
|
2018-01-10 04:01:34 +00:00
|
|
|
(add-to-list 'persp-filter-save-buffers-functions
|
|
|
|
'spacemacs//notmuch-persp-filter-save-buffers-function)
|
|
|
|
(spacemacs|define-custom-layout notmuch-spacemacs-layout-name
|
|
|
|
:binding notmuch-spacemacs-layout-binding
|
|
|
|
:body
|
|
|
|
(progn
|
|
|
|
(dolist (mode notmuch-modes)
|
|
|
|
(let ((hook (intern (concat (symbol-name mode) "-hook"))))
|
|
|
|
(add-hook hook #'spacemacs//notmuch-buffer-to-persp)))
|
|
|
|
(call-interactively 'notmuch))))))
|
2018-01-08 07:53:13 +00:00
|
|
|
|
2020-06-27 21:37:47 +00:00
|
|
|
(defun notmuch/post-init-window-purpose ()
|
|
|
|
(let ((modes))
|
2018-01-08 07:53:13 +00:00
|
|
|
(dolist (mode notmuch-modes)
|
2020-06-27 21:37:47 +00:00
|
|
|
(add-to-list 'modes (cons mode 'mail)))
|
|
|
|
(purpose-set-extension-configuration
|
|
|
|
:notmuch-layer
|
|
|
|
(purpose-conf :mode-purposes modes))))
|