aboutsummaryrefslogtreecommitdiffstats
path: root/src/fileio.c
diff options
context:
space:
mode:
authorTom Tromey2011-02-14 08:39:19 -0700
committerTom Tromey2011-02-14 08:39:19 -0700
commit5d8ea1203d1e659bc77d953784a85a6e7da0ce95 (patch)
tree1da71b86f9592b2f3390f0cd4d30ce41e74fbb55 /src/fileio.c
parent42f6055717e74ea9541c5cf6fd0fc6501bd907fd (diff)
downloademacs-5d8ea1203d1e659bc77d953784a85a6e7da0ce95.tar.gz
emacs-5d8ea1203d1e659bc77d953784a85a6e7da0ce95.zip
Hide implementation of `struct buffer'
* composite.c (fill_gstring_header) (composition_compute_stop_pos, composition_adjust_point) (Ffind_composition_internal): Use B_. * intervals.c (set_point_both, get_local_map): Use B_. * callproc.c (Fcall_process, Fcall_process_region): Use B_. * process.c (get_process, list_processes_1, Fstart_process) (Fmake_serial_process, Fmake_network_process) (read_process_output, send_process, exec_sentinel) (status_notify, setup_process_coding_systems): Use B_. * bytecode.c (Fbyte_code): Use B_. * syntax.c (update_syntax_table, dec_bytepos, Fsyntax_table) (Fset_syntax_table, Fmodify_syntax_entry, skip_chars) (skip_syntaxes, scan_lists): Use B_. * lread.c (readchar, unreadchar, openp, readevalloop) (Feval_buffer, Feval_region): Use B_. * print.c (printchar, strout, print_string, PRINTDECLARE) (PRINTPREPARE, PRINTFINISH, temp_output_buffer_setup) (print_object): Use B_. * font.c (font_at): Use B_. * fns.c (Fbase64_encode_region, Fbase64_decode_region, Fmd5): Use B_. * callint.c (check_mark, Fcall_interactively): Use B_. * editfns.c (region_limit, Fmark_marker, save_excursion_save) (save_excursion_restore, Fprevious_char, Fchar_before) (general_insert_function, Finsert_char, Finsert_byte) (make_buffer_string_both, Finsert_buffer_substring) (Fcompare_buffer_substrings, subst_char_in_region_unwind) (subst_char_in_region_unwind_1, Fsubst_char_in_region) (Ftranslate_region_internal, save_restriction_restore) (Fchar_equal): Use B_. * data.c (swap_in_symval_forwarding, set_internal) (Fmake_local_variable, Fkill_local_variable, Flocal_variable_p): Use B_. * undo.c (record_point, record_insert, record_delete) (record_marker_adjustment, record_first_change) (record_property_change, Fundo_boundary, truncate_undo_list) (Fprimitive_undo): Use B_. * search.c (compile_pattern_1, compile_pattern, looking_at_1) (string_match_1, fast_looking_at, newline_cache_on_off) (search_command, search_buffer, simple_search, boyer_moore) (Freplace_match): Use B_. * indent.c (buffer_display_table, recompute_width_table) (width_run_cache_on_off, current_column, scan_for_column) (Findent_to, position_indentation, compute_motion, vmotion): Use B_. * casefiddle.c (casify_object, casify_region): Use B_. * casetab.c (Fcurrent_case_table, set_case_table): Use B_. * cmds.c (Fself_insert_command, internal_self_insert): Use B_. * fileio.c (Fexpand_file_name, Ffile_directory_p) (Ffile_regular_p, Ffile_selinux_context) (Fset_file_selinux_context, Ffile_modes, Fset_file_modes) (Fset_file_times, Ffile_newer_than_file_p, decide_coding_unwind) (Finsert_file_contents, choose_write_coding_system) (Fwrite_region, build_annotations, Fverify_visited_file_modtime) (Fset_visited_file_modtime, auto_save_error, auto_save_1) (Fdo_auto_save, Fset_buffer_auto_saved): Use B_. * minibuf.c (read_minibuf, get_minibuffer, Fread_buffer): Use B_. * marker.c (Fmarker_buffer, Fset_marker, set_marker_restricted) (set_marker_both, set_marker_restricted_both, unchain_marker): Use B_. * insdel.c (check_markers, insert_char, insert_1_both) (insert_from_string_1, insert_from_gap, insert_from_buffer_1) (adjust_after_replace, replace_range, del_range_2) (modify_region, prepare_to_modify_buffer) (Fcombine_after_change_execute): Use B_. * filelock.c (unlock_all_files, Flock_buffer, Funlock_buffer) (unlock_buffer): Use B_. * keymap.c (Flocal_key_binding, Fuse_local_map) (Fcurrent_local_map, push_key_description) (Fdescribe_buffer_bindings): Use B_. * keyboard.c (command_loop_1, read_char_minibuf_menu_prompt) (read_key_sequence): Use B_. * fringe.c (get_logical_cursor_bitmap) (get_logical_fringe_bitmap, update_window_fringes): Use B_. * xfns.c (x_create_tip_frame, Fx_show_tip): Use B_. * xfaces.c (compute_char_face): Use B_. * character.c (chars_in_text, Fget_byte): Use B_. * category.c (check_category_table, Fcategory_table) (Fset_category_table, char_category_set): Use B_. * coding.c (decode_coding, encode_coding) (make_conversion_work_buffer, decode_coding_gap) (decode_coding_object, encode_coding_object) (Fdetect_coding_region, Ffind_coding_systems_region_internal) (Funencodable_char_position, Fcheck_coding_systems_region): Use B_. * charset.c (Ffind_charset_region): Use B_. * window.c (window_display_table, unshow_buffer, window_loop) (window_min_size_2, set_window_buffer, Fset_window_buffer) (select_window, Fforce_window_update, temp_output_buffer_show) (Fset_window_configuration, save_window_save): Use B_. * xdisp.c (pos_visible_p, init_iterator, reseat_1) (message_dolog, update_echo_area, ensure_echo_area_buffers) (with_echo_area_buffer, setup_echo_area_for_printing) (set_message_1, update_menu_bar, update_tool_bar) (text_outside_line_unchanged_p, redisplay_internal) (try_scrolling, try_cursor_movement, redisplay_window) (try_window_reusing_current_matrix, row_containing_pos) (try_window_id, get_overlay_arrow_glyph_row, display_line) (Fcurrent_bidi_paragraph_direction, display_mode_lines) (decode_mode_spec_coding, decode_mode_spec, display_count_lines) (get_window_cursor_type, note_mouse_highlight): Use B_. * frame.c (make_frame_visible_1): Use B_. * dispnew.c (Fframe_or_buffer_changed_p): Use B_. * dispextern.h (WINDOW_WANTS_HEADER_LINE_P) (WINDOW_WANTS_MODELINE_P): Use B_. * syntax.h (Vstandard_syntax_table): Update. (CURRENT_SYNTAX_TABLE, SETUP_BUFFER_SYNTAX_TABLE): Use B_. * intervals.h (TEXT_PROP_MEANS_INVISIBLE): Update. (TEXT_PROP_MEANS_INVISIBLE): Use B_. * character.h (FETCH_CHAR_ADVANCE): Update. (INC_BOTH, ASCII_CHAR_WIDTH, DEC_BOTH): Use B_. * category.h (Vstandard_category_table): Update. * lisp.h (DEFVAR_BUFFER_DEFAULTS): Update for change to field names. (DOWNCASE_TABLE, UPCASE_TABLE): Use B_. * buffer.c (swapfield_): New macro. (Fbuffer_swap_text): Use swapfield_ where appropriate. (Fbuffer_live_p, Fget_file_buffer, get_truename_buffer) (Fget_buffer_create, clone_per_buffer_values) (Fmake_indirect_buffer, reset_buffer) (reset_buffer_local_variables, Fbuffer_name, Fbuffer_file_name) (Fbuffer_local_value, buffer_lisp_local_variables) (Fset_buffer_modified_p, Frestore_buffer_modified_p) (Frename_buffer, Fother_buffer, Fbuffer_enable_undo) (Fkill_buffer, Fset_buffer_major_mode, set_buffer_internal_1) (set_buffer_temp, Fset_buffer, set_buffer_if_live) (Fbarf_if_buffer_read_only, Fbury_buffer, Ferase_buffer) (Fbuffer_swap_text, Fset_buffer_multibyte) (swap_out_buffer_local_variables, record_overlay_string) (overlay_strings, init_buffer_once, init_buffer, syms_of_buffer): Use B_. * buffer.h (struct buffer): Rename all Lisp_Object fields. (BUFFER_INTERNAL_FIELD, B_): New macro. (FETCH_CHAR, FETCH_CHAR_AS_MULTIBYTE): Use B_.
Diffstat (limited to 'src/fileio.c')
-rw-r--r--src/fileio.c174
1 files changed, 87 insertions, 87 deletions
diff --git a/src/fileio.c b/src/fileio.c
index 429fce9f5a0..afef7888b78 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -770,7 +770,7 @@ filesystem tree, not (expand-file-name ".." dirname). */)
770 770
771 /* Use the buffer's default-directory if DEFAULT_DIRECTORY is omitted. */ 771 /* Use the buffer's default-directory if DEFAULT_DIRECTORY is omitted. */
772 if (NILP (default_directory)) 772 if (NILP (default_directory))
773 default_directory = current_buffer->directory; 773 default_directory = B_ (current_buffer, directory);
774 if (! STRINGP (default_directory)) 774 if (! STRINGP (default_directory))
775 { 775 {
776#ifdef DOS_NT 776#ifdef DOS_NT
@@ -2669,7 +2669,7 @@ See `file-symlink-p' to distinguish symlinks. */)
2669 struct stat st; 2669 struct stat st;
2670 Lisp_Object handler; 2670 Lisp_Object handler;
2671 2671
2672 absname = expand_and_dir_to_file (filename, current_buffer->directory); 2672 absname = expand_and_dir_to_file (filename, B_ (current_buffer, directory));
2673 2673
2674 /* If the file name has special constructs in it, 2674 /* If the file name has special constructs in it,
2675 call the corresponding file handler. */ 2675 call the corresponding file handler. */
@@ -2722,7 +2722,7 @@ See `file-symlink-p' to distinguish symlinks. */)
2722 struct stat st; 2722 struct stat st;
2723 Lisp_Object handler; 2723 Lisp_Object handler;
2724 2724
2725 absname = expand_and_dir_to_file (filename, current_buffer->directory); 2725 absname = expand_and_dir_to_file (filename, B_ (current_buffer, directory));
2726 2726
2727 /* If the file name has special constructs in it, 2727 /* If the file name has special constructs in it,
2728 call the corresponding file handler. */ 2728 call the corresponding file handler. */
@@ -2769,7 +2769,7 @@ if file does not exist, is not accessible, or SELinux is disabled */)
2769 context_t context; 2769 context_t context;
2770#endif 2770#endif
2771 2771
2772 absname = expand_and_dir_to_file (filename, current_buffer->directory); 2772 absname = expand_and_dir_to_file (filename, B_ (current_buffer, directory));
2773 2773
2774 /* If the file name has special constructs in it, 2774 /* If the file name has special constructs in it,
2775 call the corresponding file handler. */ 2775 call the corresponding file handler. */
@@ -2827,7 +2827,7 @@ is disabled. */)
2827 context_t parsed_con; 2827 context_t parsed_con;
2828#endif 2828#endif
2829 2829
2830 absname = Fexpand_file_name (filename, current_buffer->directory); 2830 absname = Fexpand_file_name (filename, B_ (current_buffer, directory));
2831 2831
2832 /* If the file name has special constructs in it, 2832 /* If the file name has special constructs in it,
2833 call the corresponding file handler. */ 2833 call the corresponding file handler. */
@@ -2894,7 +2894,7 @@ Return nil, if file does not exist or is not accessible. */)
2894 struct stat st; 2894 struct stat st;
2895 Lisp_Object handler; 2895 Lisp_Object handler;
2896 2896
2897 absname = expand_and_dir_to_file (filename, current_buffer->directory); 2897 absname = expand_and_dir_to_file (filename, B_ (current_buffer, directory));
2898 2898
2899 /* If the file name has special constructs in it, 2899 /* If the file name has special constructs in it,
2900 call the corresponding file handler. */ 2900 call the corresponding file handler. */
@@ -2923,7 +2923,7 @@ symbolic notation, like the `chmod' command from GNU Coreutils. */)
2923 Lisp_Object absname, encoded_absname; 2923 Lisp_Object absname, encoded_absname;
2924 Lisp_Object handler; 2924 Lisp_Object handler;
2925 2925
2926 absname = Fexpand_file_name (filename, current_buffer->directory); 2926 absname = Fexpand_file_name (filename, B_ (current_buffer, directory));
2927 CHECK_NUMBER (mode); 2927 CHECK_NUMBER (mode);
2928 2928
2929 /* If the file name has special constructs in it, 2929 /* If the file name has special constructs in it,
@@ -2985,7 +2985,7 @@ Use the current time if TIME is nil. TIME is in the format of
2985 if (! lisp_time_argument (time, &sec, &usec)) 2985 if (! lisp_time_argument (time, &sec, &usec))
2986 error ("Invalid time specification"); 2986 error ("Invalid time specification");
2987 2987
2988 absname = Fexpand_file_name (filename, current_buffer->directory); 2988 absname = Fexpand_file_name (filename, B_ (current_buffer, directory));
2989 2989
2990 /* If the file name has special constructs in it, 2990 /* If the file name has special constructs in it,
2991 call the corresponding file handler. */ 2991 call the corresponding file handler. */
@@ -3047,8 +3047,8 @@ otherwise, if FILE2 does not exist, the answer is t. */)
3047 3047
3048 absname1 = Qnil; 3048 absname1 = Qnil;
3049 GCPRO2 (absname1, file2); 3049 GCPRO2 (absname1, file2);
3050 absname1 = expand_and_dir_to_file (file1, current_buffer->directory); 3050 absname1 = expand_and_dir_to_file (file1, B_ (current_buffer, directory));
3051 absname2 = expand_and_dir_to_file (file2, current_buffer->directory); 3051 absname2 = expand_and_dir_to_file (file2, B_ (current_buffer, directory));
3052 UNGCPRO; 3052 UNGCPRO;
3053 3053
3054 /* If the file name has special constructs in it, 3054 /* If the file name has special constructs in it,
@@ -3116,8 +3116,8 @@ decide_coding_unwind (Lisp_Object unwind_data)
3116 TEMP_SET_PT_BOTH (BEG, BEG_BYTE); 3116 TEMP_SET_PT_BOTH (BEG, BEG_BYTE);
3117 3117
3118 /* Now we are safe to change the buffer's multibyteness directly. */ 3118 /* Now we are safe to change the buffer's multibyteness directly. */
3119 current_buffer->enable_multibyte_characters = multibyte; 3119 B_ (current_buffer, enable_multibyte_characters) = multibyte;
3120 current_buffer->undo_list = undo_list; 3120 B_ (current_buffer, undo_list) = undo_list;
3121 3121
3122 return Qnil; 3122 return Qnil;
3123} 3123}
@@ -3212,7 +3212,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3212 if (current_buffer->base_buffer && ! NILP (visit)) 3212 if (current_buffer->base_buffer && ! NILP (visit))
3213 error ("Cannot do file visiting in an indirect buffer"); 3213 error ("Cannot do file visiting in an indirect buffer");
3214 3214
3215 if (!NILP (current_buffer->read_only)) 3215 if (!NILP (B_ (current_buffer, read_only)))
3216 Fbarf_if_buffer_read_only (); 3216 Fbarf_if_buffer_read_only ();
3217 3217
3218 val = Qnil; 3218 val = Qnil;
@@ -3403,16 +3403,16 @@ variable `last-coding-system-used' to the coding system actually used. */)
3403 buf = XBUFFER (buffer); 3403 buf = XBUFFER (buffer);
3404 3404
3405 delete_all_overlays (buf); 3405 delete_all_overlays (buf);
3406 buf->directory = current_buffer->directory; 3406 B_ (buf, directory) = B_ (current_buffer, directory);
3407 buf->read_only = Qnil; 3407 B_ (buf, read_only) = Qnil;
3408 buf->filename = Qnil; 3408 B_ (buf, filename) = Qnil;
3409 buf->undo_list = Qt; 3409 B_ (buf, undo_list) = Qt;
3410 eassert (buf->overlays_before == NULL); 3410 eassert (buf->overlays_before == NULL);
3411 eassert (buf->overlays_after == NULL); 3411 eassert (buf->overlays_after == NULL);
3412 3412
3413 set_buffer_internal (buf); 3413 set_buffer_internal (buf);
3414 Ferase_buffer (); 3414 Ferase_buffer ();
3415 buf->enable_multibyte_characters = Qnil; 3415 B_ (buf, enable_multibyte_characters) = Qnil;
3416 3416
3417 insert_1_both ((char *) read_buf, nread, nread, 0, 0, 0); 3417 insert_1_both ((char *) read_buf, nread, nread, 0, 0, 0);
3418 TEMP_SET_PT_BOTH (BEG, BEG_BYTE); 3418 TEMP_SET_PT_BOTH (BEG, BEG_BYTE);
@@ -3450,7 +3450,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3450 else 3450 else
3451 CHECK_CODING_SYSTEM (coding_system); 3451 CHECK_CODING_SYSTEM (coding_system);
3452 3452
3453 if (NILP (current_buffer->enable_multibyte_characters)) 3453 if (NILP (B_ (current_buffer, enable_multibyte_characters)))
3454 /* We must suppress all character code conversion except for 3454 /* We must suppress all character code conversion except for
3455 end-of-line conversion. */ 3455 end-of-line conversion. */
3456 coding_system = raw_text_coding_system (coding_system); 3456 coding_system = raw_text_coding_system (coding_system);
@@ -3598,7 +3598,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3598 we cannot use this method; giveup and try the other. */ 3598 we cannot use this method; giveup and try the other. */
3599 if (same_at_end > same_at_start 3599 if (same_at_end > same_at_start
3600 && FETCH_BYTE (same_at_end - 1) >= 0200 3600 && FETCH_BYTE (same_at_end - 1) >= 0200
3601 && ! NILP (current_buffer->enable_multibyte_characters) 3601 && ! NILP (B_ (current_buffer, enable_multibyte_characters))
3602 && (CODING_MAY_REQUIRE_DECODING (&coding))) 3602 && (CODING_MAY_REQUIRE_DECODING (&coding)))
3603 giveup_match_end = 1; 3603 giveup_match_end = 1;
3604 break; 3604 break;
@@ -3617,14 +3617,14 @@ variable `last-coding-system-used' to the coding system actually used. */)
3617 3617
3618 /* Extend the start of non-matching text area to multibyte 3618 /* Extend the start of non-matching text area to multibyte
3619 character boundary. */ 3619 character boundary. */
3620 if (! NILP (current_buffer->enable_multibyte_characters)) 3620 if (! NILP (B_ (current_buffer, enable_multibyte_characters)))
3621 while (same_at_start > BEGV_BYTE 3621 while (same_at_start > BEGV_BYTE
3622 && ! CHAR_HEAD_P (FETCH_BYTE (same_at_start))) 3622 && ! CHAR_HEAD_P (FETCH_BYTE (same_at_start)))
3623 same_at_start--; 3623 same_at_start--;
3624 3624
3625 /* Extend the end of non-matching text area to multibyte 3625 /* Extend the end of non-matching text area to multibyte
3626 character boundary. */ 3626 character boundary. */
3627 if (! NILP (current_buffer->enable_multibyte_characters)) 3627 if (! NILP (B_ (current_buffer, enable_multibyte_characters)))
3628 while (same_at_end < ZV_BYTE 3628 while (same_at_end < ZV_BYTE
3629 && ! CHAR_HEAD_P (FETCH_BYTE (same_at_end))) 3629 && ! CHAR_HEAD_P (FETCH_BYTE (same_at_end)))
3630 same_at_end++; 3630 same_at_end++;
@@ -3673,7 +3673,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3673 unsigned char *decoded; 3673 unsigned char *decoded;
3674 EMACS_INT temp; 3674 EMACS_INT temp;
3675 int this_count = SPECPDL_INDEX (); 3675 int this_count = SPECPDL_INDEX ();
3676 int multibyte = ! NILP (current_buffer->enable_multibyte_characters); 3676 int multibyte = ! NILP (B_ (current_buffer, enable_multibyte_characters));
3677 Lisp_Object conversion_buffer; 3677 Lisp_Object conversion_buffer;
3678 3678
3679 conversion_buffer = code_conversion_save (1, multibyte); 3679 conversion_buffer = code_conversion_save (1, multibyte);
@@ -3778,7 +3778,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3778 3778
3779 /* Extend the start of non-matching text area to the previous 3779 /* Extend the start of non-matching text area to the previous
3780 multibyte character boundary. */ 3780 multibyte character boundary. */
3781 if (! NILP (current_buffer->enable_multibyte_characters)) 3781 if (! NILP (B_ (current_buffer, enable_multibyte_characters)))
3782 while (same_at_start > BEGV_BYTE 3782 while (same_at_start > BEGV_BYTE
3783 && ! CHAR_HEAD_P (FETCH_BYTE (same_at_start))) 3783 && ! CHAR_HEAD_P (FETCH_BYTE (same_at_start)))
3784 same_at_start--; 3784 same_at_start--;
@@ -3795,7 +3795,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3795 3795
3796 /* Extend the end of non-matching text area to the next 3796 /* Extend the end of non-matching text area to the next
3797 multibyte character boundary. */ 3797 multibyte character boundary. */
3798 if (! NILP (current_buffer->enable_multibyte_characters)) 3798 if (! NILP (B_ (current_buffer, enable_multibyte_characters)))
3799 while (same_at_end < ZV_BYTE 3799 while (same_at_end < ZV_BYTE
3800 && ! CHAR_HEAD_P (FETCH_BYTE (same_at_end))) 3800 && ! CHAR_HEAD_P (FETCH_BYTE (same_at_end)))
3801 same_at_end++; 3801 same_at_end++;
@@ -3870,9 +3870,9 @@ variable `last-coding-system-used' to the coding system actually used. */)
3870 if (NILP (visit) && inserted > 0) 3870 if (NILP (visit) && inserted > 0)
3871 { 3871 {
3872#ifdef CLASH_DETECTION 3872#ifdef CLASH_DETECTION
3873 if (!NILP (current_buffer->file_truename) 3873 if (!NILP (B_ (current_buffer, file_truename))
3874 /* Make binding buffer-file-name to nil effective. */ 3874 /* Make binding buffer-file-name to nil effective. */
3875 && !NILP (current_buffer->filename) 3875 && !NILP (B_ (current_buffer, filename))
3876 && SAVE_MODIFF >= MODIFF) 3876 && SAVE_MODIFF >= MODIFF)
3877 we_locked_file = 1; 3877 we_locked_file = 1;
3878#endif /* CLASH_DETECTION */ 3878#endif /* CLASH_DETECTION */
@@ -3977,7 +3977,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3977 { 3977 {
3978#ifdef CLASH_DETECTION 3978#ifdef CLASH_DETECTION
3979 if (we_locked_file) 3979 if (we_locked_file)
3980 unlock_file (current_buffer->file_truename); 3980 unlock_file (B_ (current_buffer, file_truename));
3981#endif 3981#endif
3982 Vdeactivate_mark = old_Vdeactivate_mark; 3982 Vdeactivate_mark = old_Vdeactivate_mark;
3983 } 3983 }
@@ -4028,11 +4028,11 @@ variable `last-coding-system-used' to the coding system actually used. */)
4028 Lisp_Object unwind_data; 4028 Lisp_Object unwind_data;
4029 int count = SPECPDL_INDEX (); 4029 int count = SPECPDL_INDEX ();
4030 4030
4031 unwind_data = Fcons (current_buffer->enable_multibyte_characters, 4031 unwind_data = Fcons (B_ (current_buffer, enable_multibyte_characters),
4032 Fcons (current_buffer->undo_list, 4032 Fcons (B_ (current_buffer, undo_list),
4033 Fcurrent_buffer ())); 4033 Fcurrent_buffer ()));
4034 current_buffer->enable_multibyte_characters = Qnil; 4034 B_ (current_buffer, enable_multibyte_characters) = Qnil;
4035 current_buffer->undo_list = Qt; 4035 B_ (current_buffer, undo_list) = Qt;
4036 record_unwind_protect (decide_coding_unwind, unwind_data); 4036 record_unwind_protect (decide_coding_unwind, unwind_data);
4037 4037
4038 if (inserted > 0 && ! NILP (Vset_auto_coding_function)) 4038 if (inserted > 0 && ! NILP (Vset_auto_coding_function))
@@ -4062,7 +4062,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
4062 else 4062 else
4063 CHECK_CODING_SYSTEM (coding_system); 4063 CHECK_CODING_SYSTEM (coding_system);
4064 4064
4065 if (NILP (current_buffer->enable_multibyte_characters)) 4065 if (NILP (B_ (current_buffer, enable_multibyte_characters)))
4066 /* We must suppress all character code conversion except for 4066 /* We must suppress all character code conversion except for
4067 end-of-line conversion. */ 4067 end-of-line conversion. */
4068 coding_system = raw_text_coding_system (coding_system); 4068 coding_system = raw_text_coding_system (coding_system);
@@ -4080,10 +4080,10 @@ variable `last-coding-system-used' to the coding system actually used. */)
4080 && NILP (replace)) 4080 && NILP (replace))
4081 /* Visiting a file with these coding system makes the buffer 4081 /* Visiting a file with these coding system makes the buffer
4082 unibyte. */ 4082 unibyte. */
4083 current_buffer->enable_multibyte_characters = Qnil; 4083 B_ (current_buffer, enable_multibyte_characters) = Qnil;
4084 } 4084 }
4085 4085
4086 coding.dst_multibyte = ! NILP (current_buffer->enable_multibyte_characters); 4086 coding.dst_multibyte = ! NILP (B_ (current_buffer, enable_multibyte_characters));
4087 if (CODING_MAY_REQUIRE_DECODING (&coding) 4087 if (CODING_MAY_REQUIRE_DECODING (&coding)
4088 && (inserted > 0 || CODING_REQUIRE_FLUSHING (&coding))) 4088 && (inserted > 0 || CODING_REQUIRE_FLUSHING (&coding)))
4089 { 4089 {
@@ -4124,24 +4124,24 @@ variable `last-coding-system-used' to the coding system actually used. */)
4124 4124
4125 if (!NILP (visit)) 4125 if (!NILP (visit))
4126 { 4126 {
4127 if (!EQ (current_buffer->undo_list, Qt) && !nochange) 4127 if (!EQ (B_ (current_buffer, undo_list), Qt) && !nochange)
4128 current_buffer->undo_list = Qnil; 4128 B_ (current_buffer, undo_list) = Qnil;
4129 4129
4130 if (NILP (handler)) 4130 if (NILP (handler))
4131 { 4131 {
4132 current_buffer->modtime = st.st_mtime; 4132 current_buffer->modtime = st.st_mtime;
4133 current_buffer->modtime_size = st.st_size; 4133 current_buffer->modtime_size = st.st_size;
4134 current_buffer->filename = orig_filename; 4134 B_ (current_buffer, filename) = orig_filename;
4135 } 4135 }
4136 4136
4137 SAVE_MODIFF = MODIFF; 4137 SAVE_MODIFF = MODIFF;
4138 BUF_AUTOSAVE_MODIFF (current_buffer) = MODIFF; 4138 BUF_AUTOSAVE_MODIFF (current_buffer) = MODIFF;
4139 XSETFASTINT (current_buffer->save_length, Z - BEG); 4139 XSETFASTINT (B_ (current_buffer, save_length), Z - BEG);
4140#ifdef CLASH_DETECTION 4140#ifdef CLASH_DETECTION
4141 if (NILP (handler)) 4141 if (NILP (handler))
4142 { 4142 {
4143 if (!NILP (current_buffer->file_truename)) 4143 if (!NILP (B_ (current_buffer, file_truename)))
4144 unlock_file (current_buffer->file_truename); 4144 unlock_file (B_ (current_buffer, file_truename));
4145 unlock_file (filename); 4145 unlock_file (filename);
4146 } 4146 }
4147#endif /* CLASH_DETECTION */ 4147#endif /* CLASH_DETECTION */
@@ -4174,8 +4174,8 @@ variable `last-coding-system-used' to the coding system actually used. */)
4174 specbind (Qinhibit_modification_hooks, Qt); 4174 specbind (Qinhibit_modification_hooks, Qt);
4175 4175
4176 /* Save old undo list and don't record undo for decoding. */ 4176 /* Save old undo list and don't record undo for decoding. */
4177 old_undo = current_buffer->undo_list; 4177 old_undo = B_ (current_buffer, undo_list);
4178 current_buffer->undo_list = Qt; 4178 B_ (current_buffer, undo_list) = Qt;
4179 4179
4180 if (NILP (replace)) 4180 if (NILP (replace))
4181 { 4181 {
@@ -4263,7 +4263,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
4263 4263
4264 if (NILP (visit)) 4264 if (NILP (visit))
4265 { 4265 {
4266 current_buffer->undo_list = old_undo; 4266 B_ (current_buffer, undo_list) = old_undo;
4267 if (CONSP (old_undo) && inserted != old_inserted) 4267 if (CONSP (old_undo) && inserted != old_inserted)
4268 { 4268 {
4269 /* Adjust the last undo record for the size change during 4269 /* Adjust the last undo record for the size change during
@@ -4278,7 +4278,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
4278 else 4278 else
4279 /* If undo_list was Qt before, keep it that way. 4279 /* If undo_list was Qt before, keep it that way.
4280 Otherwise start with an empty undo_list. */ 4280 Otherwise start with an empty undo_list. */
4281 current_buffer->undo_list = EQ (old_undo, Qt) ? Qt : Qnil; 4281 B_ (current_buffer, undo_list) = EQ (old_undo, Qt) ? Qt : Qnil;
4282 4282
4283 unbind_to (count, Qnil); 4283 unbind_to (count, Qnil);
4284 } 4284 }
@@ -4332,8 +4332,8 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file
4332 Lisp_Object eol_parent = Qnil; 4332 Lisp_Object eol_parent = Qnil;
4333 4333
4334 if (auto_saving 4334 if (auto_saving
4335 && NILP (Fstring_equal (current_buffer->filename, 4335 && NILP (Fstring_equal (B_ (current_buffer, filename),
4336 current_buffer->auto_save_file_name))) 4336 B_ (current_buffer, auto_save_file_name))))
4337 { 4337 {
4338 val = Qutf_8_emacs; 4338 val = Qutf_8_emacs;
4339 eol_parent = Qunix; 4339 eol_parent = Qunix;
@@ -4362,12 +4362,12 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file
4362 int using_default_coding = 0; 4362 int using_default_coding = 0;
4363 int force_raw_text = 0; 4363 int force_raw_text = 0;
4364 4364
4365 val = current_buffer->buffer_file_coding_system; 4365 val = B_ (current_buffer, buffer_file_coding_system);
4366 if (NILP (val) 4366 if (NILP (val)
4367 || NILP (Flocal_variable_p (Qbuffer_file_coding_system, Qnil))) 4367 || NILP (Flocal_variable_p (Qbuffer_file_coding_system, Qnil)))
4368 { 4368 {
4369 val = Qnil; 4369 val = Qnil;
4370 if (NILP (current_buffer->enable_multibyte_characters)) 4370 if (NILP (B_ (current_buffer, enable_multibyte_characters)))
4371 force_raw_text = 1; 4371 force_raw_text = 1;
4372 } 4372 }
4373 4373
@@ -4388,7 +4388,7 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file
4388 { 4388 {
4389 /* If we still have not decided a coding system, use the 4389 /* If we still have not decided a coding system, use the
4390 default value of buffer-file-coding-system. */ 4390 default value of buffer-file-coding-system. */
4391 val = current_buffer->buffer_file_coding_system; 4391 val = B_ (current_buffer, buffer_file_coding_system);
4392 using_default_coding = 1; 4392 using_default_coding = 1;
4393 } 4393 }
4394 4394
@@ -4412,9 +4412,9 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file
4412 format, we use that of 4412 format, we use that of
4413 `default-buffer-file-coding-system'. */ 4413 `default-buffer-file-coding-system'. */
4414 if (! using_default_coding 4414 if (! using_default_coding
4415 && ! NILP (buffer_defaults.buffer_file_coding_system)) 4415 && ! NILP (B_ (&buffer_defaults, buffer_file_coding_system)))
4416 val = (coding_inherit_eol_type 4416 val = (coding_inherit_eol_type
4417 (val, buffer_defaults.buffer_file_coding_system)); 4417 (val, B_ (&buffer_defaults, buffer_file_coding_system)));
4418 4418
4419 /* If we decide not to encode text, use `raw-text' or one of its 4419 /* If we decide not to encode text, use `raw-text' or one of its
4420 subsidiaries. */ 4420 subsidiaries. */
@@ -4425,7 +4425,7 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file
4425 val = coding_inherit_eol_type (val, eol_parent); 4425 val = coding_inherit_eol_type (val, eol_parent);
4426 setup_coding_system (val, coding); 4426 setup_coding_system (val, coding);
4427 4427
4428 if (!STRINGP (start) && !NILP (current_buffer->selective_display)) 4428 if (!STRINGP (start) && !NILP (B_ (current_buffer, selective_display)))
4429 coding->mode |= CODING_MODE_SELECTIVE_DISPLAY; 4429 coding->mode |= CODING_MODE_SELECTIVE_DISPLAY;
4430 return val; 4430 return val;
4431} 4431}
@@ -4529,8 +4529,8 @@ This calls `write-region-annotate-functions' at the start, and
4529 if (visiting) 4529 if (visiting)
4530 { 4530 {
4531 SAVE_MODIFF = MODIFF; 4531 SAVE_MODIFF = MODIFF;
4532 XSETFASTINT (current_buffer->save_length, Z - BEG); 4532 XSETFASTINT (B_ (current_buffer, save_length), Z - BEG);
4533 current_buffer->filename = visit_file; 4533 B_ (current_buffer, filename) = visit_file;
4534 } 4534 }
4535 UNGCPRO; 4535 UNGCPRO;
4536 return val; 4536 return val;
@@ -4743,15 +4743,15 @@ This calls `write-region-annotate-functions' at the start, and
4743 if (visiting) 4743 if (visiting)
4744 { 4744 {
4745 SAVE_MODIFF = MODIFF; 4745 SAVE_MODIFF = MODIFF;
4746 XSETFASTINT (current_buffer->save_length, Z - BEG); 4746 XSETFASTINT (B_ (current_buffer, save_length), Z - BEG);
4747 current_buffer->filename = visit_file; 4747 B_ (current_buffer, filename) = visit_file;
4748 update_mode_lines++; 4748 update_mode_lines++;
4749 } 4749 }
4750 else if (quietly) 4750 else if (quietly)
4751 { 4751 {
4752 if (auto_saving 4752 if (auto_saving
4753 && ! NILP (Fstring_equal (current_buffer->filename, 4753 && ! NILP (Fstring_equal (B_ (current_buffer, filename),
4754 current_buffer->auto_save_file_name))) 4754 B_ (current_buffer, auto_save_file_name))))
4755 SAVE_MODIFF = MODIFF; 4755 SAVE_MODIFF = MODIFF;
4756 4756
4757 return Qnil; 4757 return Qnil;
@@ -4833,10 +4833,10 @@ build_annotations (Lisp_Object start, Lisp_Object end)
4833 } 4833 }
4834 4834
4835 /* Now do the same for annotation functions implied by the file-format */ 4835 /* Now do the same for annotation functions implied by the file-format */
4836 if (auto_saving && (!EQ (current_buffer->auto_save_file_format, Qt))) 4836 if (auto_saving && (!EQ (B_ (current_buffer, auto_save_file_format), Qt)))
4837 p = current_buffer->auto_save_file_format; 4837 p = B_ (current_buffer, auto_save_file_format);
4838 else 4838 else
4839 p = current_buffer->file_format; 4839 p = B_ (current_buffer, file_format);
4840 for (i = 0; CONSP (p); p = XCDR (p), ++i) 4840 for (i = 0; CONSP (p); p = XCDR (p), ++i)
4841 { 4841 {
4842 struct buffer *given_buffer = current_buffer; 4842 struct buffer *given_buffer = current_buffer;
@@ -5015,17 +5015,17 @@ See Info node `(elisp)Modification Time' for more details. */)
5015 b = XBUFFER (buf); 5015 b = XBUFFER (buf);
5016 } 5016 }
5017 5017
5018 if (!STRINGP (b->filename)) return Qt; 5018 if (!STRINGP (B_ (b, filename))) return Qt;
5019 if (b->modtime == 0) return Qt; 5019 if (b->modtime == 0) return Qt;
5020 5020
5021 /* If the file name has special constructs in it, 5021 /* If the file name has special constructs in it,
5022 call the corresponding file handler. */ 5022 call the corresponding file handler. */
5023 handler = Ffind_file_name_handler (b->filename, 5023 handler = Ffind_file_name_handler (B_ (b, filename),
5024 Qverify_visited_file_modtime); 5024 Qverify_visited_file_modtime);
5025 if (!NILP (handler)) 5025 if (!NILP (handler))
5026 return call2 (handler, Qverify_visited_file_modtime, buf); 5026 return call2 (handler, Qverify_visited_file_modtime, buf);
5027 5027
5028 filename = ENCODE_FILE (b->filename); 5028 filename = ENCODE_FILE (B_ (b, filename));
5029 5029
5030 if (stat (SSDATA (filename), &st) < 0) 5030 if (stat (SSDATA (filename), &st) < 0)
5031 { 5031 {
@@ -5093,7 +5093,7 @@ An argument specifies the modification time value to use
5093 struct stat st; 5093 struct stat st;
5094 Lisp_Object handler; 5094 Lisp_Object handler;
5095 5095
5096 filename = Fexpand_file_name (current_buffer->filename, Qnil); 5096 filename = Fexpand_file_name (B_ (current_buffer, filename), Qnil);
5097 5097
5098 /* If the file name has special constructs in it, 5098 /* If the file name has special constructs in it,
5099 call the corresponding file handler. */ 5099 call the corresponding file handler. */
@@ -5128,7 +5128,7 @@ auto_save_error (Lisp_Object error)
5128 ring_bell (XFRAME (selected_frame)); 5128 ring_bell (XFRAME (selected_frame));
5129 5129
5130 args[0] = build_string ("Auto-saving %s: %s"); 5130 args[0] = build_string ("Auto-saving %s: %s");
5131 args[1] = current_buffer->name; 5131 args[1] = B_ (current_buffer, name);
5132 args[2] = Ferror_message_string (error); 5132 args[2] = Ferror_message_string (error);
5133 msg = Fformat (3, args); 5133 msg = Fformat (3, args);
5134 GCPRO1 (msg); 5134 GCPRO1 (msg);
@@ -5159,19 +5159,19 @@ auto_save_1 (void)
5159 auto_save_mode_bits = 0666; 5159 auto_save_mode_bits = 0666;
5160 5160
5161 /* Get visited file's mode to become the auto save file's mode. */ 5161 /* Get visited file's mode to become the auto save file's mode. */
5162 if (! NILP (current_buffer->filename)) 5162 if (! NILP (B_ (current_buffer, filename)))
5163 { 5163 {
5164 if (stat (SSDATA (current_buffer->filename), &st) >= 0) 5164 if (stat (SSDATA (B_ (current_buffer, filename)), &st) >= 0)
5165 /* But make sure we can overwrite it later! */ 5165 /* But make sure we can overwrite it later! */
5166 auto_save_mode_bits = st.st_mode | 0600; 5166 auto_save_mode_bits = st.st_mode | 0600;
5167 else if ((modes = Ffile_modes (current_buffer->filename), 5167 else if ((modes = Ffile_modes (B_ (current_buffer, filename)),
5168 INTEGERP (modes))) 5168 INTEGERP (modes)))
5169 /* Remote files don't cooperate with stat. */ 5169 /* Remote files don't cooperate with stat. */
5170 auto_save_mode_bits = XINT (modes) | 0600; 5170 auto_save_mode_bits = XINT (modes) | 0600;
5171 } 5171 }
5172 5172
5173 return 5173 return
5174 Fwrite_region (Qnil, Qnil, current_buffer->auto_save_file_name, Qnil, 5174 Fwrite_region (Qnil, Qnil, B_ (current_buffer, auto_save_file_name), Qnil,
5175 NILP (Vauto_save_visited_file_name) ? Qlambda : Qt, 5175 NILP (Vauto_save_visited_file_name) ? Qlambda : Qt,
5176 Qnil, Qnil); 5176 Qnil, Qnil);
5177} 5177}
@@ -5312,18 +5312,18 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
5312 /* Record all the buffers that have auto save mode 5312 /* Record all the buffers that have auto save mode
5313 in the special file that lists them. For each of these buffers, 5313 in the special file that lists them. For each of these buffers,
5314 Record visited name (if any) and auto save name. */ 5314 Record visited name (if any) and auto save name. */
5315 if (STRINGP (b->auto_save_file_name) 5315 if (STRINGP (B_ (b, auto_save_file_name))
5316 && stream != NULL && do_handled_files == 0) 5316 && stream != NULL && do_handled_files == 0)
5317 { 5317 {
5318 BLOCK_INPUT; 5318 BLOCK_INPUT;
5319 if (!NILP (b->filename)) 5319 if (!NILP (B_ (b, filename)))
5320 { 5320 {
5321 fwrite (SDATA (b->filename), 1, 5321 fwrite (SDATA (B_ (b, filename)), 1,
5322 SBYTES (b->filename), stream); 5322 SBYTES (B_ (b, filename)), stream);
5323 } 5323 }
5324 putc ('\n', stream); 5324 putc ('\n', stream);
5325 fwrite (SDATA (b->auto_save_file_name), 1, 5325 fwrite (SDATA (B_ (b, auto_save_file_name)), 1,
5326 SBYTES (b->auto_save_file_name), stream); 5326 SBYTES (B_ (b, auto_save_file_name)), stream);
5327 putc ('\n', stream); 5327 putc ('\n', stream);
5328 UNBLOCK_INPUT; 5328 UNBLOCK_INPUT;
5329 } 5329 }
@@ -5340,13 +5340,13 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
5340 /* Check for auto save enabled 5340 /* Check for auto save enabled
5341 and file changed since last auto save 5341 and file changed since last auto save
5342 and file changed since last real save. */ 5342 and file changed since last real save. */
5343 if (STRINGP (b->auto_save_file_name) 5343 if (STRINGP (B_ (b, auto_save_file_name))
5344 && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b) 5344 && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)
5345 && BUF_AUTOSAVE_MODIFF (b) < BUF_MODIFF (b) 5345 && BUF_AUTOSAVE_MODIFF (b) < BUF_MODIFF (b)
5346 /* -1 means we've turned off autosaving for a while--see below. */ 5346 /* -1 means we've turned off autosaving for a while--see below. */
5347 && XINT (b->save_length) >= 0 5347 && XINT (B_ (b, save_length)) >= 0
5348 && (do_handled_files 5348 && (do_handled_files
5349 || NILP (Ffind_file_name_handler (b->auto_save_file_name, 5349 || NILP (Ffind_file_name_handler (B_ (b, auto_save_file_name),
5350 Qwrite_region)))) 5350 Qwrite_region))))
5351 { 5351 {
5352 EMACS_TIME before_time, after_time; 5352 EMACS_TIME before_time, after_time;
@@ -5360,23 +5360,23 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
5360 5360
5361 set_buffer_internal (b); 5361 set_buffer_internal (b);
5362 if (NILP (Vauto_save_include_big_deletions) 5362 if (NILP (Vauto_save_include_big_deletions)
5363 && (XFASTINT (b->save_length) * 10 5363 && (XFASTINT (B_ (b, save_length)) * 10
5364 > (BUF_Z (b) - BUF_BEG (b)) * 13) 5364 > (BUF_Z (b) - BUF_BEG (b)) * 13)
5365 /* A short file is likely to change a large fraction; 5365 /* A short file is likely to change a large fraction;
5366 spare the user annoying messages. */ 5366 spare the user annoying messages. */
5367 && XFASTINT (b->save_length) > 5000 5367 && XFASTINT (B_ (b, save_length)) > 5000
5368 /* These messages are frequent and annoying for `*mail*'. */ 5368 /* These messages are frequent and annoying for `*mail*'. */
5369 && !EQ (b->filename, Qnil) 5369 && !EQ (B_ (b, filename), Qnil)
5370 && NILP (no_message)) 5370 && NILP (no_message))
5371 { 5371 {
5372 /* It has shrunk too much; turn off auto-saving here. */ 5372 /* It has shrunk too much; turn off auto-saving here. */
5373 minibuffer_auto_raise = orig_minibuffer_auto_raise; 5373 minibuffer_auto_raise = orig_minibuffer_auto_raise;
5374 message_with_string ("Buffer %s has shrunk a lot; auto save disabled in that buffer until next real save", 5374 message_with_string ("Buffer %s has shrunk a lot; auto save disabled in that buffer until next real save",
5375 b->name, 1); 5375 B_ (b, name), 1);
5376 minibuffer_auto_raise = 0; 5376 minibuffer_auto_raise = 0;
5377 /* Turn off auto-saving until there's a real save, 5377 /* Turn off auto-saving until there's a real save,
5378 and prevent any more warnings. */ 5378 and prevent any more warnings. */
5379 XSETINT (b->save_length, -1); 5379 XSETINT (B_ (b, save_length), -1);
5380 Fsleep_for (make_number (1), Qnil); 5380 Fsleep_for (make_number (1), Qnil);
5381 continue; 5381 continue;
5382 } 5382 }
@@ -5385,7 +5385,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
5385 internal_condition_case (auto_save_1, Qt, auto_save_error); 5385 internal_condition_case (auto_save_1, Qt, auto_save_error);
5386 auto_saved++; 5386 auto_saved++;
5387 BUF_AUTOSAVE_MODIFF (b) = BUF_MODIFF (b); 5387 BUF_AUTOSAVE_MODIFF (b) = BUF_MODIFF (b);
5388 XSETFASTINT (current_buffer->save_length, Z - BEG); 5388 XSETFASTINT (B_ (current_buffer, save_length), Z - BEG);
5389 set_buffer_internal (old); 5389 set_buffer_internal (old);
5390 5390
5391 EMACS_GET_TIME (after_time); 5391 EMACS_GET_TIME (after_time);
@@ -5432,7 +5432,7 @@ No auto-save file will be written until the buffer changes again. */)
5432 /* FIXME: This should not be called in indirect buffers, since 5432 /* FIXME: This should not be called in indirect buffers, since
5433 they're not autosaved. */ 5433 they're not autosaved. */
5434 BUF_AUTOSAVE_MODIFF (current_buffer) = MODIFF; 5434 BUF_AUTOSAVE_MODIFF (current_buffer) = MODIFF;
5435 XSETFASTINT (current_buffer->save_length, Z - BEG); 5435 XSETFASTINT (B_ (current_buffer, save_length), Z - BEG);
5436 current_buffer->auto_save_failure_time = -1; 5436 current_buffer->auto_save_failure_time = -1;
5437 return Qnil; 5437 return Qnil;
5438} 5438}