summaryrefslogtreecommitdiffhomepage
path: root/notmuch.org
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-10-15 21:14:53 +0100
committerjao <jao@gnu.org>2021-10-15 21:14:53 +0100
commitf623f601436f480ff96ff85cd7763019d96fbaa7 (patch)
treeb804c72796ad5335533baabca5d8c81eb612f759 /notmuch.org
parentc8bf1d06b488634f466a54bd12acf4a5fb7d3093 (diff)
downloadelibs-f623f601436f480ff96ff85cd7763019d96fbaa7.tar.gz
elibs-f623f601436f480ff96ff85cd7763019d96fbaa7.tar.bz2
capture arXiv emails for notmuch
Diffstat (limited to 'notmuch.org')
-rw-r--r--notmuch.org39
1 files changed, 35 insertions, 4 deletions
diff --git a/notmuch.org b/notmuch.org
index 2e5b632..02afc6f 100644
--- a/notmuch.org
+++ b/notmuch.org
@@ -382,6 +382,7 @@
("u" . jao-notmuch-tree-flag)
("v" . notmuch-tree-scroll-message-window)
("V" . notmuch-tree-scroll-message-window-back)
+ ("x" . jao-notmuch-arXiv-capture)
("<" . jao-notmuch-tree-beginning-of-buffer)
(">" . jao-notmuch-tree-end-of-buffer)
("/" . notmuch-tree-view-raw-message)
@@ -431,6 +432,9 @@
"Visit the notmuch message or thread with id ID."
(notmuch-show id))
+ (defvar jao-org-notmuch-last-subject nil)
+ (defun jao-org-notmuch-last-subject () jao-org-notmuch-last-subject)
+
(defun org-notmuch-store-link ()
"Store a link to a notmuch mail message."
(cl-case major-mode
@@ -438,8 +442,9 @@
;; Store link to the current message
(let* ((id (notmuch-show-get-message-id))
(link (concat "notmuch:" id))
- (description (format "Mail: %s"
- (notmuch-show-get-subject))))
+ (subj (notmuch-show-get-subject))
+ (description (format "Mail: %s" subj)))
+ (setq jao-org-notmuch-last-subject subj)
(when (y-or-n-p "Archive message? ")
(if (derived-mode-p 'notmuch-show-mode)
(notmuch-show-archive-message)
@@ -456,13 +461,39 @@
;; Store link to the thread on the current line
(let* ((id (notmuch-search-find-thread-id))
(link (concat "notmuch:" id))
- (description (format "Mail: %s"
- (notmuch-search-find-subject))))
+ (subj (notmuch-search-find-subject))
+ (description (format "Mail: %s" subj)))
+ (setq jao-org-notmuch-last-subject subj)
(org-store-link-props
:type "notmuch"
:link link
:description description)))))))
#+end_src
+* arXiv
+ #+begin_src emacs-lisp
+ (use-package org-capture
+ :config
+ (add-to-list 'org-capture-templates
+ '("X" "arXiv" entry (file "notes/physics/arxiv.org")
+ "* %(jao-org-notmuch-last-subject)\n %i"
+ :immediate-finish t)
+ t)
+ (org-capture-upgrade-templates org-capture-templates))
+
+ (defun jao-notmuch-arXiv-capture ()
+ (interactive)
+ (save-window-excursion
+ (jao-notmuch-goto-message-buffer)
+ (save-excursion
+ (goto-char (point-min))
+ (re-search-forward "\\[ text/html \\]")
+ (forward-paragraph)
+ (setq-local transient-mark-mode 'lambda)
+ (set-mark (point))
+ (goto-char (point-max))
+ (org-capture nil "X"))))
+
+ #+end_src
* hydras
#+begin_src emacs-lisp
(major-mode-hydra-define notmuch-search-mode nil