From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bob Newell Subject: IMAP Gmail and org-mode links Date: Fri, 03 Mar 2017 09:13:19 -1000 Message-ID: <87d1dyrx68.fsf@bobnewell.net> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47323) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjsds-0007j6-3d for emacs-orgmode@gnu.org; Fri, 03 Mar 2017 14:13:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cjsdo-0004In-Uc for emacs-orgmode@gnu.org; Fri, 03 Mar 2017 14:13:28 -0500 Received: from mail-pg0-x229.google.com ([2607:f8b0:400e:c05::229]:33324) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cjsdo-0004Hw-NI for emacs-orgmode@gnu.org; Fri, 03 Mar 2017 14:13:24 -0500 Received: by mail-pg0-x229.google.com with SMTP id 25so46854057pgy.0 for ; Fri, 03 Mar 2017 11:13:23 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" 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 *