Skip to content

Instantly share code, notes, and snippets.

@bjonnh
Created May 8, 2017 16:18
Show Gist options
  • Save bjonnh/35887209ab7d32b16779805f4a8c6d0e to your computer and use it in GitHub Desktop.
Save bjonnh/35887209ab7d32b16779805f4a8c6d0e to your computer and use it in GitHub Desktop.
(setq bjo-notmuch-packages
'(
;; package names go here
notmuch
helm-notmuch
org-notmuch
))
(setq bjo-notmuch-excluded-packages '())
(setq mm-text-html-renderer 'shr)
(defun nm-tag-active ()
(interactive)
(notmuch-search-tag '("+archive" "-inbox" "-unread"))
)
(defun tw-task-add (new-task)
(interactive "MTask to add: ")
(call-process "task" nil nil nil "add" new-task))
(defun tw-annotate-task (task-id annotation)
(call-process "task" nil nil nil task-id "annotate" annotation))
(defun tw-annotate-task-notmuch (task-id annotation)
(tw-annotate-task task-id (concat "notmuch:" annotation)))
(defun tw-annotate-task-email (task-id)
(interactive "MTask to annotate with email:")
(tw-annotate-task-notmuch task-id (notmuch-show-get-message-id)))
(defun tw-open-notmuch-id (notmuch-id-with-prefix)
(if (equal (substring notmuch-id-with-prefix 0 (length "notmuch:")) "notmuch:")
(notmuch-show (substring notmuch-id-with-prefix (length "notmuch:")))
))
(defun nm-tag (flag)
(interactive)
(if (region-active-p)
(setq beg (region-beginning) end (region-end))
(setq beg (point) end (point)))
(let ((search-string (notmuch-search-find-stable-query-region
beg end)))
(notmuch-tag search-string flag)
(notmuch-search-foreach-result beg end
(lambda (pos)
(notmuch-search-set-tags
(if (member flag (notmuch-search-get-tags pos))
(notmuch-update-tags (notmuch-search-get-tags pos) flag)
(notmuch-update-tags (notmuch-search-get-tags pos) flag)
)
pos)
)
)
)
)
(setq notmuch-always-prompt-for-sender t)
(setq notmuch-identities
(quote
("Jonathan BISSON <bjo@uic.edu>" "Jonathan BISSON <bjonnh@bjonnh.net>" "Jonathan BISSON <bjonnh-psone@bjonnh.net>" "NAPRALERT Team <napralert@uic.edu>" "CTO PumpingStation <cto@pumpingstationone.org>")))
(setq notmuch-mua-user-agent-function (quote notmuch-mua-user-agent-emacs))
(setq notmuch-saved-searches
(quote
(("inbox" . "tag:inbox and not tag:deleted")
("unread" . "tag:unread")
("deleted" . "tag:deleted")
("flagged" . "tag:flagged"))))
(setq notmuch-search-line-faces
(quote
(("unread" :weight bold)
("flagged" :foreground "brown2")
("deleted" :strike-through t)
("replied" :foreground "lawn green"))))
(setq notmuch-show-all-multipart/alternative-parts t)
(setq notmuch-show-all-tags-list t)
(setq notmuch-show-indent-multipart t)
(setq notmuch-show-logo nil)
(setq notmuch-show-only-matching-messages t)
(setq notmuch-show-relative-dates t)
(setq mail-envelope-from (quote header))
(setq mail-host-address "lenny.local")
(setq mail-specify-envelope-from t)
(setq message-send-mail-function (quote message-send-mail-with-sendmail))
(setq message-sendmail-envelope-from (quote header))
(setq message-sendmail-f-is-evil nil)
(setq sendmail-program "~/bin/nm_sendmail")
;(setq notmuch-address-selection-function
; (lambda (prompt collection initial-input)
; (completing-read prompt (cons initial-input collection) nil t nil 'notmuch-address-history)))
(defun bjo-notmuch/init-notmuch ()
"Initialize bjo-notmuch main"
(use-package notmuch
:defer t
:commands notmuch
:init
(progn
(spacemacs/set-leader-keys "an" 'notmuch)
(push "\\*notmuch.*\\*" spacemacs-useful-buffers-regexp)
))
)
(defun bjo-notmuch/init-helm-notmuch
()
(use-package helm-notmuch
:defer t)
)
(defun bjo-notmuch/init-org-notmuch
()
(use-package org-notmuch
:defer t)
)
(defun bjo-notmuch/init-notmuch-address ()
"Initialize bjo-notmuch address"
(use-package notmuch-address
:defer t
:init
(progn
(setq notmuch-address-command "~/bin/notmuch-addrlookup")
(notmuch-address-message-insinuate)
(setq notmuch-address-selection-function
(lambda (prompt collection initial-input)
(completing-read prompt (cons initial-input collection) nil t nil 'notmuch-address-history)))
)
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment