Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* `eval' in Posting Styles
@ 2007-02-08 10:50 Kamen TOMOV
  2007-02-11  9:48 ` Reiner Steib
  0 siblings, 1 reply; 3+ messages in thread
From: Kamen TOMOV @ 2007-02-08 10:50 UTC (permalink / raw)
  To: info-gnus-english

Hi,

I needed to have a function executed depending on the Posting Style,
e.g. to have a things like that:

(setq gnus-posting-styles
      '(("foo"
	 (eval 'bar))
        ....))

(defun bar ()
       ....)

It looks like the base was laid some time ago and I wonder why wasn't
it implemented fully.

In gnus-msg.el I changed gnus-configure-posting-styles:

      (dolist (result results)
	(add-hook 'message-setup-hook
		  (cond
		   ((eq 'eval (car result))
-		    'ignore)
+		    (cdr result))
		   ((eq 'body (car result))

This way I managed to have the functionality I needed. Do you see any
reason why not to put it into the main branch?

Any suggestions, improvements, etc. are welcome.

-- 
Камен

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

* Re: `eval' in Posting Styles
  2007-02-08 10:50 `eval' in Posting Styles Kamen TOMOV
@ 2007-02-11  9:48 ` Reiner Steib
  2007-02-12  7:40   ` Kamen TOMOV
  0 siblings, 1 reply; 3+ messages in thread
From: Reiner Steib @ 2007-02-11  9:48 UTC (permalink / raw)
  To: info-gnus-english

On Thu, Feb 08 2007, Kamen TOMOV wrote:

> I needed to have a function executed depending on the Posting Style,
> e.g. to have a things like that:
>
> (setq gnus-posting-styles
>       '(("foo"
> 	 (eval 'bar))
>         ....))
>
> (defun bar ()
>        ....)
>
> It looks like the base was laid some time ago and I wonder why wasn't
> it implemented fully.

It works for me.  I have some
  (eval (message "applying posting style for whatever"))
expressions in my posting styles and I see the message in *Messages*.

Does the following work?

(setq gnus-posting-styles
      '(("foo"
	 (eval (bar)))
        ....))

Maybe we should add an example in the manual near this:

,----[ (info "(gnus)Posting Styles") ]
| If the attribute name is `eval', the form is evaluated, and the
| result is thrown away.
`----

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/

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

* Re: `eval' in Posting Styles
  2007-02-11  9:48 ` Reiner Steib
@ 2007-02-12  7:40   ` Kamen TOMOV
  0 siblings, 0 replies; 3+ messages in thread
From: Kamen TOMOV @ 2007-02-12  7:40 UTC (permalink / raw)
  To: info-gnus-english

On неделя, Февруари 11 2007, Reiner Steib wrote:

> It works for me.  I have some
>   (eval (message "applying posting style for whatever"))
> expressions in my posting styles and I see the message in *Messages*.
>
> Does the following work?
>
> (setq gnus-posting-styles
>       '(("foo"
> 	 (eval (bar)))
>         ....))

Yes, that one works. I thought it needed a function symbol so was my
change.

> Maybe we should add an example in the manual near this:
>
> ,----[ (info "(gnus)Posting Styles") ]
> | If the attribute name is `eval', the form is evaluated, and the
> | result is thrown away.
> `----

An example would had been great for me.


Regards,

-- 
Камен

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

end of thread, other threads:[~2007-02-12  7:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-08 10:50 `eval' in Posting Styles Kamen TOMOV
2007-02-11  9:48 ` Reiner Steib
2007-02-12  7:40   ` Kamen TOMOV

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