Re: How to create/add-to-existing headers in a posting style?

2012-07-16 Thread Tassilo Horn
a...@koldfront.dk (Adam Sjøgren) writes:

>> Another approach was to use gnus-parameters to add your
>> append-hugo-in-cc function to message-header-hook (or
>> message-header-setup-hook?) locally for this group.
>
> How do I add it locally? Ah, add-hook has a LOCAL parameter. Hm. Let's
> see if I can figure this out...

I think, there's no way to do it that way.  An existing variable in
group parameters will be automagically be made local in the
corresponding summary buffer.  So something like

 ("my\.special\.group"
   (message-setup-hook
 (append message-setup-hook
 (list (lambda () ...)

Probably, you can just use cons instead of append.  But I wan't sure if
your function maybe needs something that's setup by some other function
in message-setup-hook that needs to run earlier therefore.

> Which kind of works; the only problem with this is, that it leaves an
> empty header "X-Add-To-Cc" in the buffer, which is ugly - but I
> couldn't figure out how to have my function run without adding a
> header...

The above should omit this header creation.

Bye,
Tassilo


___
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english


Re: How to create/add-to-existing headers in a posting style?

2012-07-16 Thread Adam Sjøgren
On Mon, 16 Jul 2012 11:59:37 +0200, Peter wrote:

> On Mon, Jul 16 2012, Adam Sjøgren wrote:

>> the only problem with this is, that it leaves an empty header
>> "X-Add-To-Cc" in the buffer,

> What about (message-remove-header "X-Add-To-Cc") ?

Where should I stick that? Ah. In the end of the function I add to the
hook, of course. Thanks!

It is still kind of ugly, though...


  Best regards,

Adam

-- 
 "Godnat og sov rigtigt godt eller, subsidiært, hop opAdam Sjøgren
  og ned og hav det rigtigt af helvede til." a...@koldfront.dk


___
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english


Re: How to create/add-to-existing headers in a posting style?

2012-07-16 Thread Peter Münster
On Mon, Jul 16 2012, Adam Sjøgren wrote:

> the only problem with this is, that it leaves an empty header
> "X-Add-To-Cc" in the buffer,

What about (message-remove-header "X-Add-To-Cc") ?

-- 
   Peter


___
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english


Re: How to create/add-to-existing headers in a posting style?

2012-07-16 Thread Adam Sjøgren
On Sun, 15 Jul 2012 21:40:44 +0200, Tassilo wrote:

> Another approach was to use gnus-parameters to add your
> append-hugo-in-cc function to message-header-hook (or
> message-header-setup-hook?) locally for this group.

How do I add it locally? Ah, add-hook has a LOCAL parameter. Hm. Let's
see if I can figure this out...

Ok, this is what I have cobbled together in the group parameters of the
group in question:

 ((x-add-to-cc
   (lambda nil
 (add-hook 'message-setup-hook
   (lambda nil
 (save-excursion
   (message-goto-cc)
   (when
   (not
(string-match "gottahavethisi...@example.org"
  (buffer-substring-no-properties
   (line-beginning-position)
   (line-end-position
 (when
 (not
  (=
   (-
(point)
(line-beginning-position))
   4))
   (insert ", "))
 (insert "gottahavethisi...@example.org"
   nil t)
 "")

Which kind of works; the only problem with this is, that it leaves an
empty header "X-Add-To-Cc" in the buffer, which is ugly - but I couldn't
figure out how to have my function run without adding a header...

Any ideas to clean this up will be much appreciated.


  Best regards,

Adam

-- 
 "Godnat og sov rigtigt godt eller, subsidiært, hop opAdam Sjøgren
  og ned og hav det rigtigt af helvede til." a...@koldfront.dk


___
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english