Sven Bretfeld wrote: > I want to define a funtion called start-mutt, which does: > - open an ansi term > - rename it to *Mutt* > - start Mutt within the ansi-term > - if the ansi-term already exists and has Mutt running, switch to that > buffer > Can anybody help me? Perhaps something like this? Substitute the correct path to your mutt in the second-to-last line. (defun start-mutt (&optional bg) "Start an ansi-term running the mutt mailreader, in a buffer called \"*Mutt*\" Given an argument (assuming the buffer called \"*Mutt*\" doesn't already exist), will start in the background" (interactive "P") (if (get-buffer "*Mutt*") (switch-to-buffer "*Mutt*") (let ((buf (current-buffer))) (ansi-term "/usr/bin/mutt" "Mutt") (if bg (switch-to-buffer buf))))) Some useful information to know in the future: - Press "C-h f ansi-term" to read the documentation for the function ansi-term (or substitute some other function you're curious about), a function I had never used previously but which I found out takes two arguments: the program to run and the name of the buffer, to which it will pre-pend and append asterices. - Most of the time you won't use (switch-to-buffer) in elisp programs (see its documentation, as above). - (interactive) can be called with a wide array of arguments; see its documentation for more information. - Consider checking out the Emacs Lisp Intro., which if you're running a recent emacs I'm pretty sure should be included. - Try to go through this code and understand it, one step at a time. Anyway, I hope that's helpful. Amy -- "The History of every major Galactic Civilization tends to pass through three distinct and recognizable phases, those of Survival, Inquiry and Sophistication, otherwise known as the How, Why and Where phases. "For instance, the first phase is characterized by the question 'How can we eat?' the second by the question 'Why do we eat?' and the third by the question 'Where shall we have lunch?'" -- Hitchhiker's Guide to the Galaxy