5.1 Hiding Headers

The top section of each article is the head. (The rest is the body, but you may have guessed that already.)

There is a lot of useful information in the head: the name of the person who wrote the article, the date it was written and the subject of the article. That’s well and nice, but there’s also lots of information most people do not want to see—what systems the article has passed through before reaching you, the Message-ID, the References, etc. ad nauseam—and you’ll probably want to get rid of some of those lines. If you want to keep all those lines in the article buffer, you can set gnus-show-all-headers to t.

Gnus provides you with two variables for sifting headers:

gnus-visible-headers

If this variable is non-nil, it should be a regular expression that says what headers you wish to keep in the article buffer. All headers that do not match this variable will be hidden.

For instance, if you only want to see the name of the person who wrote the article and the subject, you’d say:

(setq gnus-visible-headers "^From:\\|^Subject:")

This variable can also be a list of regexps to match headers to remain visible.

gnus-ignored-headers

This variable is the reverse of gnus-visible-headers. If this variable is set (and gnus-visible-headers is nil), it should be a regular expression that matches all lines that you want to hide. All lines that do not match this variable will remain visible.

For instance, if you just want to get rid of the References line and the Xref line, you might say:

(setq gnus-ignored-headers "^References:\\|^Xref:")

This variable can also be a list of regexps to match headers to be removed.

Note that if gnus-visible-headers is non-nil, this variable will have no effect.

Gnus can also sort the headers for you. (It does this by default.) You can control the sorting by setting the gnus-sorted-header-list variable. It is a list of regular expressions that says in what order the headers are to be displayed.

For instance, if you want the name of the author of the article first, and then the subject, you might say something like:

(setq gnus-sorted-header-list '("^From:" "^Subject:"))

Any headers that are to remain visible, but are not listed in this variable, will be displayed in random order after all the headers listed in this variable.

You can hide further boring headers by setting gnus-treat-hide-boring-headers to head. What this function does depends on the gnus-boring-article-headers variable. It’s a list, but this list doesn’t actually contain header names. Instead it lists various boring conditions that Gnus can check and remove from sight.

These conditions are:

empty

Remove all empty headers.

followup-to

Remove the Followup-To header if it is identical to the Newsgroups header.

reply-to

Remove the Reply-To header if it lists the same addresses as the From header, or if the broken-reply-to group parameter is set.

newsgroups

Remove the Newsgroups header if it only contains the current group name.

to-address

Remove the To header if it only contains the address identical to the current group’s to-address parameter.

to-list

Remove the To header if it only contains the address identical to the current group’s to-list parameter.

cc-list

Remove the Cc header if it only contains the address identical to the current group’s to-list parameter.

date

Remove the Date header if the article is less than three days old.

long-to

Remove the To and/or Cc header if it is very long.

many-to

Remove all To and/or Cc headers if there are more than one.

To include these three elements, you could say something like:

(setq gnus-boring-article-headers
      '(empty followup-to reply-to))

This is also the default value for this variable.