Editing .newsrc with Emacs

Platform: Unix
Level of Difficulty: Beginner
<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.

Pre-Selecting Newsgroups

Netnews currently carries over 9000 different newsgroups, and each newsgroup has up to several hundred articles. When you start nn for the first time, you are automatically subscribed to every newsgroup, and there will be several hundred thousand articles waiting to be read. Needless to say, this can be a bit overwhelming. To make reading Netnews more manageable, most users prefer to limit their reading to a small number of groups in which they are interested. One way to accomplish this is to edit the file .newsrc.

When you first use nn, a file called .newsrc will be created automatically in your home directory. This file lists all of the newsgroups currently available and keeps track of the articles that you've read in each group. When first created, the .newsrc file automatically subscribes you to every newsgroup.

Editing the .newsrc File

Once .newsrc exists, you can use a text editor, such as Emacs, to subscribe or unsubscribe to groups. To do this, type

emacs .newsrc

and press <RETURN>.

The basic Emacs commands for manipulating .newsrc will be given below as needed. For more information on using the Emacs editor, type teach-emacs at the system prompt or see the NBCS document Introduction to the Emacs Text Editor (UNX01101).

If you decide, while editing .newsrc, that you want to exit without saving your changes, then do the following:

  1. Type ^X^C (hold down the <CONTROL> or <CTRL> key and type X, then hold down the <CTRL> key and type C ; the character ^ is the standard Emacs abbreviation for <CTRL> and will be used for all Emacs instructions)
  2. Answer n to the question
    Save file yourname/.newsrc (y or n)
  3. Answer yes to the question
    1 modified buffer exists, do you really want to exit? (yes or no)
  4. You will return to the system prompt and can start editing over again.

Figure 1 shows the beginning of a newly created .newsrc file. Note that the newsgroups are listed in a single column and each newsgroup name is terminated with a colon (:). A colon means that you are subscribed to the group and will see a listing of the group's articles when you enter nn. To unsubscribe a group, the colon must be replaced with an exclamation point (!).


alt.test: 
alt.gourmand:
alt.config: 
alt.drugs: 
alt.sources: 
alt.sources.amiga: 
alt.sources.d:


Figure 1: The beginning of the .newsrc file

If .newsrc was created by the enews command, the first line will begin with options -n all,.... This is used by the newsreader in enews to keep track of which groups are "inactive''. Deleting this line will make all the groups active. You may find this useful.

Deleting the Options Line

Follow these steps to delete the options line:

  1. If you are not at the beginning of the file, type <ESC>< (press the <ESCAPE> key and release it, then type the less-than sign) to move to the beginning of the file.
  2. Type ^K to delete the text of the line.
  3. Type another ^K to delete the blank line remaining.
  4. The cursor should now be at the start of the line with the first newsgroup. If it is not, type ^Y to restore the deleted text, then start again from step 1 of this procedure.

Selecting Newsgroups

Follow these steps to select newsgroups within Emacs:

  1. Since you will probably only want to see a small number of the 9000+ newsgroups, it is easiest to unsubscribe to all groups by converting all colons to exclamation points. Then you can go back and individually select the groups you want to see by replacing their exclamation points with colons.
  2. To replace all colons with exclamation points in Emacs, go to the beginning of the file with <ESC><| and type:
    <ESC>xreplace-string<RETURN>:<RETURN>!<RETURN>

  3. Type <ESC><| to return to the beginning of the file.
  4. Scroll through the list of newsgroups to those interest you. Type ^V to move forward one screenful and <ESC>V to move back one screenful.
  5. Within a screen, use ^N to move to the next line and ^P to move to the previous line. Position the cursor on the name of newsgroup you wish to subscribe to.

  6. Use ^F to move forward one character at a time (or ^B to move backwards one character at a time) until the cursor is on the exclamation point.
  7. Delete the exclamation point with ^D and type a colon (:) in its place.
  8. Move to the next newsgroup and repeat from step 3 on until finished.

Rearranging Newsgroups

Some newsreader programs, such as vnews, use the order of groups within .newsrc as the order in which groups are presented to you. However, nn, the newsreader supported by NBCS, ignores the order within .newsrc and instead uses a file called .nn/init to control the order. For more information on the file, see the NBCS document, Customizing the nn Newsreader (UNX01401).

Exiting Emacs

To exit Emacs and save your changes,

  1. Type ^X^C
  2. Answer y to the question
    Save file yourname/.newsrc (y or n)
  3. You will return to the system prompt.

You may find it easier at first to subscribe to a small number of groups until you get comfortable with the nn software. Later, after you have explored some of the functions of nn, you can repeat the steps above to subscribe to additional groups. Do not repeat the replace-string command given above or you will reconvert all of your carefully placed colons to exclamation points.

It is also possible to subscribe and unsubscribe newsgroups from within the nn software, as is explained in the NBCS document Reading Netnews with nn (UNX01601).

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