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

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

 Note that I am using Group Parameters on the group in question rather
 than setting the gnus-parameters variable.

Shouldn't make a difference.

 After factorying out the lambda to a named function I did
 toggle-debug-on-error and got this backtrace:

Hm, I can't reproduce the error.  But now I know that this approach
won't work anyway. :-(

The reason is that the new value of message-mode-hook is buffer-local to
the specific summary buffer of the group you've specified the parameters
for.  But ouf course, the new value has to be local in the new buffer
where you write your message just before message-mode is activated.

I don't have a clue how to do that...

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-19 Thread Adam Sjøgren
On Thu, 19 Jul 2012 10:44:07 +0200, Tassilo wrote:

 Hm, I can't reproduce the error.  But now I know that this approach
 won't work anyway. :-(

 The reason is that the new value of message-mode-hook is buffer-local to
 the specific summary buffer of the group you've specified the parameters
 for.  But ouf course, the new value has to be local in the new buffer
 where you write your message just before message-mode is activated.

Ah, ok.

Well, the way that inserts a dummy header and, after the tip from Peter
Münster, removes it again does work for me, so there's that.

Still, thanks for the ideas!


  Best regards,

 Adam

-- 
 You know, if the sun was an oboe, what would you do?   Adam Sjøgren
 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-18 Thread Tassilo Horn
a...@koldfront.dk (Adam Sjøgren) writes:

 An existing variable in group parameters will be automagically be
 made local in the corresponding summary buffer.

 Hm, I can't make it work, though; I get this error in *Messages*:

   let: Symbol's value as variable is void: bbdb-insinuate-message

Hm, do you have a backtrace?

 The value of message-setup-hook is (asjo-add-now-playing-header
 bbdb-insinuate-message), which works fine.

 Maybe I messed up the group parameters somehow...

Hm, basically it looks good to me.  But it might be a good idea to make
that huge lamba an own function.

