I am working through the FSF text: An Introduction to Programming in Emacs Lisp. I am having some trouble with the following buffer exercise:
(defun buf-exists (bufpos)
"tests to see if the buffer named bufpos exists"
(interactive)
(save-excursion
(if (get-buffer bufpos))
(message "%s def exists" bufpos)
(message "sorry there is no buffer named %s" bufpos)))
It fails for some reason to bind the named buffer passed as an argument to the variable bufpos. Any Advice?? THanks!
Use if and get-buffer to write a function that prints a message telling you whether a buffer exists.Here is the program I wrote:
(defun buf-exists (bufpos)
"tests to see if the buffer named bufpos exists"
(interactive)
(save-excursion
(if (get-buffer bufpos))
(message "%s def exists" bufpos)
(message "sorry there is no buffer named %s" bufpos)))
It fails for some reason to bind the named buffer passed as an argument to the variable bufpos. Any Advice?? THanks!