Mercurial > emacs
comparison src/buffer.c @ 47972:287494c5e770
(assoc_ignore_text_properties, Fother_buffer, Fkill_buffer)
(call_overlay_mod_hooks): Use CONSP and XCAR/XCDR.
(Fget_buffer_create, advance_to_char_boundary): Use BEG and BEG_BYTE;
| author | Stefan Monnier <monnier@iro.umontreal.ca> |
|---|---|
| date | Tue, 22 Oct 2002 18:57:19 +0000 |
| parents | a92cb918558c |
| children | b7e13d33cf41 |
comparison
equal
deleted
inserted
replaced
| 47971:526a8d279adb | 47972:287494c5e770 |
|---|---|
| 247 assoc_ignore_text_properties (key, list) | 247 assoc_ignore_text_properties (key, list) |
| 248 register Lisp_Object key; | 248 register Lisp_Object key; |
| 249 Lisp_Object list; | 249 Lisp_Object list; |
| 250 { | 250 { |
| 251 register Lisp_Object tail; | 251 register Lisp_Object tail; |
| 252 for (tail = list; !NILP (tail); tail = Fcdr (tail)) | 252 for (tail = list; CONSP (tail); tail = XCDR (tail)) |
| 253 { | 253 { |
| 254 register Lisp_Object elt, tem; | 254 register Lisp_Object elt, tem; |
| 255 elt = Fcar (tail); | 255 elt = XCAR (tail); |
| 256 tem = Fstring_equal (Fcar (elt), key); | 256 tem = Fstring_equal (Fcar (elt), key); |
| 257 if (!NILP (tem)) | 257 if (!NILP (tem)) |
| 258 return elt; | 258 return elt; |
| 259 } | 259 } |
| 260 return Qnil; | 260 return Qnil; |
| 361 alloc_buffer_text (b, BUF_GAP_SIZE (b) + 1); | 361 alloc_buffer_text (b, BUF_GAP_SIZE (b) + 1); |
| 362 UNBLOCK_INPUT; | 362 UNBLOCK_INPUT; |
| 363 if (! BUF_BEG_ADDR (b)) | 363 if (! BUF_BEG_ADDR (b)) |
| 364 buffer_memory_full (); | 364 buffer_memory_full (); |
| 365 | 365 |
| 366 BUF_PT (b) = 1; | 366 BUF_PT (b) = BEG; |
| 367 BUF_GPT (b) = 1; | 367 BUF_GPT (b) = BEG; |
| 368 BUF_BEGV (b) = 1; | 368 BUF_BEGV (b) = BEG; |
| 369 BUF_ZV (b) = 1; | 369 BUF_ZV (b) = BEG; |
| 370 BUF_Z (b) = 1; | 370 BUF_Z (b) = BEG; |
| 371 BUF_PT_BYTE (b) = 1; | 371 BUF_PT_BYTE (b) = BEG_BYTE; |
| 372 BUF_GPT_BYTE (b) = 1; | 372 BUF_GPT_BYTE (b) = BEG_BYTE; |
| 373 BUF_BEGV_BYTE (b) = 1; | 373 BUF_BEGV_BYTE (b) = BEG_BYTE; |
| 374 BUF_ZV_BYTE (b) = 1; | 374 BUF_ZV_BYTE (b) = BEG_BYTE; |
| 375 BUF_Z_BYTE (b) = 1; | 375 BUF_Z_BYTE (b) = BEG_BYTE; |
| 376 BUF_MODIFF (b) = 1; | 376 BUF_MODIFF (b) = 1; |
| 377 BUF_OVERLAY_MODIFF (b) = 1; | 377 BUF_OVERLAY_MODIFF (b) = 1; |
| 378 BUF_SAVE_MODIFF (b) = 1; | 378 BUF_SAVE_MODIFF (b) = 1; |
| 379 BUF_INTERVALS (b) = 0; | 379 BUF_INTERVALS (b) = 0; |
| 380 BUF_UNCHANGED_MODIFIED (b) = 1; | 380 BUF_UNCHANGED_MODIFIED (b) = 1; |
| 1153 add_ons = Fcons (Fcons (Qnil, XCAR (tem)), add_ons); | 1153 add_ons = Fcons (Fcons (Qnil, XCAR (tem)), add_ons); |
| 1154 tem = XCDR (tem); | 1154 tem = XCDR (tem); |
| 1155 } | 1155 } |
| 1156 tail = nconc2 (Fnreverse (add_ons), tail); | 1156 tail = nconc2 (Fnreverse (add_ons), tail); |
| 1157 | 1157 |
| 1158 for (; !NILP (tail); tail = Fcdr (tail)) | 1158 for (; CONSP (tail); tail = XCDR (tail)) |
| 1159 { | 1159 { |
| 1160 buf = Fcdr (Fcar (tail)); | 1160 buf = Fcdr (XCAR (tail)); |
| 1161 if (EQ (buf, buffer)) | 1161 if (EQ (buf, buffer)) |
| 1162 continue; | 1162 continue; |
| 1163 if (SREF (XBUFFER (buf)->name, 0) == ' ') | 1163 if (SREF (XBUFFER (buf)->name, 0) == ' ') |
| 1164 continue; | 1164 continue; |
| 1165 /* If the selected frame has a buffer_predicate, | 1165 /* If the selected frame has a buffer_predicate, |
| 1300 record_unwind_protect (save_excursion_restore, save_excursion_save ()); | 1300 record_unwind_protect (save_excursion_restore, save_excursion_save ()); |
| 1301 set_buffer_internal (b); | 1301 set_buffer_internal (b); |
| 1302 | 1302 |
| 1303 /* First run the query functions; if any query is answered no, | 1303 /* First run the query functions; if any query is answered no, |
| 1304 don't kill the buffer. */ | 1304 don't kill the buffer. */ |
| 1305 for (list = Vkill_buffer_query_functions; !NILP (list); list = Fcdr (list)) | 1305 for (list = Vkill_buffer_query_functions; CONSP (list); list = XCDR (list)) |
| 1306 { | 1306 { |
| 1307 tem = call0 (Fcar (list)); | 1307 tem = call0 (XCAR (list)); |
| 1308 if (NILP (tem)) | 1308 if (NILP (tem)) |
| 1309 return unbind_to (count, Qnil); | 1309 return unbind_to (count, Qnil); |
| 1310 } | 1310 } |
| 1311 | 1311 |
| 1312 /* Then run the hooks. */ | 1312 /* Then run the hooks. */ |
| 2002 { | 2002 { |
| 2003 int c; | 2003 int c; |
| 2004 | 2004 |
| 2005 if (byte_pos == BEG) | 2005 if (byte_pos == BEG) |
| 2006 /* Beginning of buffer is always a character boundary. */ | 2006 /* Beginning of buffer is always a character boundary. */ |
| 2007 return 1; | 2007 return BEG; |
| 2008 | 2008 |
| 2009 c = FETCH_BYTE (byte_pos); | 2009 c = FETCH_BYTE (byte_pos); |
| 2010 if (! CHAR_HEAD_P (c)) | 2010 if (! CHAR_HEAD_P (c)) |
| 2011 { | 2011 { |
| 2012 /* We should advance BYTE_POS only when C is a constituent of a | 2012 /* We should advance BYTE_POS only when C is a constituent of a |
| 4207 | 4207 |
| 4208 GCPRO4 (list, arg1, arg2, arg3); | 4208 GCPRO4 (list, arg1, arg2, arg3); |
| 4209 if (! after) | 4209 if (! after) |
| 4210 add_overlay_mod_hooklist (list, overlay); | 4210 add_overlay_mod_hooklist (list, overlay); |
| 4211 | 4211 |
| 4212 while (!NILP (list)) | 4212 while (CONSP (list)) |
| 4213 { | 4213 { |
| 4214 if (NILP (arg3)) | 4214 if (NILP (arg3)) |
| 4215 call4 (Fcar (list), overlay, after ? Qt : Qnil, arg1, arg2); | 4215 call4 (XCAR (list), overlay, after ? Qt : Qnil, arg1, arg2); |
| 4216 else | 4216 else |
| 4217 call5 (Fcar (list), overlay, after ? Qt : Qnil, arg1, arg2, arg3); | 4217 call5 (XCAR (list), overlay, after ? Qt : Qnil, arg1, arg2, arg3); |
| 4218 list = Fcdr (list); | 4218 list = XCDR (list); |
| 4219 } | 4219 } |
| 4220 UNGCPRO; | 4220 UNGCPRO; |
| 4221 } | 4221 } |
| 4222 | 4222 |
| 4223 /* Delete any zero-sized overlays at position POS, if the `evaporate' | 4223 /* Delete any zero-sized overlays at position POS, if the `evaporate' |
