]> git.eshelyaron.com Git - emacs.git/commitdiff
(Fmake_indirect_buffer): Throw an error if the intended base buffer
authorLuc Teirlinck <teirllm@auburn.edu>
Tue, 13 Apr 2004 01:16:22 +0000 (01:16 +0000)
committerLuc Teirlinck <teirllm@auburn.edu>
Tue, 13 Apr 2004 01:16:22 +0000 (01:16 +0000)
has been killed.  Correct the error message if the base buffer does
not exist.

src/ChangeLog
src/buffer.c

index 4a971341870b9818204419e0a7af36aae43339fb..6d48aa0f6d08b6e3ef726f4022ae0940e42d2d39 100644 (file)
@@ -1,3 +1,9 @@
+2004-04-12  Luc Teirlinck  <teirllm@auburn.edu>
+
+       * buffer.c (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.
+
 2004-04-12  Joe Buehler  <jbuehler@hekimian.com>
 
        * s/cygwin.h: Changes for Cygwin unexec() support, changes in
index 403baa817d3165b4875b744cbc1a00ca824c8e10..ca74dda73bf609000c6846a430ddee5fda15134f 100644 (file)
@@ -521,7 +521,7 @@ DEFUN ("make-indirect-buffer", Fmake_indirect_buffer, Smake_indirect_buffer,
        2, 3,
        "bMake indirect buffer (to buffer): \nBName of indirect buffer: ",
        doc: /* Create and return an indirect buffer for buffer BASE-BUFFER, named NAME.
-BASE-BUFFER should be an existing buffer (or buffer name).
+BASE-BUFFER should be a live buffer, or the name of an existing buffer.
 NAME should be a string which is not the name of an existing buffer.
 Optional argument CLONE non-nil means preserve BASE-BUFFER's state,
 such as major and minor modes, in the indirect buffer.
@@ -529,7 +529,7 @@ CLONE nil means the indirect buffer's state is reset to default values.  */)
      (base_buffer, name, clone)
      Lisp_Object base_buffer, name, clone;
 {
-  Lisp_Object buf;
+  Lisp_Object buf, tem;
   struct buffer *b;
 
   CHECK_STRING (name);
@@ -537,9 +537,12 @@ CLONE nil means the indirect buffer's state is reset to default values.  */)
   if (!NILP (buf))
     error ("Buffer name `%s' is in use", SDATA (name));
 
+  tem = base_buffer;
   base_buffer = Fget_buffer (base_buffer);
   if (NILP (base_buffer))
-    error ("No such buffer: `%s'", SDATA (name));
+    error ("No such buffer: `%s'", SDATA (tem));
+  if (NILP (XBUFFER (base_buffer)->name))
+    error ("Base buffer has been killed");
 
   if (SCHARS (name) == 0)
     error ("Empty string for buffer name is not allowed");
@@ -653,7 +656,7 @@ delete_all_overlays (b)
 }
 
 /* Reinitialize everything about a buffer except its name and contents
-   and local variables. 
+   and local variables.
    If called on an already-initialized buffer, the list of overlays
    should be deleted before calling this function, otherwise we end up
    with overlays that claim to belong to the buffer but the buffer