comparison src/buffer.c @ 83096:eb7e8d483840

Merged in changes from CVS trunk Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-200 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-201 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-202 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-203 Add entry for macroexpand-all to NEWS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-204 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-205 Add macroexpand-all to lisp reference manual * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-206 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-207 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-208 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-209 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-210 More RCS keyword removal * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-211 File-permission tweaks * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-212 Checkout from CVS with unexpanded RCS keywords git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-136
author Karoly Lorentey <lorentey@elte.hu>
date Tue, 13 Apr 2004 17:17:13 +0000
parents 8e5779acd195 9533e29b87e8
children 625059157bad
comparison
equal deleted inserted replaced
83095:b448166f5664 83096:eb7e8d483840
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 buf = Fget_buffer (name); 536 buf = Fget_buffer (name);
536 if (!NILP (buf)) 537 if (!NILP (buf))
537 error ("Buffer name `%s' is in use", SDATA (name)); 538 error ("Buffer name `%s' is in use", SDATA (name));
538 539
540 tem = base_buffer;
539 base_buffer = Fget_buffer (base_buffer); 541 base_buffer = Fget_buffer (base_buffer);
540 if (NILP (base_buffer)) 542 if (NILP (base_buffer))
541 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");
542 546
543 if (SCHARS (name) == 0) 547 if (SCHARS (name) == 0)
544 error ("Empty string for buffer name is not allowed"); 548 error ("Empty string for buffer name is not allowed");
545 549
546 b = (struct buffer *) allocate_buffer (); 550 b = (struct buffer *) allocate_buffer ();
650 eassert (b->overlays_before == NULL); 654 eassert (b->overlays_before == NULL);
651 eassert (b->overlays_after == NULL); 655 eassert (b->overlays_after == NULL);
652 } 656 }
653 657
654 /* Reinitialize everything about a buffer except its name and contents 658 /* Reinitialize everything about a buffer except its name and contents
655 and local variables. 659 and local variables.
656 If called on an already-initialized buffer, the list of overlays 660 If called on an already-initialized buffer, the list of overlays
657 should be deleted before calling this function, otherwise we end up 661 should be deleted before calling this function, otherwise we end up
658 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
659 claims it doesn't belong to it. */ 663 claims it doesn't belong to it. */
660 664
764 DEFUN ("generate-new-buffer-name", Fgenerate_new_buffer_name, Sgenerate_new_buffer_name, 768 DEFUN ("generate-new-buffer-name", Fgenerate_new_buffer_name, Sgenerate_new_buffer_name,
765 1, 2, 0, 769 1, 2, 0,
766 doc: /* Return a string that is the name of no existing buffer based on NAME. 770 doc: /* Return a string that is the name of no existing buffer based on NAME.
767 If there is no live buffer named NAME, then return NAME. 771 If there is no live buffer named NAME, then return NAME.
768 Otherwise modify name by appending `<NUMBER>', incrementing NUMBER 772 Otherwise modify name by appending `<NUMBER>', incrementing NUMBER
769 until an unused name is found, and then return that name. 773 \(starting at 2) until an unused name is found, and then return that name.
770 Optional second argument IGNORE specifies a name that is okay to use 774 Optional second argument IGNORE specifies a name that is okay to use
771 \(if it is in the sequence to be tried) 775 \(if it is in the sequence to be tried)
772 even if a buffer with that name exists. */) 776 even if a buffer with that name exists. */)
773 (name, ignore) 777 (name, ignore)
774 register Lisp_Object name, ignore; 778 register Lisp_Object name, ignore;
777 int count; 781 int count;
778 char number[10]; 782 char number[10];
779 783
780 CHECK_STRING (name); 784 CHECK_STRING (name);
781 785
786 tem = Fstring_equal (name, ignore);
787 if (!NILP (tem))
788 return name;
782 tem = Fget_buffer (name); 789 tem = Fget_buffer (name);
783 if (NILP (tem)) 790 if (NILP (tem))
784 return name; 791 return name;
785 792
786 count = 1; 793 count = 1;