🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
35 messages
35 total messages Started by Sven Guckes Wed, 17 Dec 2003 00:30
[announce] mutt vs slrn - a comparison
#139432
Author: Sven Guckes
Date: Wed, 17 Dec 2003 00:30
33 lines
1948 bytes
http://www.guckes.net/misc/mutt_vs_slrn.html
        Mutt vs Slrn - a comparison

from time to time i get mails with requests for
"mutt keybindings for slrn" - and vice versa.
and every so often someoen is looking for a
command or option in one of the programs
which does not exist in the other.

some user would be better off with mutt+nntp
(there are at least four different patch sets)
and some would need to get into scripting with
slang to add some features of mutt commands.

so i guess it is time to maintain a comparison
until both programs finally converge to a degree
which makes this comparison superfluous.
who knows, someone may come up with another
program which combines these two.  and, no,
i am not speaking about another "pine". ;-)

i am currently in the process of turning two
small lists into a bigger table with additional
explanatory text (see url).  please take a
look at it and send me some feedback - thanks!

Sven

--
Sven Guckes   usenet-mutt-vs-slrn @guckes.net
Mutt vs Slrn - a small comparison of features
http://www.guckes.net/misc/mutt_vs_slrn.html
Re: [announce] mutt vs slrn - a comparison
#139430
Author: Ben Finney
Date: Wed, 17 Dec 2003 00:25
15 lines
1696 bytes
On 17 Dec 2003 00:30:22 GMT, Sven Guckes wrote:
> http://www.guckes.net/misc/mutt_vs_slrn.html
>         Mutt vs Slrn - a comparison
> 
> so i guess it is time to maintain a comparison until both programs
> finally converge to a degree which makes this comparison superfluous.

Thanks for the initiative in creating this comparison, it's sorely
needed.

