Next: Customizing W3, Previous: Web Searches, Up: Browsing the Web

#### 6.5.3 RSS

Some web sites have an RDF Site Summary (RSS). RSS is a format for summarizing headlines from news related sites (such as BBC or CNN). But basically anything list-like can be presented as an RSS feed: weblogs, changelogs or recent changes to a wiki (e.g. http://cliki.net/recent-changes.rdf).

RSS has a quite regular and nice interface, and it's possible to get the information Gnus needs to keep groups updated.

Note: you had better use Emacs which supports the `utf-8` coding system because RSS uses UTF-8 for encoding non-ASCII text by default. It is also used by default for non-ASCII group names.

Use `G R` from the group buffer to subscribe to a feed—you will be prompted for the location, the title and the description of the feed. The title, which allows any characters, will be used for the group name and the name of the group data file. The description can be omitted.

An easy way to get started with `nnrss` is to say something like the following in the group buffer: `B nnrss RET RET y`, then subscribe to groups.

The `nnrss` back end saves the group data file in `nnrss-directory` (see below) for each `nnrss` group. File names containing non-ASCII characters will be encoded by the coding system specified with the `nnmail-pathname-coding-system` variable or other. Also See Non-ASCII Group Names, for more information.

The `nnrss` back end generates ‘`multipart/alternative`’ MIME articles in which each contains a ‘`text/plain`’ part and a ‘`text/html`’ part.

You can also use the following commands to import and export your subscriptions from a file in OPML format (Outline Processor Markup Language).

— Function: nnrss-opml-import file

> Prompt for an OPML file, and subscribe to each feed in the file.

— Function: nnrss-opml-export

> Write your current RSS subscriptions to a buffer in OPML format.

The following `nnrss` variables can be altered:

`nnrss-directory`
  The directory where `nnrss` stores its files. The default is `~/News/rss/`.
`nnrss-file-coding-system`
  The coding system used when reading and writing the `nnrss` groups data files. The default is the value of `mm-universal-coding-system` (which defaults to `emacs-mule` in Emacs or `escape-quoted` in XEmacs).
`nnrss-ignore-article-fields`
  Some feeds update constantly article fields during their publications, e.g. to indicate the number of comments. However, if there is a difference between the local article and the distant one, the latter is considered to be new. To avoid this and discard some fields, set this variable to the list of fields to be ignored. The default is `'(slash:comments)`.
`nnrss-use-local`
  If you set `nnrss-use-local` to `t`, `nnrss` will read the feeds from local files in `nnrss-directory`. You can use the command `nnrss-generate-download-script` to generate a download script using `wget`.

The following code may be helpful, if you want to show the description in the summary buffer.

         (add-to-list 'nnmail-extra-headers nnrss-description-field)
         (setq gnus-summary-line-format "%U%R%z%I%(%[%4L: %-15,15f%]%) %s%uX\n")

         (defun gnus-user-format-function-X (header)
           (let ((descr
                  (assq nnrss-description-field (mail-header-extra header))))
             (if descr (concat "\n\t" (cdr descr)) "")))

The following code may be useful to open an nnrss url directly from the summary buffer.

         (require 'browse-url)

         (defun browse-nnrss-url (arg)
           (interactive "p")
           (let ((url (assq nnrss-url-field
                            (mail-header-extra
                             (gnus-data-header
                              (assq (gnus-summary-article-number)
                                    gnus-newsgroup-data))))))
             (if url
                 (progn
                   (browse-url (cdr url))
                   (gnus-summary-mark-as-read-forward 1))
               (gnus-summary-scroll-up arg))))

         (eval-after-load "gnus"
           #'(define-key gnus-summary-mode-map
               (kbd "<RET>") 'browse-nnrss-url))
         (add-to-list 'nnmail-extra-headers nnrss-url-field)

Even if you have added ‘`text/html`’ to the `mm-discouraged-alternatives` variable (see Display Customization) since you don't want to see HTML parts, it might be more useful especially in `nnrss` groups to display ‘`text/html`’ parts. Here's an example of setting `mm-discouraged-alternatives` as a group parameter (see Group Parameters) in order to display ‘`text/html`’ parts only in `nnrss` groups:

         ;; Set the default value of mm-discouraged-alternatives.
         (eval-after-load "gnus-sum"
           '(add-to-list
             'gnus-newsgroup-variables
             '(mm-discouraged-alternatives
               . '("text/html" "image/.*"))))

         ;; Display ‘text/html’ parts in nnrss groups.
         (add-to-list
          'gnus-parameters
          '("\\`nnrss:" (mm-discouraged-alternatives nil)))