diff --git a/src/buffer.c b/src/buffer.c index d0e1f9a33474c3784c2eece2b1512e9fa43f39a5..6b03e6d3e0ca30901c5812d7204df9d239a0731b 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -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)) {