aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorMiles Bader2007-12-06 09:51:45 +0000
committerMiles Bader2007-12-06 09:51:45 +0000
commit0bd508417142ff377f34aec8dcec9438d9175c2c (patch)
tree4d60fe09e5cebf7d79766b11e9cda8cc1c9dbb9b /src/buffer.c
parent98fe991da804a42f53f6a5e84cd5eab18a82e181 (diff)
parent9fb1ba8090da3528de56158a79bd3527d31c7f2f (diff)
downloademacs-0bd508417142ff377f34aec8dcec9438d9175c2c.tar.gz
emacs-0bd508417142ff377f34aec8dcec9438d9175c2c.zip
Merge from emacs--devo--0
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-294
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c52
1 files changed, 12 insertions, 40 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 416ff7e3702..77af23ace39 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -99,17 +99,6 @@ DECL_ALIGN (struct buffer, buffer_local_symbols);
99/* A Lisp_Object pointer to the above, used for staticpro */ 99/* A Lisp_Object pointer to the above, used for staticpro */
100static Lisp_Object Vbuffer_local_symbols; 100static Lisp_Object Vbuffer_local_symbols;
101 101
102/* This structure holds the required types for the values in the
103 buffer-local slots. If a slot contains Qnil, then the
104 corresponding buffer slot may contain a value of any type. If a
105 slot contains an integer, then prospective values' tags must be
106 equal to that integer (except nil is always allowed).
107 When a tag does not match, the function
108 buffer_slot_type_mismatch will signal an error.
109
110 If a slot here contains -1, the corresponding variable is read-only. */
111struct buffer buffer_local_types;
112
113/* Flags indicating which built-in buffer-local variables 102/* Flags indicating which built-in buffer-local variables
114 are permanent locals. */ 103 are permanent locals. */
115static char buffer_permanent_local_flags[MAX_PER_BUFFER_VARS]; 104static char buffer_permanent_local_flags[MAX_PER_BUFFER_VARS];
@@ -360,7 +349,7 @@ The value is never nil. */)
360 if (SCHARS (name) == 0) 349 if (SCHARS (name) == 0)
361 error ("Empty string for buffer name is not allowed"); 350 error ("Empty string for buffer name is not allowed");
362 351
363 b = (struct buffer *) allocate_buffer (); 352 b = allocate_buffer ();
364 353
365 /* An ordinary buffer uses its own struct buffer_text. */ 354 /* An ordinary buffer uses its own struct buffer_text. */
366 b->text = &b->own_text; 355 b->text = &b->own_text;
@@ -561,7 +550,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
561 if (SCHARS (name) == 0) 550 if (SCHARS (name) == 0)
562 error ("Empty string for buffer name is not allowed"); 551 error ("Empty string for buffer name is not allowed");
563 552
564 b = (struct buffer *) allocate_buffer (); 553 b = allocate_buffer ();
565 554
566 b->base_buffer = (XBUFFER (base_buffer)->base_buffer 555 b->base_buffer = (XBUFFER (base_buffer)->base_buffer
567 ? XBUFFER (base_buffer)->base_buffer 556 ? XBUFFER (base_buffer)->base_buffer
@@ -896,8 +885,7 @@ is the default binding of the variable. */)
896 CHECK_BUFFER (buffer); 885 CHECK_BUFFER (buffer);
897 buf = XBUFFER (buffer); 886 buf = XBUFFER (buffer);
898 887
899 if (SYMBOLP (variable)) 888 variable = indirect_variable (variable);
900 variable = indirect_variable (variable);
901 889
902 /* Look in local_var_list */ 890 /* Look in local_var_list */
903 result = Fassoc (variable, buf->local_var_alist); 891 result = Fassoc (variable, buf->local_var_alist);
@@ -2534,26 +2522,11 @@ swap_out_buffer_local_variables (b)
2534 2522
2535 /* Need not do anything if some other buffer's binding is now encached. */ 2523 /* Need not do anything if some other buffer's binding is now encached. */
2536 tem = XBUFFER_LOCAL_VALUE (SYMBOL_VALUE (sym))->buffer; 2524 tem = XBUFFER_LOCAL_VALUE (SYMBOL_VALUE (sym))->buffer;
2537 if (BUFFERP (tem) && XBUFFER (tem) == current_buffer) 2525 if (EQ (tem, buffer))
2538 { 2526 {
2539 /* Symbol is set up for this buffer's old local value. 2527 /* Symbol is set up for this buffer's old local value:
2540 Set it up for the current buffer with the default value. */ 2528 swap it out! */
2541 2529 swap_in_global_binding (sym);
2542 tem = XBUFFER_LOCAL_VALUE (SYMBOL_VALUE (sym))->cdr;
2543 /* Store the symbol's current value into the alist entry
2544 it is currently set up for. This is so that, if the
2545 local is marked permanent, and we make it local again
2546 later in Fkill_all_local_variables, we don't lose the value. */
2547 XSETCDR (XCAR (tem),
2548 do_symval_forwarding (XBUFFER_LOCAL_VALUE (SYMBOL_VALUE (sym))->realvalue));
2549 /* Switch to the symbol's default-value alist entry. */
2550 XSETCAR (tem, tem);
2551 /* Mark it as current for buffer B. */
2552 XBUFFER_LOCAL_VALUE (SYMBOL_VALUE (sym))->buffer = buffer;
2553 /* Store the current value into any forwarding in the symbol. */
2554 store_symval_forwarding (sym,
2555 XBUFFER_LOCAL_VALUE (SYMBOL_VALUE (sym))->realvalue,
2556 XCDR (tem), NULL);
2557 } 2530 }
2558 } 2531 }
2559} 2532}
@@ -4434,13 +4407,13 @@ evaporate_overlays (pos)
4434 in the slot with offset OFFSET. */ 4407 in the slot with offset OFFSET. */
4435 4408
4436void 4409void
4437buffer_slot_type_mismatch (offset) 4410buffer_slot_type_mismatch (sym, type)
4438 int offset; 4411 Lisp_Object sym;
4412 int type;
4439{ 4413{
4440 Lisp_Object sym;
4441 char *type_name; 4414 char *type_name;
4442 4415
4443 switch (XINT (PER_BUFFER_TYPE (offset))) 4416 switch (type)
4444 { 4417 {
4445 case Lisp_Int: 4418 case Lisp_Int:
4446 type_name = "integers"; 4419 type_name = "integers";
@@ -4458,7 +4431,6 @@ buffer_slot_type_mismatch (offset)
4458 abort (); 4431 abort ();
4459 } 4432 }
4460 4433
4461 sym = PER_BUFFER_SYMBOL (offset);
4462 error ("Only %s should be stored in the buffer-local variable %s", 4434 error ("Only %s should be stored in the buffer-local variable %s",
4463 type_name, SDATA (SYMBOL_NAME (sym))); 4435 type_name, SDATA (SYMBOL_NAME (sym)));
4464} 4436}
@@ -5306,9 +5278,9 @@ defvar_per_buffer (namestring, address, type, doc)
5306 5278
5307 XMISCTYPE (val) = Lisp_Misc_Buffer_Objfwd; 5279 XMISCTYPE (val) = Lisp_Misc_Buffer_Objfwd;
5308 XBUFFER_OBJFWD (val)->offset = offset; 5280 XBUFFER_OBJFWD (val)->offset = offset;
5281 XBUFFER_OBJFWD (val)->slottype = type;
5309 SET_SYMBOL_VALUE (sym, val); 5282 SET_SYMBOL_VALUE (sym, val);
5310 PER_BUFFER_SYMBOL (offset) = sym; 5283 PER_BUFFER_SYMBOL (offset) = sym;
5311 PER_BUFFER_TYPE (offset) = type;
5312 5284
5313 if (PER_BUFFER_IDX (offset) == 0) 5285 if (PER_BUFFER_IDX (offset) == 0)
5314 /* Did a DEFVAR_PER_BUFFER without initializing the corresponding 5286 /* Did a DEFVAR_PER_BUFFER without initializing the corresponding