--8---cut here---start-8---
(defun my-gnus-add-special-cc ()
  (save-excursion
(message-goto-cc)
(when (not (string-match reallyreallyimport...@example.org
 (buffer-substring-no-properties
  (line-beginning-position)
  (line-end-position
  (when (not (= (- (point)
   (line-beginning-position))
4))
(insert , ))
  (insert reallyreallyimport...@example.org

(setq gnus-parameters
  '((that\.special\.group
 (message-setup-hook
   (append message-setup-hook
   '(my-gnus-add-special-cc))
--8---cut here---end---8---

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-18 Thread Adam Sjøgren
On Wed, 18 Jul 2012 12:54:32 +0200, Tassilo wrote:

 a...@koldfront.dk (Adam Sjøgren) writes:

 An existing variable in group parameters will be automagically be
 made local in the corresponding summary buffer.
 
 Hm, I can't make it work, though; I get this error in *Messages*:
 
 let: Symbol's value as variable is void: bbdb-insinuate-message

 Hm, do you have a backtrace?

No, I do not get a backtrace - the buffer with the email ends up without
quotation and the message above is shown in *Messages*.

[See below, though]

 Hm, basically it looks good to me.  But it might be a good idea to make
 that huge lamba an own function.

[...]

Gives me the same symptom. (I hoped it would :-))

 (setq gnus-parameters

[...]

Note that I am using Group Parameters on the group in question rather
than setting the gnus-parameters variable.

 o o o

After factorying out the lambda to a named function I did
toggle-debug-on-error and got this backtrace:

 Debugger entered--Lisp error: (void-variable bbdb-insinuate-message)
   (asjo-add-now-playing-header bbdb-insinuate-message asjo-handle-cc)
   (let ((value (asjo-add-now-playing-header bbdb-insinuate-message 
asjo-handle-cc))) (when value (message-goto-eoh) (insert Message-Setup-Hook 
:  value) (unless (bolp) (insert \n
   (save-excursion (message-remove-header Message-Setup-Hook) (let ((value 
(asjo-add-now-playing-header bbdb-insinuate-message asjo-handle-cc))) (when 
value (message-goto-eoh) (insert Message-Setup-Hook :  value) (unless 
(bolp) (insert \n)
   (lambda nil (save-excursion (message-remove-header Message-Setup-Hook) 
(let ((value (asjo-add-now-playing-header bbdb-insinuate-message 
asjo-handle-cc))) (when value (message-goto-eoh) (insert Message-Setup-Hook 
:  value) (unless (bolp) (insert \n))()
   run-hooks(message-setup-hook)
   message-setup-1([...cut...])
   message-setup([...cut...])
   message-reply(nil t)
   ad-Orig-gnus-summary-reply((398652) t (398652))
   gnus-summary-reply((398652) t (398652))
   gnus-summary-very-wide-reply-with-original(nil)
   call-interactively(gnus-summary-very-wide-reply-with-original nil nil)


  Best regards,

Adam

-- 
 You know, if the sun was an oboe, what would you do?   Adam Sjøgren
 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-17 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-17 Thread Tassilo Horn
Tassilo Horn tass...@member.fsf.org writes:

 I think, there's no way to do it that way.
  ^^^
Of course, that should have been there's no *need* to do it that way.

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-17 Thread Adam Sjøgren
On Tue, 17 Jul 2012 08:38:19 +0200, Tassilo wrote:

 An existing variable in group parameters will be automagically be made
 local in the corresponding summary buffer.

Hm, I can't make it work, though; I get this error in *Messages*:

  let: Symbol's value as variable is void: bbdb-insinuate-message

The value of message-setup-hook is (asjo-add-now-playing-header
bbdb-insinuate-message), which works fine.

Maybe I messed up the group parameters somehow...

  (message-setup-hook
   (append message-setup-hook
   (list
(lambda nil
  (save-excursion
(message-goto-cc)
(when
(not
 (string-match reallyreallyimport...@example.org
   (buffer-substring-no-properties
(line-beginning-position)
(line-end-position
  (when
  (not
   (=
(-
 (point)
 (line-beginning-position))
4))
(insert , ))
  (insert reallyreallyimport...@example.org)))


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


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 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-15 Thread Tassilo Horn
a...@koldfront.dk (Adam Sjøgren) writes:

Hi Adam,

 I have a group parameter set on a group where I set cc to something.

 This overwrites any Cc that is added by a wide reply in that group,
 which isn't quite what I want.

 Is there a way to have the posting style add to the Cc-list if a
 Cc-header already exists, and otherwise create it?

,[ (info (gnus)Posting Styles) ]
|Each style may contain an arbitrary amount of attributes.  Each
| attribute consists of a `(NAME VALUE)' pair.  In addition, you can also
| use the `(NAME :file VALUE)' form or the `(NAME :value VALUE)' form.
| Where `:file' signifies VALUE represents a file name and its contents
| should be used as the attribute value, `:value' signifies VALUE does
| not represent a file name explicitly.  The attribute name can be one of:
| 
|The attribute name can also be a string or a symbol.  In that case,
| this will be used as a header name,[...]
| 
|The attribute value can be a string, a function with zero arguments
| (the return value will be used), a variable (its value will be used)
| or a list (it will be `eval'ed and the return value will be
| used).
`

So it seems you can have an posting style entry like that

  (Cc (save-excursion
(message-goto-cc)
(concat theboss@company.invalid
(buffer-substring-no-properties
  (point) (line-end-position)))

Totally untested, of course.

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-15 Thread Tassilo Horn
a...@koldfront.dk (Adam Sjøgren) writes:


 So it seems you can have an posting style entry like that

   (Cc (save-excursion
 (message-goto-cc)
 (concat theboss@company.invalid
 (buffer-substring-no-properties
   (point) (line-end-position)))

 Totally untested, of course.

 It fails with:

   message-position-on-field: Search failed: ^--text follows this line--$

 in an empty buffer, so I guess it runs at a different time than
 expected?

Yes, seems so.  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.

Bye,
Tassilo


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


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

2012-07-14 Thread Adam Sjøgren
I have a group parameter set on a group where I set cc to something.

This overwrites any Cc that is added by a wide reply in that group,
which isn't quite what I want.

Is there a way to have the posting style add to the Cc-list if a
Cc-header already exists, and otherwise create it?


  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