Mercurial > emacs
comparison src/buffer.c @ 5075:8deb7113bbdf
(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.
| author | Roland McGrath <roland@gnu.org> |
|---|---|
| date | Sat, 20 Nov 1993 01:41:51 +0000 |
| parents | bbc2accd226a |
| children | 0cf95629f6c4 |
comparison
equal
deleted
inserted
replaced
| 5074:bbc2accd226a | 5075:8deb7113bbdf |
|---|---|
| 558 { | 558 { |
| 559 register Lisp_Object tem, buf; | 559 register Lisp_Object tem, buf; |
| 560 | 560 |
| 561 CHECK_STRING (name, 0); | 561 CHECK_STRING (name, 0); |
| 562 tem = Fget_buffer (name); | 562 tem = Fget_buffer (name); |
| 563 if (XBUFFER (tem) == current_buffer) | 563 /* Don't short-circuit if UNIQUE is t. That is a useful way to rename |
| 564 the buffer automatically so you can create another with the original name. | |
| 565 It makes UNIQUE equivalent to | |
| 566 (rename-buffer (generate-new-buffer-name NAME)). */ | |
| 567 if (NILP (unique) && XBUFFER (tem) == current_buffer) | |
| 564 return current_buffer->name; | 568 return current_buffer->name; |
| 565 if (!NILP (tem)) | 569 if (!NILP (tem)) |
| 566 { | 570 { |
| 567 if (!NILP (unique)) | 571 if (!NILP (unique)) |
| 568 name = Fgenerate_new_buffer_name (name, current_buffer->name); | 572 name = Fgenerate_new_buffer_name (name, current_buffer->name); |
