July 13, 2004 2:28 PM
RSS feeds have become a sort of mainstream method to keep up with the vast amounts of information popping up on the Internet. Most of the blogs and news related sites offer RSS feeds. Gnus is my newsreader and mail client. It comes with emacs and as of version 5.10.0 above, Gnus can read RSS feeds as well. With Gnus Agent configured, this is very handy as all I need to do is connect, check for news using Gnus then disconnect and read all the feeds & email offline at my convenience.

If you want to browse through available RSS feeds, press B nnrss RET RET. Then you can subscribe to feeds you like using u. If you want to subscribe to specific RSS feeds that might not be listed, switch to Gnus's group buffer, press G m and type in a name, for example, Ablog. Then in the From method, enter nnrss. A new group with the name you chose will be created. When you enter it, it will ask for the RSS url of Ablog. Enter it and your summary buffer should show you the feeds as a normal news group. The display of the summary buffer isn't suited for RSS and thus we will have to modify it as follows:

(add-hook 'gnus-summary-mode-hook
          (lambda ()
            (if (string-match "^nnrss:.*" gnus-newsgroup-name)
                  (make-local-variable 'gnus-show-threads)
                  (make-local-variable 'gnus-article-sort-functions)
                  (make-local-variable 'gnus-use-adaptive-scoring)
                  (make-local-variable 'gnus-use-scoring)
                  (make-local-variable 'gnus-score-find-score-files-function)
                  (make-local-variable 'gnus-summary-line-format)
                  (setq gnus-show-threads nil)
                  (setq gnus-article-sort-functions 'gnus-article-sort-by-date)
                  (setq gnus-use-adaptive-scoring nil)
                  (setq gnus-use-scoring t)
                  (setq gnus-score-find-score-files-function 'gnus-score-find-single)
                  (setq gnus-summary-line-format "%U%R%z%d %I%(%[ %s %]%)\n")

Put this in your .gnus. This should make the summary buffer have useful summaries for RSS feeds. Customize the variables to suit your needs.

Updated 2004.12.12

The following code (stolen from the Gnus Manual) binds C-<enter> to browse the link associated with the RSS entry using browse-url1 from the Summary buffer:

(require 'cl)
(require 'gnus)
(require 'nnrss)
(require 'browse-url)

(defun browse-nnrss-url (arg)
  (interactive "p")
  (let ((url (assq nnrss-url-field
		     (assq (gnus-summary-article-number)
    (if url
	(browse-url (cdr url))
	(gnus-summary-scroll-up arg))))

(add-hook 'gnus-summary-mode-hook
	  (lambda ()
	    (define-key gnus-summary-mode-map
		(kbd "C-<return>")

(add-to-list 'nnmail-extra-headers nnrss-url-field)


[1] Read Using Firefox via Emacs to get browse-url to open a link in a new tab in Firefox.

Copyright © 2004-2011 Anirudh Sasikumar. All rights reserved.
Last Updated: January 21, 2005 4:30 PM