* Escaping carets?
@ 2003-09-29 18:32 Björn Lindström
2003-10-01 1:30 ` Jesper Harder
0 siblings, 1 reply; 5+ messages in thread
From: Björn Lindström @ 2003-09-29 18:32 UTC (permalink / raw)
I want something like this in my gnus-message-archive-group. I seem to
get something wrong concerning the caret in regexps however, since it
doesn't match my nnfolders as long as I include it. If I just use
"nnfolder:" instead it works, but it's not pretty. How do I escape that
caret so that it works?
(if (string-match "^nnfolder:" group)
group
"outgoing")
--
Björn Lindström <bkhl@elektrubadur.se>
http://bkhl.elektrubadur.se/
Hearken to the new *Elektrubadur* demo at http://elektrubadur.se/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Escaping carets?
2003-09-29 18:32 Escaping carets? Björn Lindström
@ 2003-10-01 1:30 ` Jesper Harder
2003-10-01 12:14 ` Björn Lindström
0 siblings, 1 reply; 5+ messages in thread
From: Jesper Harder @ 2003-10-01 1:30 UTC (permalink / raw)
bkhl@elektrubadur.se (Björn Lindström) writes:
> I want something like this in my gnus-message-archive-group. I seem to
> get something wrong concerning the caret in regexps however, since it
> doesn't match my nnfolders as long as I include it. If I just use
> "nnfolder:" instead it works, but it's not pretty. How do I escape that
> caret so that it works?
You shouldn't escape the caret -- I assume that your groups don't
actually include a literal caret.
What does string-match return when you insert the _full_ name of one
of your nnfolder groups, e.g.
(string-match "^nnfolder:" "nnfolder:foo.bar")
> (if (string-match "^nnfolder:" group)
> group
> "outgoing")
You need a pair of parens wrapped around that.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Escaping carets?
2003-10-01 1:30 ` Jesper Harder
@ 2003-10-01 12:14 ` Björn Lindström
2003-10-01 23:51 ` Jesper Harder
0 siblings, 1 reply; 5+ messages in thread
From: Björn Lindström @ 2003-10-01 12:14 UTC (permalink / raw)
Jesper Harder <harder@myrealbox.com> writes:
>> (if (string-match "^nnfolder:" group)
>> group
>> "outgoing")
>
> You need a pair of parens wrapped around that.
That was just a part of the whole thing. The whole should look like this:
(setq gnus-message-archive-group '((if (equal group "")
(if (message-news-p)
"outgoing"
"misc")
(if (string-match "nnfolder:" group)
group
"outgoing")
"outgoing")))
> What does string-match return when you insert the _full_ name of one
> of your nnfolder groups, e.g.
>
> (string-match "^nnfolder:" "nnfolder:foo.bar")
It returns 0, which I assume is what should happen.
--
Björn Lindström <bkhl@elektrubadur.se>
http://bkhl.elektrubadur.se/
Download the new *Elektrubadur* demo from http://elektrubadur.se/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Escaping carets?
2003-10-01 12:14 ` Björn Lindström
@ 2003-10-01 23:51 ` Jesper Harder
2003-10-02 0:06 ` Björn Lindström
0 siblings, 1 reply; 5+ messages in thread
From: Jesper Harder @ 2003-10-01 23:51 UTC (permalink / raw)
bkhl@elektrubadur.se (Björn Lindström) writes:
> That was just a part of the whole thing. The whole should look like
> this:
>
> (setq gnus-message-archive-group '((if (equal group "")
> (if (message-news-p)
> "outgoing"
> "misc")
> (if (string-match "nnfolder:" group)
> group
> "outgoing")
> "outgoing")))
But this will never return the group name -- unless `group' is the
empty string it will always return "outgoing",
(let ((group "nnfolder:foo.bar"))
(if (equal group "")
(if (message-news-p)
"outgoing"
"misc")
(if (string-match "nnfolder:" group)
group
"outgoing")
"outgoing"))
=> "outgoing"
You need to remove the last "outgoing".
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Escaping carets?
2003-10-01 23:51 ` Jesper Harder
@ 2003-10-02 0:06 ` Björn Lindström
0 siblings, 0 replies; 5+ messages in thread
From: Björn Lindström @ 2003-10-02 0:06 UTC (permalink / raw)
Jesper Harder <harder@myrealbox.com> writes:
> But this will never return the group name -- unless `group' is the
> empty string it will always return "outgoing",
Oops, bad logic. I played around a bit more and ended up with something
that works. Thanks for the help.
--
Björn Lindström <bkhl@elektrubadur.se>
http://bkhl.elektrubadur.se/
Download the new *Elektrubadur* demo from http://elektrubadur.se/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2003-10-02 0:06 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-29 18:32 Escaping carets? Björn Lindström
2003-10-01 1:30 ` Jesper Harder
2003-10-01 12:14 ` Björn Lindström
2003-10-01 23:51 ` Jesper Harder
2003-10-02 0:06 ` Björn Lindström
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 read-only IMAP folder(s) and NNTP newsgroup(s).