emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* IMAP Gmail and org-mode links
@ 2017-03-03 19:13 Bob Newell
  0 siblings, 0 replies; only message in thread
From: Bob Newell @ 2017-03-03 19:13 UTC (permalink / raw)
  To: info-gnus-english, emacs-orgmode

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 *

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-03-03 19:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-03 19:13 IMAP Gmail and org-mode links Bob Newell

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).