4.1.2 To From Newsgroups

In some groups (particularly in archive groups), the From header isn’t very interesting, since all the articles there are written by you. To display the information in the To or Newsgroups headers instead, you need to decide three things: What information to gather; where to display it; and when to display it.

  1. The reading of extra header information is controlled by the gnus-extra-headers. This is a list of header symbols. For instance:
    (setq gnus-extra-headers
          '(To Newsgroups X-Newsreader))
    

    This will result in Gnus trying to obtain these three headers, and storing it in header structures for later easy retrieval.

  2. The value of these extra headers can be accessed via the gnus-extra-header function. Here’s a format line spec that will access the X-Newsreader header:
    "%~(form (gnus-extra-header 'X-Newsreader))@"
    
  3. The gnus-ignored-from-addresses variable says when the ‘%f’ summary line spec returns the To, Newsreader or From header. The variable may be a regexp or a predicate function. If this matches the contents of the From header, the value of the To or Newsreader headers are used instead.

    To distinguish regular articles from those where the From field has been swapped, a string is prefixed to the To or Newsgroups header in the summary line. By default the string is ‘-> ’ for To and ‘=> ’ for Newsgroups, you can customize these strings with gnus-summary-to-prefix and gnus-summary-newsgroup-prefix.

A related variable is nnmail-extra-headers, which controls when to include extra headers when generating overview (NOV) files. If you have old overview files, you should regenerate them after changing this variable, by entering the server buffer using ^, and then g on the appropriate mail server (e.g., nnml) to cause regeneration.

You also have to instruct Gnus to display the data by changing the %n spec to the %f spec in the gnus-summary-line-format variable.

In summary, you’d typically put something like the following in ~/.gnus.el:

(setq gnus-extra-headers
      '(To Newsgroups))
(setq nnmail-extra-headers gnus-extra-headers)
(setq gnus-summary-line-format
      "%U%R%z%I%(%[%4L: %-23,23f%]%) %s\n")
(setq gnus-ignored-from-addresses
      "Your Name Here")

(The values listed above are the default values in Gnus. Alter them to fit your needs.)

A note for news server administrators, or for users who wish to try to convince their news server administrator to provide some additional support:

The above is mostly useful for mail groups, where you have control over the NOV files that are created. However, if you can persuade your nntp admin to add (in the usual implementation, notably INN):

Newsgroups:full

to the end of her overview.fmt file, then you can use that just as you would the extra headers from the mail groups. Otherwise, you have to disable fetching headers with ‘XOVER’:

(setq nntp-nov-is-evil t
      gnus-nov-is-evil t)

Be aware, though, that this will make entering an NNTP group much, much slower, so this is not recommended.

One particular scenario in which it can be desirable to not use ‘XOVER’ is for nnvirtual groups in order to support limiting by extra headers (e.g., by the newsgroup of its component groups). Because group parameters are not inherited, a separate select method for the component groups with the appropriate nov-is-evil set as a method variable is required.