# HG changeset patch # User Roland McGrath # Date 753759711 0 # Node ID 8deb7113bbdf87a8b10962816c370c0f9dda5062 # Parent bbc2accd226ae676ea1aeceea415731c633f94f6 (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. diff -r bbc2accd226a -r 8deb7113bbdf src/buffer.c --- a/src/buffer.c Sat Nov 20 01:31:19 1993 +0000 +++ b/src/buffer.c Sat Nov 20 01:41:51 1993 +0000 @@ -560,7 +560,11 @@ 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)) {