emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: make-indirect-buffer


From: Luc Teirlinck
Subject: Re: make-indirect-buffer
Date: Mon, 12 Apr 2004 18:36:15 -0500 (CDT)

Stefan Monnier wrote:

   > Basically one could do this (I do not know whether it is worth the
   > extra variable):

   AFAIK, variables have no cost.

So what if I install the following:

===File ~/buffer.c-diff=====================================
diff -c /home/teirllm/emacscvsdir/emacs/src/buffer.c /home/teirllm/buffer.new.c
*** /home/teirllm/emacscvsdir/emacs/src/buffer.c        Mon Apr 12 18:26:33 2004
--- /home/teirllm/buffer.new.c  Mon Apr 12 18:01:22 2004
***************
*** 521,527 ****
         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).
  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.
--- 521,527 ----
         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 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,535 ****
       (base_buffer, name, clone)
       Lisp_Object base_buffer, name, clone;
  {
!   Lisp_Object buf;
    struct buffer *b;
  
    CHECK_STRING (name);
--- 529,535 ----
       (base_buffer, name, clone)
       Lisp_Object base_buffer, name, clone;
  {
!   Lisp_Object buf, tem;
    struct buffer *b;
  
    CHECK_STRING (name);
***************
*** 537,545 ****
    if (!NILP (buf))
      error ("Buffer name `%s' is in use", SDATA (name));
  
    base_buffer = Fget_buffer (base_buffer);
    if (NILP (base_buffer))
!     error ("No such buffer: `%s'", SDATA (name));
  
    if (SCHARS (name) == 0)
      error ("Empty string for buffer name is not allowed");
--- 537,548 ----
    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 (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");

Diff finished.  Mon Apr 12 18:27:39 2004
============================================================




reply via email to

[Prev in Thread] Current Thread [Next in Thread]