-- 
 \       "If you define cowardice as running away at the first sign of |
  `\   danger, screaming and tripping and begging for mercy, then yes, |
_o__)            Mr. Brave man, I guess I'm a coward."  -- Jack Handey |
Ben Finney <http://bignose.squidly.org/>
Re: [announce] mutt vs slrn - a comparison
#139441
Author: Max Quordlepleen
Date: Wed, 17 Dec 2003 02:02
12 lines
1605 bytes
Sven Guckes <usenet@guckes.net> writes:

> who knows, someone may come up with another
> program which combines these two

(X)Emacs <beg>

-- 
Registered Linux User 297164
GPG Key ID 1B1B6A1D5A2407C3
Noho ora mai, ka kite ano
http://maxqnz.com/References.html
Re: [announce] mutt vs slrn - a comparison
#139446
Author: Sven Guckes
Date: Wed, 17 Dec 2003 02:27
12 lines
1485 bytes
* Max Quordlepleen <maxq@nonags.com>:
> Sven Guckes <usenet@guckes.net>:
>> who knows, someone may come up with another
>> program which combines these two
>
> (X)Emacs <beg>

well, it's called "Gnus" and
has more than you ever want.
except speed, of course.  *ehem*

Sven
Re: [announce] mutt vs slrn - a comparison
#139447
Author: Max Quordlepleen
Date: Wed, 17 Dec 2003 02:43
15 lines
1807 bytes
Sven Guckes <usenet@guckes.net> writes:

> well, it's called "Gnus" and
> has more than you ever want.
> except speed, of course. 

Yep, GNUs has more than I ever want, and even with a modest Athlon
XP2000, speed is not an issue for me. But then, I like a sedentary
pace. 8-D

-- 
Registered Linux User 297164
GPG Key ID 1B1B6A1D5A2407C3
Noho ora mai, ka kite ano
http://maxqnz.com/References.html
Re: [announce] mutt vs slrn - a comparison
#139448
Author: kMax Quordlepleen
Date: Wed, 17 Dec 2003 02:43
15 lines
1873 bytes
Sven Guckes <usenet@guckes.net> writes:

> well, it's called "Gnus" and
> has more than you ever want.
> except speed, of course. 

Yep, GNUs has more than I ever want, and even with a modest Athlon
XP2000, speed is not an issue for me. But then, I like a sedentary
pace. 8-D

-- 
Registered Linux User 297164
GPG Key ID 1B1B6A1D5A2407C3
Noho ora mai, ka kite ano
http://maxqnz.com/References.html
Re: [announce] mutt vs slrn - a comparison
#139469
Author: Blinky the Shark
Date: Wed, 17 Dec 2003 05:37
18 lines
1692 bytes
kMax Quordlepleen wrote:

> Sven Guckes <usenet@guckes.net> writes:

>> well, it's called "Gnus" and
>> has more than you ever want.
>> except speed, of course. 

> Yep, GNUs has more than I ever want, and even with a modest Athlon
> XP2000, speed is not an issue for me. But then, I like a sedentary
> pace. 8-D

Now, if it would only post once, and not misspell your name, it might
be a winner.

-- 
Blinky                                      Linux RU 4892F
The Boulder Pledge  http://blinkynet.net/spag/boulder.html
Re: [announce] mutt vs slrn - a comparison
#139468
Author: Blinky the Shark
Date: Wed, 17 Dec 2003 06:01
24 lines
1820 bytes
Blinky the Shark wrote:

> kMax Quordlepleen wrote:

>> Sven Guckes <usenet@guckes.net> writes:

>>> well, it's called "Gnus" and
>>> has more than you ever want.
>>> except speed, of course. 

>> Yep, GNUs has more than I ever want, and even with a modest Athlon
>> XP2000, speed is not an issue for me. But then, I like a sedentary
>> pace. 8-D

> Now, if it would only post once, and not misspell your name, it might
> be a winner.

<piggybacking>

Forgot the smilie, kMax.  Sorry!  :)

-- 
Blinky                                      Linux RU 4892F
The Boulder Pledge  http://blinkynet.net/spag/boulder.html
Re: [announce] mutt vs slrn - a comparison
#139471
Author: Max Quordlepleen
Date: Wed, 17 Dec 2003 06:09
14 lines
1890 bytes
Blinky the Shark <no.spam@box.invalid> writes:

> Now, if it would only post once, and not misspell your name, it might
> be a winner.


Nah, that was me - trying to operate a keyboard driven client when
caffeine-deprived and wracked by a bronchial coughing spasm. Not
clever. 
-- 
Registered Linux User 297164
GPG Key ID 1B1B6A1D5A2407C3
Noho ora mai, ka kite ano
http://maxqnz.com/References.html
Re: [announce] mutt vs slrn - a comparison
#139482
Author: Max Quordlepleen
Date: Wed, 17 Dec 2003 12:31
12 lines
1899 bytes
Blinky the Shark <no.spam@box.invalid> writes:

> Forgot the smilie, kMax.  Sorry!  :)

Don't  worry - my  GNUs has  the  Deanna Troi  empath extension,  and,
knowing you had intended one, added it for you. ;D

-- 
Registered Linux User 297164
GPG Key ID 1B1B6A1D5A2407C3
Noho ora mai, ka kite ano
http://maxqnz.com/References.html
Re: [announce] mutt vs slrn - a comparison
#139489
Author: Thomas Schultz
Date: Wed, 17 Dec 2003 22:39
45 lines
2842 bytes
* Sven Guckes [2003-12-17 00:30] :
[...]
> i am currently in the process of turning two small lists into a
> bigger table with additional explanatory text (see url).  please take
> a look at it and send me some feedback - thanks!

There are some good points in that table and you will find that some
of them are already on our wishlist.

However, I do have a few quick remarks:

| Slrn does not have a command line by default. You can simulate one
| with macros, however. 

Did you ever try Ctrl-X ESC (like in jed)?

| Slrn does not employ an extermal display_filter. (But maybe this can
| be done with a hook?)

Yep; after you asked me about this at the last LinuxTag, I wrote up
such a macro and sent it to you.

| Therefore there is no command which allows to search all message
| bodies as this will force a download of all messages first.

There are ready-to-use macro packages for this. One of them even comes
with slrn.

| And as Slrn is a newsreader it will not show you any messages which
| you have already read. Still, it will show you *all* unread messages
| and not allow to show only a part of them all.

Depends on what you mean by "part of them" - ESC 1 RET at least lets
you specify a number of articles you want to display.

| Slrn remembers the last read message and allow you to jump back to it
| using 'l' (what was that command name again?).

It's 'L' and "goto_last_read" (if you don't have a different command
mapped to 'l', pressing that key will work just as well).
-- 
Thomas Schultz <tststs@gmx.de>  News on slrn: http://slrn.sf.net/news.html
.-----------------------------. [2003-08-25] Released slrn 0.9.8.0
| Home of the slrn newsreader | [2003-08-19] New slrn FAQ available
| http://slrn.sourceforge.net | [2003-07-31] First beta with offline reading
Re: [announce] mutt vs slrn - a comparison
#139503
Author: Andreas Karrer
Date: Thu, 18 Dec 2003 14:16
10 lines
1258 bytes
* Sven Guckes <usenet@guckes.net>:
> http://www.guckes.net/misc/mutt_vs_slrn.html
>         Mutt vs Slrn - a comparison

$ wget -qO - http://www.guckes.net/misc/mutt_vs_slrn.html | grep -i mouse
$

Hmm...

 - Andi
Re: [announce] mutt vs slrn - a comparison
#139502
Author: Sven Guckes
Date: Thu, 18 Dec 2003 17:16
13 lines
1422 bytes
* Andreas Karrer <AndreasKarrer0312@gmx.net>:
> * Sven Guckes <usenet@guckes.net>:
>> http://www.guckes.net/misc/mutt_vs_slrn.html
>>         Mutt vs Slrn - a comparison
>
> $ wget -qO - http://www.guckes.net/misc/mutt_vs_slrn.html | grep -i mouse
> $
>
> Hmm...

and your point *is*?

Sven
Re: [announce] mutt vs slrn - a comparison
#139508
Author: Sven Guckes
Date: Thu, 18 Dec 2003 20:06
119 lines
5411 bytes
* Thomas Schultz <tststs@gmx.de>:
> * Sven Guckes [2003-12-17 00:30] :
>> i am currently in the process of turning two small lists into a
>> bigger table with additional explanatory text (see url).  please take
>> a look at it and send me some feedback - thanks!
>
> There are some good points in that table and you will
> find that some of them are already on our wishlist.

i have added a link to the slrn wishlist now.
->  http://slrn.sourceforge.net/wishlist.html

> However, I do have a few quick remarks:
>| Slrn does not have a command line by default. You can simulate one
>| with macros, however.
>
> Did you ever try Ctrl-X ESC (like in jed)?

  Ctrl-X ESC       Read line and interpret it as S-Lang.

obviously i never had.  :-/

so there is some kind of a command line..
but is this one for slang functions only?

does this allow ":source setupfile", too?
is there (tab) completion of command names,
option names, and values?  is there
an intro for using this command line?

>| Slrn does not employ an extermal display_filter. (But maybe this can
>| be done with a hook?)
>
> Yep; after you asked me about this at the last LinuxTag,
> I wrote up such a macro and sent it to you.

indeed - i remember you sending it to me.
never got round to test it, though.  :-(

this mail may be still on some archive -
but i definietly don't have it at hand.
can you send it to me again, please?

and what was the structure of this macro?  does this allow to
set an arbitrary shell command for use as a display_filter?

i have changed the description to this (for now):
  Slrn does not employ an extermal display_filter by default.
  However, there is a macro which allows this.  (TODO)

>| Therefore there is no command which allows to search all message
>| bodies as this will force a download of all messages first.
>
> There are ready-to-use macro packages for this.
> One of them even comes with slrn.

ok, got it:  macros/search.sl

i need to test all those macros, obviously.
however, i still haven't got into doing this.
hope you can help me when i overlook
the functionalities of those macros..

a quick look shows me that the macro allows you to
search through bodies with a regular expression.
but i fear the macro won't allow to *combine* the regex with
other search patterns such as "date between date1 and date2"
or "only from address a with subject s" - or does it?

i must say that i do like mutt's pattern language (although
it isn't perfect), eg "~f tststs ~s slrn ~b 'body search'".

>| And as Slrn is a newsreader it will not show you any messages which
>| you have already read. Still, it will show you *all* unread messages
>| and not allow to show only a part of them all.
>
> Depends on what you mean by "part of them" - ESC 1 RET at least
> lets you specify a number of articles you want to display.

yes, but that's about it, isn't it?

sometimes i'd rather want to see the
read messages *only* (ie no new ones).
and i would often want to sort these by
sender and with a limit on the subject, too.

>| Slrn remembers the last read message and allow you to jump back to it
>| using 'l' (what was that command name again?).
>
> It's 'L' and "goto_last_read" (if you don't have a different command
> mapped to 'l', pressing that key will work just as well).

so goto_last_read is bound to 'L' by default.
i cannot find anything in my setup
that also binds 'l' to that command.
do the lower-case keys get bound, too?

hmm.. better rtfm first...  yep, here is the answer:

  7.  Interactive functions
  ...
  Note: If a function is bound to an uppercase letter, you can call it
  without holding down shift as long as the corresponding lowercase
  letter is unbound (e.g. pressing `p' in group mode will post an
  article, although ``post'' is really bound to `P').

another thing learned there. :-)

that's why i like programs which allow key binding -
the commands have a name which you can find easily. :-)

thanks for your comments, Thomas!

Sven  [learning more about slrn through this comparison]

--
Sven Guckes   usenet-mutt-vs-slrn @guckes.net
Mutt vs Slrn - a small comparison of features
http://www.guckes.net/misc/mutt_vs_slrn.html
Re: [announce] mutt vs slrn - a comparison
#139511
Author: Andreas Karrer
Date: Thu, 18 Dec 2003 20:53
18 lines
1592 bytes
* Sven Guckes <usenet@guckes.net>:
> * Andreas Karrer <AndreasKarrer0312@gmx.net>:
>> * Sven Guckes <usenet@guckes.net>:
>>> http://www.guckes.net/misc/mutt_vs_slrn.html
>>>         Mutt vs Slrn - a comparison
>>
>> $ wget -qO - http://www.guckes.net/misc/mutt_vs_slrn.html | grep -i mouse
>> $
>>
>> Hmm...
>
> and your point *is*?

slrn has mouse support, mutt has not. It's a fairly prominent feature
that should be included in any fair comparison no matter if it's rated
MUTT+, or SLRN+.

 - Andi
Re: [announce] mutt vs slrn - a comparison
#139543
Author: Sven Guckes
Date: Fri, 19 Dec 2003 02:25
25 lines
2086 bytes
* Andreas Karrer <AndreasKarrer0312@gmx.net>:
> slrn has mouse support, mutt has not. It's a fairly
> prominent feature that should be included in any fair
> comparison no matter if it's rated MUTT+, or SLRN+.

well, mutt once *had* mouse support.  it ws dropped,
though.  for good.  at least that's how i see it.
those of you using slrn on windows may need it.

oh, well, there is mouse code in slrn..
guess i'll add this item for the heck of it.

but i doubt this is a plus for slrn. ;-)

seriously:  if anyone is using slrn with mouse
then pleae get in touch and tell me about it.
i personally never had a use for it at all...

Sven

-- 
Three blind mousers, Three blind mousers, See how they push!
They all push around the desktop's icons
Which cut off the commands, With a batting iron,
Did you ever see such a thing on your desk, As three blind mousers?
Re: [announce] mutt vs slrn - a comparison
#139544
Author: SINNER
Date: Fri, 19 Dec 2003 03:49
28 lines
2594 bytes
* Sven Guckes Wrote in news.software.readers, on 2003-12-18:
> * Andreas Karrer <AndreasKarrer0312@gmx.net>:
>> slrn has mouse support, mutt has not. It's a fairly
>> prominent feature that should be included in any fair
>> comparison no matter if it's rated MUTT+, or SLRN+.

> well, mutt once *had* mouse support.  it ws dropped,
> though.  for good.  at least that's how i see it.
> those of you using slrn on windows may need it.

> oh, well, there is mouse code in slrn..
> guess i'll add this item for the heck of it.

> but i doubt this is a plus for slrn. ;-)

> seriously:  if anyone is using slrn with mouse
> then pleae get in touch and tell me about it.
> i personally never had a use for it at all...

It is nice for going out to the web from a url in a post. I used to use
it but then Blinky called me a heathen so I turned it off ;)

Now I just use a mouse sweep and clipper functionality.

-- 
David                    | AGM Favorite Games - http://tinyurl.com/loec 
"Your attitude determines your attitude."
-- Zig Ziglar, self-improvement doofus
[slrn] Mouse support (was: [announce] mutt vs slrn - a comparison)
#139573
Author: Thomas Schultz
Date: Fri, 19 Dec 2003 17:46
20 lines
2243 bytes
* SINNER [2003-12-19 03:49] :
[mouse support in slrn]
> It is nice for going out to the web from a url in a post. I used to
> use it but then Blinky called me a heathen so I turned it off ;)

I once considered adding an alternative mouse mode (e.g. "set mouse
2") that allows navigation (selecting articles, groups, URLs etc)
using the mouse, but does not turn on the clickable menu in the top
status line.

Would anyone want such a feature?

By the way, I once made an attempt to make the mouse wheel work (for
scrolling the header list / article), but I could not even detect its
movement properly. Does anyone know if slang allows capturing this?
-- 
Thomas Schultz <tststs@gmx.de>  News on slrn: http://slrn.sf.net/news.html
.-----------------------------. [2003-08-25] Released slrn 0.9.8.0
| Home of the slrn newsreader | [2003-08-19] New slrn FAQ available
| http://slrn.sourceforge.net | [2003-07-31] First beta with offline reading
Re: [announce] mutt vs slrn - a comparison
#139578
Author: Thomas Schultz
Date: Fri, 19 Dec 2003 19:34
115 lines
5897 bytes
* Sven Guckes [2003-12-18 20:06] :

> so there is some kind of a command line.. but is this one for slang
> functions only?

Yep.

> does this allow ":source setupfile", too?

No. It allows you to evaluate slang-files, though, and in the long
term, it might be a nice idea to specify the config file in slang (the
editor jed does this) instead of using a separate syntax.

> is there (tab) completion of command names, option names, and values?

Not yet, although the source code should already have the
"infrastructure" to add this (i.e. tab completion of filenames is
implemented in a way that should make it easy to re-use the code).

> is there an intro for using this command line?

Not yet. But wait... (some time later) what do you think about this
new section of the reference manual:

<--->
  2.1.  A brief introduction to the built-in s-lang prompt

  When trying various configuration settings, you may find it quite
  inconvenient to constantly toggle between slrn and your editor and to
  restart slrn each time you made a change. Maybe you also want to play
  around with some settings without making (permanent) changes to your
  config file. In these cases, making yourself familiar with the built-
  in s-lang prompt of slrn can be worthwhile.

  You get to the prompt by calling ``evaluate_cmd'' (by default bound to
  `CTRL-X ESC') in either group or article mode. You will notice that
  the bottom status line changes and displays S-Lang> - behind that
  prompt, you can enter your commands. Basically, you can do anything
  here that you could do in a macro, so if you want to explore the full
  capabilities of this prompt, you'll have to read the documentation
  that comes with slang and look at the file slrnfuns.txt that comes
  with slrn.

  However, you can also do some simple things without understanding much
  about s-lang:

  o  To find out the current value of a config variable, use a command
     like this one:

     message(string(get_variable_value("use_metamail")))


  After this, the current value of the variable will appear in the bot-
  tom status line. By the way, the call to string() is only needed when
  querying an integer variable, so you can omit it if you want when get-
  ting the value of a string variable.

  o  If you want to set a config variable at runtime, you need to know
     whether its type is integer or string (if in doubt, look it up in
     this manual). To set a variable, use something like

     set_integer_variable("use_metamail", 0) % for integer variables
     set_string_variable("metamail_command", "metamutt") % for string variables


  Note that changing a variable does not always have an immediate
  effect: For example, changing ``sorting_method'' does not automati-
  cally imply a re-sorting of the articles. By the way, you can call the
  intrinsic function sort_by_sorting_method from the s-lang prompt
  afterwards in this specific case.

  o  You can also load macros dynamically using a line like

     () = evalfile("my-macro.sl")



  Note that you need those funny leading brackets and the equals sign in
  this case, because evalfile returns 1 on success. Using the given
  notation, we simply ignore the returned value. If we didn't do any-
  thing with it, it would be left on the stack and when this happens too
  often, you'll get a stack overflow at some point. If you really want
  to understand this, please read the file slang.txt that comes with the
  s-lang documentation. Otherwise, simply use the notation given here.
