Created
March 9, 2014 13:59
-
-
Save til/9448139 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(custom-set-variables | |
'(notmuch-fcc-dirs "archive") | |
'(notmuch-message-headers (quote ("Subject" "To" "Cc" "Date"))) | |
'(notmuch-poll-script "notmuch-rsync") | |
'(notmuch-search-oldest-first nil) | |
'(notmuch-show-all-multipart/alternative-parts nil) | |
'(notmuch-show-indent-messages-width 0) | |
'(notmuch-show-logo t) | |
'(notmuch-show-part-button-default-action (quote notmuch-show-view-part)) | |
) | |
;; brute force override key set in widget-keymap | |
(add-hook | |
'notmuch-show-hook | |
'(lambda () (local-set-key (kbd "<C-tab>") 'ido-switch-buffer))) | |
(require 'org-protocol) | |
(require 'org-notmuch) | |
;; I wish this would work | |
(defun notmuch-todo-add () | |
"Create a TODO entry into an org file for the current message" | |
(interactive) | |
(org-notmuch-store-link) | |
(with-current-buffer "projects.org<tils/org>" | |
(end-of-buffer) | |
; TODO make sure there is a newline | |
(insert "* TODO ") | |
(let ((link (car org-stored-links))) | |
(insert (org-make-link-string (car link) (cadr link)))) | |
(insert " :mail:") | |
(org-fix-tags-on-the-fly) ; doesn't work | |
(newline) | |
(org-insert-time-stamp (current-time) nil t) | |
(newline) | |
(save-buffer)) | |
(notmuch-show-tag "-inbox") | |
(message "Added mail as TODO entry to projects.org") | |
) | |
(require 'notmuch) | |
(setq notmuch-wash-wrap-lines-length 80) | |
(define-key notmuch-show-mode-map (kbd "C-c t") 'notmuch-todo-add) | |
(define-key notmuch-show-mode-map "d" | |
(lambda () | |
"toggle deleted tag for message" | |
(interactive) | |
(notmuch-show-tag-message | |
(if (member "deleted" (notmuch-show-get-tags)) | |
"-deleted" "+deleted")))) | |
(define-key notmuch-search-mode-map "d" | |
(lambda () | |
"add deleted tag" | |
(interactive) | |
(notmuch-search-tag '("+deleted" "-inbox")) | |
(notmuch-search-next-thread))) | |
(define-key notmuch-search-mode-map "g" 'notmuch-search-poll-and-refresh-view) | |
;; Import addresses into bbdb | |
(defun bbdb/snarf-header-value (header-value) | |
"Parse a header value string and add to bbdb, skip errors" | |
(let ((added-addresses '())) | |
(dolist (person (mail-header-parse-addresses header-value)) | |
(condition-case nil | |
(progn | |
(bbdb-create-internal (cdr person) nil nil nil (car person)) | |
(setq added-addresses (cons (cdr person) added-addresses))) | |
(error | |
(message (concat "error adding " (cdr person)))))) | |
(bbdb-save) | |
(concat "Added: " (mapconcat 'identity added-addresses ", "))) | |
) | |
(defun snarf () | |
"From notmuch show buffer, import addresses from all headers" | |
(interactive) | |
(dolist (header '(:From :To :Cc)) | |
(bbdb/snarf-header-value (notmuch-show-get-header header)))) | |
;; Sign messages by default. | |
(add-hook 'message-setup-hook 'mml-secure-message-sign) | |
;; Improve notmuch washing of original message quotes | |
(setq notmuch-wash-original-regexp | |
(concat "^" | |
"\\(--+\s?[oO]riginal [mM]essage\s?--+\\)" | |
"\\|" | |
"\\(On .+\\( | |
.+\\)? wrote:\\)" | |
"\\|" | |
"\\(Am .+ schrieb .+\\( | |
.+\\)?:\\)" | |
"$")) | |
(define-button-type 'notmuch-wash-button-invisibility-toggle-type | |
'action 'notmuch-wash-toggle-invisible-action | |
'follow-link t | |
'face 'notmuch-search-non-matching-authors | |
:supertype 'notmuch-button-type) | |
(define-button-type 'notmuch-wash-button-citation-toggle-type | |
'help-echo "mouse-1, RET: Show citation" | |
:supertype 'notmuch-wash-button-invisibility-toggle-type) | |
(define-button-type 'notmuch-wash-button-signature-toggle-type | |
'help-echo "mouse-1, RET: Show signature" | |
:supertype 'notmuch-wash-button-invisibility-toggle-type) | |
(define-button-type 'notmuch-wash-button-original-toggle-type | |
'help-echo "mouse-1, RET: Show original message" | |
:supertype 'notmuch-wash-button-invisibility-toggle-type) | |
(require 'bbdb) | |
(bbdb-initialize) | |
(bbdb-insinuate-message) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment