Customizing the nn Newsreader

Platform: Unix
Level of Difficulty: Intermediate
<hr>
Rutgers Main | OIT Main | NBCS Main | NBCS Documentation Main


Introduction

The Office of Information Technology supports the nn news reader, a powerful, menu-driven interface to Netnews. With nn, you can read individual articles in newsgroups, respond through electronic mail to authors of articles, remail articles to other users, and post your own articles for local or more widespread distribution. In addition, special nn configuration files allow you to customize the nn environment to suit your own needs and interests.

The instructions below describe such customizations. To become more proficient in other aspects of nn, consult the other nn documents, available at all OIT locations.

While the specific procedures in this document apply to the OIT computers, they can easily be used by people with accounts on other UNIX systems that run nn.

Creating an .nn/init File

If you know the names of the newsgroups or newsgroup categories you want to see, you can create a special initialization (or "init'') file called .nn/init. An init file allows you to specify the groups you want to see as well as their order of presentation. (The order of presentation is otherwise dictated by the .newsrc file.) In addition, you can specify the names of groups you never want to see. Other kinds of information for customizing your nn environment can also be stored in the init file. Advanced users can employ the init file to define macros, remap the standard command key bindings, and change nn's default settings through an extensive set of variables. Even relative beginners may find some of these variables useful.

The .nn/init file must be created manually by the user The instructions below describe how to create a simple init file for listing the newsgroups you do and do not want to see.

  1. Your initial login procedure will have automatically created a directory called .nn beneath your home directory. To see this directory, start in your home directory, type
  2. ls -dl .nn

    at the system prompt, and press <RETURN>.

  3. You should see something like this:
  4. drwxr-xr-x 2 cje 512 Apr 6 17:24 .nn

    with your own username, directory size, and last modified date in place of "cje", "512", and "Apr 6 17:24". If for some reason you do not have such a directory, you need to create one. To do so,

    1. Type mkdir at the system prompt and press <RETURN>.
    2. When prompted for the directory name, type .nn (don't forget the period!) and press <RETURN>.

    If the directory does not exist, the system will create it. If it does already exist, the message .nn : file exists will appear. In either case, you will be returned to the system prompt. Type ls -dl .nn again to verify that the directory exists.

  5. To change to the .nn directory, type
    cd .nn
    at the system prompt and press <RETURN>.
  6. Type emacs init at the system prompt and press <RETURN>. You'll start an emacs session, with your cursor placed at the top line of an empty file.
  7. On the top line, type
    sequence
    The sequence command tells nn that you want to see the newsgroups in the order listed.
  8. Type the names of the newsgroups you want to read in the order you want to see them. When listing groups in your init file, special punctuation can be used to indicate which topics and subtopics should be included. The following are four ways in which punctuation makes a difference in the init file:
  9. group.name
    A newsgroup name with no punctuation following it will display that specified newsgroup and, in most cases, its subgroups as well.
    group.name.
    A newsgroup name with a period following it will display all of the subgroups of that group, but not the specified group. With the sample init file shown below, the alt.sources newsgroup itself would not be displayed, but all of its subgroups would.
    group.name*
    An asterisk following a newsgroup name will display the specified newsgroup along with all of its subgroups. In the sample init file shown below, the expression ru* would display all of the groups beginning with the ru prefix.
    !group.name
    An exclamation point preceding the newsgroup's name prevents that particular newsgroup or category of newsgroups from being displayed. The main subject areas gnu, bionet, comp, and news have been treated in this manner in the sample init file.
  10. If you only want to see the groups listed in your init file and no others, type !! beneath the last group listed in your init file. This will unsubscribe every group not listed in your init file. If you choose this method, it is not necessary to list groups you do not want to see individually as was done in the above example.
  11. A typical init file might look like this:

  12.      sequence
         alt.cult.movies
         alt.sources.
         clari.news
         alt.folklore.urban
         rec.humor.funny
         ru*
         !gnu
         !bionet
         !comp
         !news
    
    
    
    
    

    Using the sample init file above for an nn session, you would first see the newsgroups listed in the init file in the order specified. After working your way through to the groups with the prefix ru, you would be shown any additional newsgroups to which you are subscribed in your .newsrc file. Groups beginning with the prefixes gnu, bionet, comp, and news will never be displayed.

  13. Once you have entered the list of groups you do and do not want to see, save the init file and exit emacs by pressing <CTRL>x<CTRL>c and answering yes to the question
  14. Save file ~yourname/.nn/init? (y or n)

  15. To return to your main directory, type cd at the system prompt and press <RETURN>.

Order of Newsgroup Presentation

nn will present newsgroups to you in the order in which they appear in .nn/init. If .nn/init does not exist, nn will use alphabetical order.

If a new newsgroup has been created, it will typically be added to the end of .newsrc . Unless .nn/init indicates otherwise, it will be presented after all other newsgroups have been presented.

However, if the new newsgroup falls under a hierarchy you have indicated a blanket interest in, (e.g., ru*), it will be presented at the end of that hierarchy. Similarly, if the new newsgroup falls under a hierarchy you have expressed no interest in seeing, (e.g., !talk), you will never see the group.

At any time, you can change your mind about subscribing to a hierarchy, subhierarchy, or group. See the section Other Useful Reading Mode Commands in the NBCS document Reading Netnews with nn (UNX01601).

Setting nn Variables

It is important to recognize that nn is an extremely flexible application that can be highly customized. The specific results of many of the commands listed in this user guide can be altered by changing nn's default settings. These default settings are controlled by a large set of variables that can be changed interactively during an nn session or permanently by entering a series of set commands in the nn init file. All of the commands described in other nn documents take for granted the defaults normally in effect when you start nn for the first time.

A variable is like a switch. Some may be turned on or off. Others may be set to one of a predetermined number of settings. Still others can take a text string or command name. But all variables exist to control nn's behavior, what it does when a particular command is issued.

There are four types of nn variables:

  • Boolean variables can be turned on with set variable-name and off with either unset variable-name or set novariable-name (that is, the variable name with no added to it, as one word). They can also be switched from one to the other with toggle variable-name.
  • All other variables have the syntax set variable-name value
  • where variable-name is the name of the variable and value is one of the appropriate settings for that variable. These other variables are - Integer variables, which take a number as a value; - String variables, which take text as a value; - Key variables, which take key-names as a value.
  • Integer variables can be restored to their default settings with unset variable-name. You must provide string and key variables with their original values by typing them in again.

You can prevent a variable from being modified with lock variable-name .

Variable settings intended for the entire nn session should be added to the init file above the presentation sequence (above the line sequence). These settings will control nn's behavior for every nn session. But any of these variables can be used temporarily, for the current nn session, with the extended commands :set and :unset. For example, :set auto-preview-mode <RETURN> or :unset auto-preview-mode <RETURN>.

IMPORTANT: nn will consider any line in the init file following the sequence command to be the name of a newsgroup. Any other commands in the init file must precede the sequence command.

Some useful variables are described below. To see a complete list of the variables and their current settings, type the extended command :set all <RETURN>. For a brief description of each variable, type the extended command :help variables <RETURN>. For further information, use the :man command to read the section of the online manual about variables.

set auto-preview-mode
Causes nn to enter reading mode immediately after selecting an article ID. After the article is read, nn returns to selection mode.
set confirm-messages
Causes nn to wait, after it displays a message on the screen, for you to press any key before the message is removed. The symbol <> will appear to indicate that nn is awaiting confirmation.
set consolidated-menu
Combines all the replies to a posting on the same line with the original posting in the selection mode menu. The actual number of postings appears in brackets to the left of the title. Selecting the ID of the consolidated posting will automatically select all associated replies. Setting this variable will significantly reduce the number of menu pages for newsgroups containing large numbers of articles.
set include-art-id
When you respond to an article, this variable ensures that the ID of the referenced article will be included at the beginning of the reply. (For example, In article <1991Aug30.003459.11384@sbcs.sunysb.edu> rmiller@sbcs.sunysb.edu (Robert Miller) writes...). Otherwise, replies do not contain specific information about the articles to which they refer.
set re-layout option-number
If a message is a followup to an earlier message, the selection mode screen normally prefixes the subject with a number of > symbols equal to the number of articles listed in the article's References: header. For example, if you replied to someone's response to an earlier article by you, your reply would have >> before the subject. A discussion that has continued for some time may thus have many > symbols in its subject. The re-layout variable may be used to set a different subject prefix, chosen from the following options:
     0     One > per reference is shown (default)
     1     A single > is shown if the subject contains "Re:"
     2     The prefix is n>, with n equal to the number of references
     3     A single Re: is shown
     4     If there are any references, use option 0; otherwise, use 1.
set record or mail-record or news-record file
Defines a file to which copies of outgoing messages are to be sent. If you want to save a reply mailed to an article's author, set mail-record is used. If you want to save a followup article posted to a newsgroup, set news-record is used. If you want to save both types of responses, set record is used. The file can be any file. If you use the name of your mail file (e.g., mbox), the response will be kept with your other mail messages.
set response-default-answer action
Defines the default action to be taken when <RETURN> is pressed at the Action: prompt after responding to a message. The action should be one of the following: abort, edit, send, view, write.
set suggest-default-save
Controls the default filename normally presented when saving an article. When suggest-default-save is set to on, nn suggests a filename in a series of subdirectories based on the newsgroup name; for example, Save on (+~|) +rec/arts/tv , where the + stands for the subdirectory News. You can always change the filename by deleting the unwanted subdirectories in the prompt, all the way back to, and including, the + sign. You file will then be saved in the name you type. When this variable is set to off, the prompt Save on (+~|) appears, and you can enter the filename of your choice immediately, without deleting a default. If you do not plan on saving messages in folders, you should probably set this to off see the NBCS document nn Folders (UNX01901).
set tidy-newsrc
Automatically removes the names of inactive groups from the .newsrc file. Also removes the names of unsubscribed groups if the command unset keep-unsubscribed is also listed in the init file. Both commands should be included in the init file if you have an account with a small disk space allocation.
unset keep-unsubscribed
If tidy-newsrc is set (see above), this command will remove all unsubscribed newsgroups from the .newsrc file.

Special nn Files

nn uses several files in your home and .nn directories to perform various record-keeping functions. Most of these files are created automatically, with the exception of the .nn/init file described in the Creating an .nn/init File section on page 1 of this document. If the files are erased, they will be recreated (but you will have lost any current configuration information). Additionally, all of the nn configuration files, with the exception of the file .nn/KILL.COMP, can be edited with emacs. Brief descriptions of the nn files that you are likely to find in your directories are given below.

.newsrc The .newsrc is located in your home directory and keeps track of all of the newsgroups to which you are subscribed as well as which articles have been read in each group. Subscribed groups are followed by colons(:), and unsubscribed groups are followed by exclamation points(!). Groups can be subscribed and unsubscribed to by editing the file or by using the U command in nn. For more complete information on editing the file, see the NBCS document, Editing .newsrc with Emacs (UNX01501).
.nn/init Use of the .nn/init file is described in detail above.
.nn/kill and .nn/KILL.COMP These files keep track of entries made with the kill (K) command. The .nn/kill file is an ASCII text file, and .nn/KILL.COMP is a compiled version of the same file that nn uses for faster access.
.nn/LAST The file .nn/LAST contains the time and date stamp of the last group added to your .newsrc file. nn uses this information to determine whether a new newsgroup has been or has yet to be added to your .newsrc file by comparing the timestamp given in the file .nn/LAST with the timestamp of the newly created group.
.nn/NEXTG The file .nn/NEXTG records the name of the group you were in when you last quit nn. When you start nn, you will be asked if you want to go to the newsgroup named in this file first. If not, you will be taken to the first group in your presentation sequence.

NOTE: nn occasionally fails to start, giving a Segmentation Fault error message. If this happens, deleting .nn/NEXTG may correct the problem.

.nn/select This file keeps track of the articles that have been selected, but not yet read. Selected articles will continue to be selected, even between invocations of nn, until they are unselected or read.

Changing the Layout of the Selection Mode Screen

Selection mode has five different screen layouts to choose from:

     0      x Name.........  Subject.............. +123
     1      x Name.........   123  Subject..............
     2      x 123  Subject...................................
     3      x Subject...........................................
     4      x    Subject........................................
Layout 1 is the default.
Layout 0 is a variation on Layout 1, where the number of lines will appear as +lll after the article's subject. Its position will vary, depending on the length of the subject line.

In both 0 and 1, the name field is limited to 16 characters. nn will abbreviate names in order to fit the most significant information (primarily the sender's first and last names, if present) into the space.

Similarly, nn will remove text found in the subject line in order to fit the subject into the space of the layout. With subjects, the text will be removed from the middle of the line and replaced by the two characters <>.

To see the full subject or author of an article, use the h command in reading mode. See the section "Other Useful Reading Mode Commands" in the NBCS document, Reading Netnews with nn (UNX01601).

The next three layouts provide more room for the subject text, perhaps removing the abbreviation.

Layout 2 removes the name field.
Layout 4 removes the name and lines fields.
Layout 3 is similar to Layout 4 but gives the subject field the maximum number of characters, 75.

If you want to see a less abbreviated subject for an article before selecting it or not, you can change the layout of selection mode with the double-quote (") key. This will step you through all the possible layouts, from 0 to 4 and back to 0 again, each time the key is pressed.

If you prefer one of the other layouts over the default, you can change that default for your nn sessions by putting the command set layout n in your .nn/init file, where n is the number of the layout you prefer.

For More Information

Questions on nn should be directed to the OIT/NBCS Help Desk (732-445-HELP). You can also send electronic mail to the address help on any OIT system (e.g., help@eden.rutgers.edu or help@rci.rutgers.edu) or post a message to the newsgroup ru.comp.qa.news .


<hr>
Copyright © 2008 Rutgers, The State University of New Jersey, NBCS Help Desk. All rights reserved.

Rutgers Logo

webmaster@nbcs.rutgers.edu
06/22/05