Macros and slrn

The slrn newsreader can be easily extended using S-Lang scripts that are most commonly called macros and these scripts can easily be recognised by their .sl suffix. This page aims to give a brief 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. Downloading Other Macros: Several macros written by others and made available for download from this site.
  3. Writing Your Own Macros: Several online resources that will enable the skilled and keen to get a start with writing their own macros.

Using the Macros Available with slrn

The slrn tarball contains a number of pre-written macros in the /macros directory and a standard installatioin of slrn will place these on your system ready for use. 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 available for direct download from this page. Perhaps you might also read on and see the information for creating your own macros?

Downloading Other Macros

Several fine macros can be downloaded directly from this website:

Thanks again to the authors for making these macros available!

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: