aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorJoakim Verona2012-09-10 16:03:53 +0200
committerJoakim Verona2012-09-10 16:03:53 +0200
commitb035a30e5cd2f34fedc04c253eeb5a11afed8145 (patch)
treeb9350cce389602f4967bdc1beed745929155ad5d /src/buffer.c
parent4a37733c693d59a9b83a3fb2d0c7f9461d149f60 (diff)
parenta31a4cdacb196cc96dcb9bd229edb1d635e01344 (diff)
downloademacs-b035a30e5cd2f34fedc04c253eeb5a11afed8145.tar.gz
emacs-b035a30e5cd2f34fedc04c253eeb5a11afed8145.zip
upstream
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c44
1 files changed, 14 insertions, 30 deletions
diff --git a/src/buffer.c b/src/buffer.c
index f4d38e50a47..3af45122a0d 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -44,7 +44,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
44#include "keymap.h" 44#include "keymap.h"
45#include "frame.h" 45#include "frame.h"
46 46
47struct buffer *current_buffer; /* the current buffer */ 47struct buffer *current_buffer; /* The current buffer. */
48 48
49/* First buffer in chain of all buffers (in reverse order of creation). 49/* First buffer in chain of all buffers (in reverse order of creation).
50 Threaded through ->header.next.buffer. */ 50 Threaded through ->header.next.buffer. */
@@ -60,10 +60,6 @@ struct buffer *all_buffers;
60 60
61struct buffer alignas (GCALIGNMENT) buffer_defaults; 61struct buffer alignas (GCALIGNMENT) buffer_defaults;
62 62
63/* A Lisp_Object pointer to the above, used for staticpro */
64
65static Lisp_Object Vbuffer_defaults;
66
67/* This structure marks which slots in a buffer have corresponding 63/* This structure marks which slots in a buffer have corresponding
68 default values in buffer_defaults. 64 default values in buffer_defaults.
69 Each such slot has a nonzero value in this structure. 65 Each such slot has a nonzero value in this structure.
@@ -78,18 +74,15 @@ static Lisp_Object Vbuffer_defaults;
78 and the corresponding slot in buffer_defaults is not used. 74 and the corresponding slot in buffer_defaults is not used.
79 75
80 If a slot in this structure corresponding to a DEFVAR_PER_BUFFER is 76 If a slot in this structure corresponding to a DEFVAR_PER_BUFFER is
81 zero, that is a bug */ 77 zero, that is a bug. */
82 78
83struct buffer buffer_local_flags; 79struct buffer buffer_local_flags;
84 80
85/* This structure holds the names of symbols whose values may be 81/* This structure holds the names of symbols whose values may be
86 buffer-local. It is indexed and accessed in the same way as the above. */ 82 buffer-local. It is indexed and accessed in the same way as the above. */
87 83
88struct buffer alignas (GCALIGNMENT) buffer_local_symbols; 84struct buffer alignas (GCALIGNMENT) buffer_local_symbols;
89 85
90/* A Lisp_Object pointer to the above, used for staticpro */
91static Lisp_Object Vbuffer_local_symbols;
92
93/* Return the symbol of the per-buffer variable at offset OFFSET in 86/* Return the symbol of the per-buffer variable at offset OFFSET in
94 the buffer structure. */ 87 the buffer structure. */
95 88
@@ -115,7 +108,7 @@ static void call_overlay_mod_hooks (Lisp_Object list, Lisp_Object overlay,
115static void swap_out_buffer_local_variables (struct buffer *b); 108static void swap_out_buffer_local_variables (struct buffer *b);
116static void reset_buffer_local_variables (struct buffer *, bool); 109static void reset_buffer_local_variables (struct buffer *, bool);
117 110
118/* Alist of all buffer names vs the buffers. */ 111/* Alist of all buffer names vs the buffers. */
119/* This used to be a variable, but is no longer, 112/* This used to be a variable, but is no longer,
120 to prevent lossage due to user rplac'ing this alist or its elements. */ 113 to prevent lossage due to user rplac'ing this alist or its elements. */
121Lisp_Object Vbuffer_alist; 114Lisp_Object Vbuffer_alist;
@@ -134,7 +127,7 @@ static Lisp_Object Qpermanent_local_hook;
134 127
135static Lisp_Object Qprotected_field; 128static Lisp_Object Qprotected_field;
136 129
137static Lisp_Object QSFundamental; /* A string "Fundamental" */ 130static Lisp_Object QSFundamental; /* A string "Fundamental". */
138 131
139static Lisp_Object Qkill_buffer_hook; 132static Lisp_Object Qkill_buffer_hook;
140static Lisp_Object Qbuffer_list_update_hook; 133static Lisp_Object Qbuffer_list_update_hook;
@@ -595,10 +588,6 @@ even if it is dead. The return value is never nil. */)
595 bset_width_table (b, Qnil); 588 bset_width_table (b, Qnil);
596 b->prevent_redisplay_optimizations_p = 1; 589 b->prevent_redisplay_optimizations_p = 1;
597 590
598 /* Put this on the chain of all buffers including killed ones. */
599 b->header.next.buffer = all_buffers;
600 all_buffers = b;
601
602 /* An ordinary buffer normally doesn't need markers 591 /* An ordinary buffer normally doesn't need markers
603 to handle BEGV and ZV. */ 592 to handle BEGV and ZV. */
604 bset_pt_marker (b, Qnil); 593 bset_pt_marker (b, Qnil);
@@ -819,10 +808,6 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
819 b->width_run_cache = 0; 808 b->width_run_cache = 0;
820 bset_width_table (b, Qnil); 809 bset_width_table (b, Qnil);
821 810
822 /* Put this on the chain of all buffers including killed ones. */
823 b->header.next.buffer = all_buffers;
824 all_buffers = b;
825
826 name = Fcopy_sequence (name); 811 name = Fcopy_sequence (name);
827 set_string_intervals (name, NULL); 812 set_string_intervals (name, NULL);
828 bset_name (b, name); 813 bset_name (b, name);
@@ -1242,7 +1227,7 @@ buffer_local_value_1 (Lisp_Object variable, Lisp_Object buffer)
1242 result = Fdefault_value (variable); 1227 result = Fdefault_value (variable);
1243 break; 1228 break;
1244 } 1229 }
1245 default: abort (); 1230 default: emacs_abort ();
1246 } 1231 }
1247 1232
1248 return result; 1233 return result;
@@ -2671,7 +2656,7 @@ current buffer is cleared. */)
2671 /* Make sure no markers were put on the chain 2656 /* Make sure no markers were put on the chain
2672 while the chain value was incorrect. */ 2657 while the chain value was incorrect. */
2673 if (BUF_MARKERS (current_buffer)) 2658 if (BUF_MARKERS (current_buffer))
2674 abort (); 2659 emacs_abort ();
2675 2660
2676 BUF_MARKERS (current_buffer) = markers; 2661 BUF_MARKERS (current_buffer) = markers;
2677 2662
@@ -3413,7 +3398,7 @@ overlay_strings (ptrdiff_t pos, struct window *w, unsigned char **pstr)
3413 } 3398 }
3414 } 3399 }
3415 if (p != overlay_str_buf + total) 3400 if (p != overlay_str_buf + total)
3416 abort (); 3401 emacs_abort ();
3417 if (pstr) 3402 if (pstr)
3418 *pstr = overlay_str_buf; 3403 *pstr = overlay_str_buf;
3419 return total; 3404 return total;
@@ -4596,7 +4581,7 @@ buffer_slot_type_mismatch (Lisp_Object newval, int type)
4596 case_Lisp_Int: predicate = Qintegerp; break; 4581 case_Lisp_Int: predicate = Qintegerp; break;
4597 case Lisp_String: predicate = Qstringp; break; 4582 case Lisp_String: predicate = Qstringp; break;
4598 case Lisp_Symbol: predicate = Qsymbolp; break; 4583 case Lisp_Symbol: predicate = Qsymbolp; break;
4599 default: abort (); 4584 default: emacs_abort ();
4600 } 4585 }
4601 4586
4602 wrong_type_argument (predicate, newval); 4587 wrong_type_argument (predicate, newval);
@@ -5145,10 +5130,11 @@ init_buffer_once (void)
5145 buffer_local_symbols.indirections = 0; 5130 buffer_local_symbols.indirections = 0;
5146 set_buffer_intervals (&buffer_defaults, NULL); 5131 set_buffer_intervals (&buffer_defaults, NULL);
5147 set_buffer_intervals (&buffer_local_symbols, NULL); 5132 set_buffer_intervals (&buffer_local_symbols, NULL);
5133 /* This is not strictly necessary, but let's make them initialized. */
5134 bset_name (&buffer_defaults, build_pure_c_string (" *buffer-defaults*"));
5135 bset_name (&buffer_local_symbols, build_pure_c_string (" *buffer-local-symbols*"));
5148 XSETPVECTYPESIZE (&buffer_defaults, PVEC_BUFFER, pvecsize); 5136 XSETPVECTYPESIZE (&buffer_defaults, PVEC_BUFFER, pvecsize);
5149 XSETBUFFER (Vbuffer_defaults, &buffer_defaults);
5150 XSETPVECTYPESIZE (&buffer_local_symbols, PVEC_BUFFER, pvecsize); 5137 XSETPVECTYPESIZE (&buffer_local_symbols, PVEC_BUFFER, pvecsize);
5151 XSETBUFFER (Vbuffer_local_symbols, &buffer_local_symbols);
5152 5138
5153 /* Set up the default values of various buffer slots. */ 5139 /* Set up the default values of various buffer slots. */
5154 /* Must do these before making the first buffer! */ 5140 /* Must do these before making the first buffer! */
@@ -5277,7 +5263,7 @@ init_buffer_once (void)
5277 5263
5278 /* Need more room? */ 5264 /* Need more room? */
5279 if (idx >= MAX_PER_BUFFER_VARS) 5265 if (idx >= MAX_PER_BUFFER_VARS)
5280 abort (); 5266 emacs_abort ();
5281 last_per_buffer_idx = idx; 5267 last_per_buffer_idx = idx;
5282 5268
5283 Vbuffer_alist = Qnil; 5269 Vbuffer_alist = Qnil;
@@ -5418,7 +5404,7 @@ defvar_per_buffer (struct Lisp_Buffer_Objfwd *bo_fwd, const char *namestring,
5418 if (PER_BUFFER_IDX (offset) == 0) 5404 if (PER_BUFFER_IDX (offset) == 0)
5419 /* Did a DEFVAR_PER_BUFFER without initializing the corresponding 5405 /* Did a DEFVAR_PER_BUFFER without initializing the corresponding
5420 slot of buffer_local_flags */ 5406 slot of buffer_local_flags */
5421 abort (); 5407 emacs_abort ();
5422} 5408}
5423 5409
5424 5410
@@ -5430,8 +5416,6 @@ syms_of_buffer (void)
5430 last_overlay_modification_hooks 5416 last_overlay_modification_hooks
5431 = Fmake_vector (make_number (10), Qnil); 5417 = Fmake_vector (make_number (10), Qnil);
5432 5418
5433 staticpro (&Vbuffer_defaults);
5434 staticpro (&Vbuffer_local_symbols);
5435 staticpro (&Qfundamental_mode); 5419 staticpro (&Qfundamental_mode);
5436 staticpro (&Qmode_class); 5420 staticpro (&Qmode_class);
5437 staticpro (&QSFundamental); 5421 staticpro (&QSFundamental);