Macros and slrn

The slrn newsreader can be easily extended using S-Lang scripts that are most commonly called macros and can be recognised by their ".sl" suffix. This page aims to be an introduction to macros and slrn by describing:

  1. Using the Macros Available with slrn: A description of how to utilise the macros that come with the slrn tarball.
  2. Resources for writing your own macros: Several online resources that will enable the skilled and keen to get a start with writing their own macros.
  3. The Macros of Thomas Schultz: Several macros written by Thomas Schultz described here and made avalable for download.

Using the Macros Available with slrn

The slrn tarball contains a number of pre-written macros in the /macros directory and by default these are installed to /usr/local/share/slrn/slang although this path may very well differ on your system. For the purpose of demonstration I will show how to successfully use one of these macros with slrn, the color.sl macro. This macro implements a function called "edit_colors" that may be used for designing a color scheme interactively. It is called from the .slrnrc file as follows:

interpret "color.sl"
setkey article edit_colors "\eec"

Because this is a well written macro much of this information can be gained from opening the macro itself with your favourite editor and this is really mandatory before using any macro. When the file color.sl is opened you will see that the keybinding of "ESC e c" that I have suggested is drawn from the file itself. After pressing these keys you can now interactively select a color scheme by chosing an object, foreground color and background color.

The same principles hold true for any macro you choose to run with slrn, either those that came with slrn or those that you have sourced from elsewhere. Your own macros can be placed in a variety of locations and then sourced from the .slrnrc file using the interpret command. These locations are:

  1. A path relative to $HOME (or $SLRNHOME if set).
  2. An absolute path prefixed with an "/".
  3. In you "macro_directory" if this string is set in .slrnrc.

This can be best illustrated in this brief extract from the slrn manual where the following example:

interpret "News/macros/my-macro.sl"
interpret "/usr/share/slrn/slang/util.sl"

could be more efficiently be rendered as:

set macro_directory "News/macros,/usr/share/slrn/slang"
interpret "my-macro.sl"
interpret "util.sl"

There are many, many slrn macros available on the Internet. An excellent starting point might be the links available on this web site or the macros that Thomas Schultz has made available. Perhaps you might also read on and see the information for creating your own macros?

Resources for writing your own macros

This page does not offer "hands-on" guidance on the writing of S-Lang macros, although hopefully one day it will. However below are some links that should at the very least furnish an excellent start:

I would recommend as well having a look at the macros of Thomas Schultz which can be seen below.

The Macros of Thomas Schultz

In his time developing slrn Thomas Schultz put together some macros which are preserved on this web site for download:

Thanks again Thomas for making these macros available!