Hi Ulf,

Ulf Stegemann <ulf-n...@zeitform.de> writes:

> (defun ulf-message-send-and-org-gnus-store-link (&optional arg)

This is something I've been trying to achieve for very long!  Great 
you found a solution.  A minor suggestion: the function should make 
sure the buffer is not killed after the message is sent.

I added (message-kill-buffer-on-exit nil) like this:

--8<---------------cut here---------------start------------->8---
(defun ulf-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")
        (let ((gcc (car (last
                           (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)
         ;; gcc group found ...
         (and gcc
                (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."))))))
--8<---------------cut here---------------end--------------->8---

I also added an entry in org-hacks.org.



Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.

Reply via email to