emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bastien <bzg@gnu.org>
To: Ivan Kanis <ivan@kanis.fr>
Cc: org mode <emacs-orgmode@gnu.org>, Gnus General <ding@gnus.org>
Subject: Re: Capturing outgoing gnus e-mail
Date: Sat, 14 Jun 2014 11:05:18 +0200	[thread overview]
Message-ID: <87mwdfg8tt.fsf@bzg.ath.cx> (raw)
In-Reply-To: <8761k3rivi.fsf@kanis.fr> (Ivan Kanis's message of "Sat, 14 Jun	2014 10:32:49 +0200")

Hi Ivan,

this is what I use :

========================================================================
;; Hack to store Org links upon sending Gnus messages

(defun bzg-message-send-and-org-gnus-store-link (&optional arg)
  "Send message with `message-send-and-exit' and store org link to message copy.
If multiple groups appear in the Gcc header, the link refers to
the copy in the last group."
  (interactive "P")
    (save-excursion
      (save-restriction
        (message-narrow-to-headers)
        (let ((gcc (car (last
                         (message-unquote-tokens
                          (message-tokenize-header
                           (mail-fetch-field "gcc" nil t) " ,")))))
              (buf (current-buffer))
              (message-kill-buffer-on-exit nil)
              id to from subject desc link newsgroup xarchive)
        (message-send-and-exit arg)
        (or
         ;; gcc group found ...
         (and gcc
              (save-current-buffer
                (progn (set-buffer buf)
                       (setq id (org-remove-angle-brackets
                                 (mail-fetch-field "Message-ID")))
                       (setq to (mail-fetch-field "To"))
                       (setq from (mail-fetch-field "From"))
                       (setq subject (mail-fetch-field "Subject"))))
              (org-store-link-props :type "gnus" :from from :subject subject
                                    :message-id id :group gcc :to to)
              (setq desc (org-email-link-description))
              (setq link (org-gnus-article-link
                          gcc newsgroup id xarchive))
              (setq org-stored-links
                    (cons (list link desc) org-stored-links)))
         ;; no gcc group found ...
         (message "Can not create Org link: No Gcc header found."))))))

(define-key message-mode-map [(control c) (control meta c)]
  'bzg-message-send-and-org-gnus-store-link)
========================================================================

Then, in a message, I use C-c C-M-c instead of C-c C-c to send the
message and create a link to it that I can reinsert later one.  This
is not really capturing, but it's good enough for my needs.

HTH,

-- 
 Bastien

  reply	other threads:[~2014-06-14  9:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-14  8:32 Capturing outgoing gnus e-mail Ivan Kanis
2014-06-14  9:05 ` Bastien [this message]
2014-12-15 12:08   ` Uwe Brauer
2014-06-14 10:06 ` Eric Abrahamsen
2014-06-16  2:08   ` Esben Stien
2014-06-16 13:29     ` Eric Abrahamsen
2014-09-24 21:04 ` Ted Zlatanov
2014-12-14 22:58   ` Uwe Brauer
  -- strict thread matches above, loose matches on Subject: below --
2014-06-14 14:43 Marvin Doyley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mwdfg8tt.fsf@bzg.ath.cx \
    --to=bzg@gnu.org \
    --cc=ding@gnus.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=ivan@kanis.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).