trh178
trh178

Reputation: 11688

What do I pass to the switch-to-buffer argument in my .emacs file?

I am getting an error in my .emacs file at the following line:

(switch-to-buffer *Completions*)

error: symbols value as variable is void

I did a describe-function on switch-to-buffer and found I CAN pass it a BUFFER (and another optional argument which I do not currently need). What am I doing wrong?

Just a few notes:
a. I also need two similar lines (switch-to-buffer *grep*) and (switch-to-buffer *compilation*) so the simple solution of using (switch-to-completions) won't solve all of my problems.
b. All of the buffers I require are already open, so I don't think that is the problem.

Upvotes: 1

Views: 984

Answers (3)

quodlibetor
quodlibetor

Reputation: 8433

The implication of what Dewayne said is that you can pass objects returned from things like (buffer-list) to functions, if you're trying to do things programmatically, and don't particularly want to deal with strings as an intermediary.

Upvotes: 0

Francis Upton IV
Francis Upton IV

Reputation: 19443

Try

(switch-to-buffer "*Completions*")

Upvotes: 5

Dewayne Christensen
Dewayne Christensen

Reputation: 2094

You can specify a buffer name, as such:


(switch-to-buffer "*Help*")

From the docs:

Select buffer BUFFER in the current window. BUFFER may be a buffer or a buffer name.

Upvotes: 3

Related Questions