<--->

[display_filter macro]
> this mail may be still on some archive - but i definietly don't have
> it at hand. can you send it to me again, please?

Will do.

> and what was the structure of this macro?  does this allow to set an
> arbitrary shell command for use as a display_filter?

Yep.

[macro for searching in article bodies]
> but i fear the macro won't allow to *combine* the regex with other
> search patterns such as "date between date1 and date2" or "only from
> address a with subject s" - or does it? [...]

No - extending it to do this would be possible, though.

> sometimes i'd rather want to see the read messages *only* (ie no new
> ones). and i would often want to sort these by sender and with a
> limit on the subject, too.

I agree that a "limit" command would be nice to have; I just added
this to the wishlist.
-- 
Thomas Schultz <tststs@gmx.de>  News on slrn: http://slrn.sf.net/news.html
.-----------------------------. [2003-08-25] Released slrn 0.9.8.0
| Home of the slrn newsreader | [2003-08-19] New slrn FAQ available
| http://slrn.sourceforge.net | [2003-07-31] First beta with offline reading
Re: [announce] mutt vs slrn - a comparison
#139613
Author: Paul
Date: Sat, 20 Dec 2003 13:29
53 lines
3366 bytes
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Fri, 19 Dec 2003 17:46:25 +0000 (UTC), Thomas Schultz <tststs@gmx.de> said:
> By the way, I once made an attempt to make the mouse wheel work (for
> scrolling the header list / article), but I could not even detect its
> movement properly. Does anyone know if slang allows capturing this?
Grepping for "wheel" in the JED sources, it seems JED only uses wheel mice
in windows (see wterm.c).

> * Sven Guckes [2003-12-18 20:06] :
>
>> so there is some kind of a command line.. but is this one for slang
>> functions only?
>
> Yep.
>
>> does this allow ":source setupfile", too?
>
> No. It allows you to evaluate slang-files, though, and in the long
> term, it might be a nice idea to specify the config file in slang (the
> editor jed does this) instead of using a separate syntax.
For those of us not familiar with S-Lang, it would be better if there were
also a ":" where you could give commands in the config-file syntax.

Maybe if JED had a simple rc-syntax setupfile, it would be easier to use for
the newbies.

>   2.1.  A brief introduction to the built-in s-lang prompt

>   However, you can also do some simple things without understanding much
>   about s-lang:
>
>   o  To find out the current value of a config variable, use a command
>      like this one:
>
>      message(string(get_variable_value("use_metamail")))
>
Real simple, if you're a S-lang guru. In JED, I can just press C-h v,
like in Emacs. In fact the C-h v in the extended "hyperhelp" help mode
lets me customize the variable while I'm at it.

Back to the topic of this thread. SLRN has support for module loading.
How about working the good bits of mutt (aliases, MIME) into a S-Lang
module and using that in slrn (and maybe in JED as well :-) ?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: processed by gpg.sl <http://jedmodes.sf.net>

iEYEARECAAYFAj/kTikACgkQ1RTqFUe7bzNdIgCgmN9Rg44/y/cj3IA0Sxx0x0Yk
W/YAoJyr2gcmvrW8M9qLLO2vNMQUsYzP
=oTHA
-----END PGP SIGNATURE-----
Re: [announce] mutt vs slrn - a comparison
#139642
Author: J.B. Nicholson-Owens
Date: Sat, 20 Dec 2003 23:33
32 lines
2785 bytes
Paul wrote:
> For those of us not familiar with S-Lang, it would be better if there were
> also a ":" where you could give commands in the config-file syntax.

Does mutt have an S-Lang prompt?

I dislike that slrn has this set of functionality that is not exposed to the
S-Lang interpreter.  There are things you can set in a slrn.rc that cannot
be changed or even read by a macro and that's not good, in my opinion.

As for an config-file syntax prompt, If I were asked to implement this I
would hesitate to do so because it sounds like a slippery slope.  I suspect
that when people learn what little functionality I had put into this, they
would want more and there would come a point where I was either working to
reinvent S-Lang poorly or refusing to continue because I didn't want to
reinvent the wheel.

> Maybe if JED had a simple rc-syntax setupfile, it would be easier to use
> for the newbies.

Maybe, but that would make JED have two languages--this rc language and
S-Lang.  Emacs doesn't have a special rc language, it uses Emacs-LISP.

> Real simple, if you're a S-lang guru. In JED, I can just press C-h v,
> like in Emacs. In fact the C-h v in the extended "hyperhelp" help mode
> lets me customize the variable while I'm at it.

Perhaps you should write up a fixed set of features, keybindings, and let
people who are knowledgable about writing macros take a look.  Or you could
learn S-Lang and implement it yourself.  It's not a complex language and the
documentation is certainly good enough to make fruitful experiments to learn
more.
Re: slrn - adding a command line
#139645
Author: Sven Guckes
Date: Sun, 21 Dec 2003 00:28
27 lines
2450 bytes
* J.B. Nicholson-Owens <jbn@forestfield.org>:
> Paul wrote:
>> For those of us not familiar with S-Lang, it
>> would be better if there were also a ":" where
>> you could give commands in the config-file syntax.
> Does mutt have an S-Lang prompt?

no.  but i can imagine mutt adding slang support.  can you?

> I dislike that slrn has this set of functionality that is not exposed to the
> S-Lang interpreter.  There are things you can set in a slrn.rc that cannot
> be changed or even read by a macro and that's not good, in my opinion.

amen!

> As for an config-file syntax prompt, If I were asked to implement this
> I would hesitate to do so because it sounds like a slippery slope.
> I suspect that when people learn what little functionality I had
> put into this, they would want more and there would come a point
> where I was either working to reinvent S-Lang poorly or refusing
> to continue because I didn't want to reinvent the wheel.

so it is better to force every user to learn slang
before he can change the value of an option with, say,
":set prefix<TAB>=<TAB>" and simply editing the value?

Sven
Re: [announce] mutt vs slrn - a comparison
#139665
Author: Paul
Date: Sun, 21 Dec 2003 11:43
69 lines
4265 bytes
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Op 2003-12-20, J.B. Nicholson-Owens schreef <jbn@forestfield.org>:
> Paul wrote:
>> For those of us not familiar with S-Lang, it would be better if there were
>> also a ":" where you could give commands in the config-file syntax.
>
> Does mutt have an S-Lang prompt?
I gather that's a rhetorical question since mutt does not have S-Lang.
I believe Vim has ex-commands as well as support for other scripting
languages, so it's not unprecedented.

> I dislike that slrn has this set of functionality that is not exposed to the
> S-Lang interpreter.  There are things you can set in a slrn.rc that cannot
> be changed or even read by a macro and that's not good, in my opinion.
>From slrnfuns.txt:

  7.14.  set_integer_variable


      Usage
        Void set_integer_variable (String name, Integer v)

      Description
        This function may be used to set the value of the internal
        integer variable specified by name to value v.  name must be an
        integer variable name allowed in .slrnrc set commands.

      See Also
        set_string_variable, get_variable_value

