diff options
| -rw-r--r-- | notmuch.org | 88 | 
1 files changed, 41 insertions, 47 deletions
diff --git a/notmuch.org b/notmuch.org index 07bc472..7739d2e 100644 --- a/notmuch.org +++ b/notmuch.org @@ -385,7 +385,6 @@          ("TAB" . jao-notmuch-show-next-button)          ([backtab] . jao-notmuch-show-previous-button)          ("RET" . jao-notmuch-show-ret)))) -    #+end_src  * search    #+begin_src emacs-lisp @@ -493,53 +492,48 @@  * org mode      Stolen and adapted from [[https://gist.github.com/fedxa/fac592424473f1b70ea489cc64e08911][Fedor Bezrukov]].      #+begin_src emacs-lisp +      (defvar jao-org-notmuch-last-subject nil) +      (defun jao-org-notmuch-last-subject () jao-org-notmuch-last-subject) + +      (defun jao-notmuch--add-tags (tags) +        (if (derived-mode-p 'notmuch-show-mode) +            (notmuch-show-add-tag tags) +          (notmuch-tree-add-tag tags))) + +      (defun org-notmuch-store-link () +        "Store a link to a notmuch mail message." +        (cl-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)) +                  (subj (notmuch-show-get-subject)) +                  (description (format "Mail: %s" subj))) +             (setq jao-org-notmuch-last-subject subj) +             (when (y-or-n-p "Archive message? ") +               (jao-notmuch--add-tags '("+trove"))) +             (when (y-or-n-p "Flag message as todo? ") +               (jao-notmuch--add-tags '("+flagged"))) +             (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)) +                  (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))))) +        (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)) - -          (defvar jao-org-notmuch-last-subject nil) -          (defun jao-org-notmuch-last-subject () jao-org-notmuch-last-subject) - -          (defun jao-notmuch--add-tags (tags) -            (if (derived-mode-p 'notmuch-show-mode) -                (notmuch-show-add-tag tags) -              (notmuch-tree-add-tag tags))) - -          (defun org-notmuch-store-link () -            "Store a link to a notmuch mail message." -            (cl-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)) -                      (subj (notmuch-show-get-subject)) -                      (description (format "Mail: %s" subj))) -                 (setq jao-org-notmuch-last-subject subj) -                 (when (y-or-n-p "Archive message? ") -                   (jao-notmuch--add-tags '("+trove"))) -                 (when (y-or-n-p "Flag message as todo? ") -                   (jao-notmuch--add-tags '("+todo"))) -                 (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)) -                      (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))))))) +        (org-link-set-parameters "notmuch" +                                 :follow 'notmuch-show +                                 :store 'org-notmuch-store-link))      #+end_src  * arXiv      #+begin_src emacs-lisp  | 
