Gnus development mailing list
 help / color / mirror / Atom feed
From: Katsumi Yamaoka <yamaoka@jpl.org>
Cc: ding@gnus.org
Subject: Re: Recovering newsgroup specific settings when editing drafts
Date: Thu, 13 Apr 2006 10:18:33 +0900	[thread overview]
Message-ID: <b9yr742z312.fsf@jpl.org> (raw)
In-Reply-To: <878xqbawko.fsf@denkblock.local>

>>>>> In <878xqbawko.fsf@denkblock.local> 
>>>>>	Elias Oltmanns <oltmanns@uni-bonn.de> wrote:

> here is a problem which I couldn't find a solution for. If you have
> code hooked into message-setup-hook or message-header-setup-hook which
> performs various actions depending on the current group, you would
> often want to have this code referring to the original group of a
> draft when pressing e in the drafts group. Good examples are changing
> ispell-local-dictionary or pgg-default-user-id. Since X-Draft-From
> holds the name of the group in which the message was originally
> created, the obvious way is to make the code refer to this header.
> However, message-fetch-field / message-field-value don't seem to have
> access to this variable by the time message-(header-)setup-hook is
> run. What would be the right way to accomplish my goal?

At that time, the `message-required-headers' variable has the
value of X-Draft-From header as:

(X-Draft-From
 lambda nil
 (gnus-inews-make-draft-meta-information
  "GROUP_NAME" '(ARTICLES)))

How about the following snippet?

  (with-temp-buffer
    (message-generate-headers message-required-headers)
    (message-fetch-field "X-Draft-From"))

I used the following hook to verify that it works.

(add-hook
 'message-header-setup-hook
 (lambda nil
   (let ((x-draft-from (with-temp-buffer
			 (message-generate-headers
			  message-required-headers)
			 (message-fetch-field "X-Draft-From"))))
     (save-restriction
       (widen)
       (message-goto-body)
       (insert (format "X-Draft-From's value is `%s'.\n"
		       x-draft-from))))))



  reply	other threads:[~2006-04-13  1:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-12 10:59 Elias Oltmanns
2006-04-13  1:18 ` Katsumi Yamaoka [this message]
2006-04-13 12:44   ` Elias Oltmanns

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

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

  git send-email \
    --in-reply-to=b9yr742z312.fsf@jpl.org \
    --to=yamaoka@jpl.org \
    --cc=ding@gnus.org \
    /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.
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 NNTP newsgroup(s).