> As for an config-file syntax prompt, If I were asked to implement this I
> would hesitate to do so because it sounds like a slippery slope.
Good point. But maybe something could be written *in* S-Lang. Or on top
of S-Lang. I don't know what I mean :-)

>> Maybe if JED had a simple rc-syntax setupfile, it would be easier to use
>> for the newbies.
>
> Maybe, but that would make JED have two languages--this rc language and
> S-Lang.  Emacs doesn't have a special rc language, it uses Emacs-LISP.
Yes, but Emacs has the wonderful "customize" functionality. I could use
Emacs without learning LISP, but wouldn't want use JED without learning
S-Lang. I believe there's a tk script for customizing slrn, could that be
redesigned to generate meaningful S-Lang code?

>> Real simple, if you're a S-lang guru. In JED, I can just press C-h v,
>> like in Emacs. In fact the C-h v in the extended "hyperhelp" help mode
>> lets me customize the variable while I'm at it.
> Perhaps you should write up a fixed set of features, keybindings, and let
> people who are knowledgable about writing macros take a look.
Why? SLRN is sort of a clone of Gnus, just read the Gnus manual. One
thing I miss is scrolling up one line with M-enter. Since Gnus runs in
Emacs, some features of Emacs such as the C-h v should also be in slrn.
Another misfeature is the i18n. See the attribution line to see what I
mean. It's not even correct Dutch!

> Or you could learn S-Lang and implement it yourself.
I'm rather busy with my rmail pet project for JED, which will eventually
make mutt, slrn and Gnus obsolete.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: processed by gpg.sl <http://jedmodes.sf.net>

iEYEARECAAYFAj/lgsUACgkQ1RTqFUe7bzN4KACeKv3/3NPMX2yMfFz3oRsEa2tr
I2UAnj3EujoIN2lldjMiZcaVZcHdlq5Y
=g/ID
-----END PGP SIGNATURE-----
Re: [announce] mutt vs slrn - a comparison
#139694
Author: J.B. Nicholson-Owens
Date: Mon, 22 Dec 2003 05:00
79 lines
5320 bytes
In <slrnbu9n9s.2hu.jbn@forestfield.org> I asked if mutt has an S-Lang
prompt.

Paul replied:
> I gather that's a rhetorical question since mutt does not have S-Lang.
> I believe Vim has ex-commands as well as support for other scripting
> languages, so it's not unprecedented.

It was not a rhetorical question.  I've used mutt before but I don't use
much of its capabilities and I haven't kept up with the various patches
available to make mutt do different things.  My version of mutt suits my
needs but is out of date.  So I did not know.

> From slrnfuns.txt:
> 
>   7.14.  set_integer_variable

Thanks, but I'm fairly familiar with slrn's S-Lang API.  Perhaps you didn't
know this, but there is no way for a slrn macro to read or set the
server->newsrc mapping indicating which newsrc to use with which news
server.  There's no way a slrn macro can read or set the regular expressions
that determine what is quoted material and what is not.

There is also no fast way for a macro to retreive the list of articles
including their relationship to other articles.  A macro must navigate the
article list by moving the cursor, reading header information and
reconstructing the parent-child relationships.  This means the more articles
there are to scan the longer the scan will take.  This kind of list walking
can quickly become prohibitively expensive (in terms of time) on slow
machines.  I think it would be faster to pass a reference to an array
containing an ordered list of structures in which each structure holds an
article (or some unambiguous reference to an article, like a message-ID) and
an array of similar article references if that article has child articles. I
imagine if this array had other metalevel info about the articles (and was
somehow updated as the state of the articles changed) it would be even more
useful.

One could make a macro to build such an array, and once built, this array
would let macros quickly deal with the article list.  One could use the
information found in this array to quickly jump around the article list
without having to navigate it one article at a time (or even one thread at a
time).  But slrn could construct this array much more quickly than any macro
and keep the data within the array updated (or allow the macro the ability
to fetch a new state listing ad hoc).

> I believe there's a tk script for customizing slrn, could that be
> redesigned to generate meaningful S-Lang code?

I don't know what tk script you're talking about, so I have no comment on
how it might be useful.

> Why? SLRN is sort of a clone of Gnus, just read the Gnus manual.

Because you appeared to be looking for assistance getting some job done.
When asking someone for help it's usually a good idea to give them a clear 
understanding of precisely what you want done.

A lot of slrn's features come from Gnus, but to say slrn is a clone of Gnus
goes too far I think.  Gnus is considerably more powerful than slrn but slrn
has a much smaller footprint and slrn doesn't encourage the use of any
particular text editor, just to name a couple differences.  I don't think
slrn's developers aspire to make slrn a full replacement for Gnus.

> [...] I miss is scrolling up one line with M-enter. Since Gnus runs in
> Emacs, some features of Emacs such as the C-h v should also be in slrn.

If you think they're missing, by all means add them.  But if you are too
busy to do the work and you want someone else to do it, expect to have to
describe the features you want in detail.  I don't use Emacs and I don't tax
much of what JED has to offer either (even in Emacs mode), so I don't
immediately know what wonderful functionality C-h v is supposed to provide.

> Another misfeature is the i18n. See the attribution line to see what I
> mean. It's not even correct Dutch!

I don't speak Dutch so I never would have noticed.  Perhaps you could
describe in more detail how the internationalization is broken.

Happy newsreading.
Re: [announce] mutt vs slrn - a comparison
#139700
Author: Paul Boekholt
Date: Mon, 22 Dec 2003 09:13
95 lines
4716 bytes
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 22 Dec 2003 05:00:09 GMT, "J.B. Nicholson-Owens" <jbn@forestfield.org> said:
> 
> In <slrnbu9n9s.2hu.jbn@forestfield.org> I asked if mutt has an S-Lang
> prompt.
Actually there was a patch to add S-Lang to Mutt once. Never saw it
though.

>  There's no way a slrn macro can read or set the regular expressions
> that determine what is quoted material and what is not.

What version of S-Lang are you using?

  7.13.  set_ignore_quotes


      Usage
        Void set_ignore_quotes (Array_Type regexps)

      Description
        This function allows you to change the setting of the
        ignore_quotes configuration command. regexps has to be a (one-
        dimensional) array of 1-5 strings that are interpreted as
        regular expressions to detect quoted lines.

      Example
        set_ignore_quotes (["^>", "^|"]);

      Notes
        This function is only available if slrn was compiled with S-Lang
        1.4.x.  The effect of this command becomes visible with the next
        article you download. If one is currently displayed, it remains
        unaffected.

 
> But slrn could construct this array much more quickly than any macro
> and keep the data within the array updated (or allow the macro the ability
> to fetch a new state listing ad hoc).
You could develop it as a S-Lang module.

> Because you appeared to be looking for assistance getting some job done.
No, I'm trying to help you.

> > [...] I miss is scrolling up one line with M-enter. Since Gnus runs in
> > Emacs, some features of Emacs such as the C-h v should also be in slrn.
> 
> If you think they're missing, by all means add them.
At least the M-enter is easy.

