notmuch: Set up org-capture

master
Pierre Neidhardt 2019-03-18 10:51:26 +01:00
parent 81de9c1599
commit 5ef0010edd
2 changed files with 25 additions and 1 deletions

View File

@ -41,8 +41,13 @@
notmuch-show-mode-map
notmuch-tree-mode-map))
(define-key map "s" 'helm-notmuch)))
(when (require 'org-notmuch nil 'noerror)
(dolist (map (list notmuch-show-mode-map notmuch-tree-mode-map))
(define-key map (kbd "C-c C-t") 'org-capture))
(add-to-list 'org-capture-templates
`("t" "Mark e-mail in agenda" entry (file+headline ,(car org-agenda-files) "E-mails")
"* %?\nSCHEDULED: %(org-insert-time-stamp (org-read-date nil t \"++7d\" nil (notmuch-show-get-date)))\n%a\n")))
(require 'org-notmuch nil 'noerror)
(defun notmuch-show-bounce (&optional address)
"Bounce the current message."

View File

@ -1,4 +1,23 @@
(require 'notmuch-message)
;; TODO: Report org-notmuch-store-link upstream.
(defun org-notmuch-store-link ()
"Store a link to a notmuch search or message."
(when (or (eq major-mode 'notmuch-show-mode)
(eq major-mode 'notmuch-tree-mode))
(let* ((message-id (notmuch-show-get-message-id t))
(subject (notmuch-show-get-subject))
(to (notmuch-show-get-to))
(from (notmuch-show-get-from))
(date (org-trim (notmuch-show-get-date)))
desc link)
(org-store-link-props :type "notmuch" :from from :to to :date date
:subject subject :message-id message-id)
(setq desc (org-email-link-description))
(setq link (concat "notmuch:id:" message-id))
(org-add-link-props :link link :description desc)
link)))
;; From https://notmuchmail.org/pipermail/notmuch/2018/026423.html
;; attachment checks