Commit c059b5ea authored by Roland McGrath's avatar Roland McGrath

(Frename_buffer): When the current buffer is already named NAME, don't

short-circuit and just return unless UNIQUE is nil.  This makes passing
UNIQUE=t equivalent to (rename-buffer (generate-new-buffer-name NAME)).
This is useful way to rename the buffer automatically so you can create
another with the original name.
parent 4c7e5f09
......@@ -560,7 +560,11 @@ This does not change the name of the visited file (if any).")
CHECK_STRING (name, 0);
tem = Fget_buffer (name);
if (XBUFFER (tem) == current_buffer)
/* Don't short-circuit if UNIQUE is t. That is a useful way to rename
the buffer automatically so you can create another with the original name.
It makes UNIQUE equivalent to
(rename-buffer (generate-new-buffer-name NAME)). */
if (NILP (unique) && XBUFFER (tem) == current_buffer)
return current_buffer->name;
if (!NILP (tem))
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment