Next: , Previous: Changing Servers, Up: Starting Up

1.6 Startup Files

Most common Unix news readers use a shared startup file called .newsrc. This file contains all the information about what groups are subscribed, and which articles in these groups have been read.

Things got a bit more complicated with gnus. In addition to keeping the .newsrc file updated, it also used a file called .newsrc.el for storing all the information that didn't fit into the .newsrc file. (Actually, it also duplicated everything in the .newsrc file.) gnus would read whichever one of these files was the most recently saved, which enabled people to swap between gnus and other newsreaders.

That was kinda silly, so Gnus went one better: In addition to the .newsrc and .newsrc.el files, Gnus also has a file called .newsrc.eld. It will read whichever of these files that are most recent, but it will never write a .newsrc.el file. You should never delete the .newsrc.eld file—it contains much information not stored in the .newsrc file.

You can turn off writing the .newsrc file by setting gnus-save-newsrc-file to nil, which means you can delete the file and save some space, as well as exiting from Gnus faster. However, this will make it impossible to use other newsreaders than Gnus. But hey, who would want to, right? Similarly, setting gnus-read-newsrc-file to nil makes Gnus ignore the .newsrc file and any .newsrc-SERVER files, which can be convenient if you use a different news reader occasionally, and you want to read a different subset of the available groups with that news reader.

If gnus-save-killed-list (default t) is nil, Gnus will not save the list of killed groups to the startup file. This will save both time (when starting and quitting) and space (on disk). It will also mean that Gnus has no record of what groups are new or old, so the automatic new groups subscription methods become meaningless. You should always set gnus-check-new-newsgroups to nil or ask-server if you set this variable to nil (see New Groups). This variable can also be a regular expression. If that's the case, remove all groups that do not match this regexp before saving. This can be useful in certain obscure situations that involve several servers where not all servers support ask-server.

The gnus-startup-file variable says where the startup files are. The default value is ~/.newsrc, with the Gnus (El Dingo) startup file being whatever that one is, with a ‘.eld’ appended. If you want to keep multiple numbered backups of this file, set gnus-backup-startup-file. It respects the same values as the version-control variable.

gnus-save-newsrc-hook is called before saving any of the newsrc files, while gnus-save-quick-newsrc-hook is called just before saving the .newsrc.eld file, and gnus-save-standard-newsrc-hook is called just before saving the .newsrc file. The latter two are commonly used to turn version control on or off. Version control is on by default when saving the startup files. If you want to turn backup creation off, say something like:

     (defun turn-off-backup ()
       (set (make-local-variable 'backup-inhibited) t))
     
     (add-hook 'gnus-save-quick-newsrc-hook 'turn-off-backup)
     (add-hook 'gnus-save-standard-newsrc-hook 'turn-off-backup)

When Gnus starts, it will read the gnus-site-init-file (.../site-lisp/gnus-init by default) and gnus-init-file (~/.gnus by default) files. These are normal Emacs Lisp files and can be used to avoid cluttering your ~/.emacs and site-init files with Gnus stuff. Gnus will also check for files with the same names as these, but with .elc and .el suffixes. In other words, if you have set gnus-init-file to ~/.gnus, it will look for ~/.gnus.elc, ~/.gnus.el, and finally ~/.gnus (in this order). If Emacs was invoked with the -q or --no-init-file options (see Initial Options), Gnus doesn't read gnus-init-file.