Mercurial > emacs
comparison src/buffer.c @ 54834:9533e29b87e8
(Fmake_indirect_buffer): Throw an error if the intended base buffer
has been killed. Correct the error message if the base buffer does
not exist.
| author | Luc Teirlinck <teirllm@auburn.edu> |
|---|---|
| date | Tue, 13 Apr 2004 01:13:17 +0000 |
| parents | 8df5ed349fc2 |
| children | 95d283fb2215 eb7e8d483840 |
comparison
equal
deleted
inserted
replaced
| 54833:7b278dbd537f | 54834:9533e29b87e8 |
|---|---|
| 519 | 519 |
| 520 DEFUN ("make-indirect-buffer", Fmake_indirect_buffer, Smake_indirect_buffer, | 520 DEFUN ("make-indirect-buffer", Fmake_indirect_buffer, Smake_indirect_buffer, |
| 521 2, 3, | 521 2, 3, |
| 522 "bMake indirect buffer (to buffer): \nBName of indirect buffer: ", | 522 "bMake indirect buffer (to buffer): \nBName of indirect buffer: ", |
| 523 doc: /* Create and return an indirect buffer for buffer BASE-BUFFER, named NAME. | 523 doc: /* Create and return an indirect buffer for buffer BASE-BUFFER, named NAME. |
| 524 BASE-BUFFER should be an existing buffer (or buffer name). | 524 BASE-BUFFER should be a live buffer, or the name of an existing buffer. |
| 525 NAME should be a string which is not the name of an existing buffer. | 525 NAME should be a string which is not the name of an existing buffer. |
| 526 Optional argument CLONE non-nil means preserve BASE-BUFFER's state, | 526 Optional argument CLONE non-nil means preserve BASE-BUFFER's state, |
| 527 such as major and minor modes, in the indirect buffer. | 527 such as major and minor modes, in the indirect buffer. |
| 528 CLONE nil means the indirect buffer's state is reset to default values. */) | 528 CLONE nil means the indirect buffer's state is reset to default values. */) |
| 529 (base_buffer, name, clone) | 529 (base_buffer, name, clone) |
| 530 Lisp_Object base_buffer, name, clone; | 530 Lisp_Object base_buffer, name, clone; |
| 531 { | 531 { |
| 532 Lisp_Object buf; | 532 Lisp_Object buf, tem; |
| 533 struct buffer *b; | 533 struct buffer *b; |
| 534 | 534 |
| 535 CHECK_STRING (name); | 535 CHECK_STRING (name); |
| 536 buf = Fget_buffer (name); | 536 buf = Fget_buffer (name); |
| 537 if (!NILP (buf)) | 537 if (!NILP (buf)) |
| 538 error ("Buffer name `%s' is in use", SDATA (name)); | 538 error ("Buffer name `%s' is in use", SDATA (name)); |
| 539 | 539 |
| 540 tem = base_buffer; | |
| 540 base_buffer = Fget_buffer (base_buffer); | 541 base_buffer = Fget_buffer (base_buffer); |
| 541 if (NILP (base_buffer)) | 542 if (NILP (base_buffer)) |
| 542 error ("No such buffer: `%s'", SDATA (name)); | 543 error ("No such buffer: `%s'", SDATA (tem)); |
| 544 if (NILP (XBUFFER (base_buffer)->name)) | |
| 545 error ("Base buffer has been killed"); | |
| 543 | 546 |
| 544 if (SCHARS (name) == 0) | 547 if (SCHARS (name) == 0) |
| 545 error ("Empty string for buffer name is not allowed"); | 548 error ("Empty string for buffer name is not allowed"); |
| 546 | 549 |
| 547 b = (struct buffer *) allocate_buffer (); | 550 b = (struct buffer *) allocate_buffer (); |
| 651 eassert (b->overlays_before == NULL); | 654 eassert (b->overlays_before == NULL); |
| 652 eassert (b->overlays_after == NULL); | 655 eassert (b->overlays_after == NULL); |
| 653 } | 656 } |
| 654 | 657 |
| 655 /* Reinitialize everything about a buffer except its name and contents | 658 /* Reinitialize everything about a buffer except its name and contents |
| 656 and local variables. | 659 and local variables. |
| 657 If called on an already-initialized buffer, the list of overlays | 660 If called on an already-initialized buffer, the list of overlays |
| 658 should be deleted before calling this function, otherwise we end up | 661 should be deleted before calling this function, otherwise we end up |
| 659 with overlays that claim to belong to the buffer but the buffer | 662 with overlays that claim to belong to the buffer but the buffer |
| 660 claims it doesn't belong to it. */ | 663 claims it doesn't belong to it. */ |
| 661 | 664 |
