From: Bastien <bastien.guerry@wikimedia.fr>
To: Ulf Stegemann <ulf-news@zeitform.de>
Cc: emacs-orgmode@gnu.org
Subject: Re: Re: Store link upon sending a message
Date: Tue, 04 Jan 2011 18:51:30 +0100 [thread overview]
Message-ID: <87k4ik1rrx.fsf@altern.org> (raw)
In-Reply-To: <zf.upn7hgizob6.fsf@zeitform.de> (Ulf Stegemann's message of "Fri, 12 Nov 2010 14:03:41 +0100")
Hi Ulf,
Ulf Stegemann <ulf-news@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")
(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."))))))
--8<---------------cut here---------------end--------------->8---
I also added an entry in org-hacks.org.
Thanks!
--
Bastien
next prev parent reply other threads:[~2011-01-04 17:51 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-01 9:11 Store link upon sending a message Ulf Stegemann
2010-10-01 9:58 ` Łukasz Stelmach
2010-10-01 10:56 ` Ulf Stegemann
2010-11-12 13:03 ` Ulf Stegemann
2010-11-12 13:58 ` Eric S Fraga
2010-11-12 14:55 ` Ulf Stegemann
2010-11-12 15:52 ` Eric S Fraga
2010-11-12 16:07 ` Ulf Stegemann
2010-11-12 16:20 ` Eric S Fraga
2010-11-12 15:54 ` Ulf Stegemann
2010-11-12 16:03 ` Eric S Fraga
2011-01-04 17:51 ` Bastien [this message]
2011-01-05 7:24 ` Ulf Stegemann
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=87k4ik1rrx.fsf@altern.org \
--to=bastien.guerry@wikimedia.fr \
--cc=emacs-orgmode@gnu.org \
--cc=ulf-news@zeitform.de \
/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).