Previous: Keystrokes, Up: Emacs for Heathens

11.8.2 Emacs Lisp

Emacs is the King of Editors because it's really a Lisp interpreter. Each and every key you tap runs some Emacs Lisp code snippet, and since Emacs Lisp is an interpreted language, that means that you can configure any key to run any arbitrary code. You just, like, do it.

Gnus is written in Emacs Lisp, and is run as a bunch of interpreted functions. (These are byte-compiled for speed, but it's still interpreted.) If you decide that you don't like the way Gnus does certain things, it's trivial to have it do something a different way. (Well, at least if you know how to write Lisp code.) However, that's beyond the scope of this manual, so we are simply going to talk about some common constructs that you normally use in your ~/.gnus.el file to customize Gnus. (You can also use the ~/.emacs file, but in order to set things of Gnus up, it is much better to use the ~/.gnus.el file, See Startup Files.)

If you want to set the variable gnus-florgbnize to four (4), you write the following:

     (setq gnus-florgbnize 4)

This function (really “special form”) setq is the one that can set a variable to some value. This is really all you need to know. Now you can go and fill your ~/.gnus.el file with lots of these to change how Gnus works.

If you have put that thing in your ~/.gnus.el file, it will be read and evaled (which is Lisp-ese for “run”) the next time you start Gnus. If you want to change the variable right away, simply say C-x C-e after the closing parenthesis. That will eval the previous “form”, which is a simple setq statement here.

Go ahead—just try it, if you're located at your Emacs. After you C-x C-e, you will see ‘4’ appear in the echo area, which is the return value of the form you evaled.

Some pitfalls:

If the manual says “set gnus-read-active-file to some”, that means:

     (setq gnus-read-active-file 'some)

On the other hand, if the manual says “set gnus-nntp-server-file to ‘/etc/nntpserver’”, that means:

     (setq gnus-nntp-server-file "/etc/nntpserver")

So be careful not to mix up strings (the latter) with symbols (the former). The manual is unambiguous, but it can be confusing.