From 50d3eefc9a9c595dac8cb08515caf46991dc3a59 Mon Sep 17 00:00:00 2001 From: jao Date: Sun, 20 Jun 2021 02:48:21 +0100 Subject: ol-notmuch --- email.org | 73 ++++++++++++++++++++------------------------------------------- 1 file changed, 23 insertions(+), 50 deletions(-) (limited to 'email.org') diff --git a/email.org b/email.org index dacbedf..9010012 100644 --- a/email.org +++ b/email.org @@ -329,7 +329,8 @@ (:name "S" :query "tag:new and tag:bigml and tag:support") (:name "W" :query "tag:new and tag:bigml" :face jao-themes-dimm) (:name "I" :query "tag:new and tag:jao and tag:inbox") - (:name "J" :query "tag:new and tag:jao" :face jao-themes-dimm) + (:name "J" :query "tag:new and tag:jao and not tag:emacs" + :face jao-themes-dimm) (:name "E" :query "tag:new and tag:emacs" :face jao-themes-dimm) (:name "N" :query "tag:new and tag:gmane and not tag:emacs" :face jao-themes-dimm) @@ -401,6 +402,24 @@ ,(jao-notmuch--q "new" nil "n" '("tag:new")) ,(jao-notmuch--q "draft" nil "d" '("tag:draft")))) #+end_src +*** enclosures + #+begin_src emacs-lisp + (with-eval-after-load "notmuch-show" + (defun jao-notmuch-open-enclosure (add) + (interactive "P") + (with-current-notmuch-show-message + (goto-char (point-min)) + (if (not (search-forward "Enclosure:" nil t)) + (user-error "No enclosure in message body") + (re-search-forward "https?://" nil t) + (if-let (url (thing-at-point-url-at-point)) + (progn + (message "%s %s ..." (if add "Adding" "Playing") url) + (unless add (jao-mpc-clear)) + (jao-mpc-add-url url) + (unless add (jao-mpc-play))) + (error "Found an enclosure, but not a link!")))))) + #+end_src *** package #+begin_src emacs-lisp (if (< emacs-major-version 28) @@ -408,7 +427,6 @@ (add-to-list 'load-path "/usr/local/share/emacs/site-lisp/")) (use-package notmuch - ;; :ensure t :init (setq notmuch-draft-folder "trove/drafts" notmuch-draft-quoted-tags '("part") @@ -475,21 +493,6 @@ (let ((notmuch-hello-auto-refresh nil)) (notmuch-hello))) (jao-notmuch-hello-first)))) - (defun jao-notmuch-open-enclosure (add) - (interactive "P") - (with-current-notmuch-show-message - (goto-char (point-min)) - (if (not (search-forward "Enclosure:" nil t)) - (user-error "No enclosure in message body") - (re-search-forward "https?://" nil t) - (if-let (url (thing-at-point-url-at-point)) - (progn - (message "%s %s ..." (if add "Adding" "Playing") url) - (unless add (jao-mpc-clear)) - (jao-mpc-add-url url) - (unless add (jao-mpc-play))) - (error "Found an enclosure, but not a link!"))))) - :hook ((notmuch-hello-refresh . jao-notmuch-notify) (jao-afio-switch . jao-notmuch-refresh-hello)) @@ -610,37 +613,7 @@ *** org mode integration Stolen and adapted from [[https://gist.github.com/fedxa/fac592424473f1b70ea489cc64e08911][Fedor Bezrukov]]. #+begin_src emacs-lisp - (with-eval-after-load "org" - (with-eval-after-load "notmuch" - (org-link-set-parameters "notmuch" - :follow 'org-notmuch-open - :store 'org-notmuch-store-link) - - (defun org-notmuch-open (id) - "Visit the notmuch message or thread with id ID." - (notmuch-show id)) - - (defun org-notmuch-store-link () - "Store a link to a notmuch mail message." - (case major-mode - ((notmuch-show-mode notmuch-tree-mode) - ;; 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)))) - (org-store-link-props - :type "notmuch" - :link link - :description description))) - (notmuch-search-mode - ;; 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)))) - (org-store-link-props - :type "notmuch" - :link link - :description description))))))) + (jao-load-path "ol-notmuch") + (use-package ol-notmuch + :demand t) #+end_src -- cgit v1.2.3