comparison src/buffer.c @ 272:c5d627a313b1 r21-0b34

Import from CVS: tag r21-0b34
author cvs
date Mon, 13 Aug 2007 10:28:48 +0200
parents 405dd6d1825b
children 6330739388db
comparison
equal deleted inserted replaced
271:c7b7086b0a39 272:c5d627a313b1
78 #include "insdel.h" 78 #include "insdel.h"
79 #include "process.h" /* for kill_buffer_processes */ 79 #include "process.h" /* for kill_buffer_processes */
80 #ifdef REGION_CACHE_NEEDS_WORK 80 #ifdef REGION_CACHE_NEEDS_WORK
81 #include "region-cache.h" 81 #include "region-cache.h"
82 #endif 82 #endif
83 #include "symeval.h"
84 #include "syntax.h" 83 #include "syntax.h"
85 #include "sysdep.h" /* for getwd */ 84 #include "sysdep.h" /* for getwd */
86 #include "window.h" 85 #include "window.h"
87 86
88 #include "sysfile.h" 87 #include "sysfile.h"
96 Setting the default value also goes through the alist of buffers 95 Setting the default value also goes through the alist of buffers
97 and stores into each buffer that does not say it has a local value. */ 96 and stores into each buffer that does not say it has a local value. */
98 Lisp_Object Vbuffer_defaults; 97 Lisp_Object Vbuffer_defaults;
99 98
100 /* This structure marks which slots in a buffer have corresponding 99 /* This structure marks which slots in a buffer have corresponding
101 default values in buffer_defaults. 100 default values in Vbuffer_defaults.
102 Each such slot has a nonzero value in this structure. 101 Each such slot has a nonzero value in this structure.
103 The value has only one nonzero bit. 102 The value has only one nonzero bit.
104 103
105 When a buffer has its own local value for a slot, 104 When a buffer has its own local value for a slot,
106 the bit for that slot (found in the same slot in this structure) 105 the bit for that slot (found in the same slot in this structure)
107 is turned on in the buffer's local_var_flags slot. 106 is turned on in the buffer's local_var_flags slot.
108 107
109 If a slot in this structure is 0, then there is a DEFVAR_BUFFER_LOCAL 108 If a slot in this structure is 0, then there is a DEFVAR_BUFFER_LOCAL
110 for the slot, but there is no default value for it; the corresponding 109 for the slot, but there is no default value for it; the corresponding
111 slot in buffer_defaults is not used except to initialize newly-created 110 slot in Vbuffer_defaults is not used except to initialize newly-created
112 buffers. 111 buffers.
113 112
114 If a slot is -1, then there is a DEFVAR_BUFFER_LOCAL for it 113 If a slot is -1, then there is a DEFVAR_BUFFER_LOCAL for it
115 as well as a default value which is used to initialize newly-created 114 as well as a default value which is used to initialize newly-created
116 buffers and as a reset-value when local-vars are killed. 115 buffers and as a reset-value when local-vars are killed.
119 (The slot is always local, but there's no lisp variable for it.) 118 (The slot is always local, but there's no lisp variable for it.)
120 The default value is only used to initialize newly-creation buffers. 119 The default value is only used to initialize newly-creation buffers.
121 120
122 If a slot is -3, then there is no DEFVAR_BUFFER_LOCAL for it but 121 If a slot is -3, then there is no DEFVAR_BUFFER_LOCAL for it but
123 there is a default which is used to initialize newly-creation 122 there is a default which is used to initialize newly-creation
124 buffers and as a reset-value when local-vars are killed. 123 buffers and as a reset-value when local-vars are killed. */
125
126
127 */
128 struct buffer buffer_local_flags; 124 struct buffer buffer_local_flags;
129 125
130 /* This structure holds the names of symbols whose values may be 126 /* This structure holds the names of symbols whose values may be
131 buffer-local. It is indexed and accessed in the same way as the above. */ 127 buffer-local. It is indexed and accessed in the same way as the above. */
132 static Lisp_Object Vbuffer_local_symbols; 128 static Lisp_Object Vbuffer_local_symbols;
205 int find_file_use_truenames; 201 int find_file_use_truenames;
206 202
207 203
208 static void reset_buffer_local_variables (struct buffer *, int first_time); 204 static void reset_buffer_local_variables (struct buffer *, int first_time);
209 static void nuke_all_buffer_slots (struct buffer *b, Lisp_Object zap); 205 static void nuke_all_buffer_slots (struct buffer *b, Lisp_Object zap);
210 static Lisp_Object mark_buffer (Lisp_Object, void (*) (Lisp_Object)); 206
211 static void print_buffer (Lisp_Object, Lisp_Object, int); 207 Lisp_Object
208 make_buffer (struct buffer *buf)
209 {
210 Lisp_Object obj;
211 XSETBUFFER (obj, buf);
212 return obj;
213 }
214
215 static Lisp_Object
216 mark_buffer (Lisp_Object obj, void (*markobj) (Lisp_Object))
217 {
218 struct buffer *buf = XBUFFER (obj);
219
220 /* Truncate undo information. */
221 buf->undo_list = truncate_undo_list (buf->undo_list,
222 undo_threshold,
223 undo_high_threshold);
224
225 #define MARKED_SLOT(x) ((markobj) (buf->x));
226 #include "bufslots.h"
227 #undef MARKED_SLOT
228
229 ((markobj) (buf->extent_info));
230
231 /* Don't mark normally through the children slot.
232 (Actually, in this case, it doesn't matter.) */
233 if (! EQ (buf->indirect_children, Qnull_pointer))
234 mark_conses_in_list (buf->indirect_children);
235
236 return buf->base_buffer ? make_buffer (buf->base_buffer) : Qnil;
237 }
238
239 static void
240 print_buffer (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
241 {
242 struct buffer *b = XBUFFER (obj);
243
244 if (print_readably)
245 {
246 if (!BUFFER_LIVE_P (b))
247 error ("printing unreadable object #<killed buffer>");
248 else
249 error ("printing unreadable object #<buffer %s>",
250 XSTRING_DATA (b->name));
251 }
252 else if (!BUFFER_LIVE_P (b))
253 write_c_string ("#<killed buffer>", printcharfun);
254 else if (escapeflag)
255 {
256 write_c_string ("#<buffer ", printcharfun);
257 print_internal (b->name, printcharfun, 1);
258 write_c_string (">", printcharfun);
259 }
260 else
261 {
262 print_internal (b->name, printcharfun, 0);
263 }
264 }
265
212 /* We do not need a finalize method to handle a buffer's children list 266 /* We do not need a finalize method to handle a buffer's children list
213 because all buffers have `kill-buffer' applied to them before 267 because all buffers have `kill-buffer' applied to them before
214 they disappear, and the children removal happens then. */ 268 they disappear, and the children removal happens then. */
215 DEFINE_LRECORD_IMPLEMENTATION ("buffer", buffer, 269 DEFINE_LRECORD_IMPLEMENTATION ("buffer", buffer,
216 mark_buffer, print_buffer, 0, 0, 0, 270 mark_buffer, print_buffer, 0, 0, 0,
217 struct buffer); 271 struct buffer);
218
219 Lisp_Object
220 make_buffer (struct buffer *buf)
221 {
222 Lisp_Object obj;
223 XSETBUFFER (obj, buf);
224 return obj;
225 }
226
227 static Lisp_Object
228 mark_buffer (Lisp_Object obj, void (*markobj) (Lisp_Object))
229 {
230 struct buffer *buf = XBUFFER (obj);
231
232 /* Truncate undo information. */
233 buf->undo_list = truncate_undo_list (buf->undo_list,
234 undo_threshold,
235 undo_high_threshold);
236
237 #define MARKED_SLOT(x) ((markobj) (buf->x));
238 #include "bufslots.h"
239 #undef MARKED_SLOT
240
241 ((markobj) (buf->extent_info));
242
243 /* Don't mark normally through the children slot.
244 (Actually, in this case, it doesn't matter.)
245 */
246 if (! EQ (buf->indirect_children, Qnull_pointer))
247 mark_conses_in_list (buf->indirect_children);
248
249 if (buf->base_buffer)
250 {
251 Lisp_Object base_buf_obj = Qnil;
252
253 XSETBUFFER (base_buf_obj, buf->base_buffer);
254 return base_buf_obj;
255 }
256 else
257 return Qnil;
258 }
259
260 static void
261 print_buffer (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
262 {
263 struct buffer *b = XBUFFER (obj);
264
265 if (print_readably)
266 {
267 if (!BUFFER_LIVE_P (b))
268 error ("printing unreadable object #<killed buffer>");
269 else
270 error ("printing unreadable object #<buffer %s>",
271 XSTRING_DATA (b->name));
272 }
273 else if (!BUFFER_LIVE_P (b))
274 write_c_string ("#<killed buffer>", printcharfun);
275 else if (escapeflag)
276 {
277 write_c_string ("#<buffer ", printcharfun);
278 print_internal (b->name, printcharfun, 1);
279 write_c_string (">", printcharfun);
280 }
281 else
282 {
283 print_internal (b->name, printcharfun, 0);
284 }
285 }
286
287 272
288 DEFUN ("bufferp", Fbufferp, 1, 1, 0, /* 273 DEFUN ("bufferp", Fbufferp, 1, 1, 0, /*
289 T if OBJECT is an editor buffer. 274 Return t if OBJECT is an editor buffer.
290 */ 275 */
291 (object)) 276 (object))
292 { 277 {
293 if (BUFFERP (object)) 278 return BUFFERP (object) ? Qt : Qnil;
294 return Qt;
295 return Qnil;
296 } 279 }
297 280
298 DEFUN ("buffer-live-p", Fbuffer_live_p, 1, 1, 0, /* 281 DEFUN ("buffer-live-p", Fbuffer_live_p, 1, 1, 0, /*
299 T if OBJECT is an editor buffer that has not been deleted. 282 Return t if OBJECT is an editor buffer that has not been deleted.
300 */ 283 */
301 (object)) 284 (object))
302 { 285 {
303 if (BUFFERP (object) && BUFFER_LIVE_P (XBUFFER (object))) 286 return BUFFERP (object) && BUFFER_LIVE_P (XBUFFER (object)) ? Qt : Qnil;
304 return Qt;
305 return Qnil;
306 } 287 }
307 288
308 static void 289 static void
309 nsberror (Lisp_Object spec) 290 nsberror (Lisp_Object spec)
310 { 291 {
331 } 312 }
332 313
333 Lisp_Object 314 Lisp_Object
334 get_buffer (Lisp_Object name, int error_if_deleted_or_does_not_exist) 315 get_buffer (Lisp_Object name, int error_if_deleted_or_does_not_exist)
335 { 316 {
336 Lisp_Object buf;
337
338 if (BUFFERP (name)) 317 if (BUFFERP (name))
339 { 318 {
340 if (!BUFFER_LIVE_P (XBUFFER (name))) 319 if (!BUFFER_LIVE_P (XBUFFER (name)))
341 { 320 {
342 if (error_if_deleted_or_does_not_exist) 321 if (error_if_deleted_or_does_not_exist)
345 } 324 }
346 return name; 325 return name;
347 } 326 }
348 else 327 else
349 { 328 {
329 Lisp_Object buf;
350 struct gcpro gcpro1; 330 struct gcpro gcpro1;
351 331
352 CHECK_STRING (name); 332 CHECK_STRING (name);
353 name = LISP_GETTEXT (name); /* I18N3 */ 333 name = LISP_GETTEXT (name); /* I18N3 */
354 GCPRO1 (name); 334 GCPRO1 (name);
705 } 685 }
706 #include "bufslots.h" 686 #include "bufslots.h"
707 #undef MARKED_SLOT 687 #undef MARKED_SLOT
708 #if 0 688 #if 0
709 #define STRING256_P(obj) \ 689 #define STRING256_P(obj) \
710 (STRINGP (obj) && string_char_length (XSTRING (obj)) == 256) 690 (STRINGP (obj) && XSTRING_CHAR_LENGTH (obj) == 256)
711 /* If the standard case table has been altered and invalidated, 691 /* If the standard case table has been altered and invalidated,
712 fix up its insides first. */ 692 fix up its insides first. */
713 if (!(STRING256_P(Vascii_upcase_table) && 693 if (!(STRING256_P(Vascii_upcase_table) &&
714 STRING256_P(Vascii_canon_table) && 694 STRING256_P(Vascii_canon_table) &&
715 STRING256_P(Vascii_eqv_table))) 695 STRING256_P(Vascii_eqv_table)))
811 If BUFFER is not indirect, return nil. 791 If BUFFER is not indirect, return nil.
812 */ 792 */
813 (buffer)) 793 (buffer))
814 { 794 {
815 struct buffer *buf = decode_buffer (buffer, 0); 795 struct buffer *buf = decode_buffer (buffer, 0);
816 struct buffer *base = buf->base_buffer; 796
817 Lisp_Object base_buffer = Qnil; 797 return buf->base_buffer ? make_buffer (buf->base_buffer) : Qnil;
818
819 if (! base)
820 return Qnil;
821 XSETBUFFER (base_buffer, base);
822 return base_buffer;
823 } 798 }
824 799
825 DEFUN ("buffer-indirect-children", Fbuffer_indirect_children, 0, 1, 0, /* 800 DEFUN ("buffer-indirect-children", Fbuffer_indirect_children, 0, 1, 0, /*
826 Return a list of all indirect buffers whose base buffer is BUFFER. 801 Return a list of all indirect buffers whose base buffer is BUFFER.
827 If BUFFER is indirect, the return value will always be nil; see 802 If BUFFER is indirect, the return value will always be nil; see
1593 } 1568 }
1594 } 1569 }
1595 } 1570 }
1596 1571
1597 DEFUN ("set-buffer", Fset_buffer, 1, 1, 0, /* 1572 DEFUN ("set-buffer", Fset_buffer, 1, 1, 0, /*
1598 Make the buffer BUFNAME current for editing operations. 1573 Make the buffer BUFFER current for editing operations.
1599 BUFNAME may be a buffer or the name of an existing buffer. 1574 BUFFER may be a buffer or the name of an existing buffer.
1600 See also `save-excursion' when you want to make a buffer current temporarily. 1575 See also `save-excursion' when you want to make a buffer current temporarily.
1601 This function does not display the buffer, so its effect ends 1576 This function does not display the buffer, so its effect ends
1602 when the current command terminates. 1577 when the current command terminates.
1603 Use `switch-to-buffer' or `pop-to-buffer' to switch buffers permanently. 1578 Use `switch-to-buffer' or `pop-to-buffer' to switch buffers permanently.
1604 */ 1579 */
1605 (bufname)) 1580 (buffer))
1606 { 1581 {
1607 Lisp_Object buffer; 1582 buffer = get_buffer (buffer, 0);
1608 buffer = get_buffer (bufname, 0);
1609 if (NILP (buffer)) 1583 if (NILP (buffer))
1610 error ("Selecting deleted or non-existent buffer"); 1584 error ("Selecting deleted or non-existent buffer");
1611 set_buffer_internal (XBUFFER (buffer)); 1585 set_buffer_internal (XBUFFER (buffer));
1612 return buffer; 1586 return buffer;
1613 } 1587 }
1622 `read-only' property. (Extents that lie completely within the range, 1596 `read-only' property. (Extents that lie completely within the range,
1623 however, are not checked.) END defaults to the value of START. 1597 however, are not checked.) END defaults to the value of START.
1624 1598
1625 If START and END are equal, the range checked is [START, END] (i.e. 1599 If START and END are equal, the range checked is [START, END] (i.e.
1626 closed on both ends); otherwise, the range checked is (START, END) 1600 closed on both ends); otherwise, the range checked is (START, END)
1627 (open on both ends), except that extents that lie completely within 1601 \(open on both ends), except that extents that lie completely within
1628 [START, END] are not checked. See `extent-in-region-p' for a fuller 1602 [START, END] are not checked. See `extent-in-region-p' for a fuller
1629 discussion. 1603 discussion.
1630 */ 1604 */
1631 (buffer, start, end)) 1605 (buffer, start, end))
1632 { 1606 {
1727 b->last_window_start = 1; 1701 b->last_window_start = 1;
1728 1702
1729 /* Prevent warnings, or suspension of auto saving, that would happen 1703 /* Prevent warnings, or suspension of auto saving, that would happen
1730 if future size is less than past size. Use of erase-buffer 1704 if future size is less than past size. Use of erase-buffer
1731 implies that the future text is not really related to the past text. */ 1705 implies that the future text is not really related to the past text. */
1732 b->save_length = Qzero; 1706 b->saved_size = Qzero;
1733 1707
1734 zmacs_region_stays = 0; 1708 zmacs_region_stays = 0;
1735 return Qnil; 1709 return Qnil;
1736 } 1710 }
1737 1711
1782 int markers; 1756 int markers;
1783 int extents; 1757 int extents;
1784 int other; 1758 int other;
1785 }; 1759 };
1786 1760
1787 static int 1761 static size_t
1788 compute_buffer_text_usage (struct buffer *b, struct overhead_stats *ovstats) 1762 compute_buffer_text_usage (struct buffer *b, struct overhead_stats *ovstats)
1789 { 1763 {
1790 int malloc_use; 1764 int was_requested = b->text->z - 1;
1791 int was_requested; 1765 size_t gap = b->text->gap_size + b->text->end_gap_size;
1792 int gap; 1766 size_t malloc_use = malloced_storage_size (b->text->beg, was_requested + gap, 0);
1793 1767
1794 was_requested = b->text->z - 1; 1768 ovstats->gap_overhead += gap;
1795 gap = b->text->gap_size + b->text->end_gap_size; 1769 ovstats->was_requested += was_requested;
1796 malloc_use = malloced_storage_size (b->text->beg, was_requested + gap, 0);
1797 ovstats->gap_overhead += gap;
1798 ovstats->was_requested += was_requested;
1799 ovstats->malloc_overhead += malloc_use - (was_requested + gap); 1770 ovstats->malloc_overhead += malloc_use - (was_requested + gap);
1800 return malloc_use; 1771 return malloc_use;
1801 } 1772 }
1802 1773
1803 static void 1774 static void
1804 compute_buffer_usage (struct buffer *b, struct buffer_stats *stats, 1775 compute_buffer_usage (struct buffer *b, struct buffer_stats *stats,
1805 struct overhead_stats *ovstats) 1776 struct overhead_stats *ovstats)
1806 { 1777 {
1807 memset (stats, 0, sizeof (*stats)); 1778 xzero (*stats);
1808 stats->other += malloced_storage_size (b, sizeof (struct buffer), ovstats); 1779 stats->other += malloced_storage_size (b, sizeof (*b), ovstats);
1809 stats->text += compute_buffer_text_usage (b, ovstats); 1780 stats->text += compute_buffer_text_usage (b, ovstats);
1810 stats->markers += compute_buffer_marker_usage (b, ovstats); 1781 stats->markers += compute_buffer_marker_usage (b, ovstats);
1811 stats->extents += compute_buffer_extent_usage (b, ovstats); 1782 stats->extents += compute_buffer_extent_usage (b, ovstats);
1812 } 1783 }
1813 1784
1814 DEFUN ("buffer-memory-usage", Fbuffer_memory_usage, 1, 1, 0, /* 1785 DEFUN ("buffer-memory-usage", Fbuffer_memory_usage, 1, 1, 0, /*
1815 Return stats about the memory usage of buffer BUFFER. 1786 Return stats about the memory usage of buffer BUFFER.
1816 The values returned are in the form an alist of usage types and byte 1787 The values returned are in the form of an alist of usage types and byte
1817 counts. The byte counts attempt to encompass all the memory used 1788 counts. The byte counts attempt to encompass all the memory used
1818 by the buffer (separate from the memory logically associated with a 1789 by the buffer (separate from the memory logically associated with a
1819 buffer or frame), including internal structures and any malloc() 1790 buffer or frame), including internal structures and any malloc()
1820 overhead associated with them. In practice, the byte counts are 1791 overhead associated with them. In practice, the byte counts are
1821 underestimated because certain memory usage is very hard to determine 1792 underestimated because certain memory usage is very hard to determine
1822 (e.g. the amount of memory used inside the Xt library or inside the 1793 \(e.g. the amount of memory used inside the Xt library or inside the
1823 X server) and because there is other stuff that might logically 1794 X server) and because there is other stuff that might logically
1824 be associated with a window, buffer, or frame (e.g. window configurations, 1795 be associated with a window, buffer, or frame (e.g. window configurations,
1825 glyphs) but should not obviously be included in the usage counts. 1796 glyphs) but should not obviously be included in the usage counts.
1826 1797
1827 Multiple slices of the total memory usage may be returned, separated 1798 Multiple slices of the total memory usage may be returned, separated
1832 */ 1803 */
1833 (buffer)) 1804 (buffer))
1834 { 1805 {
1835 struct buffer_stats stats; 1806 struct buffer_stats stats;
1836 struct overhead_stats ovstats; 1807 struct overhead_stats ovstats;
1808 Lisp_Object val = Qnil;
1837 1809
1838 CHECK_BUFFER (buffer); /* dead buffers should be allowed, no? */ 1810 CHECK_BUFFER (buffer); /* dead buffers should be allowed, no? */
1839 memset (&ovstats, 0, sizeof (ovstats)); 1811 xzero (ovstats);
1840 compute_buffer_usage (XBUFFER (buffer), &stats, &ovstats); 1812 compute_buffer_usage (XBUFFER (buffer), &stats, &ovstats);
1841 1813
1842 return nconc2 (list4 (Fcons (Qtext, make_int (stats.text)), 1814 val = acons (Qtext, make_int (stats.text), val);
1843 Fcons (Qmarkers, make_int (stats.markers)), 1815 val = acons (Qmarkers, make_int (stats.markers), val);
1844 Fcons (Qextents, make_int (stats.extents)), 1816 val = acons (Qextents, make_int (stats.extents), val);
1845 Fcons (Qother, make_int (stats.other))), 1817 val = acons (Qother, make_int (stats.other), val);
1846 list5 (Qnil, 1818 val = Fcons (Qnil, val);
1847 Fcons (Qactually_requested, 1819 val = acons (Qactually_requested, make_int (ovstats.was_requested), val);
1848 make_int (ovstats.was_requested)), 1820 val = acons (Qmalloc_overhead, make_int (ovstats.malloc_overhead), val);
1849 Fcons (Qmalloc_overhead, 1821 val = acons (Qgap_overhead, make_int (ovstats.gap_overhead), val);
1850 make_int (ovstats.malloc_overhead)), 1822 val = acons (Qdynarr_overhead, make_int (ovstats.dynarr_overhead), val);
1851 Fcons (Qgap_overhead, 1823
1852 make_int (ovstats.malloc_overhead)), 1824 return Fnreverse (val);
1853 Fcons (Qdynarr_overhead,
1854 make_int (ovstats.dynarr_overhead))));
1855 } 1825 }
1856 1826
1857 #endif /* MEMORY_USAGE_STATS */ 1827 #endif /* MEMORY_USAGE_STATS */
1858 1828
1859 void 1829 void
2184 #ifdef MULE 2154 #ifdef MULE
2185 defs->mirror_downcase_table = Vmirror_ascii_downcase_table; 2155 defs->mirror_downcase_table = Vmirror_ascii_downcase_table;
2186 defs->mirror_upcase_table = Vmirror_ascii_upcase_table; 2156 defs->mirror_upcase_table = Vmirror_ascii_upcase_table;
2187 defs->mirror_case_canon_table = Vmirror_ascii_canon_table; 2157 defs->mirror_case_canon_table = Vmirror_ascii_canon_table;
2188 defs->mirror_case_eqv_table = Vmirror_ascii_eqv_table; 2158 defs->mirror_case_eqv_table = Vmirror_ascii_eqv_table;
2159 defs->category_table = Vstandard_category_table;
2189 #endif /* MULE */ 2160 #endif /* MULE */
2190 defs->syntax_table = Vstandard_syntax_table; 2161 defs->syntax_table = Vstandard_syntax_table;
2191 defs->mirror_syntax_table = 2162 defs->mirror_syntax_table =
2192 XCHAR_TABLE (Vstandard_syntax_table)->mirror_table; 2163 XCHAR_TABLE (Vstandard_syntax_table)->mirror_table;
2193 #ifdef MULE
2194 defs->category_table = Vstandard_category_table;
2195 #endif
2196 defs->modeline_format = build_string ("%-"); /* reset in loaddefs.el */ 2164 defs->modeline_format = build_string ("%-"); /* reset in loaddefs.el */
2197 defs->case_fold_search = Qt; 2165 defs->case_fold_search = Qt;
2198 defs->selective_display_ellipses = Qt; 2166 defs->selective_display_ellipses = Qt;
2199 defs->tab_width = make_int (8); 2167 defs->tab_width = make_int (8);
2200 defs->ctl_arrow = Qt; 2168 defs->ctl_arrow = Qt;
2201 defs->fill_column = make_int (70); 2169 defs->fill_column = make_int (70);
2202 defs->left_margin = Qzero; 2170 defs->left_margin = Qzero;
2203 defs->save_length = Qzero; /* lisp code wants int-or-nil */ 2171 defs->saved_size = Qzero; /* lisp code wants int-or-nil */
2204 defs->modtime = 0; 2172 defs->modtime = 0;
2205 defs->auto_save_modified = 0; 2173 defs->auto_save_modified = 0;
2206 defs->auto_save_failure_time = -1; 2174 defs->auto_save_failure_time = -1;
2207 defs->invisibility_spec = Qt; 2175 defs->invisibility_spec = Qt;
2208 2176
2231 2199
2232 nuke_all_buffer_slots (&buffer_local_flags, make_int (-2)); 2200 nuke_all_buffer_slots (&buffer_local_flags, make_int (-2));
2233 buffer_local_flags.filename = always_local_no_default; 2201 buffer_local_flags.filename = always_local_no_default;
2234 buffer_local_flags.directory = always_local_no_default; 2202 buffer_local_flags.directory = always_local_no_default;
2235 buffer_local_flags.backed_up = always_local_no_default; 2203 buffer_local_flags.backed_up = always_local_no_default;
2236 buffer_local_flags.save_length = always_local_no_default; 2204 buffer_local_flags.saved_size = always_local_no_default;
2237 buffer_local_flags.auto_save_file_name = always_local_no_default; 2205 buffer_local_flags.auto_save_file_name = always_local_no_default;
2238 buffer_local_flags.read_only = always_local_no_default; 2206 buffer_local_flags.read_only = always_local_no_default;
2239 2207
2240 buffer_local_flags.major_mode = always_local_resettable; 2208 buffer_local_flags.major_mode = always_local_resettable;
2241 buffer_local_flags.mode_name = always_local_resettable; 2209 buffer_local_flags.mode_name = always_local_resettable;
2581 Non-nil if this buffer's file has been backed up. 2549 Non-nil if this buffer's file has been backed up.
2582 Backing up is done before the first time the file is saved. 2550 Backing up is done before the first time the file is saved.
2583 Each buffer has its own value of this variable. 2551 Each buffer has its own value of this variable.
2584 */ ); 2552 */ );
2585 2553
2586 DEFVAR_BUFFER_LOCAL ("buffer-saved-size", save_length /* 2554 DEFVAR_BUFFER_LOCAL ("buffer-saved-size", saved_size /*
2587 Length of current buffer when last read in, saved or auto-saved. 2555 Length of current buffer when last read in, saved or auto-saved.
2588 0 initially. 2556 0 initially.
2589 Each buffer has its own value of this variable. 2557 Each buffer has its own value of this variable.
2590 */ ); 2558 */ );
2591 2559
2768 /* Check for DEFVAR_BUFFER_LOCAL without initializing the corresponding 2736 /* Check for DEFVAR_BUFFER_LOCAL without initializing the corresponding
2769 slot of buffer_local_flags and vice-versa. Must be done after all 2737 slot of buffer_local_flags and vice-versa. Must be done after all
2770 DEFVAR_BUFFER_LOCAL() calls. */ 2738 DEFVAR_BUFFER_LOCAL() calls. */
2771 #define MARKED_SLOT(slot) \ 2739 #define MARKED_SLOT(slot) \
2772 if ((XINT (buffer_local_flags.slot) != -2 && \ 2740 if ((XINT (buffer_local_flags.slot) != -2 && \
2773 XINT (buffer_local_flags.slot) != -3) \ 2741 XINT (buffer_local_flags.slot) != -3) \
2774 != !(NILP (XBUFFER (Vbuffer_local_symbols)->slot))) \ 2742 != !(NILP (XBUFFER (Vbuffer_local_symbols)->slot))) \
2775 abort () 2743 abort ()
2776 #include "bufslots.h" 2744 #include "bufslots.h"
2777 #undef MARKED_SLOT 2745 #undef MARKED_SLOT
2778 2746
2779 { 2747 {
2780 Lisp_Object scratch = 2748 Lisp_Object scratch = Fget_buffer_create (QSscratch);
2781 Fset_buffer (Fget_buffer_create (QSscratch)); 2749 Fset_buffer (scratch);
2782 /* Want no undo records for *scratch* until after Emacs is dumped */ 2750 /* Want no undo records for *scratch* until after Emacs is dumped */
2783 Fbuffer_disable_undo (scratch); 2751 Fbuffer_disable_undo (scratch);
2784 } 2752 }
2785 } 2753 }
2786 2754
2823 #ifdef DOS_NT 2791 #ifdef DOS_NT
2824 #define CORRECT_DIR_SEPS(s) \ 2792 #define CORRECT_DIR_SEPS(s) \
2825 do { if ('/' == DIRECTORY_SEP) dostounix_filename (s); \ 2793 do { if ('/' == DIRECTORY_SEP) dostounix_filename (s); \
2826 else unixtodos_filename (s); \ 2794 else unixtodos_filename (s); \
2827 } while (0) 2795 } while (0)
2828 2796
2829 CORRECT_DIR_SEPS(buf); 2797 CORRECT_DIR_SEPS(buf);
2830 #endif 2798 #endif
2831 current_buffer->directory = build_string (buf); 2799 current_buffer->directory = build_string (buf);
2832 2800
2833 #if 0 /* FSFmacs */ 2801 #if 0 /* FSFmacs */