setkey article article_line_up      "\e\r"	% Scroll article up one line

But since slrn is almost a Gnus clone, this should be the default.

> But if you are too busy to do the work and you want someone else to do
> it, expect to have to describe the features you want in detail.
All I'm saying is that

     message(string(get_variable_value("use_metamail")))

is rather a lot of typing. Someone familiar with Emacs (or JED) would
rather type

C-h v use_m<TAB>

except that apparently use_metamail is not a S-Lang variable. I don't do
much newsreading and what little I do, I'm now doing in JED. If most
slrn-users are more familiar with Vi than with Emacs, maybe it should be

:set use_m<TAB>

or something. Since mutt has a NNTP patch, slrn might as well try to
remain similar to Gnus. Or it could support both.

> > Another misfeature is the i18n. See the attribution line to see what I
> > mean. It's not even correct Dutch!
> 
> I don't speak Dutch so I never would have noticed.  Perhaps you could
> describe in more detail how the internationalization is broken.
It should be

Op 2003-12-20 schreef J.B. Nicholson-Owens <jbn@forestfield.org>:

But I'd rather have the attribution in English. While I'm at it, slrn's
Dutch translations seem rather poor compared to mutt's.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: processed by gpg.sl <http://jedmodes.sf.net>

iEYEARECAAYFAj/mtYAACgkQ1RTqFUe7bzMYMgCcCvCDobuglLdednGnzeJgRSW2
jRoAoNE/6+64zx5uxLNlle8+kknwtw8x
=IABU
-----END PGP SIGNATURE-----
Re: mutt vs slrn - command line with tab expansion
#139704
Author: Sven Guckes
Date: Mon, 22 Dec 2003 10:40
21 lines
2321 bytes
* Paul Boekholt <p.boekholt@hetnet.nl>:
> All I'm saying is that [the following] is rather a lot of typing.
>   message(string(get_variable_value("use_metamail")))
>
> Someone familiar with Emacs (or JED) would rather type
>   C-h v use_m<TAB>
>
> .. If most slrn-users are more familiar with
> Vi than with Emacs, maybe it should be
>   :set use_m<TAB>

indeed, long function names with several levels of brackets and
some quoting are quite likely to become annoying rather than fun.
the command line within mutt with its expansion of variables names
and expansion of the current value is much easier to handle.
that's why suggest such a feature for slrn, too.

and i don't really care whether this will be done with slang macros
or with some extra implementation. at least not right now. comments?

Sven  [has yet to evaluate Thomas Schultz macros, though]
Re: [announce] mutt vs slrn - a comparison
#139726
Author: J.B. Nicholson-Owens
Date: Mon, 22 Dec 2003 22:45
5 lines
1516 bytes
Paul Boekholt wrote:
>   7.13.  set_ignore_quotes

I stand corrected on this feature, however the bulk of the rest of what I
said stands.
Re: [announce] mutt vs slrn - a comparison
#139741
Author: Paul Boekholt
Date: Tue, 23 Dec 2003 12:33
52 lines
3488 bytes
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 22 Dec 2003 22:45:21 GMT, "J.B. Nicholson-Owens" <jbn@forestfield.org> said:
> I stand corrected on this feature, however the bulk of the rest of what I
> said stands.

I believe you said that
- -you're against a ":" prompt that accepts commands in the slrnrc language,
 which I'll refer to as the "internal language"
- -there are some things you can do in the internal language, but not in S-Lang.

Your point being that the internal language should be dropped and everything
should be done over S-Lang. That's fine for S-Lang programmers, but as you
said slrn doesn't encourage the use of any particular text editor, most Vim
users do not know S-Lang. It may be easier/quicker/more desirable to make
the internal language interactive. If it could then be embedded in S-Lang,
your problem would be solved (well almost - it should also be possible to
read "internal variables" in S-Lang scripts. I'm not familiar with slrn, I'm
making the terminology up as I'm writing this.)

  5.1.  call


      Usage
        Void call (String fun)

      Description
        This function is used to execute an interactive slrn internal
        function.  Such functions are used with setkey statements in the
        .slrnrc startup files.

Apparently, slrn distinguishes between interactive slrn internal
functions, and non-interactive ones that can only be used in startup
files. If you could type

call("any legal slrn command");

the ":" prompt could easily be implemented in S-Lang (the tab completion
would be more difficult of course) and Sven's problem would be solved too.

BTW is there a slrn macro to fix messages where the reply is above the
quoted text? I'm trying to read a newsgroup where I see only some of the
messages and half the posters quote the wrong way round.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: processed by gpg.sl <http://jedmodes.sf.net>

iEYEARECAAYFAj/oNjQACgkQ1RTqFUe7bzOG6ACgkFai05G12xXN+Kq3J9sUqXkq
IVMAnjclQ7csL1LfC6vOTT9WYO81znqf
=5L5O
-----END PGP SIGNATURE-----
Re: [slrn] fixing tofu for display
#139766
Author: Sven Guckes
Date: Wed, 24 Dec 2003 07:44
31 lines
2677 bytes
* Paul Boekholt <p.boekholt@hetnet.nl>:
> BTW is there a slrn macro to fix messages where the
> reply is above the quoted text? I'm trying to read
> a newsgroup where I see only some of the messages
> and half the posters quote the wrong way round.

so you want slrn to use an internal slang function
which rearranges the text before it gets displayed?

so this would switch
from  tofu  ((new) text over, fullquote under)
to    fotu  (fullquote  over, (new) text (under)).

but i'd prefer to write it like this:
from "ntuf" (new text under fullquote)
to   "ntof" (new text over  fullquote)

gah - i wish those acronyms would be easier to pronounce.  ;-)
anyone got nicer acronyms which still make sense when read aloud?

anyway, thomas sent me a macro which allows an arbitrary external
program/script to rearrange the text before it gets displayed.
so this should act like the display_filter within mutt.

by the way, i am using "sed" as the display_filter
to make changes and deletions to the message's text,
but i'm not sure how to "detect" a fullquote
and how to move it to the start of the text.
suggestions?

Sven
Re: [slrn] fixing tofu for display
#139771
Author: Paul Boekholt
Date: Wed, 24 Dec 2003 10:07
35 lines
2949 bytes
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 24 Dec 2003 07:44:07 GMT, Sven Guckes <usenet@guckes.net> said:
> so you want slrn to use an internal slang function
> which rearranges the text before it gets displayed?
Rather a slang script, colloquially known as library function, or user
defined function. It would probably use regexp functions also available
in JED, so I could adapt it. I've done that once with oe_quot.sl, see
<http://jedmodes.sourceforge.net/mode/email/last/download/email.sl>

> so this would switch
> from  tofu  ((new) text over, fullquote under)
> to    fotu  (fullquote  over, (new) text (under)).
Yes.

> but i'd prefer to write it like this:
> from "ntuf" (new text under fullquote)
> to   "ntof" (new text over  fullquote)
That may make more sense when you don't want to read the fullquote. But
when you reply to your rearranged message, you'll look funny.

> by the way, i am using "sed" as the display_filter to make changes and
> deletions to the message's text, but i'm not sure how to "detect" a
> fullquote and how to move it to the start of the text.
Does sed have psychic powers? When there's a single block of quoting,
it's very long, and ends in a signature, it's probably a fullquote.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: processed by gpg.sl <http://jedmodes.sf.net>

iEYEARECAAYFAj/pZWYACgkQ1RTqFUe7bzMSMACgjdlNwO2Ex14DM+SFrg5HQ178
FOgAn0+0D1QExhp9owEhwu90IDhvKORS
=NwgR
-----END PGP SIGNATURE-----
Re: [slrn] fixing tofu for display
#139774
Author: Sven Guckes
Date: Wed, 24 Dec 2003 10:58
32 lines
2993 bytes
* Paul Boekholt <p.boekholt@hetnet.nl>:
> On 24 Dec 2003 07:44:07 GMT, Sven Guckes <usenet@guckes.net>:
>> so you want slrn to use an internal slang function
>> which rearranges the text before it gets displayed?
> Rather a slang script, colloquially known as library function, or user
> defined function. It would probably use regexp functions also available
> in JED, so I could adapt it. I've done that once with oe_quot.sl, see
> <http://jedmodes.sourceforge.net/mode/email/last/download/email.sl>

so - can you do it for slrn, too?

>> but i'd prefer to write it like this:
>> from "ntuf" (new text under fullquote)
>> to   "ntof" (new text over  fullquote)
> That may make more sense when you don't want to read the fullquote.
> But when you reply to your rearranged message, you'll look funny.

well, i guess there needs be two kinds of replies/followups:
with and without the pre-formatting.

>> by the way, i am using "sed" as the display_filter to make changes and
>> deletions to the message's text, but i'm not sure how to "detect" a
>> fullquote and how to move it to the start of the text.
>
> Does sed have psychic powers? When there's a single block of quoting,
> it's very long, and ends in a signature, it's probably a fullquote.

well, describing such things is not easy within sed as you
don't have a language with if/then/else "branches".  ok,
there *is* such a thing, but it's not really readable. ;-)

Sven
Re: [slrn] fixing tofu for display
#139798
Author: Paul Boekholt
Date: Wed, 24 Dec 2003 23:09
82 lines
4455 bytes
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 24 Dec 2003 10:58:47 GMT, Sven Guckes <usenet@guckes.net> said:
> so - can you do it for slrn, too?
Write an un_tofu function you mean? I'd prefer to do it in JED, and later
port it to slrn, since JED provides a nice S-Lang IDE and slrn does not.

> well, describing such things is not easy within sed as you
> don't have a language with if/then/else "branches".  ok,
> there *is* such a thing, but it's not really readable. ;-)

Doing it with S-Lang is not easy either, it has a nice C-like syntax but
the regexp functions are not as powerful as in, say, Emacs lisp (or sed).
That's actually the weakest point of S-Lang. Maybe it should be solved in
Awk or something. Writing this without using JED's intrinsics is awkward
enough for me, but I hope it can be useful in slrn as well. To fix tofu
in reply to other tofu, ntuf in reply to tofu etc. it should be made
recursive - the quoted part should be compared against a quoted tofu
pattern. Maybe next year. Merry Christmas.

define string_nth_match()
{
   variable pos, len;
   (pos, len) = string_match_nth(n);
   return substr(str, pos+1, len);
}

define un_tofu()
{
   mark_buffer;
   variable article = bufsubstr_delete;
   EXIT_BLOCK
     {
	insert (article);
     }

   % from here it should not be JED-specific
   
   % S-Lang's regexps are weak - we can group a part with parentheses,
   % but we can't make the make the group optional, so to match the
   % attribution we have to make a substring match and then do a
   % string_match on that. That will not match a quote at the beginning,
   % so we just string_match twice.
   !if (string_match
	(article,
	 "\\n>", 1)) return;

   % Now split the article in an unquoted part, and a part with quotes
   variable pos1, pos2;
   (pos2, ) = string_match_nth(0);
   pos1 = pos2;
   
   variable part2 = substr(article, pos2+1, -1);
   % If second part is all quoted, it's tofu
   if (string_match(part2, "\\n[^>]", 1)) return;
   
   % To find the attribution, check the article again, including the last
   % non-empty line of the non-quoted part.
   variable attribution = "";
   if (string_match(article, "\\(\n+[^\n]+\n*\\)\\n>", 1))
     { 
	attribution = string_nth_match(article, 1);
	if (orelse
	    { is_substr(attribution, "@")}
	      { attribution[-1] == ':'})
	  (pos1, ) = string_match_nth(1);
	else attribution = "";
     }
   
   variable part1 = substr(article, 1, pos1);
   
   article = strcat(attribution, part2, part1);
}
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: processed by gpg.sl <http://jedmodes.sf.net>

iEYEARECAAYFAj/qGwMACgkQ1RTqFUe7bzOAJQCfWkvHxuJWR0AnO8sKAB0Zw9p+
3CUAmgMm64Y13vS8ZUj8j60nJU0QEEmB
=LUXc
-----END PGP SIGNATURE-----
Re: [announce] mutt vs slrn - a comparison
#139817
Author: Mike Dee
Date: Thu, 25 Dec 2003 10:11
27 lines
2464 bytes
> well, mutt once *had* mouse support.  it ws dropped,
> though.  for good.  at least that's how i see it.
> those of you using slrn on windows may need it.
> 
> oh, well, there is mouse code in slrn..
> guess i'll add this item for the heck of it.
> 
> but i doubt this is a plus for slrn. ;-)
> 
> seriously:  if anyone is using slrn with mouse
> then pleae get in touch and tell me about it.
> i personally never had a use for it at all...

Hi, I'm a *total* slrn [Win32] newbie and this is the first time I've used
a CLI type newsreader, I haven't tried any other CLI type before, including
MUTT. I did have the mouse turned on in slrn [for about 10 minutes], but
have quickly decided this program is better off without it.

Besides. when it comes to editing a post, slrn [Win32], uses an external
editor, where a mouse can be of more use. But for the operation of slrn
itself, it becomes a hinderance ie, click your right mouse button in a
slrn group window and see where it gets you.

But this is just my newbie observations. I quite like slrn, so far, just
haven't the experience with others yet to compare. - as an aside - slrn looks
pretty good to me but I don't think a mouse is important for it to operate,
even in Win32. Just MHO.
Re: [slrn] verbatim text
#141038
Author: Sven Guckes
Date: Mon, 12 Jan 2004 03:36
35 lines
2714 bytes
* Ben Shimmin <bas@monster.buffster.org.uk> [2004-01-12]:
> Sven Guckes <usenet@guckes.net>:
>> my point: the manual should have a short section explaining
>> the idea behind verbatim text and why such marks are necessary.
>
> I agree that it is a somewhat clumsy definition, not a little along the
> lines of `to understand recursion, one must first understand recursion'.

exactly.

> The suggestion that they might be used for source code, however, and
> the fact that, when employed, the text inside these marks appears in
> a different colour, may perhaps be enough to illustrate their usage.

indeed.  but then you cannot put a color screenshot into a text manual. :-/

> Given that no other client actually supports them, though, I don't
> really think they're of any particular use (at the moment), and
> would probably only serve to confuse people not familiar with slrn.

actually, that's a plus.  *grin*

> On the other hand, it has been my experience that
> writing `sic' confuses the hell out of people too.

hmm?

like i said:  a small chapter with a few paragraphs of explanation and a
small example would be nice to help explaining the use of verbatim text.
actually, i would not mind a few color screenshots which can show the
use of the color options and some more features.  and if it gets too
big, well, make the picture documentation its own package.  *shrug*

Sven
Re: [slrn] fixing tofu for display
#141043
Author: John E. Davis
Date: Mon, 12 Jan 2004 05:49
185 lines
7938 bytes
On 24 Dec 2003 23:09:08 GMT, Paul Boekholt <p.boekholt@hetnet.nl>
wrote:
>Doing it with S-Lang is not easy either, it has a nice C-like syntax but
>the regexp functions are not as powerful as in, say, Emacs lisp (or sed).
>That's actually the weakest point of S-Lang. Maybe it should be solved in

Agreed.  However, you should be able to use the pcre module
(slang/modules in the slang source dist) with slrn, e.g., 
#v+
   import ("pcre");
       .
       .
   compiled_pattern = pcre_compile (pattern);
   if (pcre_exec (compiled_pattern, text_to_match)) {...}
       .
       .
#v-

The module contains documentation that may be stripped with sl2tm and
tm2txt (in the slang/doc/tm/tools directory):
#v+
  sl2tm pcre-module.c | tm2txt
#v-
to yield:

#v+
pcre_compile

 SYNOPSIS
   Compile a regular expression

 USAGE
   PCRE_Type pcre_compile (String_Type pattern [, Int_Type options])

 DESCRIPTION
   The `pcre_compile' function compiles a PCRE style regular expression
   and returns the result.  The optional `options' argument may be used
   to provide addition information affecting the compilation of the pattern.
   Specifically, it is a bit-mapped value formed from the logical-or of zero 
   or more of the following symbolic constants:

       PCRE_ANCHORED     Force the match to be at the start of a string
       PCRE_CASELESS     Matches are to be case-insensitive
       PCRE_DOLLAR_ENDONLY (See PCRE docs for more information)
       PCRE_DOTALL       The dot pattern matches all characters
       PCRE_EXTENDED     Ignore whitespace in the pattern
       PCRE_EXTRA        (See PCRE docs for features this activates)
       PCRE_MULTILINE    Treat the subject string as multi-lines
       PCRE_UNGREEDY     Make the matches greedy
       PCRE_UTF8         Regard the pattern and subject strings as UTF-8

   Many of these flags may be set within the pattern itself.   See the PCRE
   library documentation for more information about the precise details 
   of these flags and the supported regular expressions.
   
   Upon success, this function returns a `PCRE_Type' object representing
   the compiled patterned.  If compilation fails, an error will be thrown.

 SEE ALSO
   pcre_exec, pcre_nth_match, pcre_nth_substr
--------------------------------------------------------------

pcre_exec

 SYNOPSIS
   Match a string against a compiled PCRE pattern

 USAGE
   Int_Type pcre_exec(p, str [,pos [,options]]);

      PCRE_Type p;
      String_Type str;
      Int_Type pos, options;


 DESCRIPTION
   The `pcre_exec' function applies a pre-compiled pattern `p' to a 
   string `str' and returns the result of the match.  The optional third 
   argument `pos' may be used to specify the point, as an offset from the
   start of the string, where matching is to start.  The fourth argument, if
   present, may be used to provide additional information about how matching
   is to take place.  Its value may be specified as a logical-or of zero or
   more of the following flags:

      PCRE_NOTBOL      
           The first character in the string is not at the beginning of a line.
      PCRE_NOTEOL
           The last character in the string is not at the end of a line.
      PCRE_NOTEMPTY
           An empty string is not a valid match.

   See the PCRE library documentation for more information about the meaning 
   of these flags.
   
   Upon success, this function returns a positive integer equal to 1 plus the
   number of so-called captured substrings.  It returns 0 if the pattern
   fails to match the string.

 SEE ALSO
   pcre_compile, pcre_nth_match, pcre_nth_substr
--------------------------------------------------------------

pcre_nth_match

 SYNOPSIS
   Return the location of the nth match of a PCRE

 USAGE
   Int_Type[2] pcre_nth_match (PCRE_Type p, Int_Type nth)

 DESCRIPTION
   The `pcre_nth_match' function returns an integer array whose values
   specify the locations of the beginning and end of the `nth' captured 
   substrings of the most recent call to `pcre_exec' with the compiled
   pattern.  A value of `nth' equal to 0 represents the substring 
   representing the entire match of the pattern.
   
   If the `nth' match did not take place, the function returns `NULL'.

 EXAMPLE
   After the execution of:

       str = "Error in file foo.c, line 127, column 10";
       pattern = "file ([^,]+), line (\\d+)";
       p = pcre_compile (pattern);
       if (pcre_exec (p, str))
         { 
            match_pos = pcre_nth_match (p, 0);
            file_pos = pcre_nth_match (p, 1);
            line_pos = pcre_nth_match (p, 2);
         }

   `match_pos' will be set to `[9,29]', `file_pos' to `[14,19,]'
   and `line_pos' to `[26,29]'.  These integer arrays may be used to 
   extract the substrings matched by the pattern, e.g.,

        file = substr (str, file_pos[0]+1, file_pos[1]-file_pos[0]);

   Alternatively, the function `pcre_nth_substr' may be used to get the 
   matched substrings:

        file = pcre_nth_substr (p, str, 0);


 SEE ALSO
   pcre_compile, pcre_exec, pcre_nth_substr
--------------------------------------------------------------

pcre_nth_substr

 SYNOPSIS
   Extract the nth substring from a PCRE match

 USAGE
   String_Type pcre_nth_substr (PCRE_Type p, String_Type str, Int_Type nth)

 DESCRIPTION
   This function may be used to extract the `nth' captured substring
   resulting from the most recent use of the compiled pattern `p' by the
   `pcre_exec' function.  Unlike `pcre_nth_match', this function returns
   the specified captured substring itself and not the position of the substring.
   For this reason, the subject string of the pattern is a required argument.

 SEE ALSO
   pcre_compile, pcre_exec, pcre_nth_match
--------------------------------------------------------------

slang_to_pcre

 SYNOPSIS
   Convert a S-Lang regular expression to a PCRE one

 USAGE
   String_Type slang_to_pcre (String_Type pattern)

 DESCRIPTION
   This function may be used to convert a slang regular expression to a PCRE
   compatible one.  The converted is returned.

 SEE ALSO
   pcre_compile, string_match
--------------------------------------------------------------
#v-

--John
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads