Mercurial > emacs
comparison src/buffer.c @ 9296:a1a7fc21ded9
(reset_buffer, Ferase_buffer, validate_region, list_buffers_1, recenter_overlay_lists, init_buffer_once): Don't use XFASTINT as an lvalue.
| author | Karl Heuer <kwzh@gnu.org> |
|---|---|
| date | Tue, 04 Oct 1994 15:36:45 +0000 |
| parents | 582534b6e763 |
| children | 8cf58b38d244 |
comparison
equal
deleted
inserted
replaced
| 9295:17d393a8eed6 | 9296:a1a7fc21ded9 |
|---|---|
| 302 { | 302 { |
| 303 b->filename = Qnil; | 303 b->filename = Qnil; |
| 304 b->directory = (current_buffer) ? current_buffer->directory : Qnil; | 304 b->directory = (current_buffer) ? current_buffer->directory : Qnil; |
| 305 b->modtime = 0; | 305 b->modtime = 0; |
| 306 b->save_modified = 1; | 306 b->save_modified = 1; |
| 307 XFASTINT (b->save_length) = 0; | 307 XSETFASTINT (b->save_length, 0); |
| 308 b->last_window_start = 1; | 308 b->last_window_start = 1; |
| 309 b->backed_up = Qnil; | 309 b->backed_up = Qnil; |
| 310 b->auto_save_modified = 0; | 310 b->auto_save_modified = 0; |
| 311 b->auto_save_failure_time = -1; | 311 b->auto_save_failure_time = -1; |
| 312 b->auto_save_file_name = Qnil; | 312 b->auto_save_file_name = Qnil; |
| 313 b->read_only = Qnil; | 313 b->read_only = Qnil; |
| 314 b->overlays_before = Qnil; | 314 b->overlays_before = Qnil; |
| 315 b->overlays_after = Qnil; | 315 b->overlays_after = Qnil; |
| 316 XFASTINT (b->overlay_center) = 1; | 316 XSETFASTINT (b->overlay_center, 1); |
| 317 b->mark_active = Qnil; | 317 b->mark_active = Qnil; |
| 318 | 318 |
| 319 /* Only defined if Emacs is compiled with USE_TEXT_PROPERTIES */ | 319 /* Only defined if Emacs is compiled with USE_TEXT_PROPERTIES */ |
| 320 INITIALIZE_INTERVAL (b, NULL_INTERVAL); | 320 INITIALIZE_INTERVAL (b, NULL_INTERVAL); |
| 321 } | 321 } |
| 1070 del_range (BEG, Z); | 1070 del_range (BEG, Z); |
| 1071 current_buffer->last_window_start = 1; | 1071 current_buffer->last_window_start = 1; |
| 1072 /* Prevent warnings, or suspension of auto saving, that would happen | 1072 /* Prevent warnings, or suspension of auto saving, that would happen |
| 1073 if future size is less than past size. Use of erase-buffer | 1073 if future size is less than past size. Use of erase-buffer |
| 1074 implies that the future text is not really related to the past text. */ | 1074 implies that the future text is not really related to the past text. */ |
| 1075 XFASTINT (current_buffer->save_length) = 0; | 1075 XSETFASTINT (current_buffer->save_length, 0); |
| 1076 return Qnil; | 1076 return Qnil; |
| 1077 } | 1077 } |
| 1078 | 1078 |
| 1079 validate_region (b, e) | 1079 validate_region (b, e) |
| 1080 register Lisp_Object *b, *e; | 1080 register Lisp_Object *b, *e; |
| 1086 | 1086 |
| 1087 if (XINT (*b) > XINT (*e)) | 1087 if (XINT (*b) > XINT (*e)) |
| 1088 { | 1088 { |
| 1089 i = XFASTINT (*b); /* This is legit even if *b is < 0 */ | 1089 i = XFASTINT (*b); /* This is legit even if *b is < 0 */ |
| 1090 *b = *e; | 1090 *b = *e; |
| 1091 XFASTINT (*e) = i; /* because this is all we do with i. */ | 1091 XSETFASTINT (*e, i); /* because this is all we do with i. */ |
| 1092 } | 1092 } |
| 1093 | 1093 |
| 1094 if (!(BEGV <= XINT (*b) && XINT (*b) <= XINT (*e) | 1094 if (!(BEGV <= XINT (*b) && XINT (*b) <= XINT (*e) |
| 1095 && XINT (*e) <= ZV)) | 1095 && XINT (*e) <= ZV)) |
| 1096 args_out_of_range (*b, *e); | 1096 args_out_of_range (*b, *e); |
| 1107 Lisp_Object other_file_symbol; | 1107 Lisp_Object other_file_symbol; |
| 1108 | 1108 |
| 1109 desired_point = Qnil; | 1109 desired_point = Qnil; |
| 1110 other_file_symbol = intern ("list-buffers-directory"); | 1110 other_file_symbol = intern ("list-buffers-directory"); |
| 1111 | 1111 |
| 1112 XFASTINT (col1) = 19; | 1112 XSETFASTINT (col1, 19); |
| 1113 XFASTINT (col2) = 26; | 1113 XSETFASTINT (col2, 26); |
| 1114 XFASTINT (col3) = 40; | 1114 XSETFASTINT (col3, 40); |
| 1115 XFASTINT (minspace) = 1; | 1115 XSETFASTINT (minspace, 1); |
| 1116 | 1116 |
| 1117 Fset_buffer (Vstandard_output); | 1117 Fset_buffer (Vstandard_output); |
| 1118 Fbuffer_disable_undo (Vstandard_output); | 1118 Fbuffer_disable_undo (Vstandard_output); |
| 1119 current_buffer->read_only = Qnil; | 1119 current_buffer->read_only = Qnil; |
| 1120 | 1120 |
| 1132 /* Optionally don't mention buffers that lack files. */ | 1132 /* Optionally don't mention buffers that lack files. */ |
| 1133 if (!NILP (files) && NILP (b->filename)) | 1133 if (!NILP (files) && NILP (b->filename)) |
| 1134 continue; | 1134 continue; |
| 1135 /* Identify the current buffer. */ | 1135 /* Identify the current buffer. */ |
| 1136 if (b == old) | 1136 if (b == old) |
| 1137 XFASTINT (desired_point) = point; | 1137 XSETFASTINT (desired_point, point); |
| 1138 write_string (b == old ? "." : " ", -1); | 1138 write_string (b == old ? "." : " ", -1); |
| 1139 /* Identify modified buffers */ | 1139 /* Identify modified buffers */ |
| 1140 write_string (BUF_MODIFF (b) > b->save_modified ? "*" : " ", -1); | 1140 write_string (BUF_MODIFF (b) > b->save_modified ? "*" : " ", -1); |
| 1141 write_string (NILP (b->read_only) ? " " : "% ", -1); | 1141 write_string (NILP (b->read_only) ? " " : "% ", -1); |
| 1142 Fprinc (b->name, Qnil); | 1142 Fprinc (b->name, Qnil); |
| 1143 Findent_to (col1, make_number (2)); | 1143 Findent_to (col1, make_number (2)); |
| 1144 XFASTINT (tem) = BUF_Z (b) - BUF_BEG (b); | 1144 XSETFASTINT (tem, BUF_Z (b) - BUF_BEG (b)); |
| 1145 Fprin1 (tem, Qnil); | 1145 Fprin1 (tem, Qnil); |
| 1146 Findent_to (col2, minspace); | 1146 Findent_to (col2, minspace); |
| 1147 Fprinc (b->mode_name, Qnil); | 1147 Fprinc (b->mode_name, Qnil); |
| 1148 Findent_to (col3, minspace); | 1148 Findent_to (col3, minspace); |
| 1149 | 1149 |
| 1655 buf->overlays_before = tail; | 1655 buf->overlays_before = tail; |
| 1656 tail = prev; | 1656 tail = prev; |
| 1657 } | 1657 } |
| 1658 } | 1658 } |
| 1659 | 1659 |
| 1660 XFASTINT (buf->overlay_center) = pos; | 1660 XSETFASTINT (buf->overlay_center, pos); |
| 1661 } | 1661 } |
| 1662 | 1662 |
| 1663 /* Fix up overlays that were garbled as a result of permuting markers | 1663 /* Fix up overlays that were garbled as a result of permuting markers |
| 1664 in the range START through END. Any overlay with at least one | 1664 in the range START through END. Any overlay with at least one |
| 1665 endpoint in this range will need to be unlinked from the overlay | 1665 endpoint in this range will need to be unlinked from the overlay |
| 2465 buffer_defaults.display_table = Qnil; | 2465 buffer_defaults.display_table = Qnil; |
| 2466 buffer_defaults.undo_list = Qnil; | 2466 buffer_defaults.undo_list = Qnil; |
| 2467 buffer_defaults.mark_active = Qnil; | 2467 buffer_defaults.mark_active = Qnil; |
| 2468 buffer_defaults.overlays_before = Qnil; | 2468 buffer_defaults.overlays_before = Qnil; |
| 2469 buffer_defaults.overlays_after = Qnil; | 2469 buffer_defaults.overlays_after = Qnil; |
| 2470 XFASTINT (buffer_defaults.overlay_center) = 1; | 2470 XSETFASTINT (buffer_defaults.overlay_center, 1); |
| 2471 | 2471 |
| 2472 XFASTINT (buffer_defaults.tab_width) = 8; | 2472 XSETFASTINT (buffer_defaults.tab_width, 8); |
| 2473 buffer_defaults.truncate_lines = Qnil; | 2473 buffer_defaults.truncate_lines = Qnil; |
| 2474 buffer_defaults.ctl_arrow = Qt; | 2474 buffer_defaults.ctl_arrow = Qt; |
| 2475 | 2475 |
| 2476 #ifdef MSDOS | 2476 #ifdef MSDOS |
| 2477 buffer_defaults.buffer_file_type = Qnil; /* TEXT */ | 2477 buffer_defaults.buffer_file_type = Qnil; /* TEXT */ |
| 2478 #endif | 2478 #endif |
| 2479 XFASTINT (buffer_defaults.fill_column) = 70; | 2479 XSETFASTINT (buffer_defaults.fill_column, 70); |
| 2480 XFASTINT (buffer_defaults.left_margin) = 0; | 2480 XSETFASTINT (buffer_defaults.left_margin, 0); |
| 2481 | 2481 |
| 2482 /* Assign the local-flags to the slots that have default values. | 2482 /* Assign the local-flags to the slots that have default values. |
| 2483 The local flag is a bit that is used in the buffer | 2483 The local flag is a bit that is used in the buffer |
| 2484 to say that it has its own local value for the slot. | 2484 to say that it has its own local value for the slot. |
| 2485 The local flag bits are in the local_var_flags slot of the buffer. */ | 2485 The local flag bits are in the local_var_flags slot of the buffer. */ |
| 2487 /* Nothing can work if this isn't true */ | 2487 /* Nothing can work if this isn't true */ |
| 2488 if (sizeof (EMACS_INT) != sizeof (Lisp_Object)) abort (); | 2488 if (sizeof (EMACS_INT) != sizeof (Lisp_Object)) abort (); |
| 2489 | 2489 |
| 2490 /* 0 means not a lisp var, -1 means always local, else mask */ | 2490 /* 0 means not a lisp var, -1 means always local, else mask */ |
| 2491 bzero (&buffer_local_flags, sizeof buffer_local_flags); | 2491 bzero (&buffer_local_flags, sizeof buffer_local_flags); |
| 2492 XFASTINT (buffer_local_flags.filename) = -1; | 2492 XSETFASTINT (buffer_local_flags.filename, -1); |
| 2493 XFASTINT (buffer_local_flags.directory) = -1; | 2493 XSETFASTINT (buffer_local_flags.directory, -1); |
| 2494 XFASTINT (buffer_local_flags.backed_up) = -1; | 2494 XSETFASTINT (buffer_local_flags.backed_up, -1); |
| 2495 XFASTINT (buffer_local_flags.save_length) = -1; | 2495 XSETFASTINT (buffer_local_flags.save_length, -1); |
| 2496 XFASTINT (buffer_local_flags.auto_save_file_name) = -1; | 2496 XSETFASTINT (buffer_local_flags.auto_save_file_name, -1); |
| 2497 XFASTINT (buffer_local_flags.read_only) = -1; | 2497 XSETFASTINT (buffer_local_flags.read_only, -1); |
| 2498 XFASTINT (buffer_local_flags.major_mode) = -1; | 2498 XSETFASTINT (buffer_local_flags.major_mode, -1); |
| 2499 XFASTINT (buffer_local_flags.mode_name) = -1; | 2499 XSETFASTINT (buffer_local_flags.mode_name, -1); |
| 2500 XFASTINT (buffer_local_flags.undo_list) = -1; | 2500 XSETFASTINT (buffer_local_flags.undo_list, -1); |
| 2501 XFASTINT (buffer_local_flags.mark_active) = -1; | 2501 XSETFASTINT (buffer_local_flags.mark_active, -1); |
| 2502 | 2502 |
| 2503 XFASTINT (buffer_local_flags.mode_line_format) = 1; | 2503 XSETFASTINT (buffer_local_flags.mode_line_format, 1); |
| 2504 XFASTINT (buffer_local_flags.abbrev_mode) = 2; | 2504 XSETFASTINT (buffer_local_flags.abbrev_mode, 2); |
| 2505 XFASTINT (buffer_local_flags.overwrite_mode) = 4; | 2505 XSETFASTINT (buffer_local_flags.overwrite_mode, 4); |
| 2506 XFASTINT (buffer_local_flags.case_fold_search) = 8; | 2506 XSETFASTINT (buffer_local_flags.case_fold_search, 8); |
| 2507 XFASTINT (buffer_local_flags.auto_fill_function) = 0x10; | 2507 XSETFASTINT (buffer_local_flags.auto_fill_function, 0x10); |
| 2508 XFASTINT (buffer_local_flags.selective_display) = 0x20; | 2508 XSETFASTINT (buffer_local_flags.selective_display, 0x20); |
| 2509 #ifndef old | 2509 #ifndef old |
| 2510 XFASTINT (buffer_local_flags.selective_display_ellipses) = 0x40; | 2510 XSETFASTINT (buffer_local_flags.selective_display_ellipses, 0x40); |
| 2511 #endif | 2511 #endif |
| 2512 XFASTINT (buffer_local_flags.tab_width) = 0x80; | 2512 XSETFASTINT (buffer_local_flags.tab_width, 0x80); |
| 2513 XFASTINT (buffer_local_flags.truncate_lines) = 0x100; | 2513 XSETFASTINT (buffer_local_flags.truncate_lines, 0x100); |
| 2514 XFASTINT (buffer_local_flags.ctl_arrow) = 0x200; | 2514 XSETFASTINT (buffer_local_flags.ctl_arrow, 0x200); |
| 2515 XFASTINT (buffer_local_flags.fill_column) = 0x400; | 2515 XSETFASTINT (buffer_local_flags.fill_column, 0x400); |
| 2516 XFASTINT (buffer_local_flags.left_margin) = 0x800; | 2516 XSETFASTINT (buffer_local_flags.left_margin, 0x800); |
| 2517 XFASTINT (buffer_local_flags.abbrev_table) = 0x1000; | 2517 XSETFASTINT (buffer_local_flags.abbrev_table, 0x1000); |
| 2518 XFASTINT (buffer_local_flags.display_table) = 0x2000; | 2518 XSETFASTINT (buffer_local_flags.display_table, 0x2000); |
| 2519 XFASTINT (buffer_local_flags.syntax_table) = 0x8000; | 2519 XSETFASTINT (buffer_local_flags.syntax_table, 0x8000); |
| 2520 #ifdef MSDOS | 2520 #ifdef MSDOS |
| 2521 XFASTINT (buffer_local_flags.buffer_file_type) = 0x4000; | 2521 XSETFASTINT (buffer_local_flags.buffer_file_type, 0x4000); |
| 2522 #endif | 2522 #endif |
| 2523 | 2523 |
| 2524 Vbuffer_alist = Qnil; | 2524 Vbuffer_alist = Qnil; |
| 2525 current_buffer = 0; | 2525 current_buffer = 0; |
| 2526 all_buffers = 0; | 2526 all_buffers = 0; |
