Next Previous Contents

5. The slrn configuration file

5.1 Basics

Most customizations in slrn are done using an initialization file. If your administrator wanted to provide reasonable defaults for your system, he might have created a global configuration file. When reading such a file, slrn tells you its filename at startup (use ``slrn -w'' if you want to read the startup messages easily).

The right place for your own settings is your personal configuration file, which by default is .slrnrc (or slrn.rc on VMS, OS/2 and Windows) in your home directory. It is possible to override settings from the global file here.

An slrn configuration file consists of configuration commands, each one on a line of its own. Most commands require arguments that can be either strings or integer values. If a string contains whitespace, you have to enclose it in double quotes (").

The percent sign (%) is used as the comment character. From this character on, everything else on the same line will be ignored. Example:

        % Name of signature file to use
        set signature ".signature"

If you set the same variable more than once in your configuration file, the last setting will take effect.

The easiest way to build a personal configuration file is to make a copy of the annotated sample slrn.rc that is included in the slrn distribution and to tailor it to your needs.

This manual contains a list of all configuration commands and variables.

5.2 Preprocessing of configuration files

slrn uses routines from libslang to parse its configuration files. Among other things, a simple preprocessing facility similar to cpp(1) is provided that makes it possible to use a number of conditions in your configuration files.

Apart from minor syntactic differences, this is how they are used:

        #if...
          % Configuration commands to use if the condition is true.
        #elif...
          % ``else if''
          % Commands to use if the first condition is false but
          % the above condition is true.
        #else
          % Execute these commands if none of the above conditions
          % were true. This is the fallback case.
        #endif
As usual, you can only use one ``#if'' condition, any number of ``#elif'' conditions (including none) and up to one ``#else'' statement. If the ``#endif'' statement is missing, everything up to the end of the file is included.

Conditions may be nested, but you may not use whitespace in front of the ``#'' characters. However, whitespace may be used freely after the leading ``#'' which is useful for indenting.

#iffalse, #ifntrue

The equivalent of ``#if 0'' in cpp(1) which always returns false. This can be used to deactivate a part of your configuration without having to set a comment character (``%'') in front of each line.

Example:

        #iffalse
          This code will never
          be included in your
          configuration file.
        #endif

#iftrue, #ifnfalse

The inverse of iffalse. This condition is always true which means that configuration commands in this block will always be executed.

#if$ENV

This condition is true if the environment variable $ENV is set.

Example:

        #if$DISPLAY
          % The environment variable DISPLAY is set, so we assume
          % that X is running and use an editor with GUI.
          set editor_command "gvim +%d %s"
        #else
          % DISPLAY is unset, so we fall back to a textmode editor
          set editor_command "vi +%d %s"
        #endif

#ifn$ENV

This condition is true if the environment variable ENV is not set.

#if$ENV string1 string2 ...

The condition is true if the contents of the environment variable ENV are equal to at least one of its argument strings. The arguments have to be separated using whitespace. There is no quoting mechanism for space or tabulator characters.

Example:

        #if$TERM rxvt
          % In my rxvt, ``default'' is a light background;
          % ``color15'' is re-defined as a dark shade of blue.
          color normal    "black"         "default"
          color headers   "color15"       "default"
          color thread_number     "blue"  "default"
          % [...] More color settings follow
        #elif$TERM linux wsvt*
          % On the Linux or NetBSD console, I prefer a black background
          % to reduce flickering:
          color normal    "lightgray"     "black"
          color headers   "brightblue"    "black"
          color thread_number     "brown" "black"
          % [...] More color settings follow
        #endif
The strings may contain wildcard characters. The ``?'' character matches an arbitrary single character and ``*'' matches any number of characters (including none). To use them literally, you have to escape them with a backslash (``\*'' and ``\?''). The backslash itself also has to be escaped when used literally (``\\'').

#ifn$ENV string1 string2 ...

The condition is true if the contents of the environment variable ENV are equal to none of its argument strings. The arguments have to be separated using whitespace. There is no quoting mechanism for space or tabulator characters.

As with #if$ENV, wildcards can be used.

#ifdef SYMBOL1 SYMBOL1

This condition is true if any of its arguments is a defined preprocessor symbol. You can define symbol using the -D command line switch.

Depending on the operating system, one of the following symbols is defined: ``UNIX'', ``WIN32'', ``NT'', ``VMS'', ``OS2''.

Example:

        #ifdef UNIX
          % On Unix, printer_name is the command to use for printing
          set printer_name "lpr -Pmy_printer"
        #elifdef WIN32
          % On Win32, printer_name is set to the print queue
          set printer_name "MyPrinter"
        #endif

#ifndef SYMBOL1 SYMBOL2 ...

This condition is true if none of its arguments is a defined preprocessor symbol.

5.3 Configuration commands

autobaud

Usage: autobaud
Default: off

The autobaud command may be used to synchronize the output rate slrn uses to the terminal baud rate.

charset

Usage: charset option charset

option can be one of these:

display

slrn will use this character set when displaying articles.

Default: detected from locale settings if supported by OS. (autodetection not supported in (cyg)win)

outgoing

This setting will be used for the charset encoding of outgoing articles and emails. Setting a value like "iso-8859-15,utf-8" is possible; slrn will try the settings from left to right and use the first for which encoding succeeds.

config

Set this value if your .slrnrc contains non-ascii characters.

Default: us-ascii

editor

Set this value if the encoding your editor uses is different from the locale setting.

Default: value from charset display

color

Usage: color display_element foreground background [attributes]

If your terminal supports ANSI color sequences, you can use the color command to define your own color scheme. You can assign a different color to almost every element on your screen.

display_element can be one of these:

article

Regular text in the article body.

author

The author's name / email address in header overview.

boldtext

Text in the article body that is interpreted as *bold*.

box

Text inside of selection boxes (like the one you see when choosing a sorting mode).

cursor

The cursor you see in the group window and in header overview.

date

The article date in the header overview.

description

The group descriptions (taglines) in group window.

error

Error messages in the bottom line.

frame

The frame around selection boxes (see also: ``box'').

from_myself

The ``From:'' header line or realname in header overview, in case it contains your name.

group

The group names in group window.

grouplens_display

GroupLens scores.

header_name

The name of header lines in the pager (e.g. ``From:'').

header_number

The header number in header overview.

headers

The content of header lines in the pager.

high_score

The exclamation mark (``!'') used to denote high scoring articles in header overview.

italicstext

Text in the article body that is interpreted as /italic/.

menu

The first line of your display. If mouse reporting is turned on, it contains a menu.

menu_press

A menu item while you click on it.

message

The messages and prompts in the bottom line of the screen.

neg_score

The subject / score of articles with a negative score value, depending on the setting of color_by_score.

normal

Everything that does not have its own color object.

pos_score

The subject / score of articles with a positive score value, depending on the setting of color_by_score.

pgpsignature

PGP signatures appended to the article body.

quotes

Quoted text in the article body. It is now possible to distinguish up to 8 levels of quoted material by using color objects ``quotes0'' to ``quotes7''.

response_char

The highlighted character you need to press if you want to make a selection (e.g. in ``[Y]es or [N]o?'').

selection

The ``cursor'' used in selection boxes (see also: ``box'').

signature

Signatures appended to the article body.

status

The status lines slrn displays.

subject

The subject in header overview (see also: ``unread_subject'').

thread_number

The number of articles in the thread (displayed in header overview next to collapsed threads).

tilde

The tilde displayed at the end of the article body.

tree

The thread tree drawn in the header overview.

underlinetext

Text in the article body that is interpreted as _underlined_.

unread_subject

Color for unread subjects. Please see the entry on highlight_unread_subjects for details.

url

Used to highlight URLs in the article body.

verbatim

Text in the article body enclosed by verbatim marks.

The foreground and background colors have to be set to one of the following strings:

        black      gray
        red        brightred
        green      brightgreen
        brown      yellow
        blue       brightblue
        magenta    brightmagenta
        cyan       brightcyan
        lightgray  white

Additionally, you can use the default foreground / background colors of your terminal via the keyword ``default''.

Please note that the colors in the right column are all ``bright'' (or ``bold''). On many terminals, they can only be used for the foreground. If you think your terminal has more than 8 background colors, but slrn refuses to use them, you might need to chose a different terminfo entry. On modern xterms and rxvt, setting $TERM to xterm-16color should work.

Some terminals support more than 16 colors, and slrn can then use 256 colors when compiled against slang-2. The additional values for foreground and background colors are specified as colorN, where N is a decimal number from 0 to 256. In this case, $TERM may need to be set to xterm-256color.

After the color settings, you can optionally use attributes (like underline and bold) the same way you would specify them using the mono command (see there for details).

A sample color scheme (which simply sets the colors to their compile time default) can be found in the slrn.rc file that should have come with your slrn distribution.

compatible_charsets

This command is obsolete, use charset instead.

group_display_format

Usage: group_display_format number format-string

This command allows you to change the way the groups are presented to you in the group window. You can save up to 10 different formats and switch among them using toggle_group_formats (default binding: ESC a).

The default settings are:

        group_display_format 0 "  %F%-5u  %n%45g%d"
        group_display_format 1 "  %F%-5u  %n%50g%-8l-%h"
        group_display_format 2 "  %F%-5u [%-6t]  %n"

number is the number of the format (0-9).

The following % escapes can be used:

        F  Group flag (`U' for unsubscribed, `N' for new)
        d  Group description (needs to be downloaded once with slrn -d)
        h  ``High water mark'' (highest article number in the group)
        l  ``Low water mark'' (lowest article number in the group)
        n  Group name
        t  Total number of articles in the group (estimate)
        u  Number of unread articles in the group

The special descriptors ``%g'' and ``%?'' work like in header_display_format.

grouplens_add

Usage: grouplens_add newsgroup

Add newsgroup to the list of groups for which you want to download GroupLens scores.

header_display_format

Usage: header_display_format number format-string

This command can be used to customize the way article headers are presented in the header overview in article mode. You can specify up to 10 different formats and switch among them using toggle_header_formats (default binding: ESC a). This command may also be used with a prefix argument to select a particular format, e.g., ESC 0 ESC a will select the 0th format.

Here are slrn's default settings:

        header_display_format 0 "%F%B%-5S%G%-5l:[%12r]%t%s"
        header_display_format 1 "%F%B%G%-5l:[%12r]%t%s"
        header_display_format 2 "%F%B%-5l:%t%s"
        header_display_format 3 "%F%B%-5S%-5l:%t%50s %r"
        header_display_format 4 "%F%B%-5S [%10r]:%t%49s %-19g[%17d]"

number is the number of the format (0-9).

format-string is a string containing printf(3) style % escapes. This is the generic format:

        %[[-*]w]x

The brackets indicate optional items: w may consist of one or more digits and specifies the width of the field. In fields with a fixed width, the minus sign (-) can be used to right justify an item, the asterisk (*) to center justify it. Please note that these modifiers have no effect if the text does not fit into the field.

The item specifier (x) is required and, depending on its value, has the following meaning:

         %  percent character
         B  body status for true offline reading: 'H' means no body
            (header only), 'M' means body is marked for download
         C  prints `C' if current thread is collapsed
         D  date (as defined by overview_date_format)
         F  flags (read/unread, `*' and `#' tags, header number)
         G  GroupLens score
         P  prints `P' if current article has a parent (inside threads)
         S  score
         T  thread tree
         b  article size (usually in kilobyte)
         c  number of messages in current subthread
         d  date
         f  from header
         l  article length (number of lines)
         n  server number
         r  author's real name
         s  subject
         t  number of messages in thread plus tree

Additionally, the special format descriptor %Xg can be used. It is not substituted by text, but specifies that the next write on the screen should take place in column X (numbered from 0). If X is negative, the cursor is placed X columns from the right edge of the window.

Thus, "%F%-5l:%t%s%-20g %r" indicates that the header window will contain (in that order): the flags, the number of lines the article contains (right justified in a 5 character field), a `:', the tree, the subject, and, beginning 20 columns from the right edge of the window and separated by a blank, the author's real name.

A %? construct can be used to print a string only if one of the above descriptors expands to a non-zero string (i.e. one that is not empty and does not contain only a single whitespace or the number `0'). It has the following syntax:

        %?<descriptor>?<optional string>?
        %?<descriptor>?<string if true>&<string if false>?

You can use escape sequences in optional strings; however, it is not possible to nest them, nor to have literal `?' or `&' characters in them.

Example: If you want to display the number of messages for collapsed threads and the number of lines in the message otherwise, you can use the following:

        %?C?%-3c&%-3l?

Note: The descriptor %b automatically choses a ``unit'' (bytes / kilobytes / megabytes) and works best when given four characters of space, i.e. %-4b. The descriptors %t and %T write directly to the screen, so they cannot be ``tested'' with the %? operator and ignore the requested field width (i.e. ``%10t'' is the same as ``%t''; the ``10'' is ignored). The descriptor %t is included for backwards compatibility and equivalent to ``%?C?%-3c&   ? %T''.

See also: group_display_format, overview_date_format

ignore_quotes

Usage: ignore_quotes pattern [pattern] ...

The regular expressions given here are used to determine quoted lines in the body of an article. You can define up to 5 different patterns (this is meant to make up for the lack of an OR operator in S-Lang regexps). Please try to keep them as exact as possible, so that slrn is able to distinguish different quoting levels - e.g. use ``^>'' rather than ``^>*''.

By default, only one pattern is set: ``^ ? ?[><:=|]''

include

Usage: include filename

You can use this command to load an additional file that contains configuration commands. With this feature, you can easily keep startup files for different key bindings, colors etc. filename is relative to your home directory (see $SLRNHOME). This can safely be done multiple times and recursively.

Example:

        include ".slrnrc-colors"

interpret

Usage: interpret filename

This command loads and executes an S-Lang macro file. filename may be an absolute or relative path. Relative paths are resolved by checking first your macro_directory if set, then $SLRNHOME if set, then $HOME, and finally the default directory set at compile-time for the macros included with slrn.

This command has no effect if the S-Lang interpreter has been deactivated at compile time.

mono

Usage: mono display_element attributes

You can use this command to customize slrn's appearence on monochrome displays. See section color for a description of display_element. attributes can be one of

or ``none'' to turn off video attributes. The attributes can also be combined (simply separate them with blanks). You can find sample settings in the slrn.rc file that should have come with your slrn distribution.

If you don't like blinking, you can turn it off altogether via use_blink. If you run slrn with colors, these settings will not have any effect.

nnrpaccess

Usage: nnrpaccess host[:port] username password

This command can be used to set the necessary data for servers that request NNRP authentification. host is the full hostname of the server.

If you do not feel comfortable with leaving your password written on disk, you might want to set the password (and optionally the username as well) to an empty string (""). slrn will then prompt for it on startup. If your server requires a username, but no password, set it to a blank (" ") and you won't be prompted.

posting_host

Usage: posting_host hostname

The hostname specified in this command will be used to generate Message-IDs. Please note that it is usually not necessary to set this manually, as slrn uses the fully-qualified domain name of the machine it is running on for this task, which is the correct solution in most cases.

However, if your system is part of a local network, it might not have an official hostname. As the current MESSFOR draft permits the use of hostnames without a DNS record for Message-ID generation, some providers started to give each user a unique hostname that may be used here.

Note: Do not use this command unless you fully understand the implications. Specifically, do not enter an arbitrary string here! Instead, please turn off generate_message_id if the hostname found by slrn is not unique.

server

Usage: server nntp-server[:port] newsrc-file

By default, slrn uses .jnewsrc in your home directory (jnews.rc on VMS, OS/2 and Windows) as its newsrc file. If you want to define a different filename for it or if you want to access more than one server, you can use this command. It tells slrn to use newsrc-file when connecting to nntp-server (which has to be the full hostname of the server and an optional port number or, if you are reading from spool, the path of the spool directory).

If your server requires a password, you will also need to use the nnrpaccess command.

set

Usage: set varname value

The set command is used to assign values to the configuration variables described below. varname has to be a valid variable name. value is either a string (best enclosed in double quotes ``"'') or an integer value (number), depending on the variable.

Example:

        set realname "Matthias Friedrich"
        set kill_score -9999

Note: If you set a variable which controls a feature that has not been compiled in, slrn will not give you an error message. The setting will simply remain without an effect.

setkey

Usage: setkey keymap function key-sequence

This command allows you to map slrn's functions to keys. There are three different keymaps: The ``group'' keymap contains all functions in group mode, ``article'' contains the functions in article mode (note that header overview and pager do not have separate keymaps); finally, the ``readline'' keymap can be used to customize the line editor.

function specifies the function that is executed when key-sequence is pressed. In key-sequence, special keys can be addressed in different ways. First of all, the control key plus a character C is written as ^C.

The special function keys found on most keyboards have the following (case insensitive) names:

        <PageUp>
        <PageDown>
        <Up>
        <Down>
        <Right>
        <Left>
        <Delete>
        <BackSpace>
        <Insert>
        <Home>
        <End>
        <Enter>
        <Return>
        <Tab>
        <BackTab>
        <Space>
        <Esc>

Additionally, the keys <F1> through <F20> denote the function keys. When you use these symbolic names, slrn uses the terminfo database (if available) to look up the key sequences generated be those keys, so if these names do not seem to work, make sure you selected the correct terminal (e.g. via the $TERM environment variable).

Alternatively, you can specify special keys by entering the key sequence they generate directly. To do this, the following shortcuts may be useful:

        \e    escape
        \r    return
        \\    backslash
        \NNN  the key sending keycode (octal) NNN

A full list of available functions can be found in sections group functions and article functions.

strip_re_regexp

Usage: strip_re_regexp pattern [pattern] ...

Here, you can define up to 5 different regular expressions to detect non-standard back references created by broken user agents. They will be stripped on followups.

By default, slrn only checks for the standard ``Re:''. This test is performed before strip_re_regexp is even tried and it cannot be turned off.

Note: This variable does not affect the way slrn sorts subjects. For example, ``subject'' and ``Re: subject'' are equivalent when sorting; ``subject'' and ``AW: subject'' are not, even if you defined ``^AW:'' in strip_re_regexp. The reason for this is that it would be too expensive to do a full regexp search whenever comparing subjects.

strip_sig_regexp

Usage: strip_sig_regexp pattern [pattern] ...

slrn itself makes sure that you use the signature delimiter that current drafts prescribe (``-- '' - mind the trailing space!). If you want it to recognize different delimiters as well (e.g. ones created by broken software), you can use this command to define (up to five) regular expressions that match them.

strip_was_regexp

Usage: strip_was_regexp pattern [pattern] ...

When changing the ``Subject:'' header line, some people follow a convention and include the old subject in brackets (e.g. ``new subject (was: old subject)''). You can use this command to strip the old subject automatically on followups and when creating scorefile entries based on the subject (so it will still match when the old subject is stripped). To do this, I recommend the setting `` ?(was:.*)$''.

Note: This variable does not affect sorting. See strip_re_regexp for an explanation.

unsetkey

Usage: unsetkey keymap key-sequence

The unsetkey command undoes a key binding. Please see setkey for more information.

Example:

        unsetkey group "\e"

visible_headers

Usage: visible_headers header_lines

With this command, you can specify a comma-separated list of header_lines that should still be visible in the article pager when the display of all headers is turned off (this is toggled via toggle_headers, by default bound to `t').

Note that the strings are not regular expressions. However, substrings can be used; e.g. ``X-'' matches all headers beginning with ``X-''. It's also possible to exclude certain headers by preceding them with a bang (`!'). If multiple entries match, the last one decides whether or not the header is displayed, so ``X-,!X-Trace:'' shows all X-headers except ``X-Trace:''.

Headers mentioned in visible_headers that don't occur in the article are silently ignored.

Example:

        visible_headers "From:,Subject:,Newsgroups:,Followup-To:,Reply-To:"

Next Previous Contents