emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] IMAP Gmail and org-mode links


From: Bob Newell
Subject: [O] IMAP Gmail and org-mode links
Date: Fri, 03 Mar 2017 09:13:19 -1000
User-agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.1 (gnu/linux)

Aloha kakou,

I'm cross-posting to both gnus and org lists, although I suspect the
readership overlaps greatly. I wanted to solve the problem of using
Gmail via IMAP with gnus and org-mode links, wherein if you make a link
from, say, INBOX, and then archive the mail, the link is no longer
valid. But in Gmail, everything is in All Mail--- but you don't want to
have to leave INBOX and go to All Mail just to make a link.

The first part is this. It's kludgy, but it works for me. It edits the
link just after creation to force it to point to All Mail if it's a
Gmail link. The regexp could possibly have to change in another
environment; I don't have a means to test that.

---
;; This function and defadvice attempts to solve the problem of Gmail
;; email being moved from folder to folder. We change org-mode email
;; links involving gmail to always point to the All Mail folder, where
;; everything resides except stuff that has been purged.

(defun changegroupinemaillink (&rest args)
  (if org-stored-links
    (let* ( (oldlink (car (car org-stored-links)))
            (newlink (replace-regexp-in-string
            "gmail:.*#" "gmail:[Gmail]/All Mail#" oldlink)))
        (setcar (car org-stored-links) newlink))))
(advice-add 'org-store-link :after #'changegroupinemaillink)
---

You should also use the gnus registry, with the nnregistry method added
as documented in the gnus manual. (You may have more methods than shown
below; modify to suit.

---
;; Referer (parent) lookup.
(setq gnus-refer-article-method
      '(current
        (nnregistry)))
--

Perhaps this is redundant, but as I've got it working and doing what I
need, I'm reluctant to mess it up :)

-- 
Bob Newell
Honolulu, Hawai`i
* Via Gnus/BBDB/Org/Emacs/Linux *



reply via email to

[Prev in Thread] Current Thread [Next in Thread]