/[emacs]/emacs/src/buffer.c
ViewVC logotype

Diff of /emacs/src/buffer.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.475 by lute, Fri Feb 25 15:21:30 2005 UTC revision 1.476 by rms, Thu Mar 17 23:37:39 2005 UTC
# Line 182  static void alloc_buffer_text P_ ((struc Line 182  static void alloc_buffer_text P_ ((struc
182  static void free_buffer_text P_ ((struct buffer *b));  static void free_buffer_text P_ ((struct buffer *b));
183  static struct Lisp_Overlay * copy_overlays P_ ((struct buffer *, struct Lisp_Overlay *));  static struct Lisp_Overlay * copy_overlays P_ ((struct buffer *, struct Lisp_Overlay *));
184  static void modify_overlay P_ ((struct buffer *, EMACS_INT, EMACS_INT));  static void modify_overlay P_ ((struct buffer *, EMACS_INT, EMACS_INT));
185    static Lisp_Object buffer_lisp_local_variables P_ ((struct buffer *));
186    
187    
188  /* For debugging; temporary.  See set_buffer_internal.  */  /* For debugging; temporary.  See set_buffer_internal.  */
# Line 515  clone_per_buffer_values (from, to) Line 516  clone_per_buffer_values (from, to)
516    to->overlays_before = copy_overlays (to, from->overlays_before);    to->overlays_before = copy_overlays (to, from->overlays_before);
517    to->overlays_after = copy_overlays (to, from->overlays_after);    to->overlays_after = copy_overlays (to, from->overlays_after);
518    
519    /* Copy the alist of local variables,    /* Get (a copy of) the alist of Lisp-level local variables of FROM
520       and all the alist elements too.  */       and install that in TO.  */
521    to->local_var_alist    to->local_var_alist = buffer_lisp_local_variables (from);
     = Fcopy_sequence (from->local_var_alist);  
   for (tem = to->local_var_alist; CONSP (tem);  
        tem = XCDR (tem))  
     XSETCAR (tem, Fcons (XCAR (XCAR (tem)), XCDR (XCAR (tem))));  
522  }  }
523    
   
524  DEFUN ("make-indirect-buffer", Fmake_indirect_buffer, Smake_indirect_buffer,  DEFUN ("make-indirect-buffer", Fmake_indirect_buffer, Smake_indirect_buffer,
525         2, 3,         2, 3,
526         "bMake indirect buffer (to buffer): \nBName of indirect buffer: ",         "bMake indirect buffer (to buffer): \nBName of indirect buffer: ",
# Line 934  is the default binding of variable. */) Line 930  is the default binding of variable. */)
930    return result;    return result;
931  }  }
932    
933    /* Return an alist of the Lisp-level buffer-local bindings of
934       buffer BUF.  That is, do't include  the variables maintained
935       in special slots in the buffer object.  */
936    
937    static Lisp_Object
938    buffer_lisp_local_variables (buf)
939         struct buffer *buf;
940    {
941      Lisp_Object result = Qnil;
942      register Lisp_Object tail;
943      for (tail = buf->local_var_alist; CONSP (tail); tail = XCDR (tail))
944        {
945          Lisp_Object val, elt;
946    
947          elt = XCAR (tail);
948    
949          /* Reference each variable in the alist in buf.
950             If inquiring about the current buffer, this gets the current values,
951             so store them into the alist so the alist is up to date.
952             If inquiring about some other buffer, this swaps out any values
953             for that buffer, making the alist up to date automatically.  */
954          val = find_symbol_value (XCAR (elt));
955          /* Use the current buffer value only if buf is the current buffer.  */
956          if (buf != current_buffer)
957            val = XCDR (elt);
958    
959          /* If symbol is unbound, put just the symbol in the list.  */
960          if (EQ (val, Qunbound))
961            result = Fcons (XCAR (elt), result);
962          /* Otherwise, put (symbol . value) in the list.  */
963          else
964            result = Fcons (Fcons (XCAR (elt), val), result);
965        }
966    
967      return result;
968    }
969    
970  DEFUN ("buffer-local-variables", Fbuffer_local_variables,  DEFUN ("buffer-local-variables", Fbuffer_local_variables,
971         Sbuffer_local_variables, 0, 1, 0,         Sbuffer_local_variables, 0, 1, 0,
972         doc: /* Return an alist of variables that are buffer-local in BUFFER.         doc: /* Return an alist of variables that are buffer-local in BUFFER.
# Line 955  No argument or nil as argument means use Line 988  No argument or nil as argument means use
988        buf = XBUFFER (buffer);        buf = XBUFFER (buffer);
989      }      }
990    
991    result = Qnil;    result = buffer_lisp_local_variables (buf);
   
   {  
     register Lisp_Object tail;  
     for (tail = buf->local_var_alist; CONSP (tail); tail = XCDR (tail))  
       {  
         Lisp_Object val, elt;  
   
         elt = XCAR (tail);  
   
         /* Reference each variable in the alist in buf.  
            If inquiring about the current buffer, this gets the current values,  
            so store them into the alist so the alist is up to date.  
            If inquiring about some other buffer, this swaps out any values  
            for that buffer, making the alist up to date automatically.  */  
         val = find_symbol_value (XCAR (elt));  
         /* Use the current buffer value only if buf is the current buffer.  */  
         if (buf != current_buffer)  
           val = XCDR (elt);  
   
         /* If symbol is unbound, put just the symbol in the list.  */  
         if (EQ (val, Qunbound))  
           result = Fcons (XCAR (elt), result);  
         /* Otherwise, put (symbol . value) in the list.  */  
         else  
           result = Fcons (Fcons (XCAR (elt), val), result);  
       }  
   }  
992    
993    /* Add on all the variables stored in special slots.  */    /* Add on all the variables stored in special slots.  */
994    {    {
# Line 1004  No argument or nil as argument means use Line 1010  No argument or nil as argument means use
1010    
1011    return result;    return result;
1012  }  }
   
1013    
1014  DEFUN ("buffer-modified-p", Fbuffer_modified_p, Sbuffer_modified_p,  DEFUN ("buffer-modified-p", Fbuffer_modified_p, Sbuffer_modified_p,
1015         0, 1, 0,         0, 1, 0,

Legend:
Removed from v.1.475  
changed lines
  Added in v.1.476

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26