rename-buffer

rename-buffer is an interactive built-in function in `C source code'.


(rename-buffer NEWNAME &optional UNIQUE)

:around advice: `uniquify--rename-buffer-advice'

Change current buffer's name to NEWNAME (a string).
If second arg UNIQUE is nil or omitted, it is an error if a
buffer named NEWNAME already exists.
If UNIQUE is non-nil, come up with a new name using
`generate-new-buffer-name'.
Interactively, you can set UNIQUE with a prefix argument.
We return the name we actually gave the buffer.
This does not change the name of the visited file (if any).