Emacs 30 Day Challenge: Get the latest gnus to improve speed

The gnus logo,
from gnus homepage
Ever since my first post of the emacs 30 Day Challenge, I was warned about gnus slowness. A lot of comments in reddit pointed to this, and suggested using wanderlust or installing a local IMAP server (like dovecot or notmuch) to speed up the IMAP back-end (search, retrieval and processing), while also allowing for offline reading.

The main drawback was keeping it nicely cross-platform. As you may remember, I split my time between two computers: my MacBook and my Acer netbook. Any solution regarding to gnus had to be completely cross-platform in the most seamless way I could. And having a local IMAP server didn't look like it (although notmuch can be installed through macports).

When I posted my first update on gnus in HackerNews, a kind reader pointed me to the latest development snapshot, as having far, far better IMAP and nnir (the gnus IMAP search system) support. I went to the gnus homepage, and downloaded the latest CVS snapshot. It didn't work any better, it was in fact worse: nnir search didn't even work!

The problem? The latest development snapshot is in git, not in CVS! By the way, I have found very hard to know which is the latest version of gnus. I had Gnus 5.13 (if I'm not mistaken) before installing the git version, which is NoGnus 0.11 All gnus alpha versions are labeled NoGnus, to distinguish them from the final versions.

What do you need to install the latest gnus? First, a recent copy of git. At least as suggested by the gnus git page. Don't ignore this: I had an outdated git in my MacBook and without upgrading it I could not get the package.

Once you have a current git system, fire a terminal window and go to where you want to have your new gnus. I did the following steps in ~/emacs/ Download the repository with
git clone http://git.gnus.org/gnus.git
and then you are ready to go with
cd gnus
Now make would finish the charm and get you a ready to use gnus... But sadly, it didn't work in my MacBook (had no problems in the netbook)! The problem?
Cannot open doc string file "/Applications/Emacs.app/Contents/Resources/etc/DOC-22.1.1"
make[1]: *** [gnus-load.el] Error 255
make: *** [lick] Error 2
I did a ugly hack to solve this,
cd /Applications/Emacs.app/Contents/Resources/etc
cp DOC-22.3.1 DOC-22.1.1
cd -
YMMV here when copying the correct DOC-emacs-ver file. Just check which one do you have. Then I changed where my emacs looked for gnus by adding
(add-to-list 'load-path "~/emacs/test-git-gnus/gnus/lisp/")
(require 'gnus-load)
to my .emacs file. When I checked with M-x gnus, it was blindingly fast. Starts up in a whim, and updates in a moment. But when I tried G G to do a mail search I got
nnir search Symbol's value as variable is void: gnus-registry-install
D'uh! What's this? I still don't know... But after a small google search I found a viable solution:
(setq gnus-registry-install t)
Now you can check that G G searches amazingly fast through your Gmail inbox.
(setq nnmail-crosspost t)
On the other hand, to prevent mails you processed through Gmail's website (or another mail reader) to be again in your gnus inbox (and then being unable to delete them or mark them as read as the server responds with a "non existent post"), add this to your .gnus.el:
(setq gnus-agent nil)

I hope you enjoyed this second installment in the world of gnus. I hope you give gnus another try, if the problem you had was its speed. The development git gnus will surprise you!

If you enjoyed this post, please share it with your emacs (or emacs-wannabe) friends through Hacker News, Reddit/emacs, Twitter or even Facebook. Thank you for reading this far!

Written by Ruben Berenguel