Mercurial > hg > xemacs-beta
comparison src/buffer.c @ 185:3d6bfa290dbd r20-3b19
Import from CVS: tag r20-3b19
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:55:28 +0200 |
parents | e121b013d1f0 |
children | 850242ba4a81 |
comparison
equal
deleted
inserted
replaced
184:bcd2674570bf | 185:3d6bfa290dbd |
---|---|
559 } | 559 } |
560 | 560 |
561 static struct buffer * | 561 static struct buffer * |
562 allocate_buffer (void) | 562 allocate_buffer (void) |
563 { | 563 { |
564 struct buffer *b = alloc_lcrecord (sizeof (struct buffer), lrecord_buffer); | 564 struct buffer *b = alloc_lcrecord_type (struct buffer, lrecord_buffer); |
565 | 565 |
566 copy_lcrecord (b, XBUFFER (Vbuffer_defaults)); | 566 copy_lcrecord (b, XBUFFER (Vbuffer_defaults)); |
567 | 567 |
568 return b; | 568 return b; |
569 } | 569 } |
1426 return Qt; | 1426 return Qt; |
1427 } | 1427 } |
1428 | 1428 |
1429 DEFUN ("record-buffer", Frecord_buffer, 1, 1, 0, /* | 1429 DEFUN ("record-buffer", Frecord_buffer, 1, 1, 0, /* |
1430 Place buffer BUF first in the buffer order. | 1430 Place buffer BUF first in the buffer order. |
1431 Call this function when a buffer is selected \"visibly\". | 1431 Call this function when a buffer is selected "visibly". |
1432 | 1432 |
1433 This function changes the global buffer order and the per-frame buffer | 1433 This function changes the global buffer order and the per-frame buffer |
1434 order for the selected frame. The buffer order keeps track of recency | 1434 order for the selected frame. The buffer order keeps track of recency |
1435 of selection so that `other-buffer' will return a recently selected | 1435 of selection so that `other-buffer' will return a recently selected |
1436 buffer. See `other-buffer' for more information. | 1436 buffer. See `other-buffer' for more information. |
2092 /* Renamed from DEFVAR_PER_BUFFER because FSFmacs D_P_B takes | 2092 /* Renamed from DEFVAR_PER_BUFFER because FSFmacs D_P_B takes |
2093 * a bogus extra arg, which confuses an otherwise identical make-docfile.c */ | 2093 * a bogus extra arg, which confuses an otherwise identical make-docfile.c */ |
2094 /* Declaring this stuff as const produces 'Cannot reinitialize' messages | 2094 /* Declaring this stuff as const produces 'Cannot reinitialize' messages |
2095 from SunPro C's fix-and-continue feature (a way neato feature that | 2095 from SunPro C's fix-and-continue feature (a way neato feature that |
2096 makes debugging unbelievably more bearable) */ | 2096 makes debugging unbelievably more bearable) */ |
2097 #define DEFVAR_BUFFER_LOCAL(lname, field_name) \ | 2097 #define DEFVAR_BUFFER_LOCAL(lname, field_name) do { \ |
2098 do { static CONST_IF_NOT_DEBUG struct symbol_value_forward I_hate_C \ | 2098 static CONST_IF_NOT_DEBUG struct symbol_value_forward I_hate_C \ |
2099 = { { { { lrecord_symbol_value_forward }, \ | 2099 = { { { { lrecord_symbol_value_forward }, \ |
2100 (void *) &(buffer_local_flags.field_name), 69 }, \ | 2100 (struct lcrecord_header *) &(buffer_local_flags.field_name), 69 }, \ |
2101 SYMVAL_CURRENT_BUFFER_FORWARD }, 0 }; \ | 2101 SYMVAL_CURRENT_BUFFER_FORWARD }, 0 }; \ |
2102 defvar_buffer_local ((lname), &I_hate_C); \ | 2102 defvar_buffer_local ((lname), &I_hate_C); \ |
2103 } while (0) | 2103 } while (0) |
2104 | 2104 |
2105 #define DEFVAR_BUFFER_LOCAL_MAGIC(lname, field_name, magicfun) \ | 2105 #define DEFVAR_BUFFER_LOCAL_MAGIC(lname, field_name, magicfun) do { \ |
2106 do { static CONST_IF_NOT_DEBUG struct symbol_value_forward I_hate_C \ | 2106 static CONST_IF_NOT_DEBUG struct symbol_value_forward I_hate_C \ |
2107 = { { { { lrecord_symbol_value_forward }, \ | 2107 = { { { { lrecord_symbol_value_forward }, \ |
2108 (void *) &(buffer_local_flags.field_name), 69 }, \ | 2108 (struct lcrecord_header *) &(buffer_local_flags.field_name), 69 }, \ |
2109 SYMVAL_CURRENT_BUFFER_FORWARD }, magicfun }; \ | 2109 SYMVAL_CURRENT_BUFFER_FORWARD }, magicfun }; \ |
2110 defvar_buffer_local ((lname), &I_hate_C); \ | 2110 defvar_buffer_local ((lname), &I_hate_C); \ |
2111 } while (0) | 2111 } while (0) |
2112 | 2112 |
2113 #define DEFVAR_CONST_BUFFER_LOCAL(lname, field_name) \ | 2113 #define DEFVAR_CONST_BUFFER_LOCAL(lname, field_name) do { \ |
2114 do { static CONST_IF_NOT_DEBUG struct symbol_value_forward I_hate_C \ | 2114 static CONST_IF_NOT_DEBUG struct symbol_value_forward I_hate_C \ |
2115 = { { { { lrecord_symbol_value_forward }, \ | 2115 = { { { { lrecord_symbol_value_forward }, \ |
2116 (void *) &(buffer_local_flags.field_name), 69 }, \ | 2116 (struct lcrecord_header *) &(buffer_local_flags.field_name), 69 }, \ |
2117 SYMVAL_CONST_CURRENT_BUFFER_FORWARD }, 0 }; \ | 2117 SYMVAL_CONST_CURRENT_BUFFER_FORWARD }, 0 }; \ |
2118 defvar_buffer_local ((lname), &I_hate_C); \ | 2118 defvar_buffer_local ((lname), &I_hate_C); \ |
2119 } while (0) | 2119 } while (0) |
2120 | 2120 |
2121 #define DEFVAR_CONST_BUFFER_LOCAL_MAGIC(lname, field_name, magicfun) \ | 2121 #define DEFVAR_CONST_BUFFER_LOCAL_MAGIC(lname, field_name, magicfun) do{\ |
2122 do { static CONST_IF_NOT_DEBUG struct symbol_value_forward I_hate_C \ | 2122 static CONST_IF_NOT_DEBUG struct symbol_value_forward I_hate_C \ |
2123 = { { { { lrecord_symbol_value_forward }, \ | 2123 = { { { { lrecord_symbol_value_forward }, \ |
2124 (void *) &(buffer_local_flags.field_name), 69 }, \ | 2124 (struct lcrecord_header *) &(buffer_local_flags.field_name), 69 }, \ |
2125 SYMVAL_CONST_CURRENT_BUFFER_FORWARD }, magicfun }; \ | 2125 SYMVAL_CONST_CURRENT_BUFFER_FORWARD }, magicfun }; \ |
2126 defvar_buffer_local ((lname), &I_hate_C); \ | 2126 defvar_buffer_local ((lname), &I_hate_C); \ |
2127 } while (0) | 2127 } while (0) |
2128 | 2128 |
2129 static void | 2129 static void |
2130 defvar_buffer_local (CONST char *namestring, | 2130 defvar_buffer_local (CONST char *namestring, |
2139 = intern (namestring); | 2139 = intern (namestring); |
2140 } | 2140 } |
2141 | 2141 |
2142 /* DOC is ignored because it is snagged and recorded externally | 2142 /* DOC is ignored because it is snagged and recorded externally |
2143 * by make-docfile */ | 2143 * by make-docfile */ |
2144 #define DEFVAR_BUFFER_DEFAULTS(lname, field_name) \ | 2144 #define DEFVAR_BUFFER_DEFAULTS(lname, field_name) do { \ |
2145 do { static CONST_IF_NOT_DEBUG struct symbol_value_forward I_hate_C \ | 2145 static CONST_IF_NOT_DEBUG struct symbol_value_forward I_hate_C \ |
2146 = { { { { lrecord_symbol_value_forward }, \ | 2146 = { { { { lrecord_symbol_value_forward }, \ |
2147 (void *) &(buffer_local_flags.field_name), 69 }, \ | 2147 (struct lcrecord_header *) &(buffer_local_flags.field_name), 69 }, \ |
2148 SYMVAL_DEFAULT_BUFFER_FORWARD }, 0 }; \ | 2148 SYMVAL_DEFAULT_BUFFER_FORWARD }, 0 }; \ |
2149 defvar_mumble ((lname), &I_hate_C, sizeof (I_hate_C)); \ | 2149 defvar_mumble ((lname), &I_hate_C, sizeof (I_hate_C)); \ |
2150 } while (0) | 2150 } while (0) |
2151 | 2151 |
2152 #define DEFVAR_BUFFER_DEFAULTS_MAGIC(lname, field_name, magicfun) \ | 2152 #define DEFVAR_BUFFER_DEFAULTS_MAGIC(lname, field_name, magicfun) do { \ |
2153 do { static CONST_IF_NOT_DEBUG struct symbol_value_forward I_hate_C \ | 2153 static CONST_IF_NOT_DEBUG struct symbol_value_forward I_hate_C \ |
2154 = { { { { lrecord_symbol_value_forward }, \ | 2154 = { { { { lrecord_symbol_value_forward }, \ |
2155 (void *) &(buffer_local_flags.field_name), 69 }, \ | 2155 (struct lcrecord_header *) &(buffer_local_flags.field_name), 69 }, \ |
2156 SYMVAL_DEFAULT_BUFFER_FORWARD }, magicfun }; \ | 2156 SYMVAL_DEFAULT_BUFFER_FORWARD }, magicfun }; \ |
2157 defvar_mumble ((lname), &I_hate_C, sizeof (I_hate_C)); \ | 2157 defvar_mumble ((lname), &I_hate_C, sizeof (I_hate_C)); \ |
2158 } while (0) | 2158 } while (0) |
2159 | 2159 |
2160 static void | 2160 static void |
2161 nuke_all_buffer_slots (struct buffer *b, Lisp_Object zap) | 2161 nuke_all_buffer_slots (struct buffer *b, Lisp_Object zap) |
2169 | 2169 |
2170 void | 2170 void |
2171 complex_vars_of_buffer (void) | 2171 complex_vars_of_buffer (void) |
2172 { | 2172 { |
2173 /* Make sure all markable slots in buffer_defaults | 2173 /* Make sure all markable slots in buffer_defaults |
2174 are initialized reasonably, so mark_buffer won't choke. | 2174 are initialized reasonably, so mark_buffer won't choke. */ |
2175 */ | 2175 struct buffer *defs = alloc_lcrecord_type (struct buffer, lrecord_buffer); |
2176 struct buffer *defs = alloc_lcrecord (sizeof (struct buffer), | 2176 struct buffer *syms = alloc_lcrecord_type (struct buffer, lrecord_buffer); |
2177 lrecord_buffer); | |
2178 struct buffer *syms = alloc_lcrecord (sizeof (struct buffer), | |
2179 lrecord_buffer); | |
2180 | 2177 |
2181 staticpro (&Vbuffer_defaults); | 2178 staticpro (&Vbuffer_defaults); |
2182 staticpro (&Vbuffer_local_symbols); | 2179 staticpro (&Vbuffer_local_symbols); |
2183 XSETBUFFER (Vbuffer_defaults, defs); | 2180 XSETBUFFER (Vbuffer_defaults, defs); |
2184 XSETBUFFER (Vbuffer_local_symbols, syms); | 2181 XSETBUFFER (Vbuffer_local_symbols, syms); |
2187 nuke_all_buffer_slots (defs, Qnil); | 2184 nuke_all_buffer_slots (defs, Qnil); |
2188 defs->text = &defs->own_text; | 2185 defs->text = &defs->own_text; |
2189 syms->text = &syms->own_text; | 2186 syms->text = &syms->own_text; |
2190 | 2187 |
2191 /* Set up the non-nil default values of various buffer slots. | 2188 /* Set up the non-nil default values of various buffer slots. |
2192 Must do these before making the first buffer. | 2189 Must do these before making the first buffer. */ |
2193 */ | |
2194 defs->major_mode = Qfundamental_mode; | 2190 defs->major_mode = Qfundamental_mode; |
2195 defs->mode_name = QSFundamental; | 2191 defs->mode_name = QSFundamental; |
2196 defs->abbrev_table = Qnil; /* real default setup by Lisp code */ | 2192 defs->abbrev_table = Qnil; /* real default setup by Lisp code */ |
2197 defs->downcase_table = Vascii_downcase_table; | 2193 defs->downcase_table = Vascii_downcase_table; |
2198 defs->upcase_table = Vascii_upcase_table; | 2194 defs->upcase_table = Vascii_upcase_table; |
2529 standard (and highly portable) fashion and use standard escape | 2525 standard (and highly portable) fashion and use standard escape |
2530 sequences for other charsets. Another reasonable choice is | 2526 sequences for other charsets. Another reasonable choice is |
2531 `escape-quoted', which is equivalent to `iso-2022-8' but prefixes | 2527 `escape-quoted', which is equivalent to `iso-2022-8' but prefixes |
2532 certain control characters with ESC to make sure they are not | 2528 certain control characters with ESC to make sure they are not |
2533 interpreted as escape sequences when read in. This latter coding | 2529 interpreted as escape sequences when read in. This latter coding |
2534 system results in more \"correct\" output in the presence of control | 2530 system results in more "correct" output in the presence of control |
2535 characters in the buffer, in the sense that when read in again using | 2531 characters in the buffer, in the sense that when read in again using |
2536 the same coding system, the result will virtually always match the | 2532 the same coding system, the result will virtually always match the |
2537 original contents of the buffer, which is not the case with | 2533 original contents of the buffer, which is not the case with |
2538 `iso-2022-8'; but the output is less portable when dealing with binary | 2534 `iso-2022-8'; but the output is less portable when dealing with binary |
2539 data -- there may be stray ESC characters when the file is read by | 2535 data -- there may be stray ESC characters when the file is read by |
2656 An entry (TEXT . POSITION) represents the deletion of the string TEXT | 2652 An entry (TEXT . POSITION) represents the deletion of the string TEXT |
2657 from (abs POSITION). If POSITION is positive, point was at the front | 2653 from (abs POSITION). If POSITION is positive, point was at the front |
2658 of the text being deleted; if negative, point was at the end. | 2654 of the text being deleted; if negative, point was at the end. |
2659 | 2655 |
2660 An entry (t HIGH . LOW) indicates that the buffer previously had | 2656 An entry (t HIGH . LOW) indicates that the buffer previously had |
2661 \"unmodified\" status. HIGH and LOW are the high and low 16-bit portions | 2657 "unmodified" status. HIGH and LOW are the high and low 16-bit portions |
2662 of the visited file's modification time, as of that time. If the | 2658 of the visited file's modification time, as of that time. If the |
2663 modification time of the most recent save is different, this entry is | 2659 modification time of the most recent save is different, this entry is |
2664 obsolete. | 2660 obsolete. |
2665 | 2661 |
2666 An entry of the form EXTENT indicates that EXTENT was attached in | 2662 An entry of the form EXTENT indicates that EXTENT was attached in |
2737 property is an element in that list. | 2733 property is an element in that list. |
2738 If an element is a cons cell of the form (PROP . ELLIPSIS), | 2734 If an element is a cons cell of the form (PROP . ELLIPSIS), |
2739 then characters with property value PROP are invisible, | 2735 then characters with property value PROP are invisible, |
2740 and they have an ellipsis as well if ELLIPSIS is non-nil. | 2736 and they have an ellipsis as well if ELLIPSIS is non-nil. |
2741 Note that the actual characters used for the ellipsis are controllable | 2737 Note that the actual characters used for the ellipsis are controllable |
2742 using `invisible-text-glyph', and default to \"...\". | 2738 using `invisible-text-glyph', and default to "...". |
2743 */, redisplay_variable_changed); | 2739 */, redisplay_variable_changed); |
2744 | 2740 |
2745 DEFVAR_CONST_BUFFER_LOCAL ("generated-modeline-string", | 2741 DEFVAR_CONST_BUFFER_LOCAL ("generated-modeline-string", |
2746 generated_modeline_string /* | 2742 generated_modeline_string /* |
2747 String of characters in this buffer's modeline as of the last redisplay. | 2743 String of characters in this buffer's modeline as of the last redisplay. |