Gnus development mailing list
 help / color / mirror / Atom feed
From: Elias Oltmanns <oltmanns@uni-bonn.de>
Subject: Re: Recovering newsgroup specific settings when editing drafts
Date: Thu, 13 Apr 2006 14:44:28 +0200	[thread overview]
Message-ID: <87fykhtzkj.fsf@denkblock.local> (raw)
In-Reply-To: <b9yr742z312.fsf@jpl.org>

Katsumi Yamaoka <yamaoka@jpl.org> wrote:
>>>>>> 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))))))

No. That doesn't work for me at all. I've just copied this very
snippet and rubbed out all of my own adjustments to
message-header-setup-hook. When I pressed F in order to respond to
your message, the line reporting the value of X-Draft-From is inserted
below the yanked in message of yours. Half way through I hit C-c C-d
and quit gnus. After restarting gnus I pressed e on the draft response
in the drafts buffer. This time the hook didn't output anything at
all. Wondering about it and pressing C-c C-k straight away (answering
no to the question whether to delete the backup file) made things even
worse. Trying to leave the summary buffer produced a message saying
something about changing to a deleted buffer but didn't return to the
Group buffer.

By the way, I'm using No Gnus and emacs devel (latest packages from
debian sid).

Regards,

Elias




      reply	other threads:[~2006-04-13 12:44 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
2006-04-13 12:44   ` Elias Oltmanns [this message]

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=87fykhtzkj.fsf@denkblock.local \
    --to=oltmanns@uni-bonn.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.
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).