Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* rx and gnus-posting-styles
@ 2007-07-17 17:07 Hadron
  2007-07-18 17:47 ` Tassilo Horn
       [not found] ` <mailman.3601.1184780852.32220.info-gnus-english@gnu.org>
  0 siblings, 2 replies; 13+ messages in thread
From: Hadron @ 2007-07-17 17:07 UTC (permalink / raw)
  To: info-gnus-english


I tried to use rx as a pattern match condition in gnus-posting-styles
and was advised in the emacs irc channel to use something like

rx(or "str1" "str2") to match all strings containing str1 or str2. It
didn't work.

However I did use the output of rx substituted in my gnus-posting style
and it worked:

e.g "\\(?:php\\linux)".

Could someone please explain it to me as I dont see how that matches all
strings containing "php" or "linux".

Before playing with "rx" I had ".*php.*\\|.*linux.*" matching what I wanted.

Here is the corresponding "rx output" gnus-posting-style entry:

(setq gnus-posting-styles
      '(

	(""\\(?:php\\linux)""
	 (name "Hadron")(address "hq@gmail.com")
	 )


	))


The main question is, however, can I use "rx" directly or not in
gnus-posting-style?

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

* Re: rx and gnus-posting-styles
  2007-07-17 17:07 rx and gnus-posting-styles Hadron
@ 2007-07-18 17:47 ` Tassilo Horn
       [not found] ` <mailman.3601.1184780852.32220.info-gnus-english@gnu.org>
  1 sibling, 0 replies; 13+ messages in thread
From: Tassilo Horn @ 2007-07-18 17:47 UTC (permalink / raw)
  To: info-gnus-english

Hadron <hadronquark@googlemail.com> writes:

Hi Hadron,

> The main question is, however, can I use "rx" directly or not in
> gnus-posting-style?

You can but you have to understand backquoting, see (info
"(elisp)Backquote"). Here are my posting styles:

,----[ ~/.gnus.el ]
| (setq gnus-posting-styles
|       `((".*"
|          (address "thorn+news@fastmail.fm")
|          ("Face" (lambda ()
|                    (let ((file (th-random-file "~/.faces" "\\.jpg")))
|                      (message "Chose %s as Face file." file)
|                      (gnus-face-from-file file))))
|          (signature (fortune-to-signature
|                      (replace-regexp-in-string
|                       "\\.dat$" ""
|                       (th-random-file fortune-dir)))))
| 
|         (,(rx bol "infko.")
|          (address "heimdall@uni-koblenz.de"))
| 
|         (,(rx bol (or (and (opt "de.") (or "comp." "comm.software."))
|                                 "gnu."
|                                 "nntp+Gmane:"))
|          (address "tassilo@member.fsf.org"))
| 
|         ("^de.alt.music.metal"
|          (signature (th-now-playing)))
| 
|         (,(rx bol "nnimap+Fastmail:INBOX")
|          (address "thorn@fastmail.fm"))
| 
|         (,(rx bol "nnimap+Fastmail:INBOX.FSF")
|          (address "tassilo@member.fsf.org"))
| 
|         (,(rx bol "nnimap+Fastmail:INBOX.mailinglists."
|               (or "emms-patches"
|                   "stumpwm-devel"
|                   "bbdb-info"
|                   "sbcl-devel"
|                   "openchrome"))
|          (address "tassilo@member.fsf.org"))
| 
|         (,(rx bol "nnimap+Fastmail:INBOX.mailinglists."
|               (or "d-barf"
|                   "tsdh-fans"
|                   "dtofans"))
|          (address "thorn@fastmail.fm"))
| 
|         (,(rx bol "nnimap+Fastmail:INBOX.uni")
|          (address "heimdall@uni-koblenz.de"))))
`----

Bye,
Tassilo
-- 
VI VI VI - The Roman Number Of The Beast

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

* Re: rx and gnus-posting-styles
       [not found] ` <mailman.3601.1184780852.32220.info-gnus-english@gnu.org>
@ 2007-07-18 21:08   ` Hadron
  2007-07-18 21:18     ` Hadron
  0 siblings, 1 reply; 13+ messages in thread
From: Hadron @ 2007-07-18 21:08 UTC (permalink / raw)
  To: info-gnus-english

Tassilo Horn <tassilo@member.fsf.org> writes:

> Hadron <hadronquark@googlemail.com> writes:
>
> Hi Hadron,
>
>> The main question is, however, can I use "rx" directly or not in
>> gnus-posting-style?
>
> You can but you have to understand backquoting, see (info

> "(elisp)Backquote"). Here are my posting styles:
> |         (,(rx bol "nnimap+Fastmail:INBOX.mailinglists."
> |               (or "d-barf"
> |                   "tsdh-fans"
> |                   "dtofans"))
> |          (address "thorn@fastmail.fm"))


Thanks Tassillo, but why the "bol"? Am I right in thinking the "or" part
is "any string containing the following"?.

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

* Re: rx and gnus-posting-styles
  2007-07-18 21:08   ` Hadron
@ 2007-07-18 21:18     ` Hadron
  2007-07-19  6:44       ` Tassilo Horn
       [not found]       ` <mailman.3624.1184827500.32220.info-gnus-english@gnu.org>
  0 siblings, 2 replies; 13+ messages in thread
From: Hadron @ 2007-07-18 21:18 UTC (permalink / raw)
  To: info-gnus-english

Hadron <hadronquark@googlemail.com> writes:

> Tassilo Horn <tassilo@member.fsf.org> writes:
>
>> Hadron <hadronquark@googlemail.com> writes:
>>
>> Hi Hadron,
>>
>>> The main question is, however, can I use "rx" directly or not in
>>> gnus-posting-style?
>>
>> You can but you have to understand backquoting, see (info
>
>> "(elisp)Backquote"). Here are my posting styles:
>> |         (,(rx bol "nnimap+Fastmail:INBOX.mailinglists."
>> |               (or "d-barf"
>> |                   "tsdh-fans"
>> |                   "dtofans"))
>> |          (address "thorn@fastmail.fm"))
>
>
> Thanks Tassillo, but why the "bol"? Am I right in thinking the "or" part
> is "any string containing the following"?.

Or in other words how to match, using rx, all groups containing "linux"
or "emacs" for example?

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

* Re: rx and gnus-posting-styles
  2007-07-18 21:18     ` Hadron
@ 2007-07-19  6:44       ` Tassilo Horn
       [not found]       ` <mailman.3624.1184827500.32220.info-gnus-english@gnu.org>
  1 sibling, 0 replies; 13+ messages in thread
From: Tassilo Horn @ 2007-07-19  6:44 UTC (permalink / raw)
  To: info-gnus-english

Hadron <hadronquark@googlemail.com> writes:

>> Thanks Tassillo, but why the "bol"?

The `bol' stands for beginning-of-line and is the same as ^ in a
regexp. Indeed, in my examples these are not really needed.

>> Am I right in thinking the "or" part is "any string containing the
>> following"?.

Yes, (or "foo" "bar") matches any string containing "foo" or "bar".

> Or in other words how to match, using rx, all groups containing
> "linux" or "emacs" for example?

    (,(rx (or "linux" "emacs"))
     (address "hadron+linux@foobar.invalid"))

Bye,
Tassilo
-- 
The  desire  to  be  rewarded  for one's  creativity  does  not  justify
depriving  the world  in  general of  all  or part  of that  creativity.
(Richard M. Stallman)

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

* Re: rx and gnus-posting-styles
       [not found]       ` <mailman.3624.1184827500.32220.info-gnus-english@gnu.org>
@ 2007-07-19 11:46         ` Hadron
  2007-07-19 14:19           ` Tassilo Horn
       [not found]           ` <mailman.3629.1184854774.32220.info-gnus-english@gnu.org>
  0 siblings, 2 replies; 13+ messages in thread
From: Hadron @ 2007-07-19 11:46 UTC (permalink / raw)
  To: info-gnus-english

Tassilo Horn <tassilo@member.fsf.org> writes:

> Hadron <hadronquark@googlemail.com> writes:
>
>>> Thanks Tassillo, but why the "bol"?
>
> The `bol' stands for beginning-of-line and is the same as ^ in a
> regexp. Indeed, in my examples these are not really needed.
>
>>> Am I right in thinking the "or" part is "any string containing the
>>> following"?.
>
> Yes, (or "foo" "bar") matches any string containing "foo" or "bar".
>
>> Or in other words how to match, using rx, all groups containing
>> "linux" or "emacs" for example?
>
>     (,(rx (or "linux" "emacs"))
>      (address "hadron+linux@foobar.invalid"))
>
> Bye,
> Tassilo

Hi Tassilo,

Would you be so good as to maybe try this? e.g try to post to
comp.os.linux.ubuntu and see if that "contains linux" works? (Obviously
no need to actually post it!)

It doesn't match for me. I have double checked everything.

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

* Re: rx and gnus-posting-styles
  2007-07-19 11:46         ` Hadron
@ 2007-07-19 14:19           ` Tassilo Horn
       [not found]           ` <mailman.3629.1184854774.32220.info-gnus-english@gnu.org>
  1 sibling, 0 replies; 13+ messages in thread
From: Tassilo Horn @ 2007-07-19 14:19 UTC (permalink / raw)
  To: info-gnus-english

Hadron <hadronquark@googlemail.com> writes:

Hi Hadron,

>>> Or in other words how to match, using rx, all groups containing
>>> "linux" or "emacs" for example?
>>
>>     (,(rx (or "linux" "emacs"))
>>      (address "hadron+linux@foobar.invalid"))
>
> Would you be so good as to maybe try this? e.g try to post to
> comp.os.linux.ubuntu and see if that "contains linux" works?

Yep, wors for both groups with emacs or linux in it.

> It doesn't match for me. I have double checked everything.

I guess the problem is that after this posting style follow some others
which match comp.os.linux.ubuntu, too, and thus overwrite this setting.

Bye,
Tassilo
-- 
People sometimes  ask me if it  is a sin in  the Church of  Emacs to use
vi. Using a free  version of vi is not a sin; it  is a penance. So happy
hacking. (Richard M. Stallman)

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

* Re: rx and gnus-posting-styles
       [not found]           ` <mailman.3629.1184854774.32220.info-gnus-english@gnu.org>
@ 2007-07-20 12:58             ` Hadron
  2007-07-20 15:02               ` Tassilo Horn
       [not found]               ` <mailman.3686.1184943771.32220.info-gnus-english@gnu.org>
  0 siblings, 2 replies; 13+ messages in thread
From: Hadron @ 2007-07-20 12:58 UTC (permalink / raw)
  To: info-gnus-english

Tassilo Horn <tassilo@member.fsf.org> writes:

> Hadron <hadronquark@googlemail.com> writes:
>
> Hi Hadron,
>
>>>> Or in other words how to match, using rx, all groups containing
>>>> "linux" or "emacs" for example?
>>>
>>>     (,(rx (or "linux" "emacs"))
>>>      (address "hadron+linux@foobar.invalid"))
>>
>> Would you be so good as to maybe try this? e.g try to post to
>> comp.os.linux.ubuntu and see if that "contains linux" works?
>
> Yep, wors for both groups with emacs or linux in it.
>
>> It doesn't match for me. I have double checked everything.
>
> I guess the problem is that after this posting style follow some others
> which match comp.os.linux.ubuntu, too, and thus overwrite this setting.
>
> Bye,
> Tassilo

What am I doing wrong here?

(setq gnus-posting-styles
    '(,(rx (or "linux" "emacs"))
     (address "hadron+linux@foobar.invalid"))
      )

Doesn't match either groups containing emacs or linux.

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

* Re: rx and gnus-posting-styles
  2007-07-20 12:58             ` Hadron
@ 2007-07-20 15:02               ` Tassilo Horn
       [not found]               ` <mailman.3686.1184943771.32220.info-gnus-english@gnu.org>
  1 sibling, 0 replies; 13+ messages in thread
From: Tassilo Horn @ 2007-07-20 15:02 UTC (permalink / raw)
  To: info-gnus-english

Hadron <hadronquark@googlemail.com> writes:

Hi Hadron,

> What am I doing wrong here?

As I said in a previous posting:

    You can but you have to understand backquoting, see
    (info "(elisp)Backquote").

> (setq gnus-posting-styles
>     '(,(rx (or "linux" "emacs"))
>      (address "hadron+linux@foobar.invalid"))
>       )
>
> Doesn't match either groups containing emacs or linux.

Yes, because the rx form won't be expanded.

Bye,
Tassilo
-- 
      "OS's and GUI's come and go, only Emacs has lasting power."
          Per Abrahamsen in <rjbsysc7n1.fsf@zuse.dina.kvl.dk>

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

* Re: rx and gnus-posting-styles
       [not found]               ` <mailman.3686.1184943771.32220.info-gnus-english@gnu.org>
@ 2007-07-22 11:45                 ` Hadron
  2007-07-22 11:55                   ` Brep
  2007-07-22 14:09                   ` Tassilo Horn
  0 siblings, 2 replies; 13+ messages in thread
From: Hadron @ 2007-07-22 11:45 UTC (permalink / raw)
  To: info-gnus-english

Tassilo Horn <tassilo@member.fsf.org> writes:

> Hadron <hadronquark@googlemail.com> writes:
>
> Hi Hadron,
>
>> What am I doing wrong here?
>
> As I said in a previous posting:
>
>     You can but you have to understand backquoting, see
>     (info "(elisp)Backquote").
>
>> (setq gnus-posting-styles
>>     '(,(rx (or "linux" "emacs"))
>>      (address "hadron+linux@foobar.invalid"))
>>       )
>>
>> Doesn't match either groups containing emacs or linux.
>
> Yes, because the rx form won't be expanded.

The form is the code you gave to me in an earlier post and reading the
text the "," should be backquoting it?  Clearly I am missing something
obvious?

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

* Re: rx and gnus-posting-styles
  2007-07-22 11:45                 ` Hadron
@ 2007-07-22 11:55                   ` Brep
  2007-07-22 18:10                     ` Hadron
  2007-07-22 14:09                   ` Tassilo Horn
  1 sibling, 1 reply; 13+ messages in thread
From: Brep @ 2007-07-22 11:55 UTC (permalink / raw)
  To: info-gnus-english

Hadron <hadronquark@googlemail.com> writes:

> Tassilo Horn <tassilo@member.fsf.org> writes:
>
>> Hadron <hadronquark@googlemail.com> writes:
>>
>> Hi Hadron,
>>
>>> What am I doing wrong here?
>>
>> As I said in a previous posting:
>>
>>     You can but you have to understand backquoting, see
>>     (info "(elisp)Backquote").
>>
>>> (setq gnus-posting-styles
>>>     '(,(rx (or "linux" "emacs"))
        `(,(rx (or "linux" "emacs"))
        backquote here.
>>>      (address "hadron+linux@foobar.invalid"))
>>>       )
>>>
>>> Doesn't match either groups containing emacs or linux.
>>
>> Yes, because the rx form won't be expanded.
>
> The form is the code you gave to me in an earlier post and reading the
> text the "," should be backquoting it?  Clearly I am missing something
> obvious?

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

* Re: rx and gnus-posting-styles
  2007-07-22 11:45                 ` Hadron
  2007-07-22 11:55                   ` Brep
@ 2007-07-22 14:09                   ` Tassilo Horn
  1 sibling, 0 replies; 13+ messages in thread
From: Tassilo Horn @ 2007-07-22 14:09 UTC (permalink / raw)
  To: info-gnus-english

Hadron <hadronquark@googlemail.com> writes:

Hi Hadron,

> The form is the code you gave to me in an earlier post and reading the
> text the "," should be backquoting it?  Clearly I am missing something
> obvious?

Yes. You need to backquote (``') the value of gnus-posting-styles in
order to have expressions following `,' evaluated.

     `(a list of ,(+ 2 3) elements) => (a list of 5 elements)

You quoted (`'') the list, so its elements following `,' were not
evaluated.

    '(a list of ,(+ 2 3) elements) => (a list of \, (+ 2 3) elements)

Bye,
Tassilo
-- 
No person,  no idea, and no  religion deserves to be  illegal to insult,
not even the Church of Emacs. (Richard M. Stallman)

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

* Re: rx and gnus-posting-styles
  2007-07-22 11:55                   ` Brep
@ 2007-07-22 18:10                     ` Hadron
  0 siblings, 0 replies; 13+ messages in thread
From: Hadron @ 2007-07-22 18:10 UTC (permalink / raw)
  To: info-gnus-english

Brep <brep@smth.org> writes:

> Hadron <hadronquark@googlemail.com> writes:
>
>> Tassilo Horn <tassilo@member.fsf.org> writes:
>>
>>> Hadron <hadronquark@googlemail.com> writes:
>>>
>>> Hi Hadron,
>>>
>>>> What am I doing wrong here?
>>>
>>> As I said in a previous posting:
>>>
>>>     You can but you have to understand backquoting, see
>>>     (info "(elisp)Backquote").
>>>
>>>> (setq gnus-posting-styles
>>>>     '(,(rx (or "linux" "emacs"))
>         `(,(rx (or "linux" "emacs"))
>         backquote here.
>>>>      (address "hadron+linux@foobar.invalid"))
>>>>       )
>>>>
>>>> Doesn't match either groups containing emacs or linux.
>>>
>>> Yes, because the rx form won't be expanded.
>>
>> The form is the code you gave to me in an earlier post and reading the
>> text the "," should be backquoting it?  Clearly I am missing something
>> obvious?

Thanks Brep.

,----
| (setq gnus-posting-styles
|       `(
| 	(
| 	 ,(rx(or "linux"  "emacs"))
| 	 (name "Hadron")(address "hadronquark@googlemail.com")
| 	 )
| 	)
| )
`----

was the solution.

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

end of thread, other threads:[~2007-07-22 18:10 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-17 17:07 rx and gnus-posting-styles Hadron
2007-07-18 17:47 ` Tassilo Horn
     [not found] ` <mailman.3601.1184780852.32220.info-gnus-english@gnu.org>
2007-07-18 21:08   ` Hadron
2007-07-18 21:18     ` Hadron
2007-07-19  6:44       ` Tassilo Horn
     [not found]       ` <mailman.3624.1184827500.32220.info-gnus-english@gnu.org>
2007-07-19 11:46         ` Hadron
2007-07-19 14:19           ` Tassilo Horn
     [not found]           ` <mailman.3629.1184854774.32220.info-gnus-english@gnu.org>
2007-07-20 12:58             ` Hadron
2007-07-20 15:02               ` Tassilo Horn
     [not found]               ` <mailman.3686.1184943771.32220.info-gnus-english@gnu.org>
2007-07-22 11:45                 ` Hadron
2007-07-22 11:55                   ` Brep
2007-07-22 18:10                     ` Hadron
2007-07-22 14:09                   ` Tassilo Horn

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