I'd like to add a function of my own that I find useful. Often there'll be a buffer where I want to take notes and I want to keep coming back to it from wherever I am. To this end I present:
(defun switch-to-buffer-and-back (buf)
"Toggle between given buffer and the current buffer."
(interactive)
(if (equal (buffer-name) buf)
(bury-buffer)
(switch-to-buffer buf 'NORECORD)))
(global-set-key [(control c) ?l]
(lambda () (interactive) (switch-to-buffer-and-back "BUFFER-NAME-HERE")))
Of course, you can bind the function to any key combination you want (in the example above it's bound to "Control-C l").
Extra tip: if you're running Emacs from within
Windows, and you have one of those keyboards with the windows keys next to the Alt keys, you can rebind these keys so they act as a new modifier in Emacs (like Control or Alt) using the following code:
(setq w32-rwindow-modifier 'hyper)
(setq w32-pass-rwindow-to-system nil)
Once you do this, you can use the right-windows key together with any other key to
unleash a whole new world of customised key bindings, for example:
(global-set-key [(hyper s)]
(lambda () (interactive) (switch-to-buffer-and-back "BUFFER-NAME-HERE")))
I'll include some more Elisp functions here sometime soon.
Dear God I Love Emacs.