Gnus development mailing list
 help / color / mirror / Atom feed
* Recovering newsgroup specific settings when editing drafts
@ 2006-04-12 10:59 Elias Oltmanns
  2006-04-13  1:18 ` Katsumi Yamaoka
  0 siblings, 1 reply; 3+ messages in thread
From: Elias Oltmanns @ 2006-04-12 10:59 UTC (permalink / raw)


Hi all,

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?

Thanks in advance,

Elias




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Recovering newsgroup specific settings when editing drafts
  2006-04-12 10:59 Recovering newsgroup specific settings when editing drafts Elias Oltmanns
@ 2006-04-13  1:18 ` Katsumi Yamaoka
  2006-04-13 12:44   ` Elias Oltmanns
  0 siblings, 1 reply; 3+ messages in thread
From: Katsumi Yamaoka @ 2006-04-13  1:18 UTC (permalink / raw)
  Cc: ding

>>>>> 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))))))



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Recovering newsgroup specific settings when editing drafts
  2006-04-13  1:18 ` Katsumi Yamaoka
@ 2006-04-13 12:44   ` Elias Oltmanns
  0 siblings, 0 replies; 3+ messages in thread
From: Elias Oltmanns @ 2006-04-13 12:44 UTC (permalink / raw)


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




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-04-13 12:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-12 10:59 Recovering newsgroup specific settings when editing drafts Elias Oltmanns
2006-04-13  1:18 ` Katsumi Yamaoka
2006-04-13 12:44   ` Elias Oltmanns

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).