From b9598260f96ddc652cd82ab64bbe922ccfc48a29 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sun, 13 Jun 2010 16:36:17 -0400 Subject: New branch for lexbind, losing all history. This initial patch is based on 2002-06-27T22:39:10Z!storm@cua.dk of the original lexbind branch. --- src/buffer.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index 589266f40e5..e907c295e8d 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -5418,6 +5418,7 @@ defvar_per_buffer (bo_fwd, namestring, address, type, doc) bo_fwd->type = Lisp_Fwd_Buffer_Obj; bo_fwd->offset = offset; bo_fwd->slottype = type; + sym->declared_special = 1; sym->redirect = SYMBOL_FORWARDED; { /* I tried to do the job without a cast, but it seems impossible. -- cgit v1.2.1 From b68864e5b9b695570d35dd7c41d5d010ba7cc87d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 6 Feb 2011 11:44:36 -0800 Subject: * insdel.c: conform to C89 pointer rules --- src/buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index 2c6eb7b84e3..f8008195498 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -2401,7 +2401,7 @@ current buffer is cleared. */) *p = tmp[0]; TEMP_SET_PT_BOTH (pos + 1, pos + 1); bytes--; - insert_1_both (tmp + 1, bytes, bytes, 1, 0, 0); + insert_1_both ((char *) tmp + 1, bytes, bytes, 1, 0, 0); /* Now the gap is after the just inserted data. */ pos = GPT; p = GAP_END_ADDR; -- cgit v1.2.1 From 00b3c7ac85c3811774305d8ccca6a17ec207b3f1 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 8 Feb 2011 14:42:56 -0700 Subject: Make globals.h a generated header * configure: Rebuild. * configure.in (NS_OBJC_OBJ): New subst. lib-src * make-docfile.c: Unconditionally include stdlib.h. (generate_globals): New global. (xrealloc): New function. (main): Handle '-g'. Call start_globals, write_globals. (scan_file): Conditionally call put_filename. (start_globals): New function. (struct global): New. (num_globals, globals): New globals. (add_global, compare_globals, write_globals): New functions. (scan_c_file): Update for "-g". (scan_lisp_file): Fail if "-g". (enum global_type): New. src * Makefile.in (NS_OBJC_OBJ): New variable. (base_obj): Rename from 'obj'. (obj): New variable. (globals.h, gl-stamp, $(obj)): New targets. (GLOBAL_SOURCES): New variable. * globals.h: Remove. * nsselect.m (Vselection_alist): Define. Reverts part of 2011-01-19T22:11:33Z!jan.h.d@swipnet.se. * buffer.c: Don't use "no_cell" for name of kill-buffer-hook's variable. * xselect.c (Vselection_alist): Define. Reverts part of 2011-01-19T23:32:42Z!eggert@cs.ucla.edu. --- src/buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index f8008195498..05cc12eea6f 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1320,7 +1320,7 @@ No argument or nil as argument means do this for the current buffer. */) } /* - DEFVAR_LISP ("kill-buffer-hook", no_cell, "\ + DEFVAR_LISP ("kill-buffer-hook", ..., "\ Hook to be run (by `run-hooks', which see) when a buffer is killed.\n\ The buffer being killed will be current while the hook is running.\n\ See `kill-buffer'." -- cgit v1.2.1 From 5d8ea1203d1e659bc77d953784a85a6e7da0ce95 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 14 Feb 2011 08:39:19 -0700 Subject: 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_. --- src/buffer.c | 680 ++++++++++++++++++++++++++++++----------------------------- 1 file changed, 343 insertions(+), 337 deletions(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index 05cc12eea6f..fc2dd3a4691 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -162,7 +162,7 @@ DEFUN ("buffer-live-p", Fbuffer_live_p, Sbuffer_live_p, 1, 1, 0, Value is nil if OBJECT is not a buffer or if it has been killed. */) (Lisp_Object object) { - return ((BUFFERP (object) && ! NILP (XBUFFER (object)->name)) + return ((BUFFERP (object) && ! NILP (B_ (XBUFFER (object), name))) ? Qt : Qnil); } @@ -266,8 +266,8 @@ See also `find-buffer-visiting'. */) { buf = Fcdr (XCAR (tail)); if (!BUFFERP (buf)) continue; - if (!STRINGP (XBUFFER (buf)->filename)) continue; - tem = Fstring_equal (XBUFFER (buf)->filename, filename); + if (!STRINGP (B_ (XBUFFER (buf), filename))) continue; + tem = Fstring_equal (B_ (XBUFFER (buf), filename), filename); if (!NILP (tem)) return buf; } @@ -283,8 +283,8 @@ get_truename_buffer (register Lisp_Object filename) { buf = Fcdr (XCAR (tail)); if (!BUFFERP (buf)) continue; - if (!STRINGP (XBUFFER (buf)->file_truename)) continue; - tem = Fstring_equal (XBUFFER (buf)->file_truename, filename); + if (!STRINGP (B_ (XBUFFER (buf), file_truename))) continue; + tem = Fstring_equal (B_ (XBUFFER (buf), file_truename), filename); if (!NILP (tem)) return buf; } @@ -353,7 +353,7 @@ even if it is dead. The return value is never nil. */) b->newline_cache = 0; b->width_run_cache = 0; - b->width_table = Qnil; + B_ (b, width_table) = Qnil; b->prevent_redisplay_optimizations_p = 1; /* Put this on the chain of all buffers including killed ones. */ @@ -362,22 +362,22 @@ even if it is dead. The return value is never nil. */) /* An ordinary buffer normally doesn't need markers to handle BEGV and ZV. */ - b->pt_marker = Qnil; - b->begv_marker = Qnil; - b->zv_marker = Qnil; + B_ (b, pt_marker) = Qnil; + B_ (b, begv_marker) = Qnil; + B_ (b, zv_marker) = Qnil; name = Fcopy_sequence (buffer_or_name); STRING_SET_INTERVALS (name, NULL_INTERVAL); - b->name = name; + B_ (b, name) = name; - b->undo_list = (SREF (name, 0) != ' ') ? Qnil : Qt; + B_ (b, undo_list) = (SREF (name, 0) != ' ') ? Qnil : Qt; reset_buffer (b); reset_buffer_local_variables (b, 1); - b->mark = Fmake_marker (); + B_ (b, mark) = Fmake_marker (); BUF_MARKERS (b) = NULL; - b->name = name; + B_ (b, name) = name; /* Put this in the alist of all live buffers. */ XSETBUFFER (buffer, b); @@ -486,7 +486,7 @@ clone_per_buffer_values (struct buffer *from, struct buffer *to) /* Get (a copy of) the alist of Lisp-level local variables of FROM and install that in TO. */ - to->local_var_alist = buffer_lisp_local_variables (from); + B_ (to, local_var_alist) = buffer_lisp_local_variables (from); } DEFUN ("make-indirect-buffer", Fmake_indirect_buffer, Smake_indirect_buffer, @@ -512,7 +512,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */) base_buffer = Fget_buffer (base_buffer); if (NILP (base_buffer)) error ("No such buffer: `%s'", SDATA (tem)); - if (NILP (XBUFFER (base_buffer)->name)) + if (NILP (B_ (XBUFFER (base_buffer), name))) error ("Base buffer has been killed"); if (SCHARS (name) == 0) @@ -536,7 +536,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */) b->newline_cache = 0; b->width_run_cache = 0; - b->width_table = Qnil; + B_ (b, width_table) = Qnil; /* Put this on the chain of all buffers including killed ones. */ b->next = all_buffers; @@ -544,7 +544,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */) name = Fcopy_sequence (name); STRING_SET_INTERVALS (name, NULL_INTERVAL); - b->name = name; + B_ (b, name) = name; reset_buffer (b); reset_buffer_local_variables (b, 1); @@ -553,57 +553,57 @@ CLONE nil means the indirect buffer's state is reset to default values. */) XSETBUFFER (buf, b); Vbuffer_alist = nconc2 (Vbuffer_alist, Fcons (Fcons (name, buf), Qnil)); - b->mark = Fmake_marker (); - b->name = name; + B_ (b, mark) = Fmake_marker (); + B_ (b, name) = name; /* The multibyte status belongs to the base buffer. */ - b->enable_multibyte_characters = b->base_buffer->enable_multibyte_characters; + B_ (b, enable_multibyte_characters) = B_ (b->base_buffer, enable_multibyte_characters); /* Make sure the base buffer has markers for its narrowing. */ - if (NILP (b->base_buffer->pt_marker)) + if (NILP (B_ (b->base_buffer, pt_marker))) { - b->base_buffer->pt_marker = Fmake_marker (); - set_marker_both (b->base_buffer->pt_marker, base_buffer, + B_ (b->base_buffer, pt_marker) = Fmake_marker (); + set_marker_both (B_ (b->base_buffer, pt_marker), base_buffer, BUF_PT (b->base_buffer), BUF_PT_BYTE (b->base_buffer)); } - if (NILP (b->base_buffer->begv_marker)) + if (NILP (B_ (b->base_buffer, begv_marker))) { - b->base_buffer->begv_marker = Fmake_marker (); - set_marker_both (b->base_buffer->begv_marker, base_buffer, + B_ (b->base_buffer, begv_marker) = Fmake_marker (); + set_marker_both (B_ (b->base_buffer, begv_marker), base_buffer, BUF_BEGV (b->base_buffer), BUF_BEGV_BYTE (b->base_buffer)); } - if (NILP (b->base_buffer->zv_marker)) + if (NILP (B_ (b->base_buffer, zv_marker))) { - b->base_buffer->zv_marker = Fmake_marker (); - set_marker_both (b->base_buffer->zv_marker, base_buffer, + B_ (b->base_buffer, zv_marker) = Fmake_marker (); + set_marker_both (B_ (b->base_buffer, zv_marker), base_buffer, BUF_ZV (b->base_buffer), BUF_ZV_BYTE (b->base_buffer)); - XMARKER (b->base_buffer->zv_marker)->insertion_type = 1; + XMARKER (B_ (b->base_buffer, zv_marker))->insertion_type = 1; } if (NILP (clone)) { /* Give the indirect buffer markers for its narrowing. */ - b->pt_marker = Fmake_marker (); - set_marker_both (b->pt_marker, buf, BUF_PT (b), BUF_PT_BYTE (b)); - b->begv_marker = Fmake_marker (); - set_marker_both (b->begv_marker, buf, BUF_BEGV (b), BUF_BEGV_BYTE (b)); - b->zv_marker = Fmake_marker (); - set_marker_both (b->zv_marker, buf, BUF_ZV (b), BUF_ZV_BYTE (b)); - XMARKER (b->zv_marker)->insertion_type = 1; + B_ (b, pt_marker) = Fmake_marker (); + set_marker_both (B_ (b, pt_marker), buf, BUF_PT (b), BUF_PT_BYTE (b)); + B_ (b, begv_marker) = Fmake_marker (); + set_marker_both (B_ (b, begv_marker), buf, BUF_BEGV (b), BUF_BEGV_BYTE (b)); + B_ (b, zv_marker) = Fmake_marker (); + set_marker_both (B_ (b, zv_marker), buf, BUF_ZV (b), BUF_ZV_BYTE (b)); + XMARKER (B_ (b, zv_marker))->insertion_type = 1; } else { struct buffer *old_b = current_buffer; clone_per_buffer_values (b->base_buffer, b); - b->filename = Qnil; - b->file_truename = Qnil; - b->display_count = make_number (0); - b->backed_up = Qnil; - b->auto_save_file_name = Qnil; + B_ (b, filename) = Qnil; + B_ (b, file_truename) = Qnil; + B_ (b, display_count) = make_number (0); + B_ (b, backed_up) = Qnil; + B_ (b, auto_save_file_name) = Qnil; set_buffer_internal_1 (b); Fset (intern ("buffer-save-without-query"), Qnil); Fset (intern ("buffer-file-number"), Qnil); @@ -647,34 +647,34 @@ delete_all_overlays (struct buffer *b) void reset_buffer (register struct buffer *b) { - b->filename = Qnil; - b->file_truename = Qnil; - b->directory = (current_buffer) ? current_buffer->directory : Qnil; + B_ (b, filename) = Qnil; + B_ (b, file_truename) = Qnil; + B_ (b, directory) = (current_buffer) ? B_ (current_buffer, directory) : Qnil; b->modtime = 0; b->modtime_size = -1; - XSETFASTINT (b->save_length, 0); + XSETFASTINT (B_ (b, save_length), 0); b->last_window_start = 1; /* It is more conservative to start out "changed" than "unchanged". */ b->clip_changed = 0; b->prevent_redisplay_optimizations_p = 1; - b->backed_up = Qnil; + B_ (b, backed_up) = Qnil; BUF_AUTOSAVE_MODIFF (b) = 0; b->auto_save_failure_time = -1; - b->auto_save_file_name = Qnil; - b->read_only = Qnil; + B_ (b, auto_save_file_name) = Qnil; + B_ (b, read_only) = Qnil; b->overlays_before = NULL; b->overlays_after = NULL; b->overlay_center = BEG; - b->mark_active = Qnil; - b->point_before_scroll = Qnil; - b->file_format = Qnil; - b->auto_save_file_format = Qt; - b->last_selected_window = Qnil; - XSETINT (b->display_count, 0); - b->display_time = Qnil; - b->enable_multibyte_characters = buffer_defaults.enable_multibyte_characters; - b->cursor_type = buffer_defaults.cursor_type; - b->extra_line_spacing = buffer_defaults.extra_line_spacing; + B_ (b, mark_active) = Qnil; + B_ (b, point_before_scroll) = Qnil; + B_ (b, file_format) = Qnil; + B_ (b, auto_save_file_format) = Qt; + B_ (b, last_selected_window) = Qnil; + XSETINT (B_ (b, display_count), 0); + B_ (b, display_time) = Qnil; + B_ (b, enable_multibyte_characters) = B_ (&buffer_defaults, enable_multibyte_characters); + B_ (b, cursor_type) = B_ (&buffer_defaults, cursor_type); + B_ (b, extra_line_spacing) = B_ (&buffer_defaults, extra_line_spacing); b->display_error_modiff = 0; } @@ -698,10 +698,10 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too) things that depend on the major mode. default-major-mode is handled at a higher level. We ignore it here. */ - b->major_mode = Qfundamental_mode; - b->keymap = Qnil; - b->mode_name = QSFundamental; - b->minor_modes = Qnil; + B_ (b, major_mode) = Qfundamental_mode; + B_ (b, keymap) = Qnil; + B_ (b, mode_name) = QSFundamental; + B_ (b, minor_modes) = Qnil; /* If the standard case table has been altered and invalidated, fix up its insides first. */ @@ -710,22 +710,22 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too) && CHAR_TABLE_P (XCHAR_TABLE (Vascii_downcase_table)->extras[2]))) Fset_standard_case_table (Vascii_downcase_table); - b->downcase_table = Vascii_downcase_table; - b->upcase_table = XCHAR_TABLE (Vascii_downcase_table)->extras[0]; - b->case_canon_table = XCHAR_TABLE (Vascii_downcase_table)->extras[1]; - b->case_eqv_table = XCHAR_TABLE (Vascii_downcase_table)->extras[2]; - b->invisibility_spec = Qt; + B_ (b, downcase_table) = Vascii_downcase_table; + B_ (b, upcase_table) = XCHAR_TABLE (Vascii_downcase_table)->extras[0]; + B_ (b, case_canon_table) = XCHAR_TABLE (Vascii_downcase_table)->extras[1]; + B_ (b, case_eqv_table) = XCHAR_TABLE (Vascii_downcase_table)->extras[2]; + B_ (b, invisibility_spec) = Qt; #ifndef DOS_NT - b->buffer_file_type = Qnil; + B_ (b, buffer_file_type) = Qnil; #endif /* Reset all (or most) per-buffer variables to their defaults. */ if (permanent_too) - b->local_var_alist = Qnil; + B_ (b, local_var_alist) = Qnil; else { Lisp_Object tmp, prop, last = Qnil; - for (tmp = b->local_var_alist; CONSP (tmp); tmp = XCDR (tmp)) + for (tmp = B_ (b, local_var_alist); CONSP (tmp); tmp = XCDR (tmp)) if (!NILP (prop = Fget (XCAR (XCAR (tmp)), Qpermanent_local))) { /* If permanent-local, keep it. */ @@ -755,7 +755,7 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too) } /* Delete this local variable. */ else if (NILP (last)) - b->local_var_alist = XCDR (tmp); + B_ (b, local_var_alist) = XCDR (tmp); else XSETCDR (last, XCDR (tmp)); } @@ -830,9 +830,9 @@ Return nil if BUFFER has been killed. */) (register Lisp_Object buffer) { if (NILP (buffer)) - return current_buffer->name; + return B_ (current_buffer, name); CHECK_BUFFER (buffer); - return XBUFFER (buffer)->name; + return B_ (XBUFFER (buffer), name); } DEFUN ("buffer-file-name", Fbuffer_file_name, Sbuffer_file_name, 0, 1, 0, @@ -841,9 +841,9 @@ No argument or nil as argument means use the current buffer. */) (register Lisp_Object buffer) { if (NILP (buffer)) - return current_buffer->filename; + return B_ (current_buffer, filename); CHECK_BUFFER (buffer); - return XBUFFER (buffer)->filename; + return B_ (XBUFFER (buffer), filename); } DEFUN ("buffer-base-buffer", Fbuffer_base_buffer, Sbuffer_base_buffer, @@ -895,7 +895,7 @@ is the default binding of the variable. */) { /* Look in local_var_alist. */ struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym); XSETSYMBOL (variable, sym); /* Update In case of aliasing. */ - result = Fassoc (variable, buf->local_var_alist); + result = Fassoc (variable, B_ (buf, local_var_alist)); if (!NILP (result)) { if (blv->fwd) @@ -944,7 +944,7 @@ buffer_lisp_local_variables (struct buffer *buf) { Lisp_Object result = Qnil; register Lisp_Object tail; - for (tail = buf->local_var_alist; CONSP (tail); tail = XCDR (tail)) + for (tail = B_ (buf, local_var_alist); CONSP (tail); tail = XCDR (tail)) { Lisp_Object val, elt; @@ -1043,9 +1043,9 @@ A non-nil FLAG means mark the buffer modified. */) /* If buffer becoming modified, lock the file. If buffer becoming unmodified, unlock the file. */ - fn = current_buffer->file_truename; + fn = B_ (current_buffer, file_truename); /* Test buffer-file-name so that binding it to nil is effective. */ - if (!NILP (fn) && ! NILP (current_buffer->filename)) + if (!NILP (fn) && ! NILP (B_ (current_buffer, filename))) { already = SAVE_MODIFF < MODIFF; if (!already && !NILP (flag)) @@ -1110,9 +1110,9 @@ state of the current buffer. Use with care. */) /* If buffer becoming modified, lock the file. If buffer becoming unmodified, unlock the file. */ - fn = current_buffer->file_truename; + fn = B_ (current_buffer, file_truename); /* Test buffer-file-name so that binding it to nil is effective. */ - if (!NILP (fn) && ! NILP (current_buffer->filename)) + if (!NILP (fn) && ! NILP (B_ (current_buffer, filename))) { int already = SAVE_MODIFF < MODIFF; if (!already && !NILP (flag)) @@ -1199,14 +1199,14 @@ This does not change the name of the visited file (if any). */) with the original name. It makes UNIQUE equivalent to (rename-buffer (generate-new-buffer-name NEWNAME)). */ if (NILP (unique) && XBUFFER (tem) == current_buffer) - return current_buffer->name; + return B_ (current_buffer, name); if (!NILP (unique)) - newname = Fgenerate_new_buffer_name (newname, current_buffer->name); + newname = Fgenerate_new_buffer_name (newname, B_ (current_buffer, name)); else error ("Buffer name `%s' is in use", SDATA (newname)); } - current_buffer->name = newname; + B_ (current_buffer, name) = newname; /* Catch redisplay's attention. Unless we do this, the mode lines for any windows displaying current_buffer will stay unchanged. */ @@ -1214,11 +1214,11 @@ This does not change the name of the visited file (if any). */) XSETBUFFER (buf, current_buffer); Fsetcar (Frassq (buf, Vbuffer_alist), newname); - if (NILP (current_buffer->filename) - && !NILP (current_buffer->auto_save_file_name)) + if (NILP (B_ (current_buffer, filename)) + && !NILP (B_ (current_buffer, auto_save_file_name))) call0 (intern ("rename-auto-save-file")); /* Refetch since that last call may have done GC. */ - return current_buffer->name; + return B_ (current_buffer, name); } DEFUN ("other-buffer", Fother_buffer, Sother_buffer, 0, 3, 0, @@ -1263,9 +1263,9 @@ If BUFFER is omitted or nil, some interesting buffer is returned. */) continue; if (NILP (buf)) continue; - if (NILP (XBUFFER (buf)->name)) + if (NILP (B_ (XBUFFER (buf), name))) continue; - if (SREF (XBUFFER (buf)->name, 0) == ' ') + if (SREF (B_ (XBUFFER (buf), name), 0) == ' ') continue; /* If the selected frame has a buffer_predicate, disregard buffers that don't fit the predicate. */ @@ -1313,8 +1313,8 @@ No argument or nil as argument means do this for the current buffer. */) nsberror (buffer); } - if (EQ (XBUFFER (real_buffer)->undo_list, Qt)) - XBUFFER (real_buffer)->undo_list = Qnil; + if (EQ (B_ (XBUFFER (real_buffer), undo_list), Qt)) + B_ (XBUFFER (real_buffer), undo_list) = Qnil; return Qnil; } @@ -1359,16 +1359,16 @@ with SIGHUP. */) b = XBUFFER (buffer); /* Avoid trouble for buffer already dead. */ - if (NILP (b->name)) + if (NILP (B_ (b, name))) return Qnil; /* Query if the buffer is still modified. */ - if (INTERACTIVE && !NILP (b->filename) + if (INTERACTIVE && !NILP (B_ (b, filename)) && BUF_MODIFF (b) > BUF_SAVE_MODIFF (b)) { GCPRO1 (buffer); tem = do_yes_or_no_p (format2 ("Buffer %s modified; kill anyway? ", - b->name, make_number (0))); + B_ (b, name), make_number (0))); UNGCPRO; if (NILP (tem)) return Qnil; @@ -1402,7 +1402,7 @@ with SIGHUP. */) if (EQ (buffer, XWINDOW (minibuf_window)->buffer)) return Qnil; - if (NILP (b->name)) + if (NILP (B_ (b, name))) return Qnil; /* When we kill a base buffer, kill all its indirect buffers. @@ -1417,7 +1417,7 @@ with SIGHUP. */) for (other = all_buffers; other; other = other->next) /* all_buffers contains dead buffers too; don't re-kill them. */ - if (other->base_buffer == b && !NILP (other->name)) + if (other->base_buffer == b && !NILP (B_ (other, name))) { Lisp_Object buffer; XSETBUFFER (buffer, other); @@ -1462,7 +1462,7 @@ with SIGHUP. */) /* Killing buffer processes may run sentinels which may have called kill-buffer. */ - if (NILP (b->name)) + if (NILP (B_ (b, name))) return Qnil; clear_charpos_cache (b); @@ -1476,7 +1476,7 @@ with SIGHUP. */) /* Delete any auto-save file, if we saved it in this session. But not if the buffer is modified. */ - if (STRINGP (b->auto_save_file_name) + if (STRINGP (B_ (b, auto_save_file_name)) && BUF_AUTOSAVE_MODIFF (b) != 0 && BUF_SAVE_MODIFF (b) < BUF_AUTOSAVE_MODIFF (b) && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b) @@ -1485,7 +1485,7 @@ with SIGHUP. */) Lisp_Object tem; tem = Fsymbol_value (intern ("delete-auto-save-files")); if (! NILP (tem)) - internal_delete_file (b->auto_save_file_name); + internal_delete_file (B_ (b, auto_save_file_name)); } if (b->base_buffer) @@ -1525,7 +1525,7 @@ with SIGHUP. */) swap_out_buffer_local_variables (b); reset_buffer_local_variables (b, 1); - b->name = Qnil; + B_ (b, name) = Qnil; BLOCK_INPUT; if (! b->base_buffer) @@ -1541,9 +1541,9 @@ with SIGHUP. */) free_region_cache (b->width_run_cache); b->width_run_cache = 0; } - b->width_table = Qnil; + B_ (b, width_table) = Qnil; UNBLOCK_INPUT; - b->undo_list = Qnil; + B_ (b, undo_list) = Qnil; return Qt; } @@ -1637,15 +1637,15 @@ the current buffer's major mode. */) CHECK_BUFFER (buffer); - if (STRINGP (XBUFFER (buffer)->name) - && strcmp (SSDATA (XBUFFER (buffer)->name), "*scratch*") == 0) + if (STRINGP (B_ (XBUFFER (buffer), name)) + && strcmp (SSDATA (B_ (XBUFFER (buffer), name)), "*scratch*") == 0) function = find_symbol_value (intern ("initial-major-mode")); else { - function = buffer_defaults.major_mode; + function = B_ (&buffer_defaults, major_mode); if (NILP (function) - && NILP (Fget (current_buffer->major_mode, Qmode_class))) - function = current_buffer->major_mode; + && NILP (Fget (B_ (current_buffer, major_mode), Qmode_class))) + function = B_ (current_buffer, major_mode); } if (NILP (function) || EQ (function, Qfundamental_mode)) @@ -1795,29 +1795,29 @@ set_buffer_internal_1 (register struct buffer *b) /* Put the undo list back in the base buffer, so that it appears that an indirect buffer shares the undo list of its base. */ if (old_buf->base_buffer) - old_buf->base_buffer->undo_list = old_buf->undo_list; + B_ (old_buf->base_buffer, undo_list) = B_ (old_buf, undo_list); /* If the old current buffer has markers to record PT, BEGV and ZV when it is not current, update them now. */ - if (! NILP (old_buf->pt_marker)) + if (! NILP (B_ (old_buf, pt_marker))) { Lisp_Object obuf; XSETBUFFER (obuf, old_buf); - set_marker_both (old_buf->pt_marker, obuf, + set_marker_both (B_ (old_buf, pt_marker), obuf, BUF_PT (old_buf), BUF_PT_BYTE (old_buf)); } - if (! NILP (old_buf->begv_marker)) + if (! NILP (B_ (old_buf, begv_marker))) { Lisp_Object obuf; XSETBUFFER (obuf, old_buf); - set_marker_both (old_buf->begv_marker, obuf, + set_marker_both (B_ (old_buf, begv_marker), obuf, BUF_BEGV (old_buf), BUF_BEGV_BYTE (old_buf)); } - if (! NILP (old_buf->zv_marker)) + if (! NILP (B_ (old_buf, zv_marker))) { Lisp_Object obuf; XSETBUFFER (obuf, old_buf); - set_marker_both (old_buf->zv_marker, obuf, + set_marker_both (B_ (old_buf, zv_marker), obuf, BUF_ZV (old_buf), BUF_ZV_BYTE (old_buf)); } } @@ -1825,24 +1825,24 @@ set_buffer_internal_1 (register struct buffer *b) /* Get the undo list from the base buffer, so that it appears that an indirect buffer shares the undo list of its base. */ if (b->base_buffer) - b->undo_list = b->base_buffer->undo_list; + B_ (b, undo_list) = B_ (b->base_buffer, undo_list); /* If the new current buffer has markers to record PT, BEGV and ZV when it is not current, fetch them now. */ - if (! NILP (b->pt_marker)) + if (! NILP (B_ (b, pt_marker))) { - BUF_PT (b) = marker_position (b->pt_marker); - BUF_PT_BYTE (b) = marker_byte_position (b->pt_marker); + BUF_PT (b) = marker_position (B_ (b, pt_marker)); + BUF_PT_BYTE (b) = marker_byte_position (B_ (b, pt_marker)); } - if (! NILP (b->begv_marker)) + if (! NILP (B_ (b, begv_marker))) { - BUF_BEGV (b) = marker_position (b->begv_marker); - BUF_BEGV_BYTE (b) = marker_byte_position (b->begv_marker); + BUF_BEGV (b) = marker_position (B_ (b, begv_marker)); + BUF_BEGV_BYTE (b) = marker_byte_position (B_ (b, begv_marker)); } - if (! NILP (b->zv_marker)) + if (! NILP (B_ (b, zv_marker))) { - BUF_ZV (b) = marker_position (b->zv_marker); - BUF_ZV_BYTE (b) = marker_byte_position (b->zv_marker); + BUF_ZV (b) = marker_position (B_ (b, zv_marker)); + BUF_ZV_BYTE (b) = marker_byte_position (B_ (b, zv_marker)); } /* Look down buffer's list of local Lisp variables @@ -1850,7 +1850,7 @@ set_buffer_internal_1 (register struct buffer *b) do { - for (tail = b->local_var_alist; CONSP (tail); tail = XCDR (tail)) + for (tail = B_ (b, local_var_alist); CONSP (tail); tail = XCDR (tail)) { Lisp_Object var = XCAR (XCAR (tail)); struct Lisp_Symbol *sym = XSYMBOL (var); @@ -1883,45 +1883,45 @@ set_buffer_temp (struct buffer *b) { /* If the old current buffer has markers to record PT, BEGV and ZV when it is not current, update them now. */ - if (! NILP (old_buf->pt_marker)) + if (! NILP (B_ (old_buf, pt_marker))) { Lisp_Object obuf; XSETBUFFER (obuf, old_buf); - set_marker_both (old_buf->pt_marker, obuf, + set_marker_both (B_ (old_buf, pt_marker), obuf, BUF_PT (old_buf), BUF_PT_BYTE (old_buf)); } - if (! NILP (old_buf->begv_marker)) + if (! NILP (B_ (old_buf, begv_marker))) { Lisp_Object obuf; XSETBUFFER (obuf, old_buf); - set_marker_both (old_buf->begv_marker, obuf, + set_marker_both (B_ (old_buf, begv_marker), obuf, BUF_BEGV (old_buf), BUF_BEGV_BYTE (old_buf)); } - if (! NILP (old_buf->zv_marker)) + if (! NILP (B_ (old_buf, zv_marker))) { Lisp_Object obuf; XSETBUFFER (obuf, old_buf); - set_marker_both (old_buf->zv_marker, obuf, + set_marker_both (B_ (old_buf, zv_marker), obuf, BUF_ZV (old_buf), BUF_ZV_BYTE (old_buf)); } } /* If the new current buffer has markers to record PT, BEGV and ZV when it is not current, fetch them now. */ - if (! NILP (b->pt_marker)) + if (! NILP (B_ (b, pt_marker))) { - BUF_PT (b) = marker_position (b->pt_marker); - BUF_PT_BYTE (b) = marker_byte_position (b->pt_marker); + BUF_PT (b) = marker_position (B_ (b, pt_marker)); + BUF_PT_BYTE (b) = marker_byte_position (B_ (b, pt_marker)); } - if (! NILP (b->begv_marker)) + if (! NILP (B_ (b, begv_marker))) { - BUF_BEGV (b) = marker_position (b->begv_marker); - BUF_BEGV_BYTE (b) = marker_byte_position (b->begv_marker); + BUF_BEGV (b) = marker_position (B_ (b, begv_marker)); + BUF_BEGV_BYTE (b) = marker_byte_position (B_ (b, begv_marker)); } - if (! NILP (b->zv_marker)) + if (! NILP (B_ (b, zv_marker))) { - BUF_ZV (b) = marker_position (b->zv_marker); - BUF_ZV_BYTE (b) = marker_byte_position (b->zv_marker); + BUF_ZV (b) = marker_position (B_ (b, zv_marker)); + BUF_ZV_BYTE (b) = marker_byte_position (B_ (b, zv_marker)); } } @@ -1938,7 +1938,7 @@ ends when the current command terminates. Use `switch-to-buffer' or buffer = Fget_buffer (buffer_or_name); if (NILP (buffer)) nsberror (buffer_or_name); - if (NILP (XBUFFER (buffer)->name)) + if (NILP (B_ (XBUFFER (buffer), name))) error ("Selecting deleted buffer"); set_buffer_internal (XBUFFER (buffer)); return buffer; @@ -1949,7 +1949,7 @@ ends when the current command terminates. Use `switch-to-buffer' or Lisp_Object set_buffer_if_live (Lisp_Object buffer) { - if (! NILP (XBUFFER (buffer)->name)) + if (! NILP (B_ (XBUFFER (buffer), name))) Fset_buffer (buffer); return Qnil; } @@ -1959,7 +1959,7 @@ DEFUN ("barf-if-buffer-read-only", Fbarf_if_buffer_read_only, doc: /* Signal a `buffer-read-only' error if the current buffer is read-only. */) (void) { - if (!NILP (current_buffer->read_only) + if (!NILP (B_ (current_buffer, read_only)) && NILP (Vinhibit_read_only)) xsignal1 (Qbuffer_read_only, Fcurrent_buffer ()); return Qnil; @@ -2008,7 +2008,7 @@ its frame, iconify that frame. */) /* Move buffer to the end of the buffer list. Do nothing if the buffer is killed. */ - if (!NILP (XBUFFER (buffer)->name)) + if (!NILP (B_ (XBUFFER (buffer), name))) { Lisp_Object aelt, link; @@ -2041,7 +2041,7 @@ so the buffer is truly empty after this. */) /* Prevent warnings, or suspension of auto saving, that would happen if future size is less than past size. Use of erase-buffer implies that the future text is not really related to the past text. */ - XSETFASTINT (current_buffer->save_length, 0); + XSETFASTINT (B_ (current_buffer, save_length), 0); return Qnil; } @@ -2111,7 +2111,7 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text, CHECK_BUFFER (buffer); other_buffer = XBUFFER (buffer); - if (NILP (other_buffer->name)) + if (NILP (B_ (other_buffer, name))) error ("Cannot swap a dead buffer's text"); /* Actually, it probably works just fine. @@ -2138,6 +2138,12 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text, other_buffer->field = current_buffer->field; \ current_buffer->field = tmp##field; \ } while (0) +#define swapfield_(field, type) \ + do { \ + type tmp##field = B_ (other_buffer, field); \ + B_ (other_buffer, field) = B_ (current_buffer, field); \ + B_ (current_buffer, field) = tmp##field; \ + } while (0) swapfield (own_text, struct buffer_text); eassert (current_buffer->text == ¤t_buffer->own_text); @@ -2165,18 +2171,18 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text, swapfield (overlays_before, struct Lisp_Overlay *); swapfield (overlays_after, struct Lisp_Overlay *); swapfield (overlay_center, EMACS_INT); - swapfield (undo_list, Lisp_Object); - swapfield (mark, Lisp_Object); - swapfield (enable_multibyte_characters, Lisp_Object); - swapfield (bidi_display_reordering, Lisp_Object); - swapfield (bidi_paragraph_direction, Lisp_Object); + swapfield_ (undo_list, Lisp_Object); + swapfield_ (mark, Lisp_Object); + swapfield_ (enable_multibyte_characters, Lisp_Object); + swapfield_ (bidi_display_reordering, Lisp_Object); + swapfield_ (bidi_paragraph_direction, Lisp_Object); /* FIXME: Not sure what we should do with these *_marker fields. Hopefully they're just nil anyway. */ - swapfield (pt_marker, Lisp_Object); - swapfield (begv_marker, Lisp_Object); - swapfield (zv_marker, Lisp_Object); - current_buffer->point_before_scroll = Qnil; - other_buffer->point_before_scroll = Qnil; + swapfield_ (pt_marker, Lisp_Object); + swapfield_ (begv_marker, Lisp_Object); + swapfield_ (zv_marker, Lisp_Object); + B_ (current_buffer, point_before_scroll) = Qnil; + B_ (other_buffer, point_before_scroll) = Qnil; current_buffer->text->modiff++; other_buffer->text->modiff++; current_buffer->text->chars_modiff++; other_buffer->text->chars_modiff++; @@ -2250,21 +2256,21 @@ current buffer is cleared. */) EMACS_INT begv, zv; int narrowed = (BEG != BEGV || Z != ZV); int modified_p = !NILP (Fbuffer_modified_p (Qnil)); - Lisp_Object old_undo = current_buffer->undo_list; + Lisp_Object old_undo = B_ (current_buffer, undo_list); struct gcpro gcpro1; if (current_buffer->base_buffer) error ("Cannot do `set-buffer-multibyte' on an indirect buffer"); /* Do nothing if nothing actually changes. */ - if (NILP (flag) == NILP (current_buffer->enable_multibyte_characters)) + if (NILP (flag) == NILP (B_ (current_buffer, enable_multibyte_characters))) return flag; GCPRO1 (old_undo); /* Don't record these buffer changes. We will put a special undo entry instead. */ - current_buffer->undo_list = Qt; + B_ (current_buffer, undo_list) = Qt; /* If the cached position is for this buffer, clear it out. */ clear_charpos_cache (current_buffer); @@ -2286,7 +2292,7 @@ current buffer is cleared. */) to calculate the old correspondences. */ set_intervals_multibyte (0); - current_buffer->enable_multibyte_characters = Qnil; + B_ (current_buffer, enable_multibyte_characters) = Qnil; Z = Z_BYTE; BEGV = BEGV_BYTE; @@ -2424,7 +2430,7 @@ current buffer is cleared. */) /* Do this first, so that chars_in_text asks the right question. set_intervals_multibyte needs it too. */ - current_buffer->enable_multibyte_characters = Qt; + B_ (current_buffer, enable_multibyte_characters) = Qt; GPT_BYTE = advance_to_char_boundary (GPT_BYTE); GPT = chars_in_text (BEG_ADDR, GPT_BYTE - BEG_BYTE) + BEG; @@ -2482,7 +2488,7 @@ current buffer is cleared. */) if (!EQ (old_undo, Qt)) { /* Represent all the above changes by a special undo entry. */ - current_buffer->undo_list = Fcons (list3 (Qapply, + B_ (current_buffer, undo_list) = Fcons (list3 (Qapply, intern ("set-buffer-multibyte"), NILP (flag) ? Qt : Qnil), old_undo); @@ -2498,10 +2504,10 @@ current buffer is cleared. */) /* Copy this buffer's new multibyte status into all of its indirect buffers. */ for (other = all_buffers; other; other = other->next) - if (other->base_buffer == current_buffer && !NILP (other->name)) + if (other->base_buffer == current_buffer && !NILP (B_ (other, name))) { - other->enable_multibyte_characters - = current_buffer->enable_multibyte_characters; + B_ (other, enable_multibyte_characters) + = B_ (current_buffer, enable_multibyte_characters); other->prevent_redisplay_optimizations_p = 1; } @@ -2568,7 +2574,7 @@ swap_out_buffer_local_variables (struct buffer *b) Lisp_Object oalist, alist, buffer; XSETBUFFER (buffer, b); - oalist = b->local_var_alist; + oalist = B_ (b, local_var_alist); for (alist = oalist; CONSP (alist); alist = XCDR (alist)) { @@ -3072,7 +3078,7 @@ record_overlay_string (struct sortstrlist *ssl, Lisp_Object str, Lisp_Object str ssl->buf[ssl->used].priority = (INTEGERP (pri) ? XINT (pri) : 0); ssl->used++; - if (NILP (current_buffer->enable_multibyte_characters)) + if (NILP (B_ (current_buffer, enable_multibyte_characters))) nbytes = SCHARS (str); else if (! STRING_MULTIBYTE (str)) nbytes = count_size_as_multibyte (SDATA (str), @@ -3084,7 +3090,7 @@ record_overlay_string (struct sortstrlist *ssl, Lisp_Object str, Lisp_Object str if (STRINGP (str2)) { - if (NILP (current_buffer->enable_multibyte_characters)) + if (NILP (B_ (current_buffer, enable_multibyte_characters))) nbytes = SCHARS (str2); else if (! STRING_MULTIBYTE (str2)) nbytes = count_size_as_multibyte (SDATA (str2), @@ -3114,7 +3120,7 @@ overlay_strings (EMACS_INT pos, struct window *w, unsigned char **pstr) Lisp_Object overlay, window, str; struct Lisp_Overlay *ov; EMACS_INT startpos, endpos; - int multibyte = ! NILP (current_buffer->enable_multibyte_characters); + int multibyte = ! NILP (B_ (current_buffer, enable_multibyte_characters)); overlay_heads.used = overlay_heads.bytes = 0; overlay_tails.used = overlay_tails.bytes = 0; @@ -4985,9 +4991,9 @@ init_buffer_once (void) /* Make sure all markable slots in buffer_defaults are initialized reasonably, so mark_buffer won't choke. */ reset_buffer (&buffer_defaults); - eassert (EQ (buffer_defaults.name, make_number (0))); + eassert (EQ (B_ (&buffer_defaults, name), make_number (0))); reset_buffer_local_variables (&buffer_defaults, 1); - eassert (EQ (buffer_local_symbols.name, make_number (0))); + eassert (EQ (B_ (&buffer_local_symbols, name), make_number (0))); reset_buffer (&buffer_local_symbols); reset_buffer_local_variables (&buffer_local_symbols, 1); /* Prevent GC from getting confused. */ @@ -5004,60 +5010,60 @@ init_buffer_once (void) /* Must do these before making the first buffer! */ /* real setup is done in bindings.el */ - buffer_defaults.mode_line_format = make_pure_c_string ("%-"); - buffer_defaults.header_line_format = Qnil; - buffer_defaults.abbrev_mode = Qnil; - buffer_defaults.overwrite_mode = Qnil; - buffer_defaults.case_fold_search = Qt; - buffer_defaults.auto_fill_function = Qnil; - buffer_defaults.selective_display = Qnil; + B_ (&buffer_defaults, mode_line_format) = make_pure_c_string ("%-"); + B_ (&buffer_defaults, header_line_format) = Qnil; + B_ (&buffer_defaults, abbrev_mode) = Qnil; + B_ (&buffer_defaults, overwrite_mode) = Qnil; + B_ (&buffer_defaults, case_fold_search) = Qt; + B_ (&buffer_defaults, auto_fill_function) = Qnil; + B_ (&buffer_defaults, selective_display) = Qnil; #ifndef old - buffer_defaults.selective_display_ellipses = Qt; + B_ (&buffer_defaults, selective_display_ellipses) = Qt; #endif - buffer_defaults.abbrev_table = Qnil; - buffer_defaults.display_table = Qnil; - buffer_defaults.undo_list = Qnil; - buffer_defaults.mark_active = Qnil; - buffer_defaults.file_format = Qnil; - buffer_defaults.auto_save_file_format = Qt; + B_ (&buffer_defaults, abbrev_table) = Qnil; + B_ (&buffer_defaults, display_table) = Qnil; + B_ (&buffer_defaults, undo_list) = Qnil; + B_ (&buffer_defaults, mark_active) = Qnil; + B_ (&buffer_defaults, file_format) = Qnil; + B_ (&buffer_defaults, auto_save_file_format) = Qt; buffer_defaults.overlays_before = NULL; buffer_defaults.overlays_after = NULL; buffer_defaults.overlay_center = BEG; - XSETFASTINT (buffer_defaults.tab_width, 8); - buffer_defaults.truncate_lines = Qnil; - buffer_defaults.word_wrap = Qnil; - buffer_defaults.ctl_arrow = Qt; - buffer_defaults.bidi_display_reordering = Qnil; - buffer_defaults.bidi_paragraph_direction = Qnil; - buffer_defaults.cursor_type = Qt; - buffer_defaults.extra_line_spacing = Qnil; - buffer_defaults.cursor_in_non_selected_windows = Qt; + XSETFASTINT (B_ (&buffer_defaults, tab_width), 8); + B_ (&buffer_defaults, truncate_lines) = Qnil; + B_ (&buffer_defaults, word_wrap) = Qnil; + B_ (&buffer_defaults, ctl_arrow) = Qt; + B_ (&buffer_defaults, bidi_display_reordering) = Qnil; + B_ (&buffer_defaults, bidi_paragraph_direction) = Qnil; + B_ (&buffer_defaults, cursor_type) = Qt; + B_ (&buffer_defaults, extra_line_spacing) = Qnil; + B_ (&buffer_defaults, cursor_in_non_selected_windows) = Qt; #ifdef DOS_NT buffer_defaults.buffer_file_type = Qnil; /* TEXT */ #endif - buffer_defaults.enable_multibyte_characters = Qt; - buffer_defaults.buffer_file_coding_system = Qnil; - XSETFASTINT (buffer_defaults.fill_column, 70); - XSETFASTINT (buffer_defaults.left_margin, 0); - buffer_defaults.cache_long_line_scans = Qnil; - buffer_defaults.file_truename = Qnil; - XSETFASTINT (buffer_defaults.display_count, 0); - XSETFASTINT (buffer_defaults.left_margin_cols, 0); - XSETFASTINT (buffer_defaults.right_margin_cols, 0); - buffer_defaults.left_fringe_width = Qnil; - buffer_defaults.right_fringe_width = Qnil; - buffer_defaults.fringes_outside_margins = Qnil; - buffer_defaults.scroll_bar_width = Qnil; - buffer_defaults.vertical_scroll_bar_type = Qt; - buffer_defaults.indicate_empty_lines = Qnil; - buffer_defaults.indicate_buffer_boundaries = Qnil; - buffer_defaults.fringe_indicator_alist = Qnil; - buffer_defaults.fringe_cursor_alist = Qnil; - buffer_defaults.scroll_up_aggressively = Qnil; - buffer_defaults.scroll_down_aggressively = Qnil; - buffer_defaults.display_time = Qnil; + B_ (&buffer_defaults, enable_multibyte_characters) = Qt; + B_ (&buffer_defaults, buffer_file_coding_system) = Qnil; + XSETFASTINT (B_ (&buffer_defaults, fill_column), 70); + XSETFASTINT (B_ (&buffer_defaults, left_margin), 0); + B_ (&buffer_defaults, cache_long_line_scans) = Qnil; + B_ (&buffer_defaults, file_truename) = Qnil; + XSETFASTINT (B_ (&buffer_defaults, display_count), 0); + XSETFASTINT (B_ (&buffer_defaults, left_margin_cols), 0); + XSETFASTINT (B_ (&buffer_defaults, right_margin_cols), 0); + B_ (&buffer_defaults, left_fringe_width) = Qnil; + B_ (&buffer_defaults, right_fringe_width) = Qnil; + B_ (&buffer_defaults, fringes_outside_margins) = Qnil; + B_ (&buffer_defaults, scroll_bar_width) = Qnil; + B_ (&buffer_defaults, vertical_scroll_bar_type) = Qt; + B_ (&buffer_defaults, indicate_empty_lines) = Qnil; + B_ (&buffer_defaults, indicate_buffer_boundaries) = Qnil; + B_ (&buffer_defaults, fringe_indicator_alist) = Qnil; + B_ (&buffer_defaults, fringe_cursor_alist) = Qnil; + B_ (&buffer_defaults, scroll_up_aggressively) = Qnil; + B_ (&buffer_defaults, scroll_down_aggressively) = Qnil; + B_ (&buffer_defaults, display_time) = Qnil; /* Assign the local-flags to the slots that have default values. The local flag is a bit that is used in the buffer @@ -5069,73 +5075,73 @@ init_buffer_once (void) /* 0 means not a lisp var, -1 means always local, else mask */ memset (&buffer_local_flags, 0, sizeof buffer_local_flags); - XSETINT (buffer_local_flags.filename, -1); - XSETINT (buffer_local_flags.directory, -1); - XSETINT (buffer_local_flags.backed_up, -1); - XSETINT (buffer_local_flags.save_length, -1); - XSETINT (buffer_local_flags.auto_save_file_name, -1); - XSETINT (buffer_local_flags.read_only, -1); - XSETINT (buffer_local_flags.major_mode, -1); - XSETINT (buffer_local_flags.mode_name, -1); - XSETINT (buffer_local_flags.undo_list, -1); - XSETINT (buffer_local_flags.mark_active, -1); - XSETINT (buffer_local_flags.point_before_scroll, -1); - XSETINT (buffer_local_flags.file_truename, -1); - XSETINT (buffer_local_flags.invisibility_spec, -1); - XSETINT (buffer_local_flags.file_format, -1); - XSETINT (buffer_local_flags.auto_save_file_format, -1); - XSETINT (buffer_local_flags.display_count, -1); - XSETINT (buffer_local_flags.display_time, -1); - XSETINT (buffer_local_flags.enable_multibyte_characters, -1); + XSETINT (B_ (&buffer_local_flags, filename), -1); + XSETINT (B_ (&buffer_local_flags, directory), -1); + XSETINT (B_ (&buffer_local_flags, backed_up), -1); + XSETINT (B_ (&buffer_local_flags, save_length), -1); + XSETINT (B_ (&buffer_local_flags, auto_save_file_name), -1); + XSETINT (B_ (&buffer_local_flags, read_only), -1); + XSETINT (B_ (&buffer_local_flags, major_mode), -1); + XSETINT (B_ (&buffer_local_flags, mode_name), -1); + XSETINT (B_ (&buffer_local_flags, undo_list), -1); + XSETINT (B_ (&buffer_local_flags, mark_active), -1); + XSETINT (B_ (&buffer_local_flags, point_before_scroll), -1); + XSETINT (B_ (&buffer_local_flags, file_truename), -1); + XSETINT (B_ (&buffer_local_flags, invisibility_spec), -1); + XSETINT (B_ (&buffer_local_flags, file_format), -1); + XSETINT (B_ (&buffer_local_flags, auto_save_file_format), -1); + XSETINT (B_ (&buffer_local_flags, display_count), -1); + XSETINT (B_ (&buffer_local_flags, display_time), -1); + XSETINT (B_ (&buffer_local_flags, enable_multibyte_characters), -1); idx = 1; - XSETFASTINT (buffer_local_flags.mode_line_format, idx); ++idx; - XSETFASTINT (buffer_local_flags.abbrev_mode, idx); ++idx; - XSETFASTINT (buffer_local_flags.overwrite_mode, idx); ++idx; - XSETFASTINT (buffer_local_flags.case_fold_search, idx); ++idx; - XSETFASTINT (buffer_local_flags.auto_fill_function, idx); ++idx; - XSETFASTINT (buffer_local_flags.selective_display, idx); ++idx; + XSETFASTINT (B_ (&buffer_local_flags, mode_line_format), idx); ++idx; + XSETFASTINT (B_ (&buffer_local_flags, abbrev_mode), idx); ++idx; + XSETFASTINT (B_ (&buffer_local_flags, overwrite_mode), idx); ++idx; + XSETFASTINT (B_ (&buffer_local_flags, case_fold_search), idx); ++idx; + XSETFASTINT (B_ (&buffer_local_flags, auto_fill_function), idx); ++idx; + XSETFASTINT (B_ (&buffer_local_flags, selective_display), idx); ++idx; #ifndef old - XSETFASTINT (buffer_local_flags.selective_display_ellipses, idx); ++idx; + XSETFASTINT (B_ (&buffer_local_flags, selective_display_ellipses), idx); ++idx; #endif - XSETFASTINT (buffer_local_flags.tab_width, idx); ++idx; - XSETFASTINT (buffer_local_flags.truncate_lines, idx); ++idx; - XSETFASTINT (buffer_local_flags.word_wrap, idx); ++idx; - XSETFASTINT (buffer_local_flags.ctl_arrow, idx); ++idx; - XSETFASTINT (buffer_local_flags.fill_column, idx); ++idx; - XSETFASTINT (buffer_local_flags.left_margin, idx); ++idx; - XSETFASTINT (buffer_local_flags.abbrev_table, idx); ++idx; - XSETFASTINT (buffer_local_flags.display_table, idx); ++idx; + XSETFASTINT (B_ (&buffer_local_flags, tab_width), idx); ++idx; + XSETFASTINT (B_ (&buffer_local_flags, truncate_lines), idx); ++idx; + XSETFASTINT (B_ (&buffer_local_flags, word_wrap), idx); ++idx; + XSETFASTINT (B_ (&buffer_local_flags, ctl_arrow), idx); ++idx; + XSETFASTINT (B_ (&buffer_local_flags, fill_column), idx); ++idx; + XSETFASTINT (B_ (&buffer_local_flags, left_margin), idx); ++idx; + XSETFASTINT (B_ (&buffer_local_flags, abbrev_table), idx); ++idx; + XSETFASTINT (B_ (&buffer_local_flags, display_table), idx); ++idx; #ifdef DOS_NT XSETFASTINT (buffer_local_flags.buffer_file_type, idx); /* Make this one a permanent local. */ buffer_permanent_local_flags[idx++] = 1; #endif - XSETFASTINT (buffer_local_flags.syntax_table, idx); ++idx; - XSETFASTINT (buffer_local_flags.cache_long_line_scans, idx); ++idx; - XSETFASTINT (buffer_local_flags.category_table, idx); ++idx; - XSETFASTINT (buffer_local_flags.bidi_display_reordering, idx); ++idx; - XSETFASTINT (buffer_local_flags.bidi_paragraph_direction, idx); ++idx; - XSETFASTINT (buffer_local_flags.buffer_file_coding_system, idx); + XSETFASTINT (B_ (&buffer_local_flags, syntax_table), idx); ++idx; + XSETFASTINT (B_ (&buffer_local_flags, cache_long_line_scans), idx); ++idx; + XSETFASTINT (B_ (&buffer_local_flags, category_table), idx); ++idx; + XSETFASTINT (B_ (&buffer_local_flags, bidi_display_reordering), idx); ++idx; + XSETFASTINT (B_ (&buffer_local_flags, bidi_paragraph_direction), idx); ++idx; + XSETFASTINT (B_ (&buffer_local_flags, buffer_file_coding_system), idx); /* Make this one a permanent local. */ buffer_permanent_local_flags[idx++] = 1; - XSETFASTINT (buffer_local_flags.left_margin_cols, idx); ++idx; - XSETFASTINT (buffer_local_flags.right_margin_cols, idx); ++idx; - XSETFASTINT (buffer_local_flags.left_fringe_width, idx); ++idx; - XSETFASTINT (buffer_local_flags.right_fringe_width, idx); ++idx; - XSETFASTINT (buffer_local_flags.fringes_outside_margins, idx); ++idx; - XSETFASTINT (buffer_local_flags.scroll_bar_width, idx); ++idx; - XSETFASTINT (buffer_local_flags.vertical_scroll_bar_type, idx); ++idx; - XSETFASTINT (buffer_local_flags.indicate_empty_lines, idx); ++idx; - XSETFASTINT (buffer_local_flags.indicate_buffer_boundaries, idx); ++idx; - XSETFASTINT (buffer_local_flags.fringe_indicator_alist, idx); ++idx; - XSETFASTINT (buffer_local_flags.fringe_cursor_alist, idx); ++idx; - XSETFASTINT (buffer_local_flags.scroll_up_aggressively, idx); ++idx; - XSETFASTINT (buffer_local_flags.scroll_down_aggressively, idx); ++idx; - XSETFASTINT (buffer_local_flags.header_line_format, idx); ++idx; - XSETFASTINT (buffer_local_flags.cursor_type, idx); ++idx; - XSETFASTINT (buffer_local_flags.extra_line_spacing, idx); ++idx; - XSETFASTINT (buffer_local_flags.cursor_in_non_selected_windows, idx); ++idx; + XSETFASTINT (B_ (&buffer_local_flags, left_margin_cols), idx); ++idx; + XSETFASTINT (B_ (&buffer_local_flags, right_margin_cols), idx); ++idx; + XSETFASTINT (B_ (&buffer_local_flags, left_fringe_width), idx); ++idx; + XSETFASTINT (B_ (&buffer_local_flags, right_fringe_width), idx); ++idx; + XSETFASTINT (B_ (&buffer_local_flags, fringes_outside_margins), idx); ++idx; + XSETFASTINT (B_ (&buffer_local_flags, scroll_bar_width), idx); ++idx; + XSETFASTINT (B_ (&buffer_local_flags, vertical_scroll_bar_type), idx); ++idx; + XSETFASTINT (B_ (&buffer_local_flags, indicate_empty_lines), idx); ++idx; + XSETFASTINT (B_ (&buffer_local_flags, indicate_buffer_boundaries), idx); ++idx; + XSETFASTINT (B_ (&buffer_local_flags, fringe_indicator_alist), idx); ++idx; + XSETFASTINT (B_ (&buffer_local_flags, fringe_cursor_alist), idx); ++idx; + XSETFASTINT (B_ (&buffer_local_flags, scroll_up_aggressively), idx); ++idx; + XSETFASTINT (B_ (&buffer_local_flags, scroll_down_aggressively), idx); ++idx; + XSETFASTINT (B_ (&buffer_local_flags, header_line_format), idx); ++idx; + XSETFASTINT (B_ (&buffer_local_flags, cursor_type), idx); ++idx; + XSETFASTINT (B_ (&buffer_local_flags, extra_line_spacing), idx); ++idx; + XSETFASTINT (B_ (&buffer_local_flags, cursor_in_non_selected_windows), idx); ++idx; /* Need more room? */ if (idx >= MAX_PER_BUFFER_VARS) @@ -5149,7 +5155,7 @@ init_buffer_once (void) QSFundamental = make_pure_c_string ("Fundamental"); Qfundamental_mode = intern_c_string ("fundamental-mode"); - buffer_defaults.major_mode = Qfundamental_mode; + B_ (&buffer_defaults, major_mode) = Qfundamental_mode; Qmode_class = intern_c_string ("mode-class"); @@ -5192,7 +5198,7 @@ init_buffer (void) #endif /* USE_MMAP_FOR_BUFFERS */ Fset_buffer (Fget_buffer_create (build_string ("*scratch*"))); - if (NILP (buffer_defaults.enable_multibyte_characters)) + if (NILP (B_ (&buffer_defaults, enable_multibyte_characters))) Fset_buffer_multibyte (Qnil); pwd = get_current_dir_name (); @@ -5213,28 +5219,28 @@ init_buffer (void) pwd[len + 1] = '\0'; } - current_buffer->directory = make_unibyte_string (pwd, strlen (pwd)); - if (! NILP (buffer_defaults.enable_multibyte_characters)) + B_ (current_buffer, directory) = make_unibyte_string (pwd, strlen (pwd)); + if (! NILP (B_ (&buffer_defaults, enable_multibyte_characters))) /* At this moment, we still don't know how to decode the directory name. So, we keep the bytes in multibyte form so that ENCODE_FILE correctly gets the original bytes. */ - current_buffer->directory - = string_to_multibyte (current_buffer->directory); + B_ (current_buffer, directory) + = string_to_multibyte (B_ (current_buffer, directory)); /* Add /: to the front of the name if it would otherwise be treated as magic. */ - temp = Ffind_file_name_handler (current_buffer->directory, Qt); + temp = Ffind_file_name_handler (B_ (current_buffer, directory), Qt); if (! NILP (temp) /* If the default dir is just /, TEMP is non-nil because of the ange-ftp completion handler. However, it is not necessary to turn / into /:/. So avoid doing that. */ - && strcmp ("/", SSDATA (current_buffer->directory))) - current_buffer->directory - = concat2 (build_string ("/:"), current_buffer->directory); + && strcmp ("/", SSDATA (B_ (current_buffer, directory)))) + B_ (current_buffer, directory) + = concat2 (build_string ("/:"), B_ (current_buffer, directory)); temp = get_minibuffer (0); - XBUFFER (temp)->directory = current_buffer->directory; + B_ (XBUFFER (temp), directory) = B_ (current_buffer, directory); free (pwd); } @@ -5485,13 +5491,13 @@ This value applies in buffers that don't have their own local values. This is the same as (default-value 'scroll-down-aggressively). */); DEFVAR_PER_BUFFER ("header-line-format", - ¤t_buffer->header_line_format, + &B_ (current_buffer, header_line_format), Qnil, doc: /* Analogous to `mode-line-format', but controls the header line. The header line appears, optionally, at the top of a window; the mode line appears at the bottom. */); - DEFVAR_PER_BUFFER ("mode-line-format", ¤t_buffer->mode_line_format, + DEFVAR_PER_BUFFER ("mode-line-format", &B_ (current_buffer, mode_line_format), Qnil, doc: /* Template for displaying mode line for current buffer. Each buffer has its own value of this variable. @@ -5548,7 +5554,7 @@ Decimal digits after the % specify field width to which to pad. */); DEFVAR_BUFFER_DEFAULTS ("default-major-mode", major_mode, doc: /* *Value of `major-mode' for new buffers. */); - DEFVAR_PER_BUFFER ("major-mode", ¤t_buffer->major_mode, + DEFVAR_PER_BUFFER ("major-mode", &B_ (current_buffer, major_mode), make_number (Lisp_Symbol), doc: /* Symbol for current buffer's major mode. The default value (normally `fundamental-mode') affects new buffers. @@ -5561,46 +5567,46 @@ the buffer. Thus, the mode and its hooks should not expect certain variables such as `buffer-read-only' and `buffer-file-coding-system' to be set up. */); - DEFVAR_PER_BUFFER ("mode-name", ¤t_buffer->mode_name, + DEFVAR_PER_BUFFER ("mode-name", &B_ (current_buffer, mode_name), Qnil, doc: /* Pretty name of current buffer's major mode. Usually a string, but can use any of the constructs for `mode-line-format', which see. Format with `format-mode-line' to produce a string value. */); - DEFVAR_PER_BUFFER ("local-abbrev-table", ¤t_buffer->abbrev_table, Qnil, + DEFVAR_PER_BUFFER ("local-abbrev-table", &B_ (current_buffer, abbrev_table), Qnil, doc: /* Local (mode-specific) abbrev table of current buffer. */); - DEFVAR_PER_BUFFER ("abbrev-mode", ¤t_buffer->abbrev_mode, Qnil, + DEFVAR_PER_BUFFER ("abbrev-mode", &B_ (current_buffer, abbrev_mode), Qnil, doc: /* Non-nil if Abbrev mode is enabled. Use the command `abbrev-mode' to change this variable. */); - DEFVAR_PER_BUFFER ("case-fold-search", ¤t_buffer->case_fold_search, + DEFVAR_PER_BUFFER ("case-fold-search", &B_ (current_buffer, case_fold_search), Qnil, doc: /* *Non-nil if searches and matches should ignore case. */); - DEFVAR_PER_BUFFER ("fill-column", ¤t_buffer->fill_column, + DEFVAR_PER_BUFFER ("fill-column", &B_ (current_buffer, fill_column), make_number (LISP_INT_TAG), doc: /* *Column beyond which automatic line-wrapping should happen. Interactively, you can set the buffer local value using \\[set-fill-column]. */); - DEFVAR_PER_BUFFER ("left-margin", ¤t_buffer->left_margin, + DEFVAR_PER_BUFFER ("left-margin", &B_ (current_buffer, left_margin), make_number (LISP_INT_TAG), doc: /* *Column for the default `indent-line-function' to indent to. Linefeed indents to this column in Fundamental mode. */); - DEFVAR_PER_BUFFER ("tab-width", ¤t_buffer->tab_width, + DEFVAR_PER_BUFFER ("tab-width", &B_ (current_buffer, tab_width), make_number (LISP_INT_TAG), doc: /* *Distance between tab stops (for display of tab characters), in columns. */); - DEFVAR_PER_BUFFER ("ctl-arrow", ¤t_buffer->ctl_arrow, Qnil, + DEFVAR_PER_BUFFER ("ctl-arrow", &B_ (current_buffer, ctl_arrow), Qnil, doc: /* *Non-nil means display control chars with uparrow. A value of nil means use backslash and octal digits. This variable does not apply to characters whose display is specified in the current display table (if there is one). */); DEFVAR_PER_BUFFER ("enable-multibyte-characters", - ¤t_buffer->enable_multibyte_characters, + &B_ (current_buffer, enable_multibyte_characters), Qnil, doc: /* Non-nil means the buffer contents are regarded as multi-byte characters. Otherwise they are regarded as unibyte. This affects the display, @@ -5614,7 +5620,7 @@ See also variable `default-enable-multibyte-characters' and Info node XSYMBOL (intern_c_string ("enable-multibyte-characters"))->constant = 1; DEFVAR_PER_BUFFER ("buffer-file-coding-system", - ¤t_buffer->buffer_file_coding_system, Qnil, + &B_ (current_buffer, buffer_file_coding_system), Qnil, doc: /* Coding system to be used for encoding the buffer contents on saving. This variable applies to saving the buffer, and also to `write-region' and other functions that use `write-region'. @@ -5632,11 +5638,11 @@ The variable `coding-system-for-write', if non-nil, overrides this variable. This variable is never applied to a way of decoding a file while reading it. */); DEFVAR_PER_BUFFER ("bidi-display-reordering", - ¤t_buffer->bidi_display_reordering, Qnil, + &B_ (current_buffer, bidi_display_reordering), Qnil, doc: /* Non-nil means reorder bidirectional text for display in the visual order. */); DEFVAR_PER_BUFFER ("bidi-paragraph-direction", - ¤t_buffer->bidi_paragraph_direction, Qnil, + &B_ (current_buffer, bidi_paragraph_direction), Qnil, doc: /* *If non-nil, forces directionality of text paragraphs in the buffer. If this is nil (the default), the direction of each paragraph is @@ -5647,7 +5653,7 @@ Any other value is treated as nil. This variable has no effect unless the buffer's value of \`bidi-display-reordering' is non-nil. */); - DEFVAR_PER_BUFFER ("truncate-lines", ¤t_buffer->truncate_lines, Qnil, + DEFVAR_PER_BUFFER ("truncate-lines", &B_ (current_buffer, truncate_lines), Qnil, doc: /* *Non-nil means do not display continuation lines. Instead, give each line of text just one screen line. @@ -5655,7 +5661,7 @@ Note that this is overridden by the variable `truncate-partial-width-windows' if that variable is non-nil and this buffer is not full-frame width. */); - DEFVAR_PER_BUFFER ("word-wrap", ¤t_buffer->word_wrap, Qnil, + DEFVAR_PER_BUFFER ("word-wrap", &B_ (current_buffer, word_wrap), Qnil, doc: /* *Non-nil means to use word-wrapping for continuation lines. When word-wrapping is on, continuation lines are wrapped at the space or tab character nearest to the right window edge. @@ -5676,12 +5682,12 @@ On those systems, it is automatically local in every buffer. On other systems, this variable is normally always nil. */); #endif - DEFVAR_PER_BUFFER ("default-directory", ¤t_buffer->directory, + DEFVAR_PER_BUFFER ("default-directory", &B_ (current_buffer, directory), make_number (Lisp_String), doc: /* Name of default directory of current buffer. Should end with slash. To interactively change the default directory, use command `cd'. */); - DEFVAR_PER_BUFFER ("auto-fill-function", ¤t_buffer->auto_fill_function, + DEFVAR_PER_BUFFER ("auto-fill-function", &B_ (current_buffer, auto_fill_function), Qnil, doc: /* Function called (if non-nil) to perform auto-fill. It is called after self-inserting any character specified in @@ -5689,30 +5695,30 @@ the `auto-fill-chars' table. NOTE: This variable is not a hook; its value may not be a list of functions. */); - DEFVAR_PER_BUFFER ("buffer-file-name", ¤t_buffer->filename, + DEFVAR_PER_BUFFER ("buffer-file-name", &B_ (current_buffer, filename), make_number (Lisp_String), doc: /* Name of file visited in current buffer, or nil if not visiting a file. */); - DEFVAR_PER_BUFFER ("buffer-file-truename", ¤t_buffer->file_truename, + DEFVAR_PER_BUFFER ("buffer-file-truename", &B_ (current_buffer, file_truename), make_number (Lisp_String), doc: /* Abbreviated truename of file visited in current buffer, or nil if none. The truename of a file is calculated by `file-truename' and then abbreviated with `abbreviate-file-name'. */); DEFVAR_PER_BUFFER ("buffer-auto-save-file-name", - ¤t_buffer->auto_save_file_name, + &B_ (current_buffer, auto_save_file_name), make_number (Lisp_String), doc: /* Name of file for auto-saving current buffer. If it is nil, that means don't auto-save this buffer. */); - DEFVAR_PER_BUFFER ("buffer-read-only", ¤t_buffer->read_only, Qnil, + DEFVAR_PER_BUFFER ("buffer-read-only", &B_ (current_buffer, read_only), Qnil, doc: /* Non-nil if this buffer is read-only. */); - DEFVAR_PER_BUFFER ("buffer-backed-up", ¤t_buffer->backed_up, Qnil, + DEFVAR_PER_BUFFER ("buffer-backed-up", &B_ (current_buffer, backed_up), Qnil, doc: /* Non-nil if this buffer's file has been backed up. Backing up is done before the first time the file is saved. */); - DEFVAR_PER_BUFFER ("buffer-saved-size", ¤t_buffer->save_length, + DEFVAR_PER_BUFFER ("buffer-saved-size", &B_ (current_buffer, save_length), make_number (LISP_INT_TAG), doc: /* Length of current buffer when last read in, saved or auto-saved. 0 initially. @@ -5722,7 +5728,7 @@ If you set this to -2, that means don't turn off auto-saving in this buffer if its text size shrinks. If you use `buffer-swap-text' on a buffer, you probably should set this to -2 in that buffer. */); - DEFVAR_PER_BUFFER ("selective-display", ¤t_buffer->selective_display, + DEFVAR_PER_BUFFER ("selective-display", &B_ (current_buffer, selective_display), Qnil, doc: /* Non-nil enables selective display. An integer N as value means display only lines @@ -5733,12 +5739,12 @@ in a file, save the ^M as a newline. */); #ifndef old DEFVAR_PER_BUFFER ("selective-display-ellipses", - ¤t_buffer->selective_display_ellipses, + &B_ (current_buffer, selective_display_ellipses), Qnil, doc: /* Non-nil means display ... on previous line when a line is invisible. */); #endif - DEFVAR_PER_BUFFER ("overwrite-mode", ¤t_buffer->overwrite_mode, Qnil, + DEFVAR_PER_BUFFER ("overwrite-mode", &B_ (current_buffer, overwrite_mode), Qnil, doc: /* Non-nil if self-insertion should replace existing text. The value should be one of `overwrite-mode-textual', `overwrite-mode-binary', or nil. @@ -5747,7 +5753,7 @@ inserts at the end of a line, and inserts when point is before a tab, until the tab is filled in. If `overwrite-mode-binary', self-insertion replaces newlines and tabs too. */); - DEFVAR_PER_BUFFER ("buffer-display-table", ¤t_buffer->display_table, + DEFVAR_PER_BUFFER ("buffer-display-table", &B_ (current_buffer, display_table), Qnil, doc: /* Display table that controls display of the contents of current buffer. @@ -5784,39 +5790,39 @@ In addition, a char-table has six extra slots to control the display of: See also the functions `display-table-slot' and `set-display-table-slot'. */); - DEFVAR_PER_BUFFER ("left-margin-width", ¤t_buffer->left_margin_cols, + DEFVAR_PER_BUFFER ("left-margin-width", &B_ (current_buffer, left_margin_cols), Qnil, doc: /* *Width of left marginal area for display of a buffer. A value of nil means no marginal area. */); - DEFVAR_PER_BUFFER ("right-margin-width", ¤t_buffer->right_margin_cols, + DEFVAR_PER_BUFFER ("right-margin-width", &B_ (current_buffer, right_margin_cols), Qnil, doc: /* *Width of right marginal area for display of a buffer. A value of nil means no marginal area. */); - DEFVAR_PER_BUFFER ("left-fringe-width", ¤t_buffer->left_fringe_width, + DEFVAR_PER_BUFFER ("left-fringe-width", &B_ (current_buffer, left_fringe_width), Qnil, doc: /* *Width of this buffer's left fringe (in pixels). A value of 0 means no left fringe is shown in this buffer's window. A value of nil means to use the left fringe width from the window's frame. */); - DEFVAR_PER_BUFFER ("right-fringe-width", ¤t_buffer->right_fringe_width, + DEFVAR_PER_BUFFER ("right-fringe-width", &B_ (current_buffer, right_fringe_width), Qnil, doc: /* *Width of this buffer's right fringe (in pixels). A value of 0 means no right fringe is shown in this buffer's window. A value of nil means to use the right fringe width from the window's frame. */); - DEFVAR_PER_BUFFER ("fringes-outside-margins", ¤t_buffer->fringes_outside_margins, + DEFVAR_PER_BUFFER ("fringes-outside-margins", &B_ (current_buffer, fringes_outside_margins), Qnil, doc: /* *Non-nil means to display fringes outside display margins. A value of nil means to display fringes between margins and buffer text. */); - DEFVAR_PER_BUFFER ("scroll-bar-width", ¤t_buffer->scroll_bar_width, + DEFVAR_PER_BUFFER ("scroll-bar-width", &B_ (current_buffer, scroll_bar_width), Qnil, doc: /* *Width of this buffer's scroll bars in pixels. A value of nil means to use the scroll bar width from the window's frame. */); - DEFVAR_PER_BUFFER ("vertical-scroll-bar", ¤t_buffer->vertical_scroll_bar_type, + DEFVAR_PER_BUFFER ("vertical-scroll-bar", &B_ (current_buffer, vertical_scroll_bar_type), Qnil, doc: /* *Position of this buffer's vertical scroll bar. The value takes effect whenever you tell a window to display this buffer; @@ -5827,13 +5833,13 @@ of the window; a value of nil means don't show any vertical scroll bars. A value of t (the default) means do whatever the window's frame specifies. */); DEFVAR_PER_BUFFER ("indicate-empty-lines", - ¤t_buffer->indicate_empty_lines, Qnil, + &B_ (current_buffer, indicate_empty_lines), Qnil, doc: /* *Visually indicate empty lines after the buffer end. If non-nil, a bitmap is displayed in the left fringe of a window on window-systems. */); DEFVAR_PER_BUFFER ("indicate-buffer-boundaries", - ¤t_buffer->indicate_buffer_boundaries, Qnil, + &B_ (current_buffer, indicate_buffer_boundaries), Qnil, doc: /* *Visually indicate buffer boundaries and scrolling. If non-nil, the first and last line of the buffer are marked in the fringe of a window on window-systems with angle bitmaps, or if the window can be @@ -5858,7 +5864,7 @@ bitmaps in right fringe. To show just the angle bitmaps in the left fringe, but no arrow bitmaps, use ((top . left) (bottom . left)). */); DEFVAR_PER_BUFFER ("fringe-indicator-alist", - ¤t_buffer->fringe_indicator_alist, Qnil, + &B_ (current_buffer, fringe_indicator_alist), Qnil, doc: /* *Mapping from logical to physical fringe indicator bitmaps. The value is an alist where each element (INDICATOR . BITMAPS) specifies the fringe bitmaps used to display a specific logical @@ -5877,7 +5883,7 @@ last (only) line has no final newline. BITMAPS may also be a single symbol which is used in both left and right fringes. */); DEFVAR_PER_BUFFER ("fringe-cursor-alist", - ¤t_buffer->fringe_cursor_alist, Qnil, + &B_ (current_buffer, fringe_cursor_alist), Qnil, doc: /* *Mapping from logical to physical fringe cursor bitmaps. The value is an alist where each element (CURSOR . BITMAP) specifies the fringe bitmaps used to display a specific logical @@ -5892,7 +5898,7 @@ BITMAP is the corresponding fringe bitmap shown for the logical cursor type. */); DEFVAR_PER_BUFFER ("scroll-up-aggressively", - ¤t_buffer->scroll_up_aggressively, Qnil, + &B_ (current_buffer, scroll_up_aggressively), Qnil, doc: /* How far to scroll windows upward. If you move point off the bottom, the window scrolls automatically. This variable controls how far it scrolls. The value nil, the default, @@ -5905,7 +5911,7 @@ window scrolls by a full window height. Meaningful values are between 0.0 and 1.0, inclusive. */); DEFVAR_PER_BUFFER ("scroll-down-aggressively", - ¤t_buffer->scroll_down_aggressively, Qnil, + &B_ (current_buffer, scroll_down_aggressively), Qnil, doc: /* How far to scroll windows downward. If you move point off the top, the window scrolls automatically. This variable controls how far it scrolls. The value nil, the default, @@ -5960,7 +5966,7 @@ from happening repeatedly and making Emacs nonfunctional. */); The functions are run using the `run-hooks' function. */); Vfirst_change_hook = Qnil; - DEFVAR_PER_BUFFER ("buffer-undo-list", ¤t_buffer->undo_list, Qnil, + DEFVAR_PER_BUFFER ("buffer-undo-list", &B_ (current_buffer, undo_list), Qnil, doc: /* List of undo entries in current buffer. Recent changes come first; older changes follow newer. @@ -6001,10 +6007,10 @@ the changes between two undo boundaries as a single step to be undone. If the value of the variable is t, undo information is not recorded. */); - DEFVAR_PER_BUFFER ("mark-active", ¤t_buffer->mark_active, Qnil, + DEFVAR_PER_BUFFER ("mark-active", &B_ (current_buffer, mark_active), Qnil, doc: /* Non-nil means the mark and region are currently active in this buffer. */); - DEFVAR_PER_BUFFER ("cache-long-line-scans", ¤t_buffer->cache_long_line_scans, Qnil, + DEFVAR_PER_BUFFER ("cache-long-line-scans", &B_ (current_buffer, cache_long_line_scans), Qnil, doc: /* Non-nil means that Emacs should use caches to handle long lines more quickly. Normally, the line-motion functions work by scanning the buffer for @@ -6032,23 +6038,23 @@ maintained internally by the Emacs primitives. Enabling or disabling the cache should not affect the behavior of any of the motion functions; it should only affect their performance. */); - DEFVAR_PER_BUFFER ("point-before-scroll", ¤t_buffer->point_before_scroll, Qnil, + DEFVAR_PER_BUFFER ("point-before-scroll", &B_ (current_buffer, point_before_scroll), Qnil, doc: /* Value of point before the last series of scroll operations, or nil. */); - DEFVAR_PER_BUFFER ("buffer-file-format", ¤t_buffer->file_format, Qnil, + DEFVAR_PER_BUFFER ("buffer-file-format", &B_ (current_buffer, file_format), Qnil, doc: /* List of formats to use when saving this buffer. Formats are defined by `format-alist'. This variable is set when a file is visited. */); DEFVAR_PER_BUFFER ("buffer-auto-save-file-format", - ¤t_buffer->auto_save_file_format, Qnil, + &B_ (current_buffer, auto_save_file_format), Qnil, doc: /* *Format in which to write auto-save files. Should be a list of symbols naming formats that are defined in `format-alist'. If it is t, which is the default, auto-save files are written in the same format as a regular save would use. */); DEFVAR_PER_BUFFER ("buffer-invisibility-spec", - ¤t_buffer->invisibility_spec, Qnil, + &B_ (current_buffer, invisibility_spec), Qnil, doc: /* Invisibility spec of this buffer. The default is t, which means that text is invisible if it has a non-nil `invisible' property. @@ -6059,12 +6065,12 @@ then characters with property value PROP are invisible, and they have an ellipsis as well if ELLIPSIS is non-nil. */); DEFVAR_PER_BUFFER ("buffer-display-count", - ¤t_buffer->display_count, Qnil, + &B_ (current_buffer, display_count), Qnil, doc: /* A number incremented each time this buffer is displayed in a window. The function `set-window-buffer' increments it. */); DEFVAR_PER_BUFFER ("buffer-display-time", - ¤t_buffer->display_time, Qnil, + &B_ (current_buffer, display_time), Qnil, doc: /* Time stamp updated each time this buffer is displayed in a window. The function `set-window-buffer' updates this variable to the value obtained by calling `current-time'. @@ -6099,7 +6105,7 @@ and disregard a `read-only' text property if the property value is a member of the list. */); Vinhibit_read_only = Qnil; - DEFVAR_PER_BUFFER ("cursor-type", ¤t_buffer->cursor_type, Qnil, + DEFVAR_PER_BUFFER ("cursor-type", &B_ (current_buffer, cursor_type), Qnil, doc: /* Cursor to use when this buffer is in the selected window. Values are interpreted as follows: @@ -6118,7 +6124,7 @@ cursor's appearance is instead controlled by the variable `cursor-in-non-selected-windows'. */); DEFVAR_PER_BUFFER ("line-spacing", - ¤t_buffer->extra_line_spacing, Qnil, + &B_ (current_buffer, extra_line_spacing), Qnil, doc: /* Additional space to put between lines when displaying a buffer. The space is measured in pixels, and put below lines on graphic displays, see `display-graphic-p'. @@ -6126,7 +6132,7 @@ If value is a floating point number, it specifies the spacing relative to the default frame line height. A value of nil means add no extra space. */); DEFVAR_PER_BUFFER ("cursor-in-non-selected-windows", - ¤t_buffer->cursor_in_non_selected_windows, Qnil, + &B_ (current_buffer, cursor_in_non_selected_windows), Qnil, doc: /* *Non-nil means show a cursor in non-selected windows. If nil, only shows a cursor in the selected window. If t, displays a cursor related to the usual cursor type -- cgit v1.2.1 From fc3ca11315448fa7310f064fd9953b943ae733bf Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 14 Feb 2011 19:35:21 +0200 Subject: Fix the MS-Windows build due to introduction of B_. dired.c (directory_files_internal): fileio.c (Finsert_file_contents): insdel.c (prepare_to_modify_buffer): xdisp.c (pos_visible_p): s/ms-w32.h (MODE_LINE_BINARY_TEXT): w32fns.c (Fw32_shell_execute, Fx_show_tip, x_create_tip_frame): Use B_ for the MS-Windows build. From Tom Tromey: buffer.c (init_buffer_once, syms_of_buffer): Use B_ in DOS_NT case. --- src/buffer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index fc2dd3a4691..49ae4bbede2 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -5041,7 +5041,7 @@ init_buffer_once (void) B_ (&buffer_defaults, cursor_in_non_selected_windows) = Qt; #ifdef DOS_NT - buffer_defaults.buffer_file_type = Qnil; /* TEXT */ + B_ (&buffer_defaults, buffer_file_type) = Qnil; /* TEXT */ #endif B_ (&buffer_defaults, enable_multibyte_characters) = Qt; B_ (&buffer_defaults, buffer_file_coding_system) = Qnil; @@ -5113,7 +5113,7 @@ init_buffer_once (void) XSETFASTINT (B_ (&buffer_local_flags, abbrev_table), idx); ++idx; XSETFASTINT (B_ (&buffer_local_flags, display_table), idx); ++idx; #ifdef DOS_NT - XSETFASTINT (buffer_local_flags.buffer_file_type, idx); + XSETFASTINT (B_ (&buffer_local_flags, buffer_file_type), idx); /* Make this one a permanent local. */ buffer_permanent_local_flags[idx++] = 1; #endif @@ -5674,7 +5674,7 @@ word-wrapping, you might want to reduce the value of in narrower windows. */); #ifdef DOS_NT - DEFVAR_PER_BUFFER ("buffer-file-type", ¤t_buffer->buffer_file_type, + DEFVAR_PER_BUFFER ("buffer-file-type", &B_ (current_buffer, buffer_file_type), Qnil, doc: /* Non-nil if the visited file is a binary file. This variable is meaningful on MS-DOG and Windows NT. -- cgit v1.2.1 From 4b4deea229a39c94762dcf49da538b639df59148 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 16 Feb 2011 08:02:50 -0700 Subject: Change B_ to BVAR * xfns.c (x_create_tip_frame, Fx_show_tip): Replace B_ with BVAR. * xfaces.c (compute_char_face): Replace B_ with BVAR. * 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): Replace B_ with BVAR. * 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): Replace B_ with BVAR. * w32fns.c (x_create_tip_frame, Fx_show_tip, Fw32_shell_execute): Replace B_ with BVAR. * undo.c (record_point, record_insert, record_delete) (record_marker_adjustment, record_first_change) (record_property_change, Fundo_boundary, truncate_undo_list) (Fprimitive_undo): Replace B_ with BVAR. * syntax.h (Vstandard_syntax_table, CURRENT_SYNTAX_TABLE) (SETUP_BUFFER_SYNTAX_TABLE): Replace B_ with BVAR. * syntax.c (update_syntax_table, dec_bytepos, Fsyntax_table) (Fset_syntax_table, Fmodify_syntax_entry, skip_chars) (skip_syntaxes, scan_lists): Replace B_ with BVAR. * 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): Replace B_ with BVAR. * 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): Replace B_ with BVAR. * print.c (PRINTDECLARE, PRINTPREPARE, PRINTFINISH, printchar) (strout, print_string, temp_output_buffer_setup, print_object): Replace B_ with BVAR. * msdos.c (IT_frame_up_to_date): Replace B_ with BVAR. * minibuf.c (read_minibuf, get_minibuffer, Fread_buffer): Replace B_ with BVAR. * marker.c (Fmarker_buffer, Fset_marker, set_marker_restricted) (set_marker_both, set_marker_restricted_both, unchain_marker): Replace B_ with BVAR. * lread.c (readchar, unreadchar, openp, readevalloop) (Feval_buffer, Feval_region): Replace B_ with BVAR. * lisp.h (DOWNCASE_TABLE, UPCASE_TABLE): Replace B_ with BVAR. * keymap.c (Flocal_key_binding, Fuse_local_map) (Fcurrent_local_map, push_key_description) (Fdescribe_buffer_bindings): Replace B_ with BVAR. * keyboard.c (command_loop_1, read_char_minibuf_menu_prompt) (read_key_sequence): Replace B_ with BVAR. * intervals.h (TEXT_PROP_MEANS_INVISIBLE): Replace B_ with BVAR. * intervals.c (set_point_both, get_local_map): Replace B_ with BVAR. * 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): Replace B_ with BVAR. * 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): Replace B_ with BVAR. * fringe.c (get_logical_cursor_bitmap) (get_logical_fringe_bitmap, update_window_fringes): Replace B_ with BVAR. * frame.c (make_frame_visible_1): Replace B_ with BVAR. * font.c (font_at): Replace B_ with BVAR. * fns.c (Fbase64_encode_region, Fbase64_decode_region, Fmd5): Replace B_ with BVAR. * filelock.c (unlock_all_files, Flock_buffer, Funlock_buffer) (unlock_buffer): Replace B_ with BVAR. * 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): Replace B_ with BVAR. * 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): Replace B_ with BVAR. * dispnew.c (Fframe_or_buffer_changed_p): Replace B_ with BVAR. * dispextern.h (WINDOW_WANTS_MODELINE_P) (WINDOW_WANTS_HEADER_LINE_P): Replace B_ with BVAR. * dired.c (directory_files_internal): Replace B_ with BVAR. * data.c (swap_in_symval_forwarding, set_internal) (Fmake_local_variable, Fkill_local_variable, Flocal_variable_p): Replace B_ with BVAR. * composite.c (fill_gstring_header) (composition_compute_stop_pos, composition_adjust_point) (Ffind_composition_internal): Replace B_ with BVAR. * 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): Replace B_ with BVAR. * cmds.c (Fself_insert_command, internal_self_insert): Replace B_ with BVAR. * charset.c (Ffind_charset_region): Replace B_ with BVAR. * character.h (FETCH_CHAR_ADVANCE, INC_BOTH, DEC_BOTH) (ASCII_CHAR_WIDTH): Replace B_ with BVAR. * character.c (chars_in_text, Fget_byte): Replace B_ with BVAR. * category.h (Vstandard_category_table): Replace B_ with BVAR. * category.c (check_category_table, Fcategory_table) (Fset_category_table, char_category_set): Replace B_ with BVAR. * casetab.c (Fcurrent_case_table, set_case_table): Replace B_ with BVAR. * casefiddle.c (casify_object, casify_region): Replace B_ with BVAR. * callproc.c (Fcall_process, Fcall_process_region): Replace B_ with BVAR. * callint.c (check_mark, Fcall_interactively): Replace B_ with BVAR. * bytecode.c (Fbyte_code): Replace B_ with BVAR. * buffer.h (FETCH_CHAR, FETCH_CHAR_AS_MULTIBYTE, BVAR): Replace B_ with BVAR. * buffer.c (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, swapfield_, Fbuffer_swap_text) (Fset_buffer_multibyte, swap_out_buffer_local_variables) (record_overlay_string, overlay_strings, init_buffer_once) (init_buffer, syms_of_buffer): Replace B_ with BVAR. --- src/buffer.c | 670 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 335 insertions(+), 335 deletions(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index 49ae4bbede2..d05fe1754c2 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -162,7 +162,7 @@ DEFUN ("buffer-live-p", Fbuffer_live_p, Sbuffer_live_p, 1, 1, 0, Value is nil if OBJECT is not a buffer or if it has been killed. */) (Lisp_Object object) { - return ((BUFFERP (object) && ! NILP (B_ (XBUFFER (object), name))) + return ((BUFFERP (object) && ! NILP (BVAR (XBUFFER (object), name))) ? Qt : Qnil); } @@ -266,8 +266,8 @@ See also `find-buffer-visiting'. */) { buf = Fcdr (XCAR (tail)); if (!BUFFERP (buf)) continue; - if (!STRINGP (B_ (XBUFFER (buf), filename))) continue; - tem = Fstring_equal (B_ (XBUFFER (buf), filename), filename); + if (!STRINGP (BVAR (XBUFFER (buf), filename))) continue; + tem = Fstring_equal (BVAR (XBUFFER (buf), filename), filename); if (!NILP (tem)) return buf; } @@ -283,8 +283,8 @@ get_truename_buffer (register Lisp_Object filename) { buf = Fcdr (XCAR (tail)); if (!BUFFERP (buf)) continue; - if (!STRINGP (B_ (XBUFFER (buf), file_truename))) continue; - tem = Fstring_equal (B_ (XBUFFER (buf), file_truename), filename); + if (!STRINGP (BVAR (XBUFFER (buf), file_truename))) continue; + tem = Fstring_equal (BVAR (XBUFFER (buf), file_truename), filename); if (!NILP (tem)) return buf; } @@ -353,7 +353,7 @@ even if it is dead. The return value is never nil. */) b->newline_cache = 0; b->width_run_cache = 0; - B_ (b, width_table) = Qnil; + BVAR (b, width_table) = Qnil; b->prevent_redisplay_optimizations_p = 1; /* Put this on the chain of all buffers including killed ones. */ @@ -362,22 +362,22 @@ even if it is dead. The return value is never nil. */) /* An ordinary buffer normally doesn't need markers to handle BEGV and ZV. */ - B_ (b, pt_marker) = Qnil; - B_ (b, begv_marker) = Qnil; - B_ (b, zv_marker) = Qnil; + BVAR (b, pt_marker) = Qnil; + BVAR (b, begv_marker) = Qnil; + BVAR (b, zv_marker) = Qnil; name = Fcopy_sequence (buffer_or_name); STRING_SET_INTERVALS (name, NULL_INTERVAL); - B_ (b, name) = name; + BVAR (b, name) = name; - B_ (b, undo_list) = (SREF (name, 0) != ' ') ? Qnil : Qt; + BVAR (b, undo_list) = (SREF (name, 0) != ' ') ? Qnil : Qt; reset_buffer (b); reset_buffer_local_variables (b, 1); - B_ (b, mark) = Fmake_marker (); + BVAR (b, mark) = Fmake_marker (); BUF_MARKERS (b) = NULL; - B_ (b, name) = name; + BVAR (b, name) = name; /* Put this in the alist of all live buffers. */ XSETBUFFER (buffer, b); @@ -486,7 +486,7 @@ clone_per_buffer_values (struct buffer *from, struct buffer *to) /* Get (a copy of) the alist of Lisp-level local variables of FROM and install that in TO. */ - B_ (to, local_var_alist) = buffer_lisp_local_variables (from); + BVAR (to, local_var_alist) = buffer_lisp_local_variables (from); } DEFUN ("make-indirect-buffer", Fmake_indirect_buffer, Smake_indirect_buffer, @@ -512,7 +512,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */) base_buffer = Fget_buffer (base_buffer); if (NILP (base_buffer)) error ("No such buffer: `%s'", SDATA (tem)); - if (NILP (B_ (XBUFFER (base_buffer), name))) + if (NILP (BVAR (XBUFFER (base_buffer), name))) error ("Base buffer has been killed"); if (SCHARS (name) == 0) @@ -536,7 +536,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */) b->newline_cache = 0; b->width_run_cache = 0; - B_ (b, width_table) = Qnil; + BVAR (b, width_table) = Qnil; /* Put this on the chain of all buffers including killed ones. */ b->next = all_buffers; @@ -544,7 +544,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */) name = Fcopy_sequence (name); STRING_SET_INTERVALS (name, NULL_INTERVAL); - B_ (b, name) = name; + BVAR (b, name) = name; reset_buffer (b); reset_buffer_local_variables (b, 1); @@ -553,57 +553,57 @@ CLONE nil means the indirect buffer's state is reset to default values. */) XSETBUFFER (buf, b); Vbuffer_alist = nconc2 (Vbuffer_alist, Fcons (Fcons (name, buf), Qnil)); - B_ (b, mark) = Fmake_marker (); - B_ (b, name) = name; + BVAR (b, mark) = Fmake_marker (); + BVAR (b, name) = name; /* The multibyte status belongs to the base buffer. */ - B_ (b, enable_multibyte_characters) = B_ (b->base_buffer, enable_multibyte_characters); + BVAR (b, enable_multibyte_characters) = BVAR (b->base_buffer, enable_multibyte_characters); /* Make sure the base buffer has markers for its narrowing. */ - if (NILP (B_ (b->base_buffer, pt_marker))) + if (NILP (BVAR (b->base_buffer, pt_marker))) { - B_ (b->base_buffer, pt_marker) = Fmake_marker (); - set_marker_both (B_ (b->base_buffer, pt_marker), base_buffer, + BVAR (b->base_buffer, pt_marker) = Fmake_marker (); + set_marker_both (BVAR (b->base_buffer, pt_marker), base_buffer, BUF_PT (b->base_buffer), BUF_PT_BYTE (b->base_buffer)); } - if (NILP (B_ (b->base_buffer, begv_marker))) + if (NILP (BVAR (b->base_buffer, begv_marker))) { - B_ (b->base_buffer, begv_marker) = Fmake_marker (); - set_marker_both (B_ (b->base_buffer, begv_marker), base_buffer, + BVAR (b->base_buffer, begv_marker) = Fmake_marker (); + set_marker_both (BVAR (b->base_buffer, begv_marker), base_buffer, BUF_BEGV (b->base_buffer), BUF_BEGV_BYTE (b->base_buffer)); } - if (NILP (B_ (b->base_buffer, zv_marker))) + if (NILP (BVAR (b->base_buffer, zv_marker))) { - B_ (b->base_buffer, zv_marker) = Fmake_marker (); - set_marker_both (B_ (b->base_buffer, zv_marker), base_buffer, + BVAR (b->base_buffer, zv_marker) = Fmake_marker (); + set_marker_both (BVAR (b->base_buffer, zv_marker), base_buffer, BUF_ZV (b->base_buffer), BUF_ZV_BYTE (b->base_buffer)); - XMARKER (B_ (b->base_buffer, zv_marker))->insertion_type = 1; + XMARKER (BVAR (b->base_buffer, zv_marker))->insertion_type = 1; } if (NILP (clone)) { /* Give the indirect buffer markers for its narrowing. */ - B_ (b, pt_marker) = Fmake_marker (); - set_marker_both (B_ (b, pt_marker), buf, BUF_PT (b), BUF_PT_BYTE (b)); - B_ (b, begv_marker) = Fmake_marker (); - set_marker_both (B_ (b, begv_marker), buf, BUF_BEGV (b), BUF_BEGV_BYTE (b)); - B_ (b, zv_marker) = Fmake_marker (); - set_marker_both (B_ (b, zv_marker), buf, BUF_ZV (b), BUF_ZV_BYTE (b)); - XMARKER (B_ (b, zv_marker))->insertion_type = 1; + BVAR (b, pt_marker) = Fmake_marker (); + set_marker_both (BVAR (b, pt_marker), buf, BUF_PT (b), BUF_PT_BYTE (b)); + BVAR (b, begv_marker) = Fmake_marker (); + set_marker_both (BVAR (b, begv_marker), buf, BUF_BEGV (b), BUF_BEGV_BYTE (b)); + BVAR (b, zv_marker) = Fmake_marker (); + set_marker_both (BVAR (b, zv_marker), buf, BUF_ZV (b), BUF_ZV_BYTE (b)); + XMARKER (BVAR (b, zv_marker))->insertion_type = 1; } else { struct buffer *old_b = current_buffer; clone_per_buffer_values (b->base_buffer, b); - B_ (b, filename) = Qnil; - B_ (b, file_truename) = Qnil; - B_ (b, display_count) = make_number (0); - B_ (b, backed_up) = Qnil; - B_ (b, auto_save_file_name) = Qnil; + BVAR (b, filename) = Qnil; + BVAR (b, file_truename) = Qnil; + BVAR (b, display_count) = make_number (0); + BVAR (b, backed_up) = Qnil; + BVAR (b, auto_save_file_name) = Qnil; set_buffer_internal_1 (b); Fset (intern ("buffer-save-without-query"), Qnil); Fset (intern ("buffer-file-number"), Qnil); @@ -647,34 +647,34 @@ delete_all_overlays (struct buffer *b) void reset_buffer (register struct buffer *b) { - B_ (b, filename) = Qnil; - B_ (b, file_truename) = Qnil; - B_ (b, directory) = (current_buffer) ? B_ (current_buffer, directory) : Qnil; + BVAR (b, filename) = Qnil; + BVAR (b, file_truename) = Qnil; + BVAR (b, directory) = (current_buffer) ? BVAR (current_buffer, directory) : Qnil; b->modtime = 0; b->modtime_size = -1; - XSETFASTINT (B_ (b, save_length), 0); + XSETFASTINT (BVAR (b, save_length), 0); b->last_window_start = 1; /* It is more conservative to start out "changed" than "unchanged". */ b->clip_changed = 0; b->prevent_redisplay_optimizations_p = 1; - B_ (b, backed_up) = Qnil; + BVAR (b, backed_up) = Qnil; BUF_AUTOSAVE_MODIFF (b) = 0; b->auto_save_failure_time = -1; - B_ (b, auto_save_file_name) = Qnil; - B_ (b, read_only) = Qnil; + BVAR (b, auto_save_file_name) = Qnil; + BVAR (b, read_only) = Qnil; b->overlays_before = NULL; b->overlays_after = NULL; b->overlay_center = BEG; - B_ (b, mark_active) = Qnil; - B_ (b, point_before_scroll) = Qnil; - B_ (b, file_format) = Qnil; - B_ (b, auto_save_file_format) = Qt; - B_ (b, last_selected_window) = Qnil; - XSETINT (B_ (b, display_count), 0); - B_ (b, display_time) = Qnil; - B_ (b, enable_multibyte_characters) = B_ (&buffer_defaults, enable_multibyte_characters); - B_ (b, cursor_type) = B_ (&buffer_defaults, cursor_type); - B_ (b, extra_line_spacing) = B_ (&buffer_defaults, extra_line_spacing); + BVAR (b, mark_active) = Qnil; + BVAR (b, point_before_scroll) = Qnil; + BVAR (b, file_format) = Qnil; + BVAR (b, auto_save_file_format) = Qt; + BVAR (b, last_selected_window) = Qnil; + XSETINT (BVAR (b, display_count), 0); + BVAR (b, display_time) = Qnil; + BVAR (b, enable_multibyte_characters) = BVAR (&buffer_defaults, enable_multibyte_characters); + BVAR (b, cursor_type) = BVAR (&buffer_defaults, cursor_type); + BVAR (b, extra_line_spacing) = BVAR (&buffer_defaults, extra_line_spacing); b->display_error_modiff = 0; } @@ -698,10 +698,10 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too) things that depend on the major mode. default-major-mode is handled at a higher level. We ignore it here. */ - B_ (b, major_mode) = Qfundamental_mode; - B_ (b, keymap) = Qnil; - B_ (b, mode_name) = QSFundamental; - B_ (b, minor_modes) = Qnil; + BVAR (b, major_mode) = Qfundamental_mode; + BVAR (b, keymap) = Qnil; + BVAR (b, mode_name) = QSFundamental; + BVAR (b, minor_modes) = Qnil; /* If the standard case table has been altered and invalidated, fix up its insides first. */ @@ -710,22 +710,22 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too) && CHAR_TABLE_P (XCHAR_TABLE (Vascii_downcase_table)->extras[2]))) Fset_standard_case_table (Vascii_downcase_table); - B_ (b, downcase_table) = Vascii_downcase_table; - B_ (b, upcase_table) = XCHAR_TABLE (Vascii_downcase_table)->extras[0]; - B_ (b, case_canon_table) = XCHAR_TABLE (Vascii_downcase_table)->extras[1]; - B_ (b, case_eqv_table) = XCHAR_TABLE (Vascii_downcase_table)->extras[2]; - B_ (b, invisibility_spec) = Qt; + BVAR (b, downcase_table) = Vascii_downcase_table; + BVAR (b, upcase_table) = XCHAR_TABLE (Vascii_downcase_table)->extras[0]; + BVAR (b, case_canon_table) = XCHAR_TABLE (Vascii_downcase_table)->extras[1]; + BVAR (b, case_eqv_table) = XCHAR_TABLE (Vascii_downcase_table)->extras[2]; + BVAR (b, invisibility_spec) = Qt; #ifndef DOS_NT - B_ (b, buffer_file_type) = Qnil; + BVAR (b, buffer_file_type) = Qnil; #endif /* Reset all (or most) per-buffer variables to their defaults. */ if (permanent_too) - B_ (b, local_var_alist) = Qnil; + BVAR (b, local_var_alist) = Qnil; else { Lisp_Object tmp, prop, last = Qnil; - for (tmp = B_ (b, local_var_alist); CONSP (tmp); tmp = XCDR (tmp)) + for (tmp = BVAR (b, local_var_alist); CONSP (tmp); tmp = XCDR (tmp)) if (!NILP (prop = Fget (XCAR (XCAR (tmp)), Qpermanent_local))) { /* If permanent-local, keep it. */ @@ -755,7 +755,7 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too) } /* Delete this local variable. */ else if (NILP (last)) - B_ (b, local_var_alist) = XCDR (tmp); + BVAR (b, local_var_alist) = XCDR (tmp); else XSETCDR (last, XCDR (tmp)); } @@ -830,9 +830,9 @@ Return nil if BUFFER has been killed. */) (register Lisp_Object buffer) { if (NILP (buffer)) - return B_ (current_buffer, name); + return BVAR (current_buffer, name); CHECK_BUFFER (buffer); - return B_ (XBUFFER (buffer), name); + return BVAR (XBUFFER (buffer), name); } DEFUN ("buffer-file-name", Fbuffer_file_name, Sbuffer_file_name, 0, 1, 0, @@ -841,9 +841,9 @@ No argument or nil as argument means use the current buffer. */) (register Lisp_Object buffer) { if (NILP (buffer)) - return B_ (current_buffer, filename); + return BVAR (current_buffer, filename); CHECK_BUFFER (buffer); - return B_ (XBUFFER (buffer), filename); + return BVAR (XBUFFER (buffer), filename); } DEFUN ("buffer-base-buffer", Fbuffer_base_buffer, Sbuffer_base_buffer, @@ -895,7 +895,7 @@ is the default binding of the variable. */) { /* Look in local_var_alist. */ struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym); XSETSYMBOL (variable, sym); /* Update In case of aliasing. */ - result = Fassoc (variable, B_ (buf, local_var_alist)); + result = Fassoc (variable, BVAR (buf, local_var_alist)); if (!NILP (result)) { if (blv->fwd) @@ -944,7 +944,7 @@ buffer_lisp_local_variables (struct buffer *buf) { Lisp_Object result = Qnil; register Lisp_Object tail; - for (tail = B_ (buf, local_var_alist); CONSP (tail); tail = XCDR (tail)) + for (tail = BVAR (buf, local_var_alist); CONSP (tail); tail = XCDR (tail)) { Lisp_Object val, elt; @@ -1043,9 +1043,9 @@ A non-nil FLAG means mark the buffer modified. */) /* If buffer becoming modified, lock the file. If buffer becoming unmodified, unlock the file. */ - fn = B_ (current_buffer, file_truename); + fn = BVAR (current_buffer, file_truename); /* Test buffer-file-name so that binding it to nil is effective. */ - if (!NILP (fn) && ! NILP (B_ (current_buffer, filename))) + if (!NILP (fn) && ! NILP (BVAR (current_buffer, filename))) { already = SAVE_MODIFF < MODIFF; if (!already && !NILP (flag)) @@ -1110,9 +1110,9 @@ state of the current buffer. Use with care. */) /* If buffer becoming modified, lock the file. If buffer becoming unmodified, unlock the file. */ - fn = B_ (current_buffer, file_truename); + fn = BVAR (current_buffer, file_truename); /* Test buffer-file-name so that binding it to nil is effective. */ - if (!NILP (fn) && ! NILP (B_ (current_buffer, filename))) + if (!NILP (fn) && ! NILP (BVAR (current_buffer, filename))) { int already = SAVE_MODIFF < MODIFF; if (!already && !NILP (flag)) @@ -1199,14 +1199,14 @@ This does not change the name of the visited file (if any). */) with the original name. It makes UNIQUE equivalent to (rename-buffer (generate-new-buffer-name NEWNAME)). */ if (NILP (unique) && XBUFFER (tem) == current_buffer) - return B_ (current_buffer, name); + return BVAR (current_buffer, name); if (!NILP (unique)) - newname = Fgenerate_new_buffer_name (newname, B_ (current_buffer, name)); + newname = Fgenerate_new_buffer_name (newname, BVAR (current_buffer, name)); else error ("Buffer name `%s' is in use", SDATA (newname)); } - B_ (current_buffer, name) = newname; + BVAR (current_buffer, name) = newname; /* Catch redisplay's attention. Unless we do this, the mode lines for any windows displaying current_buffer will stay unchanged. */ @@ -1214,11 +1214,11 @@ This does not change the name of the visited file (if any). */) XSETBUFFER (buf, current_buffer); Fsetcar (Frassq (buf, Vbuffer_alist), newname); - if (NILP (B_ (current_buffer, filename)) - && !NILP (B_ (current_buffer, auto_save_file_name))) + if (NILP (BVAR (current_buffer, filename)) + && !NILP (BVAR (current_buffer, auto_save_file_name))) call0 (intern ("rename-auto-save-file")); /* Refetch since that last call may have done GC. */ - return B_ (current_buffer, name); + return BVAR (current_buffer, name); } DEFUN ("other-buffer", Fother_buffer, Sother_buffer, 0, 3, 0, @@ -1263,9 +1263,9 @@ If BUFFER is omitted or nil, some interesting buffer is returned. */) continue; if (NILP (buf)) continue; - if (NILP (B_ (XBUFFER (buf), name))) + if (NILP (BVAR (XBUFFER (buf), name))) continue; - if (SREF (B_ (XBUFFER (buf), name), 0) == ' ') + if (SREF (BVAR (XBUFFER (buf), name), 0) == ' ') continue; /* If the selected frame has a buffer_predicate, disregard buffers that don't fit the predicate. */ @@ -1313,8 +1313,8 @@ No argument or nil as argument means do this for the current buffer. */) nsberror (buffer); } - if (EQ (B_ (XBUFFER (real_buffer), undo_list), Qt)) - B_ (XBUFFER (real_buffer), undo_list) = Qnil; + if (EQ (BVAR (XBUFFER (real_buffer), undo_list), Qt)) + BVAR (XBUFFER (real_buffer), undo_list) = Qnil; return Qnil; } @@ -1359,16 +1359,16 @@ with SIGHUP. */) b = XBUFFER (buffer); /* Avoid trouble for buffer already dead. */ - if (NILP (B_ (b, name))) + if (NILP (BVAR (b, name))) return Qnil; /* Query if the buffer is still modified. */ - if (INTERACTIVE && !NILP (B_ (b, filename)) + if (INTERACTIVE && !NILP (BVAR (b, filename)) && BUF_MODIFF (b) > BUF_SAVE_MODIFF (b)) { GCPRO1 (buffer); tem = do_yes_or_no_p (format2 ("Buffer %s modified; kill anyway? ", - B_ (b, name), make_number (0))); + BVAR (b, name), make_number (0))); UNGCPRO; if (NILP (tem)) return Qnil; @@ -1402,7 +1402,7 @@ with SIGHUP. */) if (EQ (buffer, XWINDOW (minibuf_window)->buffer)) return Qnil; - if (NILP (B_ (b, name))) + if (NILP (BVAR (b, name))) return Qnil; /* When we kill a base buffer, kill all its indirect buffers. @@ -1417,7 +1417,7 @@ with SIGHUP. */) for (other = all_buffers; other; other = other->next) /* all_buffers contains dead buffers too; don't re-kill them. */ - if (other->base_buffer == b && !NILP (B_ (other, name))) + if (other->base_buffer == b && !NILP (BVAR (other, name))) { Lisp_Object buffer; XSETBUFFER (buffer, other); @@ -1462,7 +1462,7 @@ with SIGHUP. */) /* Killing buffer processes may run sentinels which may have called kill-buffer. */ - if (NILP (B_ (b, name))) + if (NILP (BVAR (b, name))) return Qnil; clear_charpos_cache (b); @@ -1476,7 +1476,7 @@ with SIGHUP. */) /* Delete any auto-save file, if we saved it in this session. But not if the buffer is modified. */ - if (STRINGP (B_ (b, auto_save_file_name)) + if (STRINGP (BVAR (b, auto_save_file_name)) && BUF_AUTOSAVE_MODIFF (b) != 0 && BUF_SAVE_MODIFF (b) < BUF_AUTOSAVE_MODIFF (b) && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b) @@ -1485,7 +1485,7 @@ with SIGHUP. */) Lisp_Object tem; tem = Fsymbol_value (intern ("delete-auto-save-files")); if (! NILP (tem)) - internal_delete_file (B_ (b, auto_save_file_name)); + internal_delete_file (BVAR (b, auto_save_file_name)); } if (b->base_buffer) @@ -1525,7 +1525,7 @@ with SIGHUP. */) swap_out_buffer_local_variables (b); reset_buffer_local_variables (b, 1); - B_ (b, name) = Qnil; + BVAR (b, name) = Qnil; BLOCK_INPUT; if (! b->base_buffer) @@ -1541,9 +1541,9 @@ with SIGHUP. */) free_region_cache (b->width_run_cache); b->width_run_cache = 0; } - B_ (b, width_table) = Qnil; + BVAR (b, width_table) = Qnil; UNBLOCK_INPUT; - B_ (b, undo_list) = Qnil; + BVAR (b, undo_list) = Qnil; return Qt; } @@ -1637,15 +1637,15 @@ the current buffer's major mode. */) CHECK_BUFFER (buffer); - if (STRINGP (B_ (XBUFFER (buffer), name)) - && strcmp (SSDATA (B_ (XBUFFER (buffer), name)), "*scratch*") == 0) + if (STRINGP (BVAR (XBUFFER (buffer), name)) + && strcmp (SSDATA (BVAR (XBUFFER (buffer), name)), "*scratch*") == 0) function = find_symbol_value (intern ("initial-major-mode")); else { - function = B_ (&buffer_defaults, major_mode); + function = BVAR (&buffer_defaults, major_mode); if (NILP (function) - && NILP (Fget (B_ (current_buffer, major_mode), Qmode_class))) - function = B_ (current_buffer, major_mode); + && NILP (Fget (BVAR (current_buffer, major_mode), Qmode_class))) + function = BVAR (current_buffer, major_mode); } if (NILP (function) || EQ (function, Qfundamental_mode)) @@ -1795,29 +1795,29 @@ set_buffer_internal_1 (register struct buffer *b) /* Put the undo list back in the base buffer, so that it appears that an indirect buffer shares the undo list of its base. */ if (old_buf->base_buffer) - B_ (old_buf->base_buffer, undo_list) = B_ (old_buf, undo_list); + BVAR (old_buf->base_buffer, undo_list) = BVAR (old_buf, undo_list); /* If the old current buffer has markers to record PT, BEGV and ZV when it is not current, update them now. */ - if (! NILP (B_ (old_buf, pt_marker))) + if (! NILP (BVAR (old_buf, pt_marker))) { Lisp_Object obuf; XSETBUFFER (obuf, old_buf); - set_marker_both (B_ (old_buf, pt_marker), obuf, + set_marker_both (BVAR (old_buf, pt_marker), obuf, BUF_PT (old_buf), BUF_PT_BYTE (old_buf)); } - if (! NILP (B_ (old_buf, begv_marker))) + if (! NILP (BVAR (old_buf, begv_marker))) { Lisp_Object obuf; XSETBUFFER (obuf, old_buf); - set_marker_both (B_ (old_buf, begv_marker), obuf, + set_marker_both (BVAR (old_buf, begv_marker), obuf, BUF_BEGV (old_buf), BUF_BEGV_BYTE (old_buf)); } - if (! NILP (B_ (old_buf, zv_marker))) + if (! NILP (BVAR (old_buf, zv_marker))) { Lisp_Object obuf; XSETBUFFER (obuf, old_buf); - set_marker_both (B_ (old_buf, zv_marker), obuf, + set_marker_both (BVAR (old_buf, zv_marker), obuf, BUF_ZV (old_buf), BUF_ZV_BYTE (old_buf)); } } @@ -1825,24 +1825,24 @@ set_buffer_internal_1 (register struct buffer *b) /* Get the undo list from the base buffer, so that it appears that an indirect buffer shares the undo list of its base. */ if (b->base_buffer) - B_ (b, undo_list) = B_ (b->base_buffer, undo_list); + BVAR (b, undo_list) = BVAR (b->base_buffer, undo_list); /* If the new current buffer has markers to record PT, BEGV and ZV when it is not current, fetch them now. */ - if (! NILP (B_ (b, pt_marker))) + if (! NILP (BVAR (b, pt_marker))) { - BUF_PT (b) = marker_position (B_ (b, pt_marker)); - BUF_PT_BYTE (b) = marker_byte_position (B_ (b, pt_marker)); + BUF_PT (b) = marker_position (BVAR (b, pt_marker)); + BUF_PT_BYTE (b) = marker_byte_position (BVAR (b, pt_marker)); } - if (! NILP (B_ (b, begv_marker))) + if (! NILP (BVAR (b, begv_marker))) { - BUF_BEGV (b) = marker_position (B_ (b, begv_marker)); - BUF_BEGV_BYTE (b) = marker_byte_position (B_ (b, begv_marker)); + BUF_BEGV (b) = marker_position (BVAR (b, begv_marker)); + BUF_BEGV_BYTE (b) = marker_byte_position (BVAR (b, begv_marker)); } - if (! NILP (B_ (b, zv_marker))) + if (! NILP (BVAR (b, zv_marker))) { - BUF_ZV (b) = marker_position (B_ (b, zv_marker)); - BUF_ZV_BYTE (b) = marker_byte_position (B_ (b, zv_marker)); + BUF_ZV (b) = marker_position (BVAR (b, zv_marker)); + BUF_ZV_BYTE (b) = marker_byte_position (BVAR (b, zv_marker)); } /* Look down buffer's list of local Lisp variables @@ -1850,7 +1850,7 @@ set_buffer_internal_1 (register struct buffer *b) do { - for (tail = B_ (b, local_var_alist); CONSP (tail); tail = XCDR (tail)) + for (tail = BVAR (b, local_var_alist); CONSP (tail); tail = XCDR (tail)) { Lisp_Object var = XCAR (XCAR (tail)); struct Lisp_Symbol *sym = XSYMBOL (var); @@ -1883,45 +1883,45 @@ set_buffer_temp (struct buffer *b) { /* If the old current buffer has markers to record PT, BEGV and ZV when it is not current, update them now. */ - if (! NILP (B_ (old_buf, pt_marker))) + if (! NILP (BVAR (old_buf, pt_marker))) { Lisp_Object obuf; XSETBUFFER (obuf, old_buf); - set_marker_both (B_ (old_buf, pt_marker), obuf, + set_marker_both (BVAR (old_buf, pt_marker), obuf, BUF_PT (old_buf), BUF_PT_BYTE (old_buf)); } - if (! NILP (B_ (old_buf, begv_marker))) + if (! NILP (BVAR (old_buf, begv_marker))) { Lisp_Object obuf; XSETBUFFER (obuf, old_buf); - set_marker_both (B_ (old_buf, begv_marker), obuf, + set_marker_both (BVAR (old_buf, begv_marker), obuf, BUF_BEGV (old_buf), BUF_BEGV_BYTE (old_buf)); } - if (! NILP (B_ (old_buf, zv_marker))) + if (! NILP (BVAR (old_buf, zv_marker))) { Lisp_Object obuf; XSETBUFFER (obuf, old_buf); - set_marker_both (B_ (old_buf, zv_marker), obuf, + set_marker_both (BVAR (old_buf, zv_marker), obuf, BUF_ZV (old_buf), BUF_ZV_BYTE (old_buf)); } } /* If the new current buffer has markers to record PT, BEGV and ZV when it is not current, fetch them now. */ - if (! NILP (B_ (b, pt_marker))) + if (! NILP (BVAR (b, pt_marker))) { - BUF_PT (b) = marker_position (B_ (b, pt_marker)); - BUF_PT_BYTE (b) = marker_byte_position (B_ (b, pt_marker)); + BUF_PT (b) = marker_position (BVAR (b, pt_marker)); + BUF_PT_BYTE (b) = marker_byte_position (BVAR (b, pt_marker)); } - if (! NILP (B_ (b, begv_marker))) + if (! NILP (BVAR (b, begv_marker))) { - BUF_BEGV (b) = marker_position (B_ (b, begv_marker)); - BUF_BEGV_BYTE (b) = marker_byte_position (B_ (b, begv_marker)); + BUF_BEGV (b) = marker_position (BVAR (b, begv_marker)); + BUF_BEGV_BYTE (b) = marker_byte_position (BVAR (b, begv_marker)); } - if (! NILP (B_ (b, zv_marker))) + if (! NILP (BVAR (b, zv_marker))) { - BUF_ZV (b) = marker_position (B_ (b, zv_marker)); - BUF_ZV_BYTE (b) = marker_byte_position (B_ (b, zv_marker)); + BUF_ZV (b) = marker_position (BVAR (b, zv_marker)); + BUF_ZV_BYTE (b) = marker_byte_position (BVAR (b, zv_marker)); } } @@ -1938,7 +1938,7 @@ ends when the current command terminates. Use `switch-to-buffer' or buffer = Fget_buffer (buffer_or_name); if (NILP (buffer)) nsberror (buffer_or_name); - if (NILP (B_ (XBUFFER (buffer), name))) + if (NILP (BVAR (XBUFFER (buffer), name))) error ("Selecting deleted buffer"); set_buffer_internal (XBUFFER (buffer)); return buffer; @@ -1949,7 +1949,7 @@ ends when the current command terminates. Use `switch-to-buffer' or Lisp_Object set_buffer_if_live (Lisp_Object buffer) { - if (! NILP (B_ (XBUFFER (buffer), name))) + if (! NILP (BVAR (XBUFFER (buffer), name))) Fset_buffer (buffer); return Qnil; } @@ -1959,7 +1959,7 @@ DEFUN ("barf-if-buffer-read-only", Fbarf_if_buffer_read_only, doc: /* Signal a `buffer-read-only' error if the current buffer is read-only. */) (void) { - if (!NILP (B_ (current_buffer, read_only)) + if (!NILP (BVAR (current_buffer, read_only)) && NILP (Vinhibit_read_only)) xsignal1 (Qbuffer_read_only, Fcurrent_buffer ()); return Qnil; @@ -2008,7 +2008,7 @@ its frame, iconify that frame. */) /* Move buffer to the end of the buffer list. Do nothing if the buffer is killed. */ - if (!NILP (B_ (XBUFFER (buffer), name))) + if (!NILP (BVAR (XBUFFER (buffer), name))) { Lisp_Object aelt, link; @@ -2041,7 +2041,7 @@ so the buffer is truly empty after this. */) /* Prevent warnings, or suspension of auto saving, that would happen if future size is less than past size. Use of erase-buffer implies that the future text is not really related to the past text. */ - XSETFASTINT (B_ (current_buffer, save_length), 0); + XSETFASTINT (BVAR (current_buffer, save_length), 0); return Qnil; } @@ -2111,7 +2111,7 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text, CHECK_BUFFER (buffer); other_buffer = XBUFFER (buffer); - if (NILP (B_ (other_buffer, name))) + if (NILP (BVAR (other_buffer, name))) error ("Cannot swap a dead buffer's text"); /* Actually, it probably works just fine. @@ -2140,9 +2140,9 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text, } while (0) #define swapfield_(field, type) \ do { \ - type tmp##field = B_ (other_buffer, field); \ - B_ (other_buffer, field) = B_ (current_buffer, field); \ - B_ (current_buffer, field) = tmp##field; \ + type tmp##field = BVAR (other_buffer, field); \ + BVAR (other_buffer, field) = BVAR (current_buffer, field); \ + BVAR (current_buffer, field) = tmp##field; \ } while (0) swapfield (own_text, struct buffer_text); @@ -2181,8 +2181,8 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text, swapfield_ (pt_marker, Lisp_Object); swapfield_ (begv_marker, Lisp_Object); swapfield_ (zv_marker, Lisp_Object); - B_ (current_buffer, point_before_scroll) = Qnil; - B_ (other_buffer, point_before_scroll) = Qnil; + BVAR (current_buffer, point_before_scroll) = Qnil; + BVAR (other_buffer, point_before_scroll) = Qnil; current_buffer->text->modiff++; other_buffer->text->modiff++; current_buffer->text->chars_modiff++; other_buffer->text->chars_modiff++; @@ -2256,21 +2256,21 @@ current buffer is cleared. */) EMACS_INT begv, zv; int narrowed = (BEG != BEGV || Z != ZV); int modified_p = !NILP (Fbuffer_modified_p (Qnil)); - Lisp_Object old_undo = B_ (current_buffer, undo_list); + Lisp_Object old_undo = BVAR (current_buffer, undo_list); struct gcpro gcpro1; if (current_buffer->base_buffer) error ("Cannot do `set-buffer-multibyte' on an indirect buffer"); /* Do nothing if nothing actually changes. */ - if (NILP (flag) == NILP (B_ (current_buffer, enable_multibyte_characters))) + if (NILP (flag) == NILP (BVAR (current_buffer, enable_multibyte_characters))) return flag; GCPRO1 (old_undo); /* Don't record these buffer changes. We will put a special undo entry instead. */ - B_ (current_buffer, undo_list) = Qt; + BVAR (current_buffer, undo_list) = Qt; /* If the cached position is for this buffer, clear it out. */ clear_charpos_cache (current_buffer); @@ -2292,7 +2292,7 @@ current buffer is cleared. */) to calculate the old correspondences. */ set_intervals_multibyte (0); - B_ (current_buffer, enable_multibyte_characters) = Qnil; + BVAR (current_buffer, enable_multibyte_characters) = Qnil; Z = Z_BYTE; BEGV = BEGV_BYTE; @@ -2430,7 +2430,7 @@ current buffer is cleared. */) /* Do this first, so that chars_in_text asks the right question. set_intervals_multibyte needs it too. */ - B_ (current_buffer, enable_multibyte_characters) = Qt; + BVAR (current_buffer, enable_multibyte_characters) = Qt; GPT_BYTE = advance_to_char_boundary (GPT_BYTE); GPT = chars_in_text (BEG_ADDR, GPT_BYTE - BEG_BYTE) + BEG; @@ -2488,7 +2488,7 @@ current buffer is cleared. */) if (!EQ (old_undo, Qt)) { /* Represent all the above changes by a special undo entry. */ - B_ (current_buffer, undo_list) = Fcons (list3 (Qapply, + BVAR (current_buffer, undo_list) = Fcons (list3 (Qapply, intern ("set-buffer-multibyte"), NILP (flag) ? Qt : Qnil), old_undo); @@ -2504,10 +2504,10 @@ current buffer is cleared. */) /* Copy this buffer's new multibyte status into all of its indirect buffers. */ for (other = all_buffers; other; other = other->next) - if (other->base_buffer == current_buffer && !NILP (B_ (other, name))) + if (other->base_buffer == current_buffer && !NILP (BVAR (other, name))) { - B_ (other, enable_multibyte_characters) - = B_ (current_buffer, enable_multibyte_characters); + BVAR (other, enable_multibyte_characters) + = BVAR (current_buffer, enable_multibyte_characters); other->prevent_redisplay_optimizations_p = 1; } @@ -2574,7 +2574,7 @@ swap_out_buffer_local_variables (struct buffer *b) Lisp_Object oalist, alist, buffer; XSETBUFFER (buffer, b); - oalist = B_ (b, local_var_alist); + oalist = BVAR (b, local_var_alist); for (alist = oalist; CONSP (alist); alist = XCDR (alist)) { @@ -3078,7 +3078,7 @@ record_overlay_string (struct sortstrlist *ssl, Lisp_Object str, Lisp_Object str ssl->buf[ssl->used].priority = (INTEGERP (pri) ? XINT (pri) : 0); ssl->used++; - if (NILP (B_ (current_buffer, enable_multibyte_characters))) + if (NILP (BVAR (current_buffer, enable_multibyte_characters))) nbytes = SCHARS (str); else if (! STRING_MULTIBYTE (str)) nbytes = count_size_as_multibyte (SDATA (str), @@ -3090,7 +3090,7 @@ record_overlay_string (struct sortstrlist *ssl, Lisp_Object str, Lisp_Object str if (STRINGP (str2)) { - if (NILP (B_ (current_buffer, enable_multibyte_characters))) + if (NILP (BVAR (current_buffer, enable_multibyte_characters))) nbytes = SCHARS (str2); else if (! STRING_MULTIBYTE (str2)) nbytes = count_size_as_multibyte (SDATA (str2), @@ -3120,7 +3120,7 @@ overlay_strings (EMACS_INT pos, struct window *w, unsigned char **pstr) Lisp_Object overlay, window, str; struct Lisp_Overlay *ov; EMACS_INT startpos, endpos; - int multibyte = ! NILP (B_ (current_buffer, enable_multibyte_characters)); + int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); overlay_heads.used = overlay_heads.bytes = 0; overlay_tails.used = overlay_tails.bytes = 0; @@ -4991,9 +4991,9 @@ init_buffer_once (void) /* Make sure all markable slots in buffer_defaults are initialized reasonably, so mark_buffer won't choke. */ reset_buffer (&buffer_defaults); - eassert (EQ (B_ (&buffer_defaults, name), make_number (0))); + eassert (EQ (BVAR (&buffer_defaults, name), make_number (0))); reset_buffer_local_variables (&buffer_defaults, 1); - eassert (EQ (B_ (&buffer_local_symbols, name), make_number (0))); + eassert (EQ (BVAR (&buffer_local_symbols, name), make_number (0))); reset_buffer (&buffer_local_symbols); reset_buffer_local_variables (&buffer_local_symbols, 1); /* Prevent GC from getting confused. */ @@ -5010,60 +5010,60 @@ init_buffer_once (void) /* Must do these before making the first buffer! */ /* real setup is done in bindings.el */ - B_ (&buffer_defaults, mode_line_format) = make_pure_c_string ("%-"); - B_ (&buffer_defaults, header_line_format) = Qnil; - B_ (&buffer_defaults, abbrev_mode) = Qnil; - B_ (&buffer_defaults, overwrite_mode) = Qnil; - B_ (&buffer_defaults, case_fold_search) = Qt; - B_ (&buffer_defaults, auto_fill_function) = Qnil; - B_ (&buffer_defaults, selective_display) = Qnil; + BVAR (&buffer_defaults, mode_line_format) = make_pure_c_string ("%-"); + BVAR (&buffer_defaults, header_line_format) = Qnil; + BVAR (&buffer_defaults, abbrev_mode) = Qnil; + BVAR (&buffer_defaults, overwrite_mode) = Qnil; + BVAR (&buffer_defaults, case_fold_search) = Qt; + BVAR (&buffer_defaults, auto_fill_function) = Qnil; + BVAR (&buffer_defaults, selective_display) = Qnil; #ifndef old - B_ (&buffer_defaults, selective_display_ellipses) = Qt; + BVAR (&buffer_defaults, selective_display_ellipses) = Qt; #endif - B_ (&buffer_defaults, abbrev_table) = Qnil; - B_ (&buffer_defaults, display_table) = Qnil; - B_ (&buffer_defaults, undo_list) = Qnil; - B_ (&buffer_defaults, mark_active) = Qnil; - B_ (&buffer_defaults, file_format) = Qnil; - B_ (&buffer_defaults, auto_save_file_format) = Qt; + BVAR (&buffer_defaults, abbrev_table) = Qnil; + BVAR (&buffer_defaults, display_table) = Qnil; + BVAR (&buffer_defaults, undo_list) = Qnil; + BVAR (&buffer_defaults, mark_active) = Qnil; + BVAR (&buffer_defaults, file_format) = Qnil; + BVAR (&buffer_defaults, auto_save_file_format) = Qt; buffer_defaults.overlays_before = NULL; buffer_defaults.overlays_after = NULL; buffer_defaults.overlay_center = BEG; - XSETFASTINT (B_ (&buffer_defaults, tab_width), 8); - B_ (&buffer_defaults, truncate_lines) = Qnil; - B_ (&buffer_defaults, word_wrap) = Qnil; - B_ (&buffer_defaults, ctl_arrow) = Qt; - B_ (&buffer_defaults, bidi_display_reordering) = Qnil; - B_ (&buffer_defaults, bidi_paragraph_direction) = Qnil; - B_ (&buffer_defaults, cursor_type) = Qt; - B_ (&buffer_defaults, extra_line_spacing) = Qnil; - B_ (&buffer_defaults, cursor_in_non_selected_windows) = Qt; + XSETFASTINT (BVAR (&buffer_defaults, tab_width), 8); + BVAR (&buffer_defaults, truncate_lines) = Qnil; + BVAR (&buffer_defaults, word_wrap) = Qnil; + BVAR (&buffer_defaults, ctl_arrow) = Qt; + BVAR (&buffer_defaults, bidi_display_reordering) = Qnil; + BVAR (&buffer_defaults, bidi_paragraph_direction) = Qnil; + BVAR (&buffer_defaults, cursor_type) = Qt; + BVAR (&buffer_defaults, extra_line_spacing) = Qnil; + BVAR (&buffer_defaults, cursor_in_non_selected_windows) = Qt; #ifdef DOS_NT - B_ (&buffer_defaults, buffer_file_type) = Qnil; /* TEXT */ + BVAR (&buffer_defaults, buffer_file_type) = Qnil; /* TEXT */ #endif - B_ (&buffer_defaults, enable_multibyte_characters) = Qt; - B_ (&buffer_defaults, buffer_file_coding_system) = Qnil; - XSETFASTINT (B_ (&buffer_defaults, fill_column), 70); - XSETFASTINT (B_ (&buffer_defaults, left_margin), 0); - B_ (&buffer_defaults, cache_long_line_scans) = Qnil; - B_ (&buffer_defaults, file_truename) = Qnil; - XSETFASTINT (B_ (&buffer_defaults, display_count), 0); - XSETFASTINT (B_ (&buffer_defaults, left_margin_cols), 0); - XSETFASTINT (B_ (&buffer_defaults, right_margin_cols), 0); - B_ (&buffer_defaults, left_fringe_width) = Qnil; - B_ (&buffer_defaults, right_fringe_width) = Qnil; - B_ (&buffer_defaults, fringes_outside_margins) = Qnil; - B_ (&buffer_defaults, scroll_bar_width) = Qnil; - B_ (&buffer_defaults, vertical_scroll_bar_type) = Qt; - B_ (&buffer_defaults, indicate_empty_lines) = Qnil; - B_ (&buffer_defaults, indicate_buffer_boundaries) = Qnil; - B_ (&buffer_defaults, fringe_indicator_alist) = Qnil; - B_ (&buffer_defaults, fringe_cursor_alist) = Qnil; - B_ (&buffer_defaults, scroll_up_aggressively) = Qnil; - B_ (&buffer_defaults, scroll_down_aggressively) = Qnil; - B_ (&buffer_defaults, display_time) = Qnil; + BVAR (&buffer_defaults, enable_multibyte_characters) = Qt; + BVAR (&buffer_defaults, buffer_file_coding_system) = Qnil; + XSETFASTINT (BVAR (&buffer_defaults, fill_column), 70); + XSETFASTINT (BVAR (&buffer_defaults, left_margin), 0); + BVAR (&buffer_defaults, cache_long_line_scans) = Qnil; + BVAR (&buffer_defaults, file_truename) = Qnil; + XSETFASTINT (BVAR (&buffer_defaults, display_count), 0); + XSETFASTINT (BVAR (&buffer_defaults, left_margin_cols), 0); + XSETFASTINT (BVAR (&buffer_defaults, right_margin_cols), 0); + BVAR (&buffer_defaults, left_fringe_width) = Qnil; + BVAR (&buffer_defaults, right_fringe_width) = Qnil; + BVAR (&buffer_defaults, fringes_outside_margins) = Qnil; + BVAR (&buffer_defaults, scroll_bar_width) = Qnil; + BVAR (&buffer_defaults, vertical_scroll_bar_type) = Qt; + BVAR (&buffer_defaults, indicate_empty_lines) = Qnil; + BVAR (&buffer_defaults, indicate_buffer_boundaries) = Qnil; + BVAR (&buffer_defaults, fringe_indicator_alist) = Qnil; + BVAR (&buffer_defaults, fringe_cursor_alist) = Qnil; + BVAR (&buffer_defaults, scroll_up_aggressively) = Qnil; + BVAR (&buffer_defaults, scroll_down_aggressively) = Qnil; + BVAR (&buffer_defaults, display_time) = Qnil; /* Assign the local-flags to the slots that have default values. The local flag is a bit that is used in the buffer @@ -5075,73 +5075,73 @@ init_buffer_once (void) /* 0 means not a lisp var, -1 means always local, else mask */ memset (&buffer_local_flags, 0, sizeof buffer_local_flags); - XSETINT (B_ (&buffer_local_flags, filename), -1); - XSETINT (B_ (&buffer_local_flags, directory), -1); - XSETINT (B_ (&buffer_local_flags, backed_up), -1); - XSETINT (B_ (&buffer_local_flags, save_length), -1); - XSETINT (B_ (&buffer_local_flags, auto_save_file_name), -1); - XSETINT (B_ (&buffer_local_flags, read_only), -1); - XSETINT (B_ (&buffer_local_flags, major_mode), -1); - XSETINT (B_ (&buffer_local_flags, mode_name), -1); - XSETINT (B_ (&buffer_local_flags, undo_list), -1); - XSETINT (B_ (&buffer_local_flags, mark_active), -1); - XSETINT (B_ (&buffer_local_flags, point_before_scroll), -1); - XSETINT (B_ (&buffer_local_flags, file_truename), -1); - XSETINT (B_ (&buffer_local_flags, invisibility_spec), -1); - XSETINT (B_ (&buffer_local_flags, file_format), -1); - XSETINT (B_ (&buffer_local_flags, auto_save_file_format), -1); - XSETINT (B_ (&buffer_local_flags, display_count), -1); - XSETINT (B_ (&buffer_local_flags, display_time), -1); - XSETINT (B_ (&buffer_local_flags, enable_multibyte_characters), -1); + XSETINT (BVAR (&buffer_local_flags, filename), -1); + XSETINT (BVAR (&buffer_local_flags, directory), -1); + XSETINT (BVAR (&buffer_local_flags, backed_up), -1); + XSETINT (BVAR (&buffer_local_flags, save_length), -1); + XSETINT (BVAR (&buffer_local_flags, auto_save_file_name), -1); + XSETINT (BVAR (&buffer_local_flags, read_only), -1); + XSETINT (BVAR (&buffer_local_flags, major_mode), -1); + XSETINT (BVAR (&buffer_local_flags, mode_name), -1); + XSETINT (BVAR (&buffer_local_flags, undo_list), -1); + XSETINT (BVAR (&buffer_local_flags, mark_active), -1); + XSETINT (BVAR (&buffer_local_flags, point_before_scroll), -1); + XSETINT (BVAR (&buffer_local_flags, file_truename), -1); + XSETINT (BVAR (&buffer_local_flags, invisibility_spec), -1); + XSETINT (BVAR (&buffer_local_flags, file_format), -1); + XSETINT (BVAR (&buffer_local_flags, auto_save_file_format), -1); + XSETINT (BVAR (&buffer_local_flags, display_count), -1); + XSETINT (BVAR (&buffer_local_flags, display_time), -1); + XSETINT (BVAR (&buffer_local_flags, enable_multibyte_characters), -1); idx = 1; - XSETFASTINT (B_ (&buffer_local_flags, mode_line_format), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, abbrev_mode), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, overwrite_mode), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, case_fold_search), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, auto_fill_function), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, selective_display), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, mode_line_format), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, abbrev_mode), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, overwrite_mode), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, case_fold_search), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, auto_fill_function), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, selective_display), idx); ++idx; #ifndef old - XSETFASTINT (B_ (&buffer_local_flags, selective_display_ellipses), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, selective_display_ellipses), idx); ++idx; #endif - XSETFASTINT (B_ (&buffer_local_flags, tab_width), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, truncate_lines), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, word_wrap), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, ctl_arrow), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, fill_column), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, left_margin), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, abbrev_table), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, display_table), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, tab_width), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, truncate_lines), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, word_wrap), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, ctl_arrow), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, fill_column), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, left_margin), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, abbrev_table), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, display_table), idx); ++idx; #ifdef DOS_NT - XSETFASTINT (B_ (&buffer_local_flags, buffer_file_type), idx); + XSETFASTINT (BVAR (&buffer_local_flags, buffer_file_type), idx); /* Make this one a permanent local. */ buffer_permanent_local_flags[idx++] = 1; #endif - XSETFASTINT (B_ (&buffer_local_flags, syntax_table), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, cache_long_line_scans), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, category_table), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, bidi_display_reordering), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, bidi_paragraph_direction), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, buffer_file_coding_system), idx); + XSETFASTINT (BVAR (&buffer_local_flags, syntax_table), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, cache_long_line_scans), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, category_table), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, bidi_display_reordering), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, bidi_paragraph_direction), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, buffer_file_coding_system), idx); /* Make this one a permanent local. */ buffer_permanent_local_flags[idx++] = 1; - XSETFASTINT (B_ (&buffer_local_flags, left_margin_cols), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, right_margin_cols), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, left_fringe_width), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, right_fringe_width), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, fringes_outside_margins), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, scroll_bar_width), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, vertical_scroll_bar_type), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, indicate_empty_lines), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, indicate_buffer_boundaries), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, fringe_indicator_alist), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, fringe_cursor_alist), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, scroll_up_aggressively), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, scroll_down_aggressively), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, header_line_format), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, cursor_type), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, extra_line_spacing), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, cursor_in_non_selected_windows), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, left_margin_cols), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, right_margin_cols), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, left_fringe_width), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, right_fringe_width), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, fringes_outside_margins), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, scroll_bar_width), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, vertical_scroll_bar_type), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, indicate_empty_lines), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, indicate_buffer_boundaries), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, fringe_indicator_alist), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, fringe_cursor_alist), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, scroll_up_aggressively), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, scroll_down_aggressively), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, header_line_format), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, cursor_type), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, extra_line_spacing), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, cursor_in_non_selected_windows), idx); ++idx; /* Need more room? */ if (idx >= MAX_PER_BUFFER_VARS) @@ -5155,7 +5155,7 @@ init_buffer_once (void) QSFundamental = make_pure_c_string ("Fundamental"); Qfundamental_mode = intern_c_string ("fundamental-mode"); - B_ (&buffer_defaults, major_mode) = Qfundamental_mode; + BVAR (&buffer_defaults, major_mode) = Qfundamental_mode; Qmode_class = intern_c_string ("mode-class"); @@ -5198,7 +5198,7 @@ init_buffer (void) #endif /* USE_MMAP_FOR_BUFFERS */ Fset_buffer (Fget_buffer_create (build_string ("*scratch*"))); - if (NILP (B_ (&buffer_defaults, enable_multibyte_characters))) + if (NILP (BVAR (&buffer_defaults, enable_multibyte_characters))) Fset_buffer_multibyte (Qnil); pwd = get_current_dir_name (); @@ -5219,28 +5219,28 @@ init_buffer (void) pwd[len + 1] = '\0'; } - B_ (current_buffer, directory) = make_unibyte_string (pwd, strlen (pwd)); - if (! NILP (B_ (&buffer_defaults, enable_multibyte_characters))) + BVAR (current_buffer, directory) = make_unibyte_string (pwd, strlen (pwd)); + if (! NILP (BVAR (&buffer_defaults, enable_multibyte_characters))) /* At this moment, we still don't know how to decode the directory name. So, we keep the bytes in multibyte form so that ENCODE_FILE correctly gets the original bytes. */ - B_ (current_buffer, directory) - = string_to_multibyte (B_ (current_buffer, directory)); + BVAR (current_buffer, directory) + = string_to_multibyte (BVAR (current_buffer, directory)); /* Add /: to the front of the name if it would otherwise be treated as magic. */ - temp = Ffind_file_name_handler (B_ (current_buffer, directory), Qt); + temp = Ffind_file_name_handler (BVAR (current_buffer, directory), Qt); if (! NILP (temp) /* If the default dir is just /, TEMP is non-nil because of the ange-ftp completion handler. However, it is not necessary to turn / into /:/. So avoid doing that. */ - && strcmp ("/", SSDATA (B_ (current_buffer, directory)))) - B_ (current_buffer, directory) - = concat2 (build_string ("/:"), B_ (current_buffer, directory)); + && strcmp ("/", SSDATA (BVAR (current_buffer, directory)))) + BVAR (current_buffer, directory) + = concat2 (build_string ("/:"), BVAR (current_buffer, directory)); temp = get_minibuffer (0); - B_ (XBUFFER (temp), directory) = B_ (current_buffer, directory); + BVAR (XBUFFER (temp), directory) = BVAR (current_buffer, directory); free (pwd); } @@ -5491,13 +5491,13 @@ This value applies in buffers that don't have their own local values. This is the same as (default-value 'scroll-down-aggressively). */); DEFVAR_PER_BUFFER ("header-line-format", - &B_ (current_buffer, header_line_format), + &BVAR (current_buffer, header_line_format), Qnil, doc: /* Analogous to `mode-line-format', but controls the header line. The header line appears, optionally, at the top of a window; the mode line appears at the bottom. */); - DEFVAR_PER_BUFFER ("mode-line-format", &B_ (current_buffer, mode_line_format), + DEFVAR_PER_BUFFER ("mode-line-format", &BVAR (current_buffer, mode_line_format), Qnil, doc: /* Template for displaying mode line for current buffer. Each buffer has its own value of this variable. @@ -5554,7 +5554,7 @@ Decimal digits after the % specify field width to which to pad. */); DEFVAR_BUFFER_DEFAULTS ("default-major-mode", major_mode, doc: /* *Value of `major-mode' for new buffers. */); - DEFVAR_PER_BUFFER ("major-mode", &B_ (current_buffer, major_mode), + DEFVAR_PER_BUFFER ("major-mode", &BVAR (current_buffer, major_mode), make_number (Lisp_Symbol), doc: /* Symbol for current buffer's major mode. The default value (normally `fundamental-mode') affects new buffers. @@ -5567,46 +5567,46 @@ the buffer. Thus, the mode and its hooks should not expect certain variables such as `buffer-read-only' and `buffer-file-coding-system' to be set up. */); - DEFVAR_PER_BUFFER ("mode-name", &B_ (current_buffer, mode_name), + DEFVAR_PER_BUFFER ("mode-name", &BVAR (current_buffer, mode_name), Qnil, doc: /* Pretty name of current buffer's major mode. Usually a string, but can use any of the constructs for `mode-line-format', which see. Format with `format-mode-line' to produce a string value. */); - DEFVAR_PER_BUFFER ("local-abbrev-table", &B_ (current_buffer, abbrev_table), Qnil, + DEFVAR_PER_BUFFER ("local-abbrev-table", &BVAR (current_buffer, abbrev_table), Qnil, doc: /* Local (mode-specific) abbrev table of current buffer. */); - DEFVAR_PER_BUFFER ("abbrev-mode", &B_ (current_buffer, abbrev_mode), Qnil, + DEFVAR_PER_BUFFER ("abbrev-mode", &BVAR (current_buffer, abbrev_mode), Qnil, doc: /* Non-nil if Abbrev mode is enabled. Use the command `abbrev-mode' to change this variable. */); - DEFVAR_PER_BUFFER ("case-fold-search", &B_ (current_buffer, case_fold_search), + DEFVAR_PER_BUFFER ("case-fold-search", &BVAR (current_buffer, case_fold_search), Qnil, doc: /* *Non-nil if searches and matches should ignore case. */); - DEFVAR_PER_BUFFER ("fill-column", &B_ (current_buffer, fill_column), + DEFVAR_PER_BUFFER ("fill-column", &BVAR (current_buffer, fill_column), make_number (LISP_INT_TAG), doc: /* *Column beyond which automatic line-wrapping should happen. Interactively, you can set the buffer local value using \\[set-fill-column]. */); - DEFVAR_PER_BUFFER ("left-margin", &B_ (current_buffer, left_margin), + DEFVAR_PER_BUFFER ("left-margin", &BVAR (current_buffer, left_margin), make_number (LISP_INT_TAG), doc: /* *Column for the default `indent-line-function' to indent to. Linefeed indents to this column in Fundamental mode. */); - DEFVAR_PER_BUFFER ("tab-width", &B_ (current_buffer, tab_width), + DEFVAR_PER_BUFFER ("tab-width", &BVAR (current_buffer, tab_width), make_number (LISP_INT_TAG), doc: /* *Distance between tab stops (for display of tab characters), in columns. */); - DEFVAR_PER_BUFFER ("ctl-arrow", &B_ (current_buffer, ctl_arrow), Qnil, + DEFVAR_PER_BUFFER ("ctl-arrow", &BVAR (current_buffer, ctl_arrow), Qnil, doc: /* *Non-nil means display control chars with uparrow. A value of nil means use backslash and octal digits. This variable does not apply to characters whose display is specified in the current display table (if there is one). */); DEFVAR_PER_BUFFER ("enable-multibyte-characters", - &B_ (current_buffer, enable_multibyte_characters), + &BVAR (current_buffer, enable_multibyte_characters), Qnil, doc: /* Non-nil means the buffer contents are regarded as multi-byte characters. Otherwise they are regarded as unibyte. This affects the display, @@ -5620,7 +5620,7 @@ See also variable `default-enable-multibyte-characters' and Info node XSYMBOL (intern_c_string ("enable-multibyte-characters"))->constant = 1; DEFVAR_PER_BUFFER ("buffer-file-coding-system", - &B_ (current_buffer, buffer_file_coding_system), Qnil, + &BVAR (current_buffer, buffer_file_coding_system), Qnil, doc: /* Coding system to be used for encoding the buffer contents on saving. This variable applies to saving the buffer, and also to `write-region' and other functions that use `write-region'. @@ -5638,11 +5638,11 @@ The variable `coding-system-for-write', if non-nil, overrides this variable. This variable is never applied to a way of decoding a file while reading it. */); DEFVAR_PER_BUFFER ("bidi-display-reordering", - &B_ (current_buffer, bidi_display_reordering), Qnil, + &BVAR (current_buffer, bidi_display_reordering), Qnil, doc: /* Non-nil means reorder bidirectional text for display in the visual order. */); DEFVAR_PER_BUFFER ("bidi-paragraph-direction", - &B_ (current_buffer, bidi_paragraph_direction), Qnil, + &BVAR (current_buffer, bidi_paragraph_direction), Qnil, doc: /* *If non-nil, forces directionality of text paragraphs in the buffer. If this is nil (the default), the direction of each paragraph is @@ -5653,7 +5653,7 @@ Any other value is treated as nil. This variable has no effect unless the buffer's value of \`bidi-display-reordering' is non-nil. */); - DEFVAR_PER_BUFFER ("truncate-lines", &B_ (current_buffer, truncate_lines), Qnil, + DEFVAR_PER_BUFFER ("truncate-lines", &BVAR (current_buffer, truncate_lines), Qnil, doc: /* *Non-nil means do not display continuation lines. Instead, give each line of text just one screen line. @@ -5661,7 +5661,7 @@ Note that this is overridden by the variable `truncate-partial-width-windows' if that variable is non-nil and this buffer is not full-frame width. */); - DEFVAR_PER_BUFFER ("word-wrap", &B_ (current_buffer, word_wrap), Qnil, + DEFVAR_PER_BUFFER ("word-wrap", &BVAR (current_buffer, word_wrap), Qnil, doc: /* *Non-nil means to use word-wrapping for continuation lines. When word-wrapping is on, continuation lines are wrapped at the space or tab character nearest to the right window edge. @@ -5674,7 +5674,7 @@ word-wrapping, you might want to reduce the value of in narrower windows. */); #ifdef DOS_NT - DEFVAR_PER_BUFFER ("buffer-file-type", &B_ (current_buffer, buffer_file_type), + DEFVAR_PER_BUFFER ("buffer-file-type", &BVAR (current_buffer, buffer_file_type), Qnil, doc: /* Non-nil if the visited file is a binary file. This variable is meaningful on MS-DOG and Windows NT. @@ -5682,12 +5682,12 @@ On those systems, it is automatically local in every buffer. On other systems, this variable is normally always nil. */); #endif - DEFVAR_PER_BUFFER ("default-directory", &B_ (current_buffer, directory), + DEFVAR_PER_BUFFER ("default-directory", &BVAR (current_buffer, directory), make_number (Lisp_String), doc: /* Name of default directory of current buffer. Should end with slash. To interactively change the default directory, use command `cd'. */); - DEFVAR_PER_BUFFER ("auto-fill-function", &B_ (current_buffer, auto_fill_function), + DEFVAR_PER_BUFFER ("auto-fill-function", &BVAR (current_buffer, auto_fill_function), Qnil, doc: /* Function called (if non-nil) to perform auto-fill. It is called after self-inserting any character specified in @@ -5695,30 +5695,30 @@ the `auto-fill-chars' table. NOTE: This variable is not a hook; its value may not be a list of functions. */); - DEFVAR_PER_BUFFER ("buffer-file-name", &B_ (current_buffer, filename), + DEFVAR_PER_BUFFER ("buffer-file-name", &BVAR (current_buffer, filename), make_number (Lisp_String), doc: /* Name of file visited in current buffer, or nil if not visiting a file. */); - DEFVAR_PER_BUFFER ("buffer-file-truename", &B_ (current_buffer, file_truename), + DEFVAR_PER_BUFFER ("buffer-file-truename", &BVAR (current_buffer, file_truename), make_number (Lisp_String), doc: /* Abbreviated truename of file visited in current buffer, or nil if none. The truename of a file is calculated by `file-truename' and then abbreviated with `abbreviate-file-name'. */); DEFVAR_PER_BUFFER ("buffer-auto-save-file-name", - &B_ (current_buffer, auto_save_file_name), + &BVAR (current_buffer, auto_save_file_name), make_number (Lisp_String), doc: /* Name of file for auto-saving current buffer. If it is nil, that means don't auto-save this buffer. */); - DEFVAR_PER_BUFFER ("buffer-read-only", &B_ (current_buffer, read_only), Qnil, + DEFVAR_PER_BUFFER ("buffer-read-only", &BVAR (current_buffer, read_only), Qnil, doc: /* Non-nil if this buffer is read-only. */); - DEFVAR_PER_BUFFER ("buffer-backed-up", &B_ (current_buffer, backed_up), Qnil, + DEFVAR_PER_BUFFER ("buffer-backed-up", &BVAR (current_buffer, backed_up), Qnil, doc: /* Non-nil if this buffer's file has been backed up. Backing up is done before the first time the file is saved. */); - DEFVAR_PER_BUFFER ("buffer-saved-size", &B_ (current_buffer, save_length), + DEFVAR_PER_BUFFER ("buffer-saved-size", &BVAR (current_buffer, save_length), make_number (LISP_INT_TAG), doc: /* Length of current buffer when last read in, saved or auto-saved. 0 initially. @@ -5728,7 +5728,7 @@ If you set this to -2, that means don't turn off auto-saving in this buffer if its text size shrinks. If you use `buffer-swap-text' on a buffer, you probably should set this to -2 in that buffer. */); - DEFVAR_PER_BUFFER ("selective-display", &B_ (current_buffer, selective_display), + DEFVAR_PER_BUFFER ("selective-display", &BVAR (current_buffer, selective_display), Qnil, doc: /* Non-nil enables selective display. An integer N as value means display only lines @@ -5739,12 +5739,12 @@ in a file, save the ^M as a newline. */); #ifndef old DEFVAR_PER_BUFFER ("selective-display-ellipses", - &B_ (current_buffer, selective_display_ellipses), + &BVAR (current_buffer, selective_display_ellipses), Qnil, doc: /* Non-nil means display ... on previous line when a line is invisible. */); #endif - DEFVAR_PER_BUFFER ("overwrite-mode", &B_ (current_buffer, overwrite_mode), Qnil, + DEFVAR_PER_BUFFER ("overwrite-mode", &BVAR (current_buffer, overwrite_mode), Qnil, doc: /* Non-nil if self-insertion should replace existing text. The value should be one of `overwrite-mode-textual', `overwrite-mode-binary', or nil. @@ -5753,7 +5753,7 @@ inserts at the end of a line, and inserts when point is before a tab, until the tab is filled in. If `overwrite-mode-binary', self-insertion replaces newlines and tabs too. */); - DEFVAR_PER_BUFFER ("buffer-display-table", &B_ (current_buffer, display_table), + DEFVAR_PER_BUFFER ("buffer-display-table", &BVAR (current_buffer, display_table), Qnil, doc: /* Display table that controls display of the contents of current buffer. @@ -5790,39 +5790,39 @@ In addition, a char-table has six extra slots to control the display of: See also the functions `display-table-slot' and `set-display-table-slot'. */); - DEFVAR_PER_BUFFER ("left-margin-width", &B_ (current_buffer, left_margin_cols), + DEFVAR_PER_BUFFER ("left-margin-width", &BVAR (current_buffer, left_margin_cols), Qnil, doc: /* *Width of left marginal area for display of a buffer. A value of nil means no marginal area. */); - DEFVAR_PER_BUFFER ("right-margin-width", &B_ (current_buffer, right_margin_cols), + DEFVAR_PER_BUFFER ("right-margin-width", &BVAR (current_buffer, right_margin_cols), Qnil, doc: /* *Width of right marginal area for display of a buffer. A value of nil means no marginal area. */); - DEFVAR_PER_BUFFER ("left-fringe-width", &B_ (current_buffer, left_fringe_width), + DEFVAR_PER_BUFFER ("left-fringe-width", &BVAR (current_buffer, left_fringe_width), Qnil, doc: /* *Width of this buffer's left fringe (in pixels). A value of 0 means no left fringe is shown in this buffer's window. A value of nil means to use the left fringe width from the window's frame. */); - DEFVAR_PER_BUFFER ("right-fringe-width", &B_ (current_buffer, right_fringe_width), + DEFVAR_PER_BUFFER ("right-fringe-width", &BVAR (current_buffer, right_fringe_width), Qnil, doc: /* *Width of this buffer's right fringe (in pixels). A value of 0 means no right fringe is shown in this buffer's window. A value of nil means to use the right fringe width from the window's frame. */); - DEFVAR_PER_BUFFER ("fringes-outside-margins", &B_ (current_buffer, fringes_outside_margins), + DEFVAR_PER_BUFFER ("fringes-outside-margins", &BVAR (current_buffer, fringes_outside_margins), Qnil, doc: /* *Non-nil means to display fringes outside display margins. A value of nil means to display fringes between margins and buffer text. */); - DEFVAR_PER_BUFFER ("scroll-bar-width", &B_ (current_buffer, scroll_bar_width), + DEFVAR_PER_BUFFER ("scroll-bar-width", &BVAR (current_buffer, scroll_bar_width), Qnil, doc: /* *Width of this buffer's scroll bars in pixels. A value of nil means to use the scroll bar width from the window's frame. */); - DEFVAR_PER_BUFFER ("vertical-scroll-bar", &B_ (current_buffer, vertical_scroll_bar_type), + DEFVAR_PER_BUFFER ("vertical-scroll-bar", &BVAR (current_buffer, vertical_scroll_bar_type), Qnil, doc: /* *Position of this buffer's vertical scroll bar. The value takes effect whenever you tell a window to display this buffer; @@ -5833,13 +5833,13 @@ of the window; a value of nil means don't show any vertical scroll bars. A value of t (the default) means do whatever the window's frame specifies. */); DEFVAR_PER_BUFFER ("indicate-empty-lines", - &B_ (current_buffer, indicate_empty_lines), Qnil, + &BVAR (current_buffer, indicate_empty_lines), Qnil, doc: /* *Visually indicate empty lines after the buffer end. If non-nil, a bitmap is displayed in the left fringe of a window on window-systems. */); DEFVAR_PER_BUFFER ("indicate-buffer-boundaries", - &B_ (current_buffer, indicate_buffer_boundaries), Qnil, + &BVAR (current_buffer, indicate_buffer_boundaries), Qnil, doc: /* *Visually indicate buffer boundaries and scrolling. If non-nil, the first and last line of the buffer are marked in the fringe of a window on window-systems with angle bitmaps, or if the window can be @@ -5864,7 +5864,7 @@ bitmaps in right fringe. To show just the angle bitmaps in the left fringe, but no arrow bitmaps, use ((top . left) (bottom . left)). */); DEFVAR_PER_BUFFER ("fringe-indicator-alist", - &B_ (current_buffer, fringe_indicator_alist), Qnil, + &BVAR (current_buffer, fringe_indicator_alist), Qnil, doc: /* *Mapping from logical to physical fringe indicator bitmaps. The value is an alist where each element (INDICATOR . BITMAPS) specifies the fringe bitmaps used to display a specific logical @@ -5883,7 +5883,7 @@ last (only) line has no final newline. BITMAPS may also be a single symbol which is used in both left and right fringes. */); DEFVAR_PER_BUFFER ("fringe-cursor-alist", - &B_ (current_buffer, fringe_cursor_alist), Qnil, + &BVAR (current_buffer, fringe_cursor_alist), Qnil, doc: /* *Mapping from logical to physical fringe cursor bitmaps. The value is an alist where each element (CURSOR . BITMAP) specifies the fringe bitmaps used to display a specific logical @@ -5898,7 +5898,7 @@ BITMAP is the corresponding fringe bitmap shown for the logical cursor type. */); DEFVAR_PER_BUFFER ("scroll-up-aggressively", - &B_ (current_buffer, scroll_up_aggressively), Qnil, + &BVAR (current_buffer, scroll_up_aggressively), Qnil, doc: /* How far to scroll windows upward. If you move point off the bottom, the window scrolls automatically. This variable controls how far it scrolls. The value nil, the default, @@ -5911,7 +5911,7 @@ window scrolls by a full window height. Meaningful values are between 0.0 and 1.0, inclusive. */); DEFVAR_PER_BUFFER ("scroll-down-aggressively", - &B_ (current_buffer, scroll_down_aggressively), Qnil, + &BVAR (current_buffer, scroll_down_aggressively), Qnil, doc: /* How far to scroll windows downward. If you move point off the top, the window scrolls automatically. This variable controls how far it scrolls. The value nil, the default, @@ -5966,7 +5966,7 @@ from happening repeatedly and making Emacs nonfunctional. */); The functions are run using the `run-hooks' function. */); Vfirst_change_hook = Qnil; - DEFVAR_PER_BUFFER ("buffer-undo-list", &B_ (current_buffer, undo_list), Qnil, + DEFVAR_PER_BUFFER ("buffer-undo-list", &BVAR (current_buffer, undo_list), Qnil, doc: /* List of undo entries in current buffer. Recent changes come first; older changes follow newer. @@ -6007,10 +6007,10 @@ the changes between two undo boundaries as a single step to be undone. If the value of the variable is t, undo information is not recorded. */); - DEFVAR_PER_BUFFER ("mark-active", &B_ (current_buffer, mark_active), Qnil, + DEFVAR_PER_BUFFER ("mark-active", &BVAR (current_buffer, mark_active), Qnil, doc: /* Non-nil means the mark and region are currently active in this buffer. */); - DEFVAR_PER_BUFFER ("cache-long-line-scans", &B_ (current_buffer, cache_long_line_scans), Qnil, + DEFVAR_PER_BUFFER ("cache-long-line-scans", &BVAR (current_buffer, cache_long_line_scans), Qnil, doc: /* Non-nil means that Emacs should use caches to handle long lines more quickly. Normally, the line-motion functions work by scanning the buffer for @@ -6038,23 +6038,23 @@ maintained internally by the Emacs primitives. Enabling or disabling the cache should not affect the behavior of any of the motion functions; it should only affect their performance. */); - DEFVAR_PER_BUFFER ("point-before-scroll", &B_ (current_buffer, point_before_scroll), Qnil, + DEFVAR_PER_BUFFER ("point-before-scroll", &BVAR (current_buffer, point_before_scroll), Qnil, doc: /* Value of point before the last series of scroll operations, or nil. */); - DEFVAR_PER_BUFFER ("buffer-file-format", &B_ (current_buffer, file_format), Qnil, + DEFVAR_PER_BUFFER ("buffer-file-format", &BVAR (current_buffer, file_format), Qnil, doc: /* List of formats to use when saving this buffer. Formats are defined by `format-alist'. This variable is set when a file is visited. */); DEFVAR_PER_BUFFER ("buffer-auto-save-file-format", - &B_ (current_buffer, auto_save_file_format), Qnil, + &BVAR (current_buffer, auto_save_file_format), Qnil, doc: /* *Format in which to write auto-save files. Should be a list of symbols naming formats that are defined in `format-alist'. If it is t, which is the default, auto-save files are written in the same format as a regular save would use. */); DEFVAR_PER_BUFFER ("buffer-invisibility-spec", - &B_ (current_buffer, invisibility_spec), Qnil, + &BVAR (current_buffer, invisibility_spec), Qnil, doc: /* Invisibility spec of this buffer. The default is t, which means that text is invisible if it has a non-nil `invisible' property. @@ -6065,12 +6065,12 @@ then characters with property value PROP are invisible, and they have an ellipsis as well if ELLIPSIS is non-nil. */); DEFVAR_PER_BUFFER ("buffer-display-count", - &B_ (current_buffer, display_count), Qnil, + &BVAR (current_buffer, display_count), Qnil, doc: /* A number incremented each time this buffer is displayed in a window. The function `set-window-buffer' increments it. */); DEFVAR_PER_BUFFER ("buffer-display-time", - &B_ (current_buffer, display_time), Qnil, + &BVAR (current_buffer, display_time), Qnil, doc: /* Time stamp updated each time this buffer is displayed in a window. The function `set-window-buffer' updates this variable to the value obtained by calling `current-time'. @@ -6105,7 +6105,7 @@ and disregard a `read-only' text property if the property value is a member of the list. */); Vinhibit_read_only = Qnil; - DEFVAR_PER_BUFFER ("cursor-type", &B_ (current_buffer, cursor_type), Qnil, + DEFVAR_PER_BUFFER ("cursor-type", &BVAR (current_buffer, cursor_type), Qnil, doc: /* Cursor to use when this buffer is in the selected window. Values are interpreted as follows: @@ -6124,7 +6124,7 @@ cursor's appearance is instead controlled by the variable `cursor-in-non-selected-windows'. */); DEFVAR_PER_BUFFER ("line-spacing", - &B_ (current_buffer, extra_line_spacing), Qnil, + &BVAR (current_buffer, extra_line_spacing), Qnil, doc: /* Additional space to put between lines when displaying a buffer. The space is measured in pixels, and put below lines on graphic displays, see `display-graphic-p'. @@ -6132,7 +6132,7 @@ If value is a floating point number, it specifies the spacing relative to the default frame line height. A value of nil means add no extra space. */); DEFVAR_PER_BUFFER ("cursor-in-non-selected-windows", - &B_ (current_buffer, cursor_in_non_selected_windows), Qnil, + &BVAR (current_buffer, cursor_in_non_selected_windows), Qnil, doc: /* *Non-nil means show a cursor in non-selected windows. If nil, only shows a cursor in the selected window. If t, displays a cursor related to the usual cursor type -- cgit v1.2.1 From 05c652517317d10690aaf0a6aa0bc876382b9d82 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 16 Feb 2011 20:39:46 +0200 Subject: Use KVAR in MS-Windows build, remove buffer-file-type. w32fns.c (Fx_create_frame): Use KVAR. w32term.c (w32_create_terminal): Use KVAR. s/ms-w32.h (MODE_LINE_BINARY_TEXT): Remove. xdisp.c (decode_mode_spec): Don't use MODE_LINE_BINARY_TEXT. fileio.c (Finsert_file_contents, Fwrite_region): Remove references to buffer_file_type. (syms_of_fileio): Don't intern and staticpro find-buffer-file-type. callproc.c (syms_of_callproc): Remove references to buffer_file_type. buffer.c (reset_buffer_local_variables): Don't set buffer_file_type. (init_buffer_once): Likewise. (syms_of_buffer): Don't define buffer-file-type. buffer.h (struct buffer): Remove buffer_file_type. --- src/buffer.c | 28 ---------------------------- 1 file changed, 28 deletions(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index d05fe1754c2..c95fbb5f516 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -715,9 +715,6 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too) BVAR (b, case_canon_table) = XCHAR_TABLE (Vascii_downcase_table)->extras[1]; BVAR (b, case_eqv_table) = XCHAR_TABLE (Vascii_downcase_table)->extras[2]; BVAR (b, invisibility_spec) = Qt; -#ifndef DOS_NT - BVAR (b, buffer_file_type) = Qnil; -#endif /* Reset all (or most) per-buffer variables to their defaults. */ if (permanent_too) @@ -5040,9 +5037,6 @@ init_buffer_once (void) BVAR (&buffer_defaults, extra_line_spacing) = Qnil; BVAR (&buffer_defaults, cursor_in_non_selected_windows) = Qt; -#ifdef DOS_NT - BVAR (&buffer_defaults, buffer_file_type) = Qnil; /* TEXT */ -#endif BVAR (&buffer_defaults, enable_multibyte_characters) = Qt; BVAR (&buffer_defaults, buffer_file_coding_system) = Qnil; XSETFASTINT (BVAR (&buffer_defaults, fill_column), 70); @@ -5112,11 +5106,6 @@ init_buffer_once (void) XSETFASTINT (BVAR (&buffer_local_flags, left_margin), idx); ++idx; XSETFASTINT (BVAR (&buffer_local_flags, abbrev_table), idx); ++idx; XSETFASTINT (BVAR (&buffer_local_flags, display_table), idx); ++idx; -#ifdef DOS_NT - XSETFASTINT (BVAR (&buffer_local_flags, buffer_file_type), idx); - /* Make this one a permanent local. */ - buffer_permanent_local_flags[idx++] = 1; -#endif XSETFASTINT (BVAR (&buffer_local_flags, syntax_table), idx); ++idx; XSETFASTINT (BVAR (&buffer_local_flags, cache_long_line_scans), idx); ++idx; XSETFASTINT (BVAR (&buffer_local_flags, category_table), idx); ++idx; @@ -5415,14 +5404,6 @@ This is the same as (default-value 'tab-width). */); doc: /* Default value of `case-fold-search' for buffers that don't override it. This is the same as (default-value 'case-fold-search). */); -#ifdef DOS_NT - DEFVAR_BUFFER_DEFAULTS ("default-buffer-file-type", - buffer_file_type, - doc: /* Default file type for buffers that do not override it. -This is the same as (default-value 'buffer-file-type). -The file type is nil for text, t for binary. */); -#endif - DEFVAR_BUFFER_DEFAULTS ("default-left-margin-width", left_margin_cols, doc: /* Default value of `left-margin-width' for buffers that don't override it. @@ -5673,15 +5654,6 @@ word-wrapping, you might want to reduce the value of `truncate-partial-width-windows', since wrapping can make text readable in narrower windows. */); -#ifdef DOS_NT - DEFVAR_PER_BUFFER ("buffer-file-type", &BVAR (current_buffer, buffer_file_type), - Qnil, - doc: /* Non-nil if the visited file is a binary file. -This variable is meaningful on MS-DOG and Windows NT. -On those systems, it is automatically local in every buffer. -On other systems, this variable is normally always nil. */); -#endif - DEFVAR_PER_BUFFER ("default-directory", &BVAR (current_buffer, directory), make_number (Lisp_String), doc: /* Name of default directory of current buffer. Should end with slash. -- cgit v1.2.1 From 8307f92370e7d86aea2c78d0dbc06c5ace9c6f11 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Wed, 23 Feb 2011 20:56:30 +0100 Subject: Fix typos. --- src/buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index 4744356d1b6..9220527313d 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -2429,7 +2429,7 @@ current buffer is cleared. */) { c = STRING_CHAR_AND_LENGTH (p, bytes); /* Delete all bytes for this 8-bit character but the - last one, and change the last one to the charcter + last one, and change the last one to the character code. */ bytes--; del_range_2 (pos, pos, pos + bytes, pos + bytes, 0); -- cgit v1.2.1 From ef1fd07e4e728fcbf60ce87f1434f5fd46862262 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 11 Mar 2011 09:49:16 -0700 Subject: * buffer.c (syms_of_buffer): Remove obsolete comment. --- src/buffer.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index c95fbb5f516..448c9236387 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -5332,9 +5332,6 @@ syms_of_buffer (void) Fput (Qprotected_field, Qerror_message, make_pure_c_string ("Attempt to modify a protected field")); - /* All these use DEFVAR_LISP_NOPRO because the slots in - buffer_defaults will all be marked via Vbuffer_defaults. */ - DEFVAR_BUFFER_DEFAULTS ("default-mode-line-format", mode_line_format, doc: /* Default value of `mode-line-format' for buffers that don't override it. -- cgit v1.2.1 From cffc6f3bd9b5dbb9825502928bd9dd58ddbac02e Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sun, 13 Mar 2011 18:25:16 -0400 Subject: Fix BUF_* macros to handle indirect buffers properly (Bug#8219). * buffer.h (BUF_BEGV, BUF_BEGV_BYTE, BUF_ZV, BUF_ZV_BYTE, BUF_PT) (BUF_PT_BYTE): Rewrite to handle indirect buffers (Bug#8219). These macros can no longer be used for assignment. * buffer.c (Fget_buffer_create, Fmake_indirect_buffer): Assign struct members directly, instead of using BUF_BEGV etc. (record_buffer_markers, fetch_buffer_markers): New functions for recording and fetching special buffer markers. (set_buffer_internal_1, set_buffer_temp): Use them. * lread.c (unreadchar): Use SET_BUF_PT_BOTH. * insdel.c (adjust_point): Use SET_BUF_PT_BOTH. * intervals.c (temp_set_point_both): Use SET_BUF_PT_BOTH. (get_local_map): Use SET_BUF_BEGV_BOTH and SET_BUF_ZV_BOTH. * xdisp.c (hscroll_window_tree): (reconsider_clip_changes): Use PT instead of BUF_PT. --- src/buffer.c | 187 ++++++++++++++++++++++++++--------------------------------- 1 file changed, 82 insertions(+), 105 deletions(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index 448c9236387..01940728275 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -330,15 +330,17 @@ even if it is dead. The return value is never nil. */) if (! BUF_BEG_ADDR (b)) buffer_memory_full (); - BUF_PT (b) = BEG; + b->pt = BEG; + b->begv = BEG; + b->zv = BEG; + b->pt_byte = BEG_BYTE; + b->begv_byte = BEG_BYTE; + b->zv_byte = BEG_BYTE; + BUF_GPT (b) = BEG; - BUF_BEGV (b) = BEG; - BUF_ZV (b) = BEG; - BUF_Z (b) = BEG; - BUF_PT_BYTE (b) = BEG_BYTE; BUF_GPT_BYTE (b) = BEG_BYTE; - BUF_BEGV_BYTE (b) = BEG_BYTE; - BUF_ZV_BYTE (b) = BEG_BYTE; + + BUF_Z (b) = BEG; BUF_Z_BYTE (b) = BEG_BYTE; BUF_MODIFF (b) = 1; BUF_CHARS_MODIFF (b) = 1; @@ -489,6 +491,53 @@ clone_per_buffer_values (struct buffer *from, struct buffer *to) BVAR (to, local_var_alist) = buffer_lisp_local_variables (from); } + +/* If buffer B has markers to record PT, BEGV and ZV when it is not + current, update these markers. */ + +static void +record_buffer_markers (struct buffer *b) +{ + if (! NILP (BVAR (b, pt_marker))) + { + Lisp_Object buffer; + + eassert (!NILP (BVAR (b, begv_marker))); + eassert (!NILP (BVAR (b, zv_marker))); + + XSETBUFFER (buffer, b); + set_marker_both (BVAR (b, pt_marker), buffer, b->pt, b->pt_byte); + set_marker_both (BVAR (b, begv_marker), buffer, b->begv, b->begv_byte); + set_marker_both (BVAR (b, zv_marker), buffer, b->zv, b->zv_byte); + } +} + + +/* If buffer B has markers to record PT, BEGV and ZV when it is not + current, fetch these values into B->begv etc. */ + +static void +fetch_buffer_markers (struct buffer *b) +{ + if (! NILP (BVAR (b, pt_marker))) + { + Lisp_Object m; + + eassert (!NILP (BVAR (b, begv_marker))); + eassert (!NILP (BVAR (b, zv_marker))); + + m = BVAR (b, pt_marker); + SET_BUF_PT_BOTH (b, marker_position (m), marker_byte_position (m)); + + m = BVAR (b, begv_marker); + SET_BUF_BEGV_BOTH (b, marker_position (m), marker_byte_position (m)); + + m = BVAR (b, zv_marker); + SET_BUF_ZV_BOTH (b, marker_position (m), marker_byte_position (m)); + } +} + + DEFUN ("make-indirect-buffer", Fmake_indirect_buffer, Smake_indirect_buffer, 2, 3, "bMake indirect buffer (to buffer): \nBName of indirect buffer: ", @@ -527,12 +576,12 @@ CLONE nil means the indirect buffer's state is reset to default values. */) /* Use the base buffer's text object. */ b->text = b->base_buffer->text; - BUF_BEGV (b) = BUF_BEGV (b->base_buffer); - BUF_ZV (b) = BUF_ZV (b->base_buffer); - BUF_PT (b) = BUF_PT (b->base_buffer); - BUF_BEGV_BYTE (b) = BUF_BEGV_BYTE (b->base_buffer); - BUF_ZV_BYTE (b) = BUF_ZV_BYTE (b->base_buffer); - BUF_PT_BYTE (b) = BUF_PT_BYTE (b->base_buffer); + b->pt = b->base_buffer->pt; + b->begv = b->base_buffer->begv; + b->zv = b->base_buffer->zv; + b->pt_byte = b->base_buffer->pt_byte; + b->begv_byte = b->base_buffer->begv_byte; + b->zv_byte = b->base_buffer->zv_byte; b->newline_cache = 0; b->width_run_cache = 0; @@ -562,24 +611,23 @@ CLONE nil means the indirect buffer's state is reset to default values. */) /* Make sure the base buffer has markers for its narrowing. */ if (NILP (BVAR (b->base_buffer, pt_marker))) { + eassert (NILP (BVAR (b, begv_marker))); + eassert (NILP (BVAR (b, zv_marker))); + BVAR (b->base_buffer, pt_marker) = Fmake_marker (); set_marker_both (BVAR (b->base_buffer, pt_marker), base_buffer, - BUF_PT (b->base_buffer), - BUF_PT_BYTE (b->base_buffer)); - } - if (NILP (BVAR (b->base_buffer, begv_marker))) - { + b->base_buffer->pt, + b->base_buffer->pt_byte); + BVAR (b->base_buffer, begv_marker) = Fmake_marker (); set_marker_both (BVAR (b->base_buffer, begv_marker), base_buffer, - BUF_BEGV (b->base_buffer), - BUF_BEGV_BYTE (b->base_buffer)); - } - if (NILP (BVAR (b->base_buffer, zv_marker))) - { + b->base_buffer->begv, + b->base_buffer->begv_byte); + BVAR (b->base_buffer, zv_marker) = Fmake_marker (); set_marker_both (BVAR (b->base_buffer, zv_marker), base_buffer, - BUF_ZV (b->base_buffer), - BUF_ZV_BYTE (b->base_buffer)); + b->base_buffer->zv, + b->base_buffer->zv_byte); XMARKER (BVAR (b->base_buffer, zv_marker))->insertion_type = 1; } @@ -587,11 +635,11 @@ CLONE nil means the indirect buffer's state is reset to default values. */) { /* Give the indirect buffer markers for its narrowing. */ BVAR (b, pt_marker) = Fmake_marker (); - set_marker_both (BVAR (b, pt_marker), buf, BUF_PT (b), BUF_PT_BYTE (b)); + set_marker_both (BVAR (b, pt_marker), buf, b->pt, b->pt_byte); BVAR (b, begv_marker) = Fmake_marker (); - set_marker_both (BVAR (b, begv_marker), buf, BUF_BEGV (b), BUF_BEGV_BYTE (b)); + set_marker_both (BVAR (b, begv_marker), buf, b->begv, b->begv_byte); BVAR (b, zv_marker) = Fmake_marker (); - set_marker_both (BVAR (b, zv_marker), buf, BUF_ZV (b), BUF_ZV_BYTE (b)); + set_marker_both (BVAR (b, zv_marker), buf, b->zv, b->zv_byte); XMARKER (BVAR (b, zv_marker))->insertion_type = 1; } else @@ -1796,27 +1844,7 @@ set_buffer_internal_1 (register struct buffer *b) /* If the old current buffer has markers to record PT, BEGV and ZV when it is not current, update them now. */ - if (! NILP (BVAR (old_buf, pt_marker))) - { - Lisp_Object obuf; - XSETBUFFER (obuf, old_buf); - set_marker_both (BVAR (old_buf, pt_marker), obuf, - BUF_PT (old_buf), BUF_PT_BYTE (old_buf)); - } - if (! NILP (BVAR (old_buf, begv_marker))) - { - Lisp_Object obuf; - XSETBUFFER (obuf, old_buf); - set_marker_both (BVAR (old_buf, begv_marker), obuf, - BUF_BEGV (old_buf), BUF_BEGV_BYTE (old_buf)); - } - if (! NILP (BVAR (old_buf, zv_marker))) - { - Lisp_Object obuf; - XSETBUFFER (obuf, old_buf); - set_marker_both (BVAR (old_buf, zv_marker), obuf, - BUF_ZV (old_buf), BUF_ZV_BYTE (old_buf)); - } + record_buffer_markers (old_buf); } /* Get the undo list from the base buffer, so that it appears @@ -1826,21 +1854,7 @@ set_buffer_internal_1 (register struct buffer *b) /* If the new current buffer has markers to record PT, BEGV and ZV when it is not current, fetch them now. */ - if (! NILP (BVAR (b, pt_marker))) - { - BUF_PT (b) = marker_position (BVAR (b, pt_marker)); - BUF_PT_BYTE (b) = marker_byte_position (BVAR (b, pt_marker)); - } - if (! NILP (BVAR (b, begv_marker))) - { - BUF_BEGV (b) = marker_position (BVAR (b, begv_marker)); - BUF_BEGV_BYTE (b) = marker_byte_position (BVAR (b, begv_marker)); - } - if (! NILP (BVAR (b, zv_marker))) - { - BUF_ZV (b) = marker_position (BVAR (b, zv_marker)); - BUF_ZV_BYTE (b) = marker_byte_position (BVAR (b, zv_marker)); - } + fetch_buffer_markers (b); /* Look down buffer's list of local Lisp variables to find and update any that forward into C variables. */ @@ -1876,50 +1890,13 @@ set_buffer_temp (struct buffer *b) old_buf = current_buffer; current_buffer = b; - if (old_buf) - { - /* If the old current buffer has markers to record PT, BEGV and ZV - when it is not current, update them now. */ - if (! NILP (BVAR (old_buf, pt_marker))) - { - Lisp_Object obuf; - XSETBUFFER (obuf, old_buf); - set_marker_both (BVAR (old_buf, pt_marker), obuf, - BUF_PT (old_buf), BUF_PT_BYTE (old_buf)); - } - if (! NILP (BVAR (old_buf, begv_marker))) - { - Lisp_Object obuf; - XSETBUFFER (obuf, old_buf); - set_marker_both (BVAR (old_buf, begv_marker), obuf, - BUF_BEGV (old_buf), BUF_BEGV_BYTE (old_buf)); - } - if (! NILP (BVAR (old_buf, zv_marker))) - { - Lisp_Object obuf; - XSETBUFFER (obuf, old_buf); - set_marker_both (BVAR (old_buf, zv_marker), obuf, - BUF_ZV (old_buf), BUF_ZV_BYTE (old_buf)); - } - } + /* If the old current buffer has markers to record PT, BEGV and ZV + when it is not current, update them now. */ + record_buffer_markers (old_buf); /* If the new current buffer has markers to record PT, BEGV and ZV when it is not current, fetch them now. */ - if (! NILP (BVAR (b, pt_marker))) - { - BUF_PT (b) = marker_position (BVAR (b, pt_marker)); - BUF_PT_BYTE (b) = marker_byte_position (BVAR (b, pt_marker)); - } - if (! NILP (BVAR (b, begv_marker))) - { - BUF_BEGV (b) = marker_position (BVAR (b, begv_marker)); - BUF_BEGV_BYTE (b) = marker_byte_position (BVAR (b, begv_marker)); - } - if (! NILP (BVAR (b, zv_marker))) - { - BUF_ZV (b) = marker_position (BVAR (b, zv_marker)); - BUF_ZV_BYTE (b) = marker_byte_position (BVAR (b, zv_marker)); - } + fetch_buffer_markers (b); } DEFUN ("set-buffer", Fset_buffer, Sset_buffer, 1, 1, 0, -- cgit v1.2.1 From 2aa46d6cce6773a0c56c93ca64750caea6ed3bba Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Mon, 14 Mar 2011 12:18:25 -0400 Subject: * src/buffer.c (Fmake_indirect_buffer): Fix incorrect assertion. --- src/buffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index 01940728275..c0485c10a99 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -611,8 +611,8 @@ CLONE nil means the indirect buffer's state is reset to default values. */) /* Make sure the base buffer has markers for its narrowing. */ if (NILP (BVAR (b->base_buffer, pt_marker))) { - eassert (NILP (BVAR (b, begv_marker))); - eassert (NILP (BVAR (b, zv_marker))); + eassert (NILP (BVAR (b->base_buffer, begv_marker))); + eassert (NILP (BVAR (b->base_buffer, zv_marker))); BVAR (b->base_buffer, pt_marker) = Fmake_marker (); set_marker_both (BVAR (b->base_buffer, pt_marker), base_buffer, -- cgit v1.2.1 From c3bd59b510ddf8a9188a7dcd46b0a01a9b3f6172 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 14 Mar 2011 16:32:27 -0700 Subject: * buffer.c (switch_to_buffer_1): Now static. --- src/buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index 01940728275..68253a261c4 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1712,7 +1712,7 @@ the current buffer's major mode. */) /* Switch to buffer BUFFER in the selected window. If NORECORD is non-nil, don't call record_buffer. */ -Lisp_Object +static Lisp_Object switch_to_buffer_1 (Lisp_Object buffer_or_name, Lisp_Object norecord) { register Lisp_Object buffer; -- cgit v1.2.1 From 8f54f30aec0b3278cc1e370445ae2b3e5a115a46 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 14 Mar 2011 16:43:16 -0700 Subject: * buffer.c: (Fkill_buffer, record_buffer, Fbury_buffer, Fset_buffer_multibyte): (report_overlay_modification): Rename locals to avoid shadowing. --- src/buffer.c | 86 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 43 insertions(+), 43 deletions(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index 68253a261c4..99b4650bb60 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1464,9 +1464,9 @@ with SIGHUP. */) don't re-kill them. */ if (other->base_buffer == b && !NILP (BVAR (other, name))) { - Lisp_Object buffer; - XSETBUFFER (buffer, other); - Fkill_buffer (buffer); + Lisp_Object buf; + XSETBUFFER (buf, other); + Fkill_buffer (buf); } UNGCPRO; @@ -1527,9 +1527,9 @@ with SIGHUP. */) && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b) && NILP (Fsymbol_value (intern ("auto-save-visited-file-name")))) { - Lisp_Object tem; - tem = Fsymbol_value (intern ("delete-auto-save-files")); - if (! NILP (tem)) + Lisp_Object delete; + delete = Fsymbol_value (intern ("delete-auto-save-files")); + if (! NILP (delete)) internal_delete_file (BVAR (b, auto_save_file_name)); } @@ -1601,19 +1601,19 @@ with SIGHUP. */) void record_buffer (Lisp_Object buf) { - register Lisp_Object link, prev; + register Lisp_Object list, prev; Lisp_Object frame; frame = selected_frame; prev = Qnil; - for (link = Vbuffer_alist; CONSP (link); link = XCDR (link)) + for (list = Vbuffer_alist; CONSP (list); list = XCDR (list)) { - if (EQ (XCDR (XCAR (link)), buf)) + if (EQ (XCDR (XCAR (list)), buf)) break; - prev = link; + prev = list; } - /* Effectively do Vbuffer_alist = Fdelq (link, Vbuffer_alist); + /* Effectively do Vbuffer_alist = Fdelq (list, Vbuffer_alist); we cannot use Fdelq itself here because it allows quitting. */ if (NILP (prev)) @@ -1621,40 +1621,40 @@ record_buffer (Lisp_Object buf) else XSETCDR (prev, XCDR (XCDR (prev))); - XSETCDR (link, Vbuffer_alist); - Vbuffer_alist = link; + XSETCDR (list, Vbuffer_alist); + Vbuffer_alist = list; /* Effectively do a delq on buried_buffer_list. */ prev = Qnil; - for (link = XFRAME (frame)->buried_buffer_list; CONSP (link); - link = XCDR (link)) + for (list = XFRAME (frame)->buried_buffer_list; CONSP (list); + list = XCDR (list)) { - if (EQ (XCAR (link), buf)) + if (EQ (XCAR (list), buf)) { if (NILP (prev)) - XFRAME (frame)->buried_buffer_list = XCDR (link); + XFRAME (frame)->buried_buffer_list = XCDR (list); else XSETCDR (prev, XCDR (XCDR (prev))); break; } - prev = link; + prev = list; } /* Now move this buffer to the front of frame_buffer_list also. */ prev = Qnil; - for (link = frame_buffer_list (frame); CONSP (link); - link = XCDR (link)) + for (list = frame_buffer_list (frame); CONSP (list); + list = XCDR (list)) { - if (EQ (XCAR (link), buf)) + if (EQ (XCAR (list), buf)) break; - prev = link; + prev = list; } /* Effectively do delq. */ - if (CONSP (link)) + if (CONSP (list)) { if (NILP (prev)) set_frame_buffer_list (frame, @@ -1662,8 +1662,8 @@ record_buffer (Lisp_Object buf) else XSETCDR (prev, XCDR (XCDR (prev))); - XSETCDR (link, frame_buffer_list (frame)); - set_frame_buffer_list (frame, link); + XSETCDR (list, frame_buffer_list (frame)); + set_frame_buffer_list (frame, list); } else set_frame_buffer_list (frame, Fcons (buf, frame_buffer_list (frame))); @@ -1984,13 +1984,13 @@ its frame, iconify that frame. */) buffer is killed. */ if (!NILP (BVAR (XBUFFER (buffer), name))) { - Lisp_Object aelt, link; + Lisp_Object aelt, list; aelt = Frassq (buffer, Vbuffer_alist); - link = Fmemq (aelt, Vbuffer_alist); + list = Fmemq (aelt, Vbuffer_alist); Vbuffer_alist = Fdelq (aelt, Vbuffer_alist); - XSETCDR (link, Qnil); - Vbuffer_alist = nconc2 (Vbuffer_alist, link); + XSETCDR (list, Qnil); + Vbuffer_alist = nconc2 (Vbuffer_alist, list); XFRAME (selected_frame)->buffer_list = Fdelq (buffer, XFRAME (selected_frame)->buffer_list); @@ -2335,12 +2335,12 @@ current buffer is cleared. */) && GPT_BYTE > 1 && GPT_BYTE < Z_BYTE && ! CHAR_HEAD_P (*(GAP_END_ADDR))) { - unsigned char *p = GPT_ADDR - 1; + unsigned char *q = GPT_ADDR - 1; - while (! CHAR_HEAD_P (*p) && p > BEG_ADDR) p--; - if (LEADING_CODE_P (*p)) + while (! CHAR_HEAD_P (*q) && q > BEG_ADDR) q--; + if (LEADING_CODE_P (*q)) { - EMACS_INT new_gpt = GPT_BYTE - (GPT_ADDR - p); + EMACS_INT new_gpt = GPT_BYTE - (GPT_ADDR - q); move_gap_both (new_gpt, new_gpt); } @@ -2424,14 +2424,14 @@ current buffer is cleared. */) ZV = chars_in_text (BEG_ADDR, ZV_BYTE - BEG_BYTE) + BEG; { - EMACS_INT pt_byte = advance_to_char_boundary (PT_BYTE); - EMACS_INT pt; + EMACS_INT byte = advance_to_char_boundary (PT_BYTE); + EMACS_INT position; - if (pt_byte > GPT_BYTE) - pt = chars_in_text (GAP_END_ADDR, pt_byte - GPT_BYTE) + GPT; + if (byte > GPT_BYTE) + position = chars_in_text (GAP_END_ADDR, byte - GPT_BYTE) + GPT; else - pt = chars_in_text (BEG_ADDR, pt_byte - BEG_BYTE) + BEG; - TEMP_SET_PT_BOTH (pt, pt_byte); + position = chars_in_text (BEG_ADDR, byte - BEG_BYTE) + BEG; + TEMP_SET_PT_BOTH (position, byte); } tail = markers = BUF_MARKERS (current_buffer); @@ -4322,10 +4322,10 @@ report_overlay_modification (Lisp_Object start, Lisp_Object end, int after, for (i = 0; i < size;) { - Lisp_Object prop, overlay; - prop = copy[i++]; - overlay = copy[i++]; - call_overlay_mod_hooks (prop, overlay, after, arg1, arg2, arg3); + Lisp_Object prop_i, overlay_i; + prop_i = copy[i++]; + overlay_i = copy[i++]; + call_overlay_mod_hooks (prop_i, overlay_i, after, arg1, arg2, arg3); } } UNGCPRO; -- cgit v1.2.1 From 5df8f01bab8c0bbc3391f41c54138d0a18973424 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 14 Mar 2011 18:15:56 -0700 Subject: * buffer.c (fix_overlays_before): Mark locals as initialized. (fix_start_end_in_overlays): Likewise. This function should be simplified by using pointers-to-pointers, but that's a different matter. --- src/buffer.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index 99b4650bb60..b718bf3e576 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -3398,7 +3398,8 @@ void fix_start_end_in_overlays (register EMACS_INT start, register EMACS_INT end) { Lisp_Object overlay; - struct Lisp_Overlay *before_list, *after_list; + struct Lisp_Overlay *before_list IF_LINT (= NULL); + struct Lisp_Overlay *after_list IF_LINT (= NULL); /* These are either nil, indicating that before_list or after_list should be assigned, or the cons cell the cdr of which should be assigned. */ @@ -3546,7 +3547,7 @@ fix_overlays_before (struct buffer *bp, EMACS_INT prev, EMACS_INT pos) /* If parent is nil, replace overlays_before; otherwise, parent->next. */ struct Lisp_Overlay *tail = bp->overlays_before, *parent = NULL, *right_pair; Lisp_Object tem; - EMACS_INT end; + EMACS_INT end IF_LINT (= 0); /* After the insertion, the several overlays may be in incorrect order. The possibility is that, in the list `overlays_before', -- cgit v1.2.1 From 20f5695598d3137257e24802479d003ea82eb5f9 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sat, 19 Mar 2011 12:42:53 -0400 Subject: Backport fix for Bug#8219 from trunk. * buffer.h (BUF_BEGV, BUF_BEGV_BYTE, BUF_ZV, BUF_ZV_BYTE, BUF_PT) (BUF_PT_BYTE): Rewrite to handle indirect buffers (Bug#8219). These macros can no longer be used for assignment. * buffer.c (Fget_buffer_create, Fmake_indirect_buffer): Assign struct members directly, instead of using BUF_BEGV etc. (record_buffer_markers, fetch_buffer_markers): New functions for recording and fetching special buffer markers. (set_buffer_internal_1, set_buffer_temp): Use them. * lread.c (unreadchar): Use SET_BUF_PT_BOTH. * insdel.c (adjust_point): Use SET_BUF_PT_BOTH. * intervals.c (temp_set_point_both): Use SET_BUF_PT_BOTH. (get_local_map): Use SET_BUF_BEGV_BOTH and SET_BUF_ZV_BOTH. * xdisp.c (hscroll_window_tree): (reconsider_clip_changes): Use PT instead of BUF_PT. --- src/buffer.c | 187 ++++++++++++++++++++++++++--------------------------------- 1 file changed, 82 insertions(+), 105 deletions(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index 9220527313d..e7759cb5255 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -371,15 +371,17 @@ even if it is dead. The return value is never nil. */) if (! BUF_BEG_ADDR (b)) buffer_memory_full (); - BUF_PT (b) = BEG; + b->pt = BEG; + b->begv = BEG; + b->zv = BEG; + b->pt_byte = BEG_BYTE; + b->begv_byte = BEG_BYTE; + b->zv_byte = BEG_BYTE; + BUF_GPT (b) = BEG; - BUF_BEGV (b) = BEG; - BUF_ZV (b) = BEG; - BUF_Z (b) = BEG; - BUF_PT_BYTE (b) = BEG_BYTE; BUF_GPT_BYTE (b) = BEG_BYTE; - BUF_BEGV_BYTE (b) = BEG_BYTE; - BUF_ZV_BYTE (b) = BEG_BYTE; + + BUF_Z (b) = BEG; BUF_Z_BYTE (b) = BEG_BYTE; BUF_MODIFF (b) = 1; BUF_CHARS_MODIFF (b) = 1; @@ -533,6 +535,53 @@ clone_per_buffer_values (from, to) to->local_var_alist = buffer_lisp_local_variables (from); } + +/* If buffer B has markers to record PT, BEGV and ZV when it is not + current, update these markers. */ + +static void +record_buffer_markers (struct buffer *b) +{ + if (! NILP (b->pt_marker)) + { + Lisp_Object buffer; + + eassert (!NILP (b->begv_marker)); + eassert (!NILP (b->zv_marker)); + + XSETBUFFER (buffer, b); + set_marker_both (b->pt_marker, buffer, b->pt, b->pt_byte); + set_marker_both (b->begv_marker, buffer, b->begv, b->begv_byte); + set_marker_both (b->zv_marker, buffer, b->zv, b->zv_byte); + } +} + + +/* If buffer B has markers to record PT, BEGV and ZV when it is not + current, fetch these values into B->begv etc. */ + +static void +fetch_buffer_markers (struct buffer *b) +{ + if (! NILP (b->pt_marker)) + { + Lisp_Object m; + + eassert (!NILP (b->begv_marker)); + eassert (!NILP (b->zv_marker)); + + m = b->pt_marker; + SET_BUF_PT_BOTH (b, marker_position (m), marker_byte_position (m)); + + m = b->begv_marker; + SET_BUF_BEGV_BOTH (b, marker_position (m), marker_byte_position (m)); + + m = b->zv_marker; + SET_BUF_ZV_BOTH (b, marker_position (m), marker_byte_position (m)); + } +} + + DEFUN ("make-indirect-buffer", Fmake_indirect_buffer, Smake_indirect_buffer, 2, 3, "bMake indirect buffer (to buffer): \nBName of indirect buffer: ", @@ -572,12 +621,12 @@ CLONE nil means the indirect buffer's state is reset to default values. */) /* Use the base buffer's text object. */ b->text = b->base_buffer->text; - BUF_BEGV (b) = BUF_BEGV (b->base_buffer); - BUF_ZV (b) = BUF_ZV (b->base_buffer); - BUF_PT (b) = BUF_PT (b->base_buffer); - BUF_BEGV_BYTE (b) = BUF_BEGV_BYTE (b->base_buffer); - BUF_ZV_BYTE (b) = BUF_ZV_BYTE (b->base_buffer); - BUF_PT_BYTE (b) = BUF_PT_BYTE (b->base_buffer); + b->pt = b->base_buffer->pt; + b->begv = b->base_buffer->begv; + b->zv = b->base_buffer->zv; + b->pt_byte = b->base_buffer->pt_byte; + b->begv_byte = b->base_buffer->begv_byte; + b->zv_byte = b->base_buffer->zv_byte; b->newline_cache = 0; b->width_run_cache = 0; @@ -607,24 +656,23 @@ CLONE nil means the indirect buffer's state is reset to default values. */) /* Make sure the base buffer has markers for its narrowing. */ if (NILP (b->base_buffer->pt_marker)) { + eassert (NILP (b->base_buffer->begv_marker)); + eassert (NILP (b->base_buffer->zv_marker)); + b->base_buffer->pt_marker = Fmake_marker (); set_marker_both (b->base_buffer->pt_marker, base_buffer, - BUF_PT (b->base_buffer), - BUF_PT_BYTE (b->base_buffer)); - } - if (NILP (b->base_buffer->begv_marker)) - { + b->base_buffer->pt, + b->base_buffer->pt_byte); + b->base_buffer->begv_marker = Fmake_marker (); set_marker_both (b->base_buffer->begv_marker, base_buffer, - BUF_BEGV (b->base_buffer), - BUF_BEGV_BYTE (b->base_buffer)); - } - if (NILP (b->base_buffer->zv_marker)) - { + b->base_buffer->begv, + b->base_buffer->begv_byte); + b->base_buffer->zv_marker = Fmake_marker (); set_marker_both (b->base_buffer->zv_marker, base_buffer, - BUF_ZV (b->base_buffer), - BUF_ZV_BYTE (b->base_buffer)); + b->base_buffer->zv, + b->base_buffer->zv_byte); XMARKER (b->base_buffer->zv_marker)->insertion_type = 1; } @@ -632,11 +680,11 @@ CLONE nil means the indirect buffer's state is reset to default values. */) { /* Give the indirect buffer markers for its narrowing. */ b->pt_marker = Fmake_marker (); - set_marker_both (b->pt_marker, buf, BUF_PT (b), BUF_PT_BYTE (b)); + set_marker_both (b->pt_marker, buf, b->pt, b->pt_byte); b->begv_marker = Fmake_marker (); - set_marker_both (b->begv_marker, buf, BUF_BEGV (b), BUF_BEGV_BYTE (b)); + set_marker_both (b->begv_marker, buf, b->begv, b->begv_byte); b->zv_marker = Fmake_marker (); - set_marker_both (b->zv_marker, buf, BUF_ZV (b), BUF_ZV_BYTE (b)); + set_marker_both (b->zv_marker, buf, b->zv, b->zv_byte); XMARKER (b->zv_marker)->insertion_type = 1; } else @@ -1890,27 +1938,7 @@ set_buffer_internal_1 (b) /* If the old current buffer has markers to record PT, BEGV and ZV when it is not current, update them now. */ - if (! NILP (old_buf->pt_marker)) - { - Lisp_Object obuf; - XSETBUFFER (obuf, old_buf); - set_marker_both (old_buf->pt_marker, obuf, - BUF_PT (old_buf), BUF_PT_BYTE (old_buf)); - } - if (! NILP (old_buf->begv_marker)) - { - Lisp_Object obuf; - XSETBUFFER (obuf, old_buf); - set_marker_both (old_buf->begv_marker, obuf, - BUF_BEGV (old_buf), BUF_BEGV_BYTE (old_buf)); - } - if (! NILP (old_buf->zv_marker)) - { - Lisp_Object obuf; - XSETBUFFER (obuf, old_buf); - set_marker_both (old_buf->zv_marker, obuf, - BUF_ZV (old_buf), BUF_ZV_BYTE (old_buf)); - } + record_buffer_markers (old_buf); } /* Get the undo list from the base buffer, so that it appears @@ -1920,21 +1948,7 @@ set_buffer_internal_1 (b) /* If the new current buffer has markers to record PT, BEGV and ZV when it is not current, fetch them now. */ - if (! NILP (b->pt_marker)) - { - BUF_PT (b) = marker_position (b->pt_marker); - BUF_PT_BYTE (b) = marker_byte_position (b->pt_marker); - } - if (! NILP (b->begv_marker)) - { - BUF_BEGV (b) = marker_position (b->begv_marker); - BUF_BEGV_BYTE (b) = marker_byte_position (b->begv_marker); - } - if (! NILP (b->zv_marker)) - { - BUF_ZV (b) = marker_position (b->zv_marker); - BUF_ZV_BYTE (b) = marker_byte_position (b->zv_marker); - } + fetch_buffer_markers (b); /* Look down buffer's list of local Lisp variables to find and update any that forward into C variables. */ @@ -1984,50 +1998,13 @@ set_buffer_temp (b) old_buf = current_buffer; current_buffer = b; - if (old_buf) - { - /* If the old current buffer has markers to record PT, BEGV and ZV - when it is not current, update them now. */ - if (! NILP (old_buf->pt_marker)) - { - Lisp_Object obuf; - XSETBUFFER (obuf, old_buf); - set_marker_both (old_buf->pt_marker, obuf, - BUF_PT (old_buf), BUF_PT_BYTE (old_buf)); - } - if (! NILP (old_buf->begv_marker)) - { - Lisp_Object obuf; - XSETBUFFER (obuf, old_buf); - set_marker_both (old_buf->begv_marker, obuf, - BUF_BEGV (old_buf), BUF_BEGV_BYTE (old_buf)); - } - if (! NILP (old_buf->zv_marker)) - { - Lisp_Object obuf; - XSETBUFFER (obuf, old_buf); - set_marker_both (old_buf->zv_marker, obuf, - BUF_ZV (old_buf), BUF_ZV_BYTE (old_buf)); - } - } + /* If the old current buffer has markers to record PT, BEGV and ZV + when it is not current, update them now. */ + record_buffer_markers (old_buf); /* If the new current buffer has markers to record PT, BEGV and ZV when it is not current, fetch them now. */ - if (! NILP (b->pt_marker)) - { - BUF_PT (b) = marker_position (b->pt_marker); - BUF_PT_BYTE (b) = marker_byte_position (b->pt_marker); - } - if (! NILP (b->begv_marker)) - { - BUF_BEGV (b) = marker_position (b->begv_marker); - BUF_BEGV_BYTE (b) = marker_byte_position (b->begv_marker); - } - if (! NILP (b->zv_marker)) - { - BUF_ZV (b) = marker_position (b->zv_marker); - BUF_ZV_BYTE (b) = marker_byte_position (b->zv_marker); - } + fetch_buffer_markers (b); } DEFUN ("set-buffer", Fset_buffer, Sset_buffer, 1, 1, 0, -- cgit v1.2.1 From dee091a37f6486dbbcf7bf00f6ee54d77033f997 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Wed, 23 Mar 2011 11:06:57 +0100 Subject: Use Frun_hooks rather than calling Vrun_hooks manually --- src/buffer.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index c0e6866dee1..da2cc1573c8 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -2520,8 +2520,7 @@ The first thing this function does is run the normal hook `change-major-mode-hook'. */) (void) { - if (!NILP (Vrun_hooks)) - call1 (Vrun_hooks, Qchange_major_mode_hook); + Frun_hooks (1, &Qchange_major_mode_hook); /* Make sure none of the bindings in local_var_alist remain swapped in, in their symbols. */ -- cgit v1.2.1 From 6b1f9ba4770e8f488c378cfa87dc868cad62c436 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Fri, 25 Mar 2011 19:06:33 +0100 Subject: src/*.c: Remove unused function parameters. * buffer.c (defvar_per_buffer): Remove unused parameter `doc'. (DEFVAR_PER_BUFFER): Don't pass it. * dispnew.c (row_equal_p, add_row_entry): Remove unused parameter `w'. (scrolling_window): Don't pass it. --- src/buffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index da2cc1573c8..8b56b285e48 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -5224,12 +5224,12 @@ init_buffer (void) #define DEFVAR_PER_BUFFER(lname, vname, type, doc) \ do { \ static struct Lisp_Buffer_Objfwd bo_fwd; \ - defvar_per_buffer (&bo_fwd, lname, vname, type, 0); \ + defvar_per_buffer (&bo_fwd, lname, vname, type); \ } while (0) static void defvar_per_buffer (struct Lisp_Buffer_Objfwd *bo_fwd, const char *namestring, - Lisp_Object *address, Lisp_Object type, char *doc) + Lisp_Object *address, Lisp_Object type) { struct Lisp_Symbol *sym; int offset; -- cgit v1.2.1 From 328ab8e7b550b2d3ae188c0ddfb174db32b0387c Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 2 Apr 2011 00:36:27 -0700 Subject: * buffer.c (Fprevious_overlay_change): Remove var that is set but not used. --- src/buffer.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index cdcd2ccecff..a0054e32d0a 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -4047,7 +4047,6 @@ If there are no overlay boundaries from (point-min) to POS, the value is (point-min). */) (Lisp_Object pos) { - int noverlays; EMACS_INT prevpos; Lisp_Object *overlay_vec; int len; @@ -4065,8 +4064,8 @@ the value is (point-min). */) /* Put all the overlays we want in a vector in overlay_vec. Store the length in len. prevpos gets the position of the previous change. */ - noverlays = overlays_at (XINT (pos), 1, &overlay_vec, &len, - (EMACS_INT *) 0, &prevpos, 1); + overlays_at (XINT (pos), 1, &overlay_vec, &len, + (EMACS_INT *) 0, &prevpos, 1); xfree (overlay_vec); return make_number (prevpos); -- cgit v1.2.1 From fde4eb868f9ec91cb3a281f798da2c0ebdadd5a3 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sun, 10 Apr 2011 16:55:52 -0400 Subject: * src/buffer.c (syms_of_buffer): Doc fix (Bug#6902). --- src/buffer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index e7759cb5255..076495cfc64 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -5746,7 +5746,8 @@ Linefeed indents to this column in Fundamental mode. */); DEFVAR_PER_BUFFER ("tab-width", ¤t_buffer->tab_width, make_number (LISP_INT_TAG), - doc: /* *Distance between tab stops (for display of tab characters), in columns. */); + doc: /* *Distance between tab stops (for display of tab characters), in columns. +This should be an integer greater than zero. */); DEFVAR_PER_BUFFER ("ctl-arrow", ¤t_buffer->ctl_arrow, Qnil, doc: /* *Non-nil means display control chars with uparrow. -- cgit v1.2.1 From 16a97296c05ec9d5bb4ffeae9dce90fc63f578ed Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 10 Apr 2011 18:41:15 -0700 Subject: Make Emacs functions such as Fatom 'static' by default. This makes it easier for human readers (and static analyzers) to see whether these functions can be called from other modules. DEFUN now defines a static function. To make the function external so that it can be used in other C modules, use the new macro DEFUE. * lisp.h (DEFINE_FUNC): New macro, with the old contents of DEFUN. (DEFUN): Rewrite in terms of DEFINE_FUNC. It now generates a static function definition. Use DEFUE if you want an extern one. (DEFUE, INFUN): New macros. (Funibyte_char_to_multibyte, Fsyntax_table_p, Finit_image_library): (Feval_region, Fbacktrace, Ffetch_bytecode, Fswitch_to_buffer): (Ffile_executable_p, Fmake_symbolic_link, Fcommand_execute): (Fget_process, Fdocumentation_property, Fbyte_code, Ffile_attributes): Remove decls, since these functions are now static. (Funintern, Fget_internal_run_time): New decls, since these functions were already external. * alloc.c, buffer.c, callint.c, callproc.c, casefiddle.c, casetab.c: * ccl.c, character.c, chartab.c, cmds.c, coding.c, data.c, dispnew.c: * doc.c, editfns.c, emacs.c, eval.c, fileio.c, filelock.c, floatfns.c: * fns.c, font.c, fontset.c, frame.c, image.c, indent.c: * keyboard.c, keymap.c, lread.c: * macros.c, marker.c, menu.c, minibuf.c, print.c, process.c, search.c: * syntax.c, term.c, terminal.c, textprop.c, undo.c: * window.c, xdisp.c, xfaces.c, xfns.c, xmenu.c, xsettings.c: Mark functions with DEFUE instead of DEFUN, if they are used in other modules. * buffer.c (Fset_buffer_major_mode, Fdelete_overlay): New forward decls for now-static functions. * buffer.h (Fdelete_overlay): Remove decl. * callproc.c (Fgetenv_internal): Mark as internal. * composite.c (Fremove_list_of_text_properties): Remove decl. (Fcomposition_get_gstring): New forward static decl. * composite.h (Fcomposite_get_gstring): Remove decl. * dired.c (Ffile_attributes): New forward static decl. * doc.c (Fdocumntation_property): New forward static decl. * eval.c (Ffetch_bytecode): New forward static decl. (Funintern): Remove extern decl; now in .h file where it belongs. * fileio.c (Fmake_symbolic_link): New forward static decl. * image.c (Finit_image_library): New forward static decl. * insdel.c (Fcombine_after_change_execute): Make forward decl static. * intervals.h (Fprevious_property_change): (Fremove_list_of_text_properties): Remove decls. * keyboard.c (Fthis_command_keys): Remove decl. (Fcommand_execute): New forward static decl. * keymap.c (Flookup_key): New forward static decl. (Fcopy_keymap): Now static. * keymap.h (Flookup_key): Remove decl. * process.c (Fget_process): New forward static decl. (Fprocess_datagram_address): Mark as internal. * syntax.c (Fsyntax_table_p): New forward static decl. (skip_chars): Remove duplicate decl. * textprop.c (Fprevious_property_change): New forward static decl. * window.c (Fset_window_fringes, Fset_window_scroll_bars): Now internal. (Fset_window_margins, Fset_window_vscroll): New forward static decls. * window.h (Fset_window_vscroll, Fset_window_margins): Remove decls. --- src/buffer.c | 53 +++++++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 26 deletions(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index a0054e32d0a..a88afbb36e6 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -100,6 +100,8 @@ static char buffer_permanent_local_flags[MAX_PER_BUFFER_VARS]; int last_per_buffer_idx; +INFUN (Fset_buffer_major_mode, 1); +INFUN (Fdelete_overlay, 1); static void call_overlay_mod_hooks (Lisp_Object list, Lisp_Object overlay, int after, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3); @@ -157,7 +159,7 @@ nsberror (Lisp_Object spec) error ("Invalid buffer argument"); } -DEFUN ("buffer-live-p", Fbuffer_live_p, Sbuffer_live_p, 1, 1, 0, +DEFUE ("buffer-live-p", Fbuffer_live_p, Sbuffer_live_p, 1, 1, 0, doc: /* Return non-nil if OBJECT is a buffer which has not been killed. Value is nil if OBJECT is not a buffer or if it has been killed. */) (Lisp_Object object) @@ -229,7 +231,7 @@ assoc_ignore_text_properties (register Lisp_Object key, Lisp_Object list) return Qnil; } -DEFUN ("get-buffer", Fget_buffer, Sget_buffer, 1, 1, 0, +DEFUE ("get-buffer", Fget_buffer, Sget_buffer, 1, 1, 0, doc: /* Return the buffer named BUFFER-OR-NAME. BUFFER-OR-NAME must be either a string or a buffer. If BUFFER-OR-NAME is a string and there is no buffer with that name, return nil. If @@ -294,7 +296,7 @@ get_truename_buffer (register Lisp_Object filename) /* Incremented for each buffer created, to assign the buffer number. */ int buffer_count; -DEFUN ("get-buffer-create", Fget_buffer_create, Sget_buffer_create, 1, 1, 0, +DEFUE ("get-buffer-create", Fget_buffer_create, Sget_buffer_create, 1, 1, 0, doc: /* Return the buffer specified by BUFFER-OR-NAME, creating a new one if needed. If BUFFER-OR-NAME is a string and a live buffer with that name exists, return that buffer. If no such buffer exists, create a new buffer with @@ -830,8 +832,8 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too) and set-visited-file-name ought to be able to use this to really rename the buffer properly. */ -DEFUN ("generate-new-buffer-name", Fgenerate_new_buffer_name, Sgenerate_new_buffer_name, - 1, 2, 0, +DEFUE ("generate-new-buffer-name", Fgenerate_new_buffer_name, + Sgenerate_new_buffer_name, 1, 2, 0, doc: /* Return a string that is the name of no existing buffer based on NAME. If there is no live buffer named NAME, then return NAME. Otherwise modify name by appending `', incrementing NUMBER @@ -868,7 +870,7 @@ it is in the sequence to be tried) even if a buffer with that name exists. */) } -DEFUN ("buffer-name", Fbuffer_name, Sbuffer_name, 0, 1, 0, +DEFUE ("buffer-name", Fbuffer_name, Sbuffer_name, 0, 1, 0, doc: /* Return the name of BUFFER, as a string. BUFFER defaults to the current buffer. Return nil if BUFFER has been killed. */) @@ -880,7 +882,7 @@ Return nil if BUFFER has been killed. */) return BVAR (XBUFFER (buffer), name); } -DEFUN ("buffer-file-name", Fbuffer_file_name, Sbuffer_file_name, 0, 1, 0, +DEFUE ("buffer-file-name", Fbuffer_file_name, Sbuffer_file_name, 0, 1, 0, doc: /* Return name of file BUFFER is visiting, or nil if none. No argument or nil as argument means use the current buffer. */) (register Lisp_Object buffer) @@ -915,7 +917,7 @@ BUFFER defaults to the current buffer. */) return base_buffer; } -DEFUN ("buffer-local-value", Fbuffer_local_value, +DEFUE ("buffer-local-value", Fbuffer_local_value, Sbuffer_local_value, 2, 2, 0, doc: /* Return the value of VARIABLE in BUFFER. If VARIABLE does not have a buffer-local binding in BUFFER, the value @@ -1056,7 +1058,7 @@ No argument or nil as argument means use current buffer as BUFFER. */) return result; } -DEFUN ("buffer-modified-p", Fbuffer_modified_p, Sbuffer_modified_p, +DEFUE ("buffer-modified-p", Fbuffer_modified_p, Sbuffer_modified_p, 0, 1, 0, doc: /* Return t if BUFFER was modified since its file was last read or saved. No argument or nil as argument means use current buffer as BUFFER. */) @@ -1074,7 +1076,7 @@ No argument or nil as argument means use current buffer as BUFFER. */) return BUF_SAVE_MODIFF (buf) < BUF_MODIFF (buf) ? Qt : Qnil; } -DEFUN ("set-buffer-modified-p", Fset_buffer_modified_p, Sset_buffer_modified_p, +DEFUE ("set-buffer-modified-p", Fset_buffer_modified_p, Sset_buffer_modified_p, 1, 1, 0, doc: /* Mark current buffer as modified or unmodified according to FLAG. A non-nil FLAG means mark the buffer modified. */) @@ -1266,7 +1268,7 @@ This does not change the name of the visited file (if any). */) return BVAR (current_buffer, name); } -DEFUN ("other-buffer", Fother_buffer, Sother_buffer, 0, 3, 0, +DEFUE ("other-buffer", Fother_buffer, Sother_buffer, 0, 3, 0, doc: /* Return most recently selected buffer other than BUFFER. Buffers not visible in windows are preferred to visible buffers, unless optional second argument VISIBLE-OK is non-nil. @@ -1276,7 +1278,6 @@ If no other buffer exists, the buffer `*scratch*' is returned. If BUFFER is omitted or nil, some interesting buffer is returned. */) (register Lisp_Object buffer, Lisp_Object visible_ok, Lisp_Object frame) { - Lisp_Object Fset_buffer_major_mode (Lisp_Object buffer); register Lisp_Object tail, buf, notsogood, tem, pred, add_ons; notsogood = Qnil; @@ -1341,7 +1342,7 @@ If BUFFER is omitted or nil, some interesting buffer is returned. */) return buf; } -DEFUN ("buffer-enable-undo", Fbuffer_enable_undo, Sbuffer_enable_undo, +DEFUE ("buffer-enable-undo", Fbuffer_enable_undo, Sbuffer_enable_undo, 0, 1, "", doc: /* Start keeping undo information for buffer BUFFER. No argument or nil as argument means do this for the current buffer. */) @@ -1370,7 +1371,7 @@ Hook to be run (by `run-hooks', which see) when a buffer is killed.\n\ The buffer being killed will be current while the hook is running.\n\ See `kill-buffer'." */ -DEFUN ("kill-buffer", Fkill_buffer, Skill_buffer, 0, 1, "bKill buffer: ", +DEFUE ("kill-buffer", Fkill_buffer, Skill_buffer, 0, 1, "bKill buffer: ", doc: /* Kill buffer BUFFER-OR-NAME. The argument may be a buffer or the name of an existing buffer. Argument nil or omitted means kill the current buffer. Return t if the @@ -1789,7 +1790,7 @@ messing with the window-buffer correspondences. */) return switch_to_buffer_1 (buffer_or_name, norecord); } -DEFUN ("current-buffer", Fcurrent_buffer, Scurrent_buffer, 0, 0, 0, +DEFUE ("current-buffer", Fcurrent_buffer, Scurrent_buffer, 0, 0, 0, doc: /* Return the current buffer as a Lisp object. */) (void) { @@ -1899,7 +1900,7 @@ set_buffer_temp (struct buffer *b) fetch_buffer_markers (b); } -DEFUN ("set-buffer", Fset_buffer, Sset_buffer, 1, 1, 0, +DEFUE ("set-buffer", Fset_buffer, Sset_buffer, 1, 1, 0, doc: /* Make buffer BUFFER-OR-NAME current for editing operations. BUFFER-OR-NAME may be a buffer or the name of an existing buffer. See also `save-excursion' when you want to make a buffer current @@ -1928,7 +1929,7 @@ set_buffer_if_live (Lisp_Object buffer) return Qnil; } -DEFUN ("barf-if-buffer-read-only", Fbarf_if_buffer_read_only, +DEFUE ("barf-if-buffer-read-only", Fbarf_if_buffer_read_only, Sbarf_if_buffer_read_only, 0, 0, 0, doc: /* Signal a `buffer-read-only' error if the current buffer is read-only. */) (void) @@ -2001,7 +2002,7 @@ its frame, iconify that frame. */) return Qnil; } -DEFUN ("erase-buffer", Ferase_buffer, Serase_buffer, 0, 0, "*", +DEFUE ("erase-buffer", Ferase_buffer, Serase_buffer, 0, 0, "*", doc: /* Delete the entire contents of the current buffer. Any narrowing restriction in effect (see `narrow-to-region') is removed, so the buffer is truly empty after this. */) @@ -2212,7 +2213,7 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text, return Qnil; } -DEFUN ("set-buffer-multibyte", Fset_buffer_multibyte, Sset_buffer_multibyte, +DEFUE ("set-buffer-multibyte", Fset_buffer_multibyte, Sset_buffer_multibyte, 1, 1, 0, doc: /* Set the multibyte flag of the current buffer to FLAG. If FLAG is t, this makes the buffer a multibyte buffer. @@ -2501,8 +2502,8 @@ current buffer is cleared. */) return flag; } -DEFUN ("kill-all-local-variables", Fkill_all_local_variables, Skill_all_local_variables, - 0, 0, 0, +DEFUE ("kill-all-local-variables", Fkill_all_local_variables, + Skill_all_local_variables, 0, 0, 0, doc: /* Switch to Fundamental mode by killing current buffer's local variables. Most local variable bindings are eliminated so that the default values become effective once more. Also, the syntax table is set from @@ -3900,7 +3901,7 @@ DEFUN ("delete-overlay", Fdelete_overlay, Sdelete_overlay, 1, 1, 0, /* Overlay dissection functions. */ -DEFUN ("overlay-start", Foverlay_start, Soverlay_start, 1, 1, 0, +DEFUE ("overlay-start", Foverlay_start, Soverlay_start, 1, 1, 0, doc: /* Return the position at which OVERLAY starts. */) (Lisp_Object overlay) { @@ -3909,7 +3910,7 @@ DEFUN ("overlay-start", Foverlay_start, Soverlay_start, 1, 1, 0, return (Fmarker_position (OVERLAY_START (overlay))); } -DEFUN ("overlay-end", Foverlay_end, Soverlay_end, 1, 1, 0, +DEFUE ("overlay-end", Foverlay_end, Soverlay_end, 1, 1, 0, doc: /* Return the position at which OVERLAY ends. */) (Lisp_Object overlay) { @@ -3999,7 +4000,7 @@ end of the buffer. */) return result; } -DEFUN ("next-overlay-change", Fnext_overlay_change, Snext_overlay_change, +DEFUE ("next-overlay-change", Fnext_overlay_change, Snext_overlay_change, 1, 1, 0, doc: /* Return the next position after POS where an overlay starts or ends. If there are no overlay boundaries from POS to (point-max), @@ -4040,7 +4041,7 @@ the value is (point-max). */) return make_number (endpos); } -DEFUN ("previous-overlay-change", Fprevious_overlay_change, +DEFUE ("previous-overlay-change", Fprevious_overlay_change, Sprevious_overlay_change, 1, 1, 0, doc: /* Return the previous position before POS where an overlay starts or ends. If there are no overlay boundaries from (point-min) to POS, @@ -4109,7 +4110,7 @@ for positions far away from POS). */) return Qnil; } -DEFUN ("overlay-get", Foverlay_get, Soverlay_get, 2, 2, 0, +DEFUE ("overlay-get", Foverlay_get, Soverlay_get, 2, 2, 0, doc: /* Get the property of overlay OVERLAY with property name PROP. */) (Lisp_Object overlay, Lisp_Object prop) { -- cgit v1.2.1 From 955cbe7b1720f09b2991b7d981147d9cc79d52e3 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 10 Apr 2011 20:39:45 -0700 Subject: Declare Lisp_Object Q* variables to be 'static' if not exproted. This makes it easier for human readers (and static analyzers) to see whether these variables are used from other modules. * alloc.c, buffer.c, bytecode.c, callint.c, casetab.c, category.c: * ccl.c, character.c, charset.c, cmds.c, coding.c, composite.c: * data.c, dbusbind.c, dired.c, editfns.c, eval.c, fileio.c, fns.c: * font.c, frame.c, fringe.c, ftfont.c, image.c, keyboard.c, keymap.c: * lread.c, macros.c, minibuf.c, print.c, process.c, search.c: * sound.c, syntax.c, textprop.c, window.c, xdisp.c, xfaces.c, xfns.c: * xmenu.c, xselect.c: Declare Q* vars static if they are not used in other modules. * ccl.h, character.h, charset.h, coding.h, composite.h, font.h: * frame.h, intervals.h, keyboard.h, lisp.h, process.h, syntax.h: Remove decls of unexported vars. * keyboard.h (EVENT_HEAD_UNMODIFIED): Remove now-unused macro. --- src/buffer.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index a88afbb36e6..82913ac20e7 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -113,30 +113,31 @@ static void reset_buffer_local_variables (struct buffer *b, int permanent_too); to prevent lossage due to user rplac'ing this alist or its elements. */ Lisp_Object Vbuffer_alist; -Lisp_Object Qkill_buffer_query_functions; +static Lisp_Object Qkill_buffer_query_functions; /* Hook run before changing a major mode. */ -Lisp_Object Qchange_major_mode_hook; +static Lisp_Object Qchange_major_mode_hook; Lisp_Object Qfirst_change_hook; Lisp_Object Qbefore_change_functions; Lisp_Object Qafter_change_functions; -Lisp_Object Qucs_set_table_for_input; +static Lisp_Object Qucs_set_table_for_input; -Lisp_Object Qfundamental_mode, Qmode_class, Qpermanent_local; -Lisp_Object Qpermanent_local_hook; +static Lisp_Object Qfundamental_mode, Qmode_class, Qpermanent_local; +static Lisp_Object Qpermanent_local_hook; -Lisp_Object Qprotected_field; +static Lisp_Object Qprotected_field; -Lisp_Object QSFundamental; /* A string "Fundamental" */ +static Lisp_Object QSFundamental; /* A string "Fundamental" */ -Lisp_Object Qkill_buffer_hook; +static Lisp_Object Qkill_buffer_hook; -Lisp_Object Qget_file_buffer; +static Lisp_Object Qget_file_buffer; -Lisp_Object Qoverlayp; +static Lisp_Object Qoverlayp; -Lisp_Object Qpriority, Qevaporate, Qbefore_string, Qafter_string; +Lisp_Object Qpriority, Qbefore_string, Qafter_string; +static Lisp_Object Qevaporate; Lisp_Object Qmodification_hooks; Lisp_Object Qinsert_in_front_hooks; -- cgit v1.2.1 From c358e587580fbd9deb39b3ddde9383611529c2a6 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 10 Apr 2011 23:15:21 -0700 Subject: * buffer.c (buffer_count): Remove unused var. --- src/buffer.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index 82913ac20e7..4e690f42934 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -294,9 +294,6 @@ get_truename_buffer (register Lisp_Object filename) return Qnil; } -/* Incremented for each buffer created, to assign the buffer number. */ -int buffer_count; - DEFUE ("get-buffer-create", Fget_buffer_create, Sget_buffer_create, 1, 1, 0, doc: /* Return the buffer specified by BUFFER-OR-NAME, creating a new one if needed. If BUFFER-OR-NAME is a string and a live buffer with that name exists, -- cgit v1.2.1 From a7ca3326c4740ed3ed118b794d35d235de49f346 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 13 Apr 2011 22:04:02 -0700 Subject: Undo the DEFUN->DEFUE change. --- src/buffer.c | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index 4e690f42934..7b543b80a25 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -160,7 +160,7 @@ nsberror (Lisp_Object spec) error ("Invalid buffer argument"); } -DEFUE ("buffer-live-p", Fbuffer_live_p, Sbuffer_live_p, 1, 1, 0, +DEFUN ("buffer-live-p", Fbuffer_live_p, Sbuffer_live_p, 1, 1, 0, doc: /* Return non-nil if OBJECT is a buffer which has not been killed. Value is nil if OBJECT is not a buffer or if it has been killed. */) (Lisp_Object object) @@ -232,7 +232,7 @@ assoc_ignore_text_properties (register Lisp_Object key, Lisp_Object list) return Qnil; } -DEFUE ("get-buffer", Fget_buffer, Sget_buffer, 1, 1, 0, +DEFUN ("get-buffer", Fget_buffer, Sget_buffer, 1, 1, 0, doc: /* Return the buffer named BUFFER-OR-NAME. BUFFER-OR-NAME must be either a string or a buffer. If BUFFER-OR-NAME is a string and there is no buffer with that name, return nil. If @@ -294,7 +294,7 @@ get_truename_buffer (register Lisp_Object filename) return Qnil; } -DEFUE ("get-buffer-create", Fget_buffer_create, Sget_buffer_create, 1, 1, 0, +DEFUN ("get-buffer-create", Fget_buffer_create, Sget_buffer_create, 1, 1, 0, doc: /* Return the buffer specified by BUFFER-OR-NAME, creating a new one if needed. If BUFFER-OR-NAME is a string and a live buffer with that name exists, return that buffer. If no such buffer exists, create a new buffer with @@ -830,7 +830,7 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too) and set-visited-file-name ought to be able to use this to really rename the buffer properly. */ -DEFUE ("generate-new-buffer-name", Fgenerate_new_buffer_name, +DEFUN ("generate-new-buffer-name", Fgenerate_new_buffer_name, Sgenerate_new_buffer_name, 1, 2, 0, doc: /* Return a string that is the name of no existing buffer based on NAME. If there is no live buffer named NAME, then return NAME. @@ -868,7 +868,7 @@ it is in the sequence to be tried) even if a buffer with that name exists. */) } -DEFUE ("buffer-name", Fbuffer_name, Sbuffer_name, 0, 1, 0, +DEFUN ("buffer-name", Fbuffer_name, Sbuffer_name, 0, 1, 0, doc: /* Return the name of BUFFER, as a string. BUFFER defaults to the current buffer. Return nil if BUFFER has been killed. */) @@ -880,7 +880,7 @@ Return nil if BUFFER has been killed. */) return BVAR (XBUFFER (buffer), name); } -DEFUE ("buffer-file-name", Fbuffer_file_name, Sbuffer_file_name, 0, 1, 0, +DEFUN ("buffer-file-name", Fbuffer_file_name, Sbuffer_file_name, 0, 1, 0, doc: /* Return name of file BUFFER is visiting, or nil if none. No argument or nil as argument means use the current buffer. */) (register Lisp_Object buffer) @@ -915,7 +915,7 @@ BUFFER defaults to the current buffer. */) return base_buffer; } -DEFUE ("buffer-local-value", Fbuffer_local_value, +DEFUN ("buffer-local-value", Fbuffer_local_value, Sbuffer_local_value, 2, 2, 0, doc: /* Return the value of VARIABLE in BUFFER. If VARIABLE does not have a buffer-local binding in BUFFER, the value @@ -1056,7 +1056,7 @@ No argument or nil as argument means use current buffer as BUFFER. */) return result; } -DEFUE ("buffer-modified-p", Fbuffer_modified_p, Sbuffer_modified_p, +DEFUN ("buffer-modified-p", Fbuffer_modified_p, Sbuffer_modified_p, 0, 1, 0, doc: /* Return t if BUFFER was modified since its file was last read or saved. No argument or nil as argument means use current buffer as BUFFER. */) @@ -1074,7 +1074,7 @@ No argument or nil as argument means use current buffer as BUFFER. */) return BUF_SAVE_MODIFF (buf) < BUF_MODIFF (buf) ? Qt : Qnil; } -DEFUE ("set-buffer-modified-p", Fset_buffer_modified_p, Sset_buffer_modified_p, +DEFUN ("set-buffer-modified-p", Fset_buffer_modified_p, Sset_buffer_modified_p, 1, 1, 0, doc: /* Mark current buffer as modified or unmodified according to FLAG. A non-nil FLAG means mark the buffer modified. */) @@ -1266,7 +1266,7 @@ This does not change the name of the visited file (if any). */) return BVAR (current_buffer, name); } -DEFUE ("other-buffer", Fother_buffer, Sother_buffer, 0, 3, 0, +DEFUN ("other-buffer", Fother_buffer, Sother_buffer, 0, 3, 0, doc: /* Return most recently selected buffer other than BUFFER. Buffers not visible in windows are preferred to visible buffers, unless optional second argument VISIBLE-OK is non-nil. @@ -1340,7 +1340,7 @@ If BUFFER is omitted or nil, some interesting buffer is returned. */) return buf; } -DEFUE ("buffer-enable-undo", Fbuffer_enable_undo, Sbuffer_enable_undo, +DEFUN ("buffer-enable-undo", Fbuffer_enable_undo, Sbuffer_enable_undo, 0, 1, "", doc: /* Start keeping undo information for buffer BUFFER. No argument or nil as argument means do this for the current buffer. */) @@ -1369,7 +1369,7 @@ Hook to be run (by `run-hooks', which see) when a buffer is killed.\n\ The buffer being killed will be current while the hook is running.\n\ See `kill-buffer'." */ -DEFUE ("kill-buffer", Fkill_buffer, Skill_buffer, 0, 1, "bKill buffer: ", +DEFUN ("kill-buffer", Fkill_buffer, Skill_buffer, 0, 1, "bKill buffer: ", doc: /* Kill buffer BUFFER-OR-NAME. The argument may be a buffer or the name of an existing buffer. Argument nil or omitted means kill the current buffer. Return t if the @@ -1788,7 +1788,7 @@ messing with the window-buffer correspondences. */) return switch_to_buffer_1 (buffer_or_name, norecord); } -DEFUE ("current-buffer", Fcurrent_buffer, Scurrent_buffer, 0, 0, 0, +DEFUN ("current-buffer", Fcurrent_buffer, Scurrent_buffer, 0, 0, 0, doc: /* Return the current buffer as a Lisp object. */) (void) { @@ -1898,7 +1898,7 @@ set_buffer_temp (struct buffer *b) fetch_buffer_markers (b); } -DEFUE ("set-buffer", Fset_buffer, Sset_buffer, 1, 1, 0, +DEFUN ("set-buffer", Fset_buffer, Sset_buffer, 1, 1, 0, doc: /* Make buffer BUFFER-OR-NAME current for editing operations. BUFFER-OR-NAME may be a buffer or the name of an existing buffer. See also `save-excursion' when you want to make a buffer current @@ -1927,7 +1927,7 @@ set_buffer_if_live (Lisp_Object buffer) return Qnil; } -DEFUE ("barf-if-buffer-read-only", Fbarf_if_buffer_read_only, +DEFUN ("barf-if-buffer-read-only", Fbarf_if_buffer_read_only, Sbarf_if_buffer_read_only, 0, 0, 0, doc: /* Signal a `buffer-read-only' error if the current buffer is read-only. */) (void) @@ -2000,7 +2000,7 @@ its frame, iconify that frame. */) return Qnil; } -DEFUE ("erase-buffer", Ferase_buffer, Serase_buffer, 0, 0, "*", +DEFUN ("erase-buffer", Ferase_buffer, Serase_buffer, 0, 0, "*", doc: /* Delete the entire contents of the current buffer. Any narrowing restriction in effect (see `narrow-to-region') is removed, so the buffer is truly empty after this. */) @@ -2211,7 +2211,7 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text, return Qnil; } -DEFUE ("set-buffer-multibyte", Fset_buffer_multibyte, Sset_buffer_multibyte, +DEFUN ("set-buffer-multibyte", Fset_buffer_multibyte, Sset_buffer_multibyte, 1, 1, 0, doc: /* Set the multibyte flag of the current buffer to FLAG. If FLAG is t, this makes the buffer a multibyte buffer. @@ -2500,7 +2500,7 @@ current buffer is cleared. */) return flag; } -DEFUE ("kill-all-local-variables", Fkill_all_local_variables, +DEFUN ("kill-all-local-variables", Fkill_all_local_variables, Skill_all_local_variables, 0, 0, 0, doc: /* Switch to Fundamental mode by killing current buffer's local variables. Most local variable bindings are eliminated so that the default values @@ -3899,7 +3899,7 @@ DEFUN ("delete-overlay", Fdelete_overlay, Sdelete_overlay, 1, 1, 0, /* Overlay dissection functions. */ -DEFUE ("overlay-start", Foverlay_start, Soverlay_start, 1, 1, 0, +DEFUN ("overlay-start", Foverlay_start, Soverlay_start, 1, 1, 0, doc: /* Return the position at which OVERLAY starts. */) (Lisp_Object overlay) { @@ -3908,7 +3908,7 @@ DEFUE ("overlay-start", Foverlay_start, Soverlay_start, 1, 1, 0, return (Fmarker_position (OVERLAY_START (overlay))); } -DEFUE ("overlay-end", Foverlay_end, Soverlay_end, 1, 1, 0, +DEFUN ("overlay-end", Foverlay_end, Soverlay_end, 1, 1, 0, doc: /* Return the position at which OVERLAY ends. */) (Lisp_Object overlay) { @@ -3998,7 +3998,7 @@ end of the buffer. */) return result; } -DEFUE ("next-overlay-change", Fnext_overlay_change, Snext_overlay_change, +DEFUN ("next-overlay-change", Fnext_overlay_change, Snext_overlay_change, 1, 1, 0, doc: /* Return the next position after POS where an overlay starts or ends. If there are no overlay boundaries from POS to (point-max), @@ -4039,7 +4039,7 @@ the value is (point-max). */) return make_number (endpos); } -DEFUE ("previous-overlay-change", Fprevious_overlay_change, +DEFUN ("previous-overlay-change", Fprevious_overlay_change, Sprevious_overlay_change, 1, 1, 0, doc: /* Return the previous position before POS where an overlay starts or ends. If there are no overlay boundaries from (point-min) to POS, @@ -4108,7 +4108,7 @@ for positions far away from POS). */) return Qnil; } -DEFUE ("overlay-get", Foverlay_get, Soverlay_get, 2, 2, 0, +DEFUN ("overlay-get", Foverlay_get, Soverlay_get, 2, 2, 0, doc: /* Get the property of overlay OVERLAY with property name PROP. */) (Lisp_Object overlay, Lisp_Object prop) { -- cgit v1.2.1 From cd64ea1d0df393beb93d1bdf19bd3990e3378f85 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 14 Apr 2011 12:34:42 -0700 Subject: * lisp.h (INFUN): Remove. Suggested by Dan Nicolaescu in . All uses spelled out. --- src/buffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index 7b543b80a25..c649836adb8 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -100,8 +100,8 @@ static char buffer_permanent_local_flags[MAX_PER_BUFFER_VARS]; int last_per_buffer_idx; -INFUN (Fset_buffer_major_mode, 1); -INFUN (Fdelete_overlay, 1); +static Lisp_Object Fset_buffer_major_mode (Lisp_Object); +static Lisp_Object Fdelete_overlay (Lisp_Object); static void call_overlay_mod_hooks (Lisp_Object list, Lisp_Object overlay, int after, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3); -- cgit v1.2.1 From eab3844f965646b62e242aa622754b86d1fd3444 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 25 Apr 2011 00:14:46 -0700 Subject: lisp.h: Fix a problem with aliasing and vector headers. GCC 4.6.0 optimizes based on type-based alias analysis. For example, if b is of type struct buffer * and v of type struct Lisp_Vector *, then gcc -O2 was incorrectly assuming that &b->size != &v->size, and therefore "v->size = 1; b->size = 2; return v->size;" must therefore return 1. This assumption is incorrect for Emacs, since it type-puns struct Lisp_Vector * with many other types. To fix this problem, this patch adds a new type struct vector_header that documents the constraints on layout of vectors and pseudovectors, and helps optimizing compilers not get fooled by Emacs's type punning. It also adds the macros XSETTYPED_PVECTYPE XSETTYPED_PSEUDOVECTOR, TYPED_PSEUDOVECTORP, for similar reasons. * lisp.h (XVECTOR_SIZE): New convenience macro. All previous uses of XVECTOR (foo)->size replaced to use this macro, to avoid the hassle of writing XVECTOR (foo)->header.size. (XVECTOR_HEADER_SIZE): New macro, for use in XSETPSEUDOVECTOR. (XSETTYPED_PVECTYPE): New macro, specifying the name of the size member. (XSETPVECTYPE): Rewrite in terms of new macro. (XSETPVECTYPESIZE): New macro, specifying both type and size. This is a bit clearer, and further avoids the possibility of undesirable aliasing. (XSETTYPED_PSEUDOVECTOR): New macro, specifying the size. (XSETPSEUDOVECTOR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR and XVECTOR_HEADER_SIZE. (XSETSUBR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR and XSIZE, since Lisp_Subr is a special case (no "next" field). (ASIZE): Rewrite in terms of XVECTOR_SIZE. (struct vector_header): New type. (TYPED_PSEUDOVECTORP): New macro, also specifying the C type of the object, to help avoid aliasing. (PSEUDOVECTORP): Rewrite in terms of TYPED_PSEUDOVECTORP. (SUBRP): Likewise, since Lisp_Subr is a special case. * lisp.h (struct Lisp_Vector, struct Lisp_Char_Table): (struct Lisp_Sub_Char_Table, struct Lisp_Bool_Vector): (struct Lisp_Hash_Table): Combine first two members into a single struct vector_header member. All uses of "size" and "next" members changed to be "header.size" and "header.next". * buffer.h (struct buffer): Likewise. * font.h (struct font_spec, struct font_entity, struct font): Likewise. * frame.h (struct frame): Likewise. * process.h (struct Lisp_Process): Likewise. * termhooks.h (struct terminal): Likewise. * window.c (struct save_window_data, struct saved_window): Likewise. * window.h (struct window): Likewise. * alloc.c (allocate_buffer, Fmake_bool_vector, allocate_pseudovector): Use XSETPVECTYPESIZE, not XSETPVECTYPE, to avoid aliasing problems. * buffer.c (init_buffer_once): Likewise. * lread.c (defsubr): Use XSETTYPED_PVECTYPE, since Lisp_Subr is a special case. * process.c (Fformat_network_address): Use local var for size, for brevity. --- src/buffer.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index c649836adb8..6ced4fbae87 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -43,7 +43,7 @@ along with GNU Emacs. If not, see . */ struct buffer *current_buffer; /* the current buffer */ /* First buffer in chain of all buffers (in reverse order of creation). - Threaded through ->next. */ + Threaded through ->header.next. */ struct buffer *all_buffers; @@ -359,7 +359,7 @@ even if it is dead. The return value is never nil. */) b->prevent_redisplay_optimizations_p = 1; /* Put this on the chain of all buffers including killed ones. */ - b->next = all_buffers; + b->header.next.buffer = all_buffers; all_buffers = b; /* An ordinary buffer normally doesn't need markers @@ -588,7 +588,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */) BVAR (b, width_table) = Qnil; /* Put this on the chain of all buffers including killed ones. */ - b->next = all_buffers; + b->header.next.buffer = all_buffers; all_buffers = b; name = Fcopy_sequence (name); @@ -1458,7 +1458,7 @@ with SIGHUP. */) GCPRO1 (buffer); - for (other = all_buffers; other; other = other->next) + for (other = all_buffers; other; other = other->header.next.buffer) /* all_buffers contains dead buffers too; don't re-kill them. */ if (other->base_buffer == b && !NILP (BVAR (other, name))) @@ -2099,7 +2099,7 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text, { /* This is probably harder to make work. */ struct buffer *other; - for (other = all_buffers; other; other = other->next) + for (other = all_buffers; other; other = other->header.next.buffer) if (other->base_buffer == other_buffer || other->base_buffer == current_buffer) error ("One of the buffers to swap has indirect buffers"); @@ -2476,7 +2476,7 @@ current buffer is cleared. */) /* Copy this buffer's new multibyte status into all of its indirect buffers. */ - for (other = all_buffers; other; other = other->next) + for (other = all_buffers; other; other = other->header.next.buffer) if (other->base_buffer == current_buffer && !NILP (BVAR (other, name))) { BVAR (other, enable_multibyte_characters) @@ -4178,7 +4178,7 @@ static int last_overlay_modification_hooks_used; static void add_overlay_mod_hooklist (Lisp_Object functionlist, Lisp_Object overlay) { - int oldsize = XVECTOR (last_overlay_modification_hooks)->size; + int oldsize = XVECTOR_SIZE (last_overlay_modification_hooks); if (last_overlay_modification_hooks_used == oldsize) last_overlay_modification_hooks = larger_vector @@ -4973,9 +4973,9 @@ init_buffer_once (void) buffer_local_symbols.text = &buffer_local_symbols.own_text; BUF_INTERVALS (&buffer_defaults) = 0; BUF_INTERVALS (&buffer_local_symbols) = 0; - XSETPVECTYPE (&buffer_defaults, PVEC_BUFFER); + XSETPVECTYPESIZE (&buffer_defaults, PVEC_BUFFER, 0); XSETBUFFER (Vbuffer_defaults, &buffer_defaults); - XSETPVECTYPE (&buffer_local_symbols, PVEC_BUFFER); + XSETPVECTYPESIZE (&buffer_local_symbols, PVEC_BUFFER, 0); XSETBUFFER (Vbuffer_local_symbols, &buffer_local_symbols); /* Set up the default values of various buffer slots. */ -- cgit v1.2.1 From 179dade40292e5bdccdd4ab88748a06a94307570 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 25 Apr 2011 00:33:57 -0700 Subject: Fix minor typos in previous change. --- src/buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index 6ced4fbae87..aa50eff4fd0 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -43,7 +43,7 @@ along with GNU Emacs. If not, see . */ struct buffer *current_buffer; /* the current buffer */ /* First buffer in chain of all buffers (in reverse order of creation). - Threaded through ->header.next. */ + Threaded through ->header.next.buffer. */ struct buffer *all_buffers; -- cgit v1.2.1 From 77b37c05572d1028d0ec2c264ac0ed3a89c0f4da Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 25 Apr 2011 14:34:39 -0700 Subject: * lisp.h: (XVECTOR_SIZE): Remove. All uses replaced with ASIZE. (ASIZE): Now contains previous implementation of XVECTOR_SIZE instead of invoking XVECTOR_SIZE. --- src/buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index aa50eff4fd0..ddaacd93707 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -4178,7 +4178,7 @@ static int last_overlay_modification_hooks_used; static void add_overlay_mod_hooklist (Lisp_Object functionlist, Lisp_Object overlay) { - int oldsize = XVECTOR_SIZE (last_overlay_modification_hooks); + int oldsize = ASIZE (last_overlay_modification_hooks); if (last_overlay_modification_hooks_used == oldsize) last_overlay_modification_hooks = larger_vector -- cgit v1.2.1 From f61f41d74747ed3189526ca70b128acf3719c6fa Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 27 Apr 2011 01:06:26 -0700 Subject: * buffer.c (init_buffer) [USE_MMAP_FOR_BUFFERS]: Adjust to aliasing change --- src/buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index d9949045444..05bd129976f 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -5155,7 +5155,7 @@ init_buffer (void) Map new memory. */ struct buffer *b; - for (b = all_buffers; b; b = b->next) + for (b = all_buffers; b; b = b->header.next.buffer) if (b->text->beg == NULL) enlarge_buffer_text (b, 0); } -- cgit v1.2.1 From 531b01656f89e093b9fa35959fa41e534b025320 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 30 May 2011 09:47:35 -0700 Subject: [ChangeLog] Malloc failure behavior now depends on size of allocation. * lib/allocator.h (struct allocator.die): New size arg. * lib/careadlinkat.c (careadlinkat): Pass size to 'die' function. If the actual problem is an ssize_t limitation, not a size_t or malloc failure, fail with errno == ENAMETOOLONG instead of calling 'die'. [src/ChangeLog] Malloc failure behavior now depends on size of allocation. * alloc.c (buffer_memory_full, memory_full): New arg NBYTES. * lisp.h: Change signatures accordingly. * alloc.c, buffer.c, editfns.c, menu.c, minibuf.c, xterm.c: All callers changed. --- src/buffer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index 05bd129976f..e9ff8f492ba 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -328,7 +328,7 @@ even if it is dead. The return value is never nil. */) alloc_buffer_text (b, BUF_GAP_SIZE (b) + 1); UNBLOCK_INPUT; if (! BUF_BEG_ADDR (b)) - buffer_memory_full (); + buffer_memory_full (BUF_GAP_SIZE (b) + 1); b->pt = BEG; b->begv = BEG; @@ -4892,7 +4892,7 @@ alloc_buffer_text (struct buffer *b, size_t nbytes) if (p == NULL) { UNBLOCK_INPUT; - memory_full (); + memory_full (nbytes); } b->text->beg = (unsigned char *) p; @@ -4920,7 +4920,7 @@ enlarge_buffer_text (struct buffer *b, EMACS_INT delta) if (p == NULL) { UNBLOCK_INPUT; - memory_full (); + memory_full (nbytes); } BUF_BEG_ADDR (b) = (unsigned char *) p; -- cgit v1.2.1 From 666398f3715a5ae76abeee1c8d760551dcf4d70e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 8 Jun 2011 17:40:43 -0700 Subject: * buffer.c (Fgenerate_new_buffer_name): Use EMACS_INT for count, not int. --- src/buffer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index e9ff8f492ba..453ea838902 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -841,8 +841,8 @@ it is in the sequence to be tried) even if a buffer with that name exists. */) (register Lisp_Object name, Lisp_Object ignore) { register Lisp_Object gentemp, tem; - int count; - char number[10]; + EMACS_INT count; + char number[INT_BUFSIZE_BOUND (EMACS_INT) + sizeof "<>"]; CHECK_STRING (name); @@ -856,7 +856,7 @@ it is in the sequence to be tried) even if a buffer with that name exists. */) count = 1; while (1) { - sprintf (number, "<%d>", ++count); + sprintf (number, "<%"pI"d>", ++count); gentemp = concat2 (name, build_string (number)); tem = Fstring_equal (gentemp, ignore); if (!NILP (tem)) -- cgit v1.2.1 From 0ceccced4ed1496f9d5cd3b09732201ef3a0be39 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 8 Jun 2011 17:47:45 -0700 Subject: * buffer.c (advance_to_char_boundary): Return EMACS_INT, not int. --- src/buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index 453ea838902..8fdd094a20d 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -2038,7 +2038,7 @@ validate_region (register Lisp_Object *b, register Lisp_Object *e) /* Advance BYTE_POS up to a character boundary and return the adjusted position. */ -static int +static EMACS_INT advance_to_char_boundary (EMACS_INT byte_pos) { int c; -- cgit v1.2.1 From 562dd5e9532d75d18843a37a1e42a1f4398d4823 Mon Sep 17 00:00:00 2001 From: Martin Rudalics Date: Fri, 10 Jun 2011 08:55:18 +0200 Subject: Move window resize code from window.c to window.el. * window.c: Remove declarations of Qwindow_size_fixed, window_min_size_1, window_min_size_2, window_min_size, size_window, window_fixed_size_p, enlarge_window, delete_window. Remove static from declaration of Qdelete_window, it's temporarily needed by Fbury_buffer. (replace_window): Don't assign orig_top_line and orig_total_lines. (Fdelete_window, delete_window): Remove. Window deletion is handled by window.el. (window_loop): Remove DELETE_OTHER_WINDOWS case. Replace Fdelete_window calls with calls to Qdelete_window. (Fdelete_other_windows): Remove. Deleting other windows is handled by window.el. (window_fixed_size_p): Remove. Fixed-sizeness of windows is handled in window.el. (window_min_size_2, window_min_size_1, window_min_size): Remove. Window minimum sizes are handled in window.el. (shrink_windows, size_window, set_window_height) (set_window_width, change_window_heights, window_height) (window_width, CURBEG, CURSIZE, enlarge_window) (adjust_window_trailing_edge, Fadjust_window_trailing_edge) (Fenlarge_window, Fshrink_window): Remove. Window resizing is handled in window.el. (make_dummy_parent): Rename to make_parent_window and give it a second argument horflag. (make_window): Don't set resize_proportionally any more. (Fsplit_window): Remove. Windows are split in window.el. (save_restore_action, save_restore_orig_size) (shrink_window_lowest_first, save_restore_orig_size): Remove. Resize mini windows in window.el. (grow_mini_window, shrink_mini_window): Implement by calling Qresize_root_window_vertically, resize_window_check and resize_window_apply. (saved_window, Fset_window_configuration, save_window_save): Do not handle orig_top_line, orig_total_lines, and resize_proportionally. (window_min_height, window_min_width): Move to window.el. (keys_of_window): Move bindings for delete-other-windows, split-window, delete-window and enlarge-window to window.el. * buffer.c: Temporarily extern Qdelete_window. (Fbury_buffer): Temporarily call Qdelete_window instead of Fdelete_window (Fbury_buffer will move to window.el soon). * frame.c (set_menu_bar_lines_1): Remove code handling orig_top_line and orig_total_lines. * dispnew.c (adjust_frame_glyphs_initially): Don't use set_window_height but set heights directly. (change_frame_size_1): Use resize_frame_windows. * xdisp.c (init_xdisp): Don't use set_window_height but set heights directly. * xfns.c (x_set_menu_bar_lines, x_set_tool_bar_lines): Use resize_frame_windows instead of change_window_heights and run run_window_configuration_change_hook. * w32fns.c (x_set_tool_bar_lines): Use resize_frame_windows instead of change_window_heights and run run_window_configuration_change_hook. * window.el (window-min-height, window-min-width): Move here from window.c. Add defcustoms and rewrite doc-strings. (resize-mini-window, resize-window): New functions. (adjust-window-trailing-edge, enlarge-window, shrink-window): Move here from window.c. (maximize-window, minimize-window): New functions. (delete-window, delete-other-windows, split-window): Move here from window.c. (window-split-min-size): New function. (split-window-keep-point): Mention split-window-above-each-other instead of split-window-vertically. (split-window-above-each-other, split-window-vertically): Rename split-window-vertically to split-window-above-each-other and provide defalias for old definition. (split-window-side-by-side, split-window-horizontally): Rename split-window-horizontally to split-window-side-by-side and provide defalias for the old definition. (ctl-x-map): Move bindings for delete-window, delete-other-windows and enlarge-window here from window.c. Replace bindings for split-window-vertically and split-window-horizontally by bindings for split-window-above-each-other and split-window-side-by-side. * cus-start.el (all): Remove entries for window-min-height and window-min-width. Add entries for window-splits and window-nest. --- src/buffer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index e9ff8f492ba..0862de9baf7 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1938,6 +1938,8 @@ DEFUN ("barf-if-buffer-read-only", Fbarf_if_buffer_read_only, return Qnil; } +extern Lisp_Object Qdelete_window; + DEFUN ("bury-buffer", Fbury_buffer, Sbury_buffer, 0, 1, "", doc: /* Put BUFFER-OR-NAME at the end of the list of all buffers. There it is the least likely candidate for `other-buffer' to return; @@ -1969,7 +1971,7 @@ its frame, iconify that frame. */) else if (NILP (XWINDOW (selected_window)->parent)) Ficonify_frame (Fwindow_frame (selected_window)); else - Fdelete_window (selected_window); + call1 (Qdelete_window, selected_window); } } else -- cgit v1.2.1 From 9397e56f7424b87f0b52be1235b25a56002661f1 Mon Sep 17 00:00:00 2001 From: Martin Rudalics Date: Sat, 11 Jun 2011 11:50:37 +0200 Subject: Move/add window-buffer-related functions to window.el. * buffer.c: New Lisp objects Qbuffer_list_update_hook and Qclone_number. Remove external declaration of Qdelete_window. (Fbuffer_list): Rewrite doc-string. Minor restructuring of code. (Fget_buffer_create, Fmake_indirect_buffer, Frename_buffer): Run Qbuffer_list_update_hook if allowed. (Fother_buffer): Rewrite doc-string. Major rewrite for new buffer list implementation. (other_buffer_safely): New function. (Fkill_buffer): Replace call to replace_buffer_in_all_windows by calls to replace_buffer_in_windows and replace_buffer_in_windows_safely. Run Qbuffer_list_update_hook if allowed. (record_buffer): Inhibit quitting and rewrite using quittable functions. Run Qbuffer_list_update_hook if allowed. (Frecord_buffer, Funrecord_buffer): New functions. (switch_to_buffer_1, Fswitch_to_buffer): Remove. Move switch-to-buffer to window.el. (bury-buffer): Move to window.el. (Vbuffer_list_update_hook): New variable. * lisp.h (other_buffer_safely): Add prototype in buffer.c section. * window.h (resize_frame_windows): Move up in code. (Fwindow_frame): Remove EXFUN. (replace_buffer_in_all_windows): Remove prototype. (replace_buffer_in_windows_safely): Add prototype. * window.c: Declare Qdelete_window static again. Move down declaration of select_count. (Fnext_window, Fprevious_window): Rewrite doc-strings. (Fother_window): Move to window.el. (window_loop): Remove DELETE_BUFFER_WINDOWS and UNSHOW_BUFFER cases. Add REPLACE_BUFFER_IN_WINDOWS_SAFELY case. (Fdelete_windows_on, Freplace_buffer_in_windows): Move to window.el. (replace_buffer_in_windows): Implement by calling Qreplace_buffer_in_windows. (replace_buffer_in_all_windows): Remove with some functionality moved into replace_buffer_in_windows_safely. (replace_buffer_in_windows_safely): New function. (select_window_norecord, select_frame_norecord): Move in front of run_window_configuration_change_hook. Remove now obsolete declarations. (Fset_window_buffer): Rewrite doc-string. Call Qrecord_window_buffer. (keys_of_window): Move binding for other-window to window.el. * loadup.el (top-level): Load window before files for the sake of replace-buffer-in-windows. * files.el (read-buffer-to-switch) (switch-to-buffer-other-window) (switch-to-buffer-other-frame, display-buffer-other-frame): Move to window.el. * simple.el (get-next-valid-buffer, last-buffer, next-buffer) (previous-buffer): Move to window.el. * bindings.el (unbury-buffer): Move to window.el. * window.el (delete-other-windows-vertically): Move after definition of delete-other-windows. (other-window, delete-windows-on, replace-buffer-in-windows): Move here from window.c. (record-window-buffer, unrecord-window-buffer) (set-window-buffer-start-and-point, switch-to-prev-buffer) (switch-to-next-buffer): New functions. (get-next-valid-buffer, last-buffer, next-buffer): Move here from simple.el. Call switch-to-next-buffer. (previous-buffer): Move here from simple.el. Call switch-to-prev-buffer. (bury-buffer): Move here from buffer.c. Switch to previous buffer when window cannot be deleted. (unbury-buffer): Move here from bindings.el. (ctl-x-map): Move binding for other-window from window.c to here. (read-buffer-to-switch, switch-to-buffer-other-window) (switch-to-buffer-other-frame): Move here from files.el. (normalize-buffer-to-switch-to): New functions. (switch-to-buffer): Move here from buffer.c. Use read-buffer-to-switch and normalize-buffer-to-switch-to. --- src/buffer.c | 455 ++++++++++++++++++++++++++--------------------------------- 1 file changed, 197 insertions(+), 258 deletions(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index 0862de9baf7..bd059cdbe14 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -131,13 +131,15 @@ static Lisp_Object Qprotected_field; static Lisp_Object QSFundamental; /* A string "Fundamental" */ static Lisp_Object Qkill_buffer_hook; +static Lisp_Object Qbuffer_list_update_hook; static Lisp_Object Qget_file_buffer; static Lisp_Object Qoverlayp; Lisp_Object Qpriority, Qbefore_string, Qafter_string; -static Lisp_Object Qevaporate; + +static Lisp_Object Qclone_number, Qevaporate; Lisp_Object Qmodification_hooks; Lisp_Object Qinsert_in_front_hooks; @@ -171,9 +173,9 @@ Value is nil if OBJECT is not a buffer or if it has been killed. */) DEFUN ("buffer-list", Fbuffer_list, Sbuffer_list, 0, 1, 0, doc: /* Return a list of all existing live buffers. -If the optional arg FRAME is a frame, we return the buffer list -in the proper order for that frame: the buffers in FRAME's `buffer-list' -frame parameter come first, followed by the rest of the buffers. */) +If the optional arg FRAME is a frame, we return the buffer list in the +proper order for that frame: the buffers show in FRAME come first, +followed by the rest of the buffers. */) (Lisp_Object frame) { Lisp_Object general; @@ -185,9 +187,9 @@ frame parameter come first, followed by the rest of the buffers. */) Lisp_Object args[3]; CHECK_FRAME (frame); - framelist = Fcopy_sequence (XFRAME (frame)->buffer_list); - prevlist = Fnreverse (Fcopy_sequence (XFRAME (frame)->buried_buffer_list)); + prevlist = Fnreverse (Fcopy_sequence + (XFRAME (frame)->buried_buffer_list)); /* Remove from GENERAL any buffer that duplicates one in FRAMELIST or PREVLIST. */ @@ -209,8 +211,8 @@ frame parameter come first, followed by the rest of the buffers. */) args[2] = prevlist; return Fnconc (3, args); } - - return general; + else + return general; } /* Like Fassoc, but use Fstring_equal to compare @@ -384,6 +386,9 @@ even if it is dead. The return value is never nil. */) /* Put this in the alist of all live buffers. */ XSETBUFFER (buffer, b); Vbuffer_alist = nconc2 (Vbuffer_alist, Fcons (Fcons (name, buffer), Qnil)); + /* And run buffer-list-update-hook. */ + if (!NILP (Vrun_hooks)) + call1 (Vrun_hooks, Qbuffer_list_update_hook); /* An error in calling the function here (should someone redefine it) can lead to infinite regress until you run out of stack. rms @@ -659,6 +664,10 @@ CLONE nil means the indirect buffer's state is reset to default values. */) set_buffer_internal_1 (old_b); } + /* Run buffer-list-update-hook. */ + if (!NILP (Vrun_hooks)) + call1 (Vrun_hooks, Qbuffer_list_update_hook); + return buf; } @@ -1262,81 +1271,119 @@ This does not change the name of the visited file (if any). */) if (NILP (BVAR (current_buffer, filename)) && !NILP (BVAR (current_buffer, auto_save_file_name))) call0 (intern ("rename-auto-save-file")); + + /* Run buffer-list-update-hook. */ + if (!NILP (Vrun_hooks)) + call1 (Vrun_hooks, Qbuffer_list_update_hook); + /* Refetch since that last call may have done GC. */ return BVAR (current_buffer, name); } DEFUN ("other-buffer", Fother_buffer, Sother_buffer, 0, 3, 0, doc: /* Return most recently selected buffer other than BUFFER. -Buffers not visible in windows are preferred to visible buffers, -unless optional second argument VISIBLE-OK is non-nil. -If the optional third argument FRAME is non-nil, use that frame's -buffer list instead of the selected frame's buffer list. -If no other buffer exists, the buffer `*scratch*' is returned. -If BUFFER is omitted or nil, some interesting buffer is returned. */) +Buffers not visible in windows are preferred to visible buffers, unless +optional second argument VISIBLE-OK is non-nil. Ignore the argument +BUFFER unless it denotes a live buffer. If the optional third argument +FRAME is non-nil, use that frame's buffer list instead of the selected +frame's buffer list. + +The buffer is found by scanning the selected or specified frame's buffer +list first, followed by the list of all buffers. If no other buffer +exists, return the buffer `*scratch*' (creating it if necessary). */) (register Lisp_Object buffer, Lisp_Object visible_ok, Lisp_Object frame) { - register Lisp_Object tail, buf, notsogood, tem, pred, add_ons; - notsogood = Qnil; + Lisp_Object Fset_buffer_major_mode (Lisp_Object buffer); + Lisp_Object tail, buf, pred; + Lisp_Object notsogood = Qnil; if (NILP (frame)) frame = selected_frame; CHECK_FRAME (frame); - tail = Vbuffer_alist; pred = frame_buffer_predicate (frame); - - /* Consider buffers that have been seen in the selected frame - before other buffers. */ - - tem = frame_buffer_list (frame); - add_ons = Qnil; - while (CONSP (tem)) + /* Consider buffers that have been seen in the frame first. */ + tail = XFRAME (frame)->buffer_list; + for (; CONSP (tail); tail = XCDR (tail)) { - if (BUFFERP (XCAR (tem))) - add_ons = Fcons (Fcons (Qnil, XCAR (tem)), add_ons); - tem = XCDR (tem); + buf = XCAR (tail); + if (BUFFERP (buf) && !EQ (buf, buffer) + && !NILP (BVAR (XBUFFER (buf), name)) + && (SREF (BVAR (XBUFFER (buf), name), 0) != ' ') + /* If the frame has a buffer_predicate, disregard buffers that + don't fit the predicate. */ + && (NILP (pred) || !NILP (call1 (pred, buf)))) + { + if (!NILP (visible_ok) + || NILP (Fget_buffer_window (buf, Qvisible))) + return buf; + else if (NILP (notsogood)) + notsogood = buf; + } } - tail = nconc2 (Fnreverse (add_ons), tail); + /* Consider alist of all buffers next. */ + tail = Vbuffer_alist; for (; CONSP (tail); tail = XCDR (tail)) { buf = Fcdr (XCAR (tail)); - if (EQ (buf, buffer)) - continue; + if (BUFFERP (buf) && !EQ (buf, buffer) + && !NILP (BVAR (XBUFFER (buf), name)) + && (SREF (BVAR (XBUFFER (buf), name), 0) != ' ') + /* If the frame has a buffer_predicate, disregard buffers that + don't fit the predicate. */ + && (NILP (pred) || !NILP (call1 (pred, buf)))) + { + if (!NILP (visible_ok) + || NILP (Fget_buffer_window (buf, Qvisible))) + return buf; + else if (NILP (notsogood)) + notsogood = buf; + } + } + + if (!NILP (notsogood)) + return notsogood; + else + { + buf = Fget_buffer (build_string ("*scratch*")); if (NILP (buf)) - continue; - if (NILP (BVAR (XBUFFER (buf), name))) - continue; - if (SREF (BVAR (XBUFFER (buf), name), 0) == ' ') - continue; - /* If the selected frame has a buffer_predicate, - disregard buffers that don't fit the predicate. */ - if (!NILP (pred)) { - tem = call1 (pred, buf); - if (NILP (tem)) - continue; + buf = Fget_buffer_create (build_string ("*scratch*")); + Fset_buffer_major_mode (buf); } + return buf; + } +} - if (NILP (visible_ok)) - tem = Fget_buffer_window (buf, Qvisible); - else - tem = Qnil; - if (NILP (tem)) +/* The following function is a safe variant of Fother_buffer: It doesn't + pay attention to any frame-local buffer lists, doesn't care about + visibility of buffers, and doesn't evaluate any frame predicates. */ + +Lisp_Object +other_buffer_safely (Lisp_Object buffer) +{ + Lisp_Object Fset_buffer_major_mode (Lisp_Object buffer); + Lisp_Object tail, buf; + + tail = Vbuffer_alist; + for (; CONSP (tail); tail = XCDR (tail)) + { + buf = Fcdr (XCAR (tail)); + if (BUFFERP (buf) && !EQ (buf, buffer) + && !NILP (BVAR (XBUFFER (buf), name)) + && (SREF (BVAR (XBUFFER (buf), name), 0) != ' ')) return buf; - if (NILP (notsogood)) - notsogood = buf; } - if (!NILP (notsogood)) - return notsogood; + buf = Fget_buffer (build_string ("*scratch*")); if (NILP (buf)) { buf = Fget_buffer_create (build_string ("*scratch*")); Fset_buffer_major_mode (buf); } + return buf; } @@ -1509,13 +1556,20 @@ with SIGHUP. */) if (NILP (BVAR (b, name))) return Qnil; + /* These may run Lisp code and into infinite loops (if someone + insisted on circular lists) so allow quitting here. */ + replace_buffer_in_windows (buffer); + frames_discard_buffer (buffer); + clear_charpos_cache (b); tem = Vinhibit_quit; Vinhibit_quit = Qt; - replace_buffer_in_all_windows (buffer); + /* Remove the buffer from the list of all buffers. */ Vbuffer_alist = Fdelq (Frassq (buffer, Vbuffer_alist), Vbuffer_alist); - frames_discard_buffer (buffer); + /* If replace_buffer_in_windows didn't do its job correctly fix that + now. */ + replace_buffer_in_windows_safely (buffer); Vinhibit_quit = tem; /* Delete any auto-save file, if we saved it in this session. @@ -1589,83 +1643,103 @@ with SIGHUP. */) UNBLOCK_INPUT; BVAR (b, undo_list) = Qnil; + /* Run buffer-list-update-hook. */ + if (!NILP (Vrun_hooks)) + call1 (Vrun_hooks, Qbuffer_list_update_hook); + return Qt; } -/* Move the assoc for buffer BUF to the front of buffer-alist. Since - we do this each time BUF is selected visibly, the more recently - selected buffers are always closer to the front of the list. This - means that other_buffer is more likely to choose a relevant buffer. */ +/* Move association for BUFFER to the front of buffer (a)lists. Since + we do this each time BUFFER is selected visibly, the more recently + selected buffers are always closer to the front of those lists. This + means that other_buffer is more likely to choose a relevant buffer. + + Note that this moves BUFFER to the front of the buffer lists of the + selected frame even if BUFFER is not shown there. If BUFFER is not + shown in the selected frame, consider the present behavior a feature. + `select-window' gets this right since it shows BUFFER in the selected + window when calling us. */ void -record_buffer (Lisp_Object buf) +record_buffer (Lisp_Object buffer) { - register Lisp_Object list, prev; - Lisp_Object frame; - frame = selected_frame; + Lisp_Object aelt, link, tem; + register struct frame *f = XFRAME (selected_frame); + register struct window *w = XWINDOW (FRAME_SELECTED_WINDOW (f)); - prev = Qnil; - for (list = Vbuffer_alist; CONSP (list); list = XCDR (list)) - { - if (EQ (XCDR (XCAR (list)), buf)) - break; - prev = list; - } + CHECK_BUFFER (buffer); - /* Effectively do Vbuffer_alist = Fdelq (list, Vbuffer_alist); - we cannot use Fdelq itself here because it allows quitting. */ + /* Update Vbuffer_alist (we know that it has an entry for BUFFER). + Don't allow quitting since this might leave the buffer list in an + inconsistent state. */ + tem = Vinhibit_quit; + Vinhibit_quit = Qt; + aelt = Frassq (buffer, Vbuffer_alist); + link = Fmemq (aelt, Vbuffer_alist); + Vbuffer_alist = Fdelq (aelt, Vbuffer_alist); + XSETCDR (link, Vbuffer_alist); + Vbuffer_alist = link; + Vinhibit_quit = tem; - if (NILP (prev)) - Vbuffer_alist = XCDR (Vbuffer_alist); - else - XSETCDR (prev, XCDR (XCDR (prev))); + /* Update buffer list of selected frame. */ + f->buffer_list = Fcons (buffer, Fdelq (buffer, f->buffer_list)); + f->buried_buffer_list = Fdelq (buffer, f->buried_buffer_list); - XSETCDR (list, Vbuffer_alist); - Vbuffer_alist = list; + /* Run buffer-list-update-hook. */ + if (!NILP (Vrun_hooks)) + call1 (Vrun_hooks, Qbuffer_list_update_hook); +} - /* Effectively do a delq on buried_buffer_list. */ +DEFUN ("record-buffer", Frecord_buffer, Srecord_buffer, 1, 1, 0, + doc: /* Move BUFFER to the front of the buffer list. +Return BUFFER. */) + (Lisp_Object buffer) +{ + CHECK_BUFFER (buffer); - prev = Qnil; - for (list = XFRAME (frame)->buried_buffer_list; CONSP (list); - list = XCDR (list)) - { - if (EQ (XCAR (list), buf)) - { - if (NILP (prev)) - XFRAME (frame)->buried_buffer_list = XCDR (list); - else - XSETCDR (prev, XCDR (XCDR (prev))); - break; - } - prev = list; - } + record_buffer (buffer); - /* Now move this buffer to the front of frame_buffer_list also. */ + return buffer; +} - prev = Qnil; - for (list = frame_buffer_list (frame); CONSP (list); - list = XCDR (list)) - { - if (EQ (XCAR (list), buf)) - break; - prev = list; - } + /* Move BUFFER to the end of the buffer (a)lists. Do nothing if the + buffer is killed. For the selected frame's buffer list this moves + BUFFER to its end even if it was never shown in that frame. If + this happens we have a feature, hence `unrecord-buffer' should be + called only when BUFFER was shown in the selected frame. */ - /* Effectively do delq. */ +DEFUN ("unrecord-buffer", Funrecord_buffer, Sunrecord_buffer, 1, 1, 0, + doc: /* Move BUFFER to the end of the buffer list. +Return BUFFER. */) + (Lisp_Object buffer) +{ + Lisp_Object aelt, link, tem; + register struct frame *f = XFRAME (selected_frame); - if (CONSP (list)) - { - if (NILP (prev)) - set_frame_buffer_list (frame, - XCDR (frame_buffer_list (frame))); - else - XSETCDR (prev, XCDR (XCDR (prev))); + CHECK_BUFFER (buffer); - XSETCDR (list, frame_buffer_list (frame)); - set_frame_buffer_list (frame, list); - } - else - set_frame_buffer_list (frame, Fcons (buf, frame_buffer_list (frame))); + /* Update Vbuffer_alist (we know that it has an entry for BUFFER). + Don't allow quitting since this might leave the buffer list in an + inconsistent state. */ + tem = Vinhibit_quit; + Vinhibit_quit = Qt; + aelt = Frassq (buffer, Vbuffer_alist); + link = Fmemq (aelt, Vbuffer_alist); + Vbuffer_alist = Fdelq (aelt, Vbuffer_alist); + XSETCDR (link, Qnil); + Vbuffer_alist = nconc2 (Vbuffer_alist, link); + Vinhibit_quit = tem; + + /* Update buffer lists of selected frame. */ + f->buffer_list = Fdelq (buffer, f->buffer_list); + f->buried_buffer_list = Fcons (buffer, Fdelq (buffer, f->buried_buffer_list)); + + /* Run buffer-list-update-hook. */ + if (!NILP (Vrun_hooks)) + call1 (Vrun_hooks, Qbuffer_list_update_hook); + + return buffer; } DEFUN ("set-buffer-major-mode", Fset_buffer_major_mode, Sset_buffer_major_mode, 1, 1, 0, @@ -1708,86 +1782,6 @@ the current buffer's major mode. */) return unbind_to (count, Qnil); } -/* Switch to buffer BUFFER in the selected window. - If NORECORD is non-nil, don't call record_buffer. */ - -static Lisp_Object -switch_to_buffer_1 (Lisp_Object buffer_or_name, Lisp_Object norecord) -{ - register Lisp_Object buffer; - - if (NILP (buffer_or_name)) - buffer = Fother_buffer (Fcurrent_buffer (), Qnil, Qnil); - else - { - buffer = Fget_buffer (buffer_or_name); - if (NILP (buffer)) - { - buffer = Fget_buffer_create (buffer_or_name); - Fset_buffer_major_mode (buffer); - } - } - Fset_buffer (buffer); - if (NILP (norecord)) - record_buffer (buffer); - - Fset_window_buffer (EQ (selected_window, minibuf_window) - ? Fnext_window (minibuf_window, Qnil, Qnil) - : selected_window, - buffer, Qnil); - - return buffer; -} - -DEFUN ("switch-to-buffer", Fswitch_to_buffer, Sswitch_to_buffer, 1, 2, - "(list (read-buffer-to-switch \"Switch to buffer: \"))", - doc: /* Make BUFFER-OR-NAME current and display it in selected window. -BUFFER-OR-NAME may be a buffer, a string \(a buffer name), or -nil. Return the buffer switched to. - -If BUFFER-OR-NAME is a string and does not identify an existing -buffer, create a new buffer with that name. Interactively, if -`confirm-nonexistent-file-or-buffer' is non-nil, request -confirmation before creating a new buffer. If BUFFER-OR-NAME is -nil, switch to buffer returned by `other-buffer'. - -Optional second arg NORECORD non-nil means do not put this buffer -at the front of the list of recently selected ones. This -function returns the buffer it switched to as a Lisp object. - -If the selected window is the minibuffer window or dedicated to -its buffer, use `pop-to-buffer' for displaying the buffer. - -WARNING: This is NOT the way to work on another buffer temporarily -within a Lisp program! Use `set-buffer' instead. That avoids -messing with the window-buffer correspondences. */) - (Lisp_Object buffer_or_name, Lisp_Object norecord) -{ - if (EQ (buffer_or_name, Fwindow_buffer (selected_window))) - { - /* Basically a NOP. Avoid signalling an error in the case where - the selected window is dedicated, or a minibuffer. */ - - /* But do put this buffer at the front of the buffer list, unless - that has been inhibited. Note that even if BUFFER-OR-NAME is - at the front of the main buffer-list already, we still want to - move it to the front of the frame's buffer list. */ - if (NILP (norecord)) - record_buffer (buffer_or_name); - return Fset_buffer (buffer_or_name); - } - else if (EQ (minibuf_window, selected_window) - /* If `dedicated' is neither nil nor t, it means it's - dedicatedness can be overridden by an explicit request - such as a call to switch-to-buffer. */ - || EQ (Fwindow_dedicated_p (selected_window), Qt)) - /* We can't use the selected window so let `pop-to-buffer' try some - other window. */ - return call3 (intern ("pop-to-buffer"), buffer_or_name, Qnil, norecord); - else - return switch_to_buffer_1 (buffer_or_name, norecord); -} - DEFUN ("current-buffer", Fcurrent_buffer, Scurrent_buffer, 0, 0, 0, doc: /* Return the current buffer as a Lisp object. */) (void) @@ -1937,70 +1931,6 @@ DEFUN ("barf-if-buffer-read-only", Fbarf_if_buffer_read_only, xsignal1 (Qbuffer_read_only, Fcurrent_buffer ()); return Qnil; } - -extern Lisp_Object Qdelete_window; - -DEFUN ("bury-buffer", Fbury_buffer, Sbury_buffer, 0, 1, "", - doc: /* Put BUFFER-OR-NAME at the end of the list of all buffers. -There it is the least likely candidate for `other-buffer' to return; -thus, the least likely buffer for \\[switch-to-buffer] to select by -default. - -The argument may be a buffer name or an actual buffer object. If -BUFFER-OR-NAME is nil or omitted, bury the current buffer and remove it -from the selected window if it is displayed there. If the selected -window is dedicated to its buffer, delete that window if there are other -windows on the same frame. If the selected window is the only window on -its frame, iconify that frame. */) - (register Lisp_Object buffer_or_name) -{ - Lisp_Object buffer; - - /* Figure out what buffer we're going to bury. */ - if (NILP (buffer_or_name)) - { - Lisp_Object tem; - XSETBUFFER (buffer, current_buffer); - - tem = Fwindow_buffer (selected_window); - /* If we're burying the current buffer, unshow it. */ - if (EQ (buffer, tem)) - { - if (NILP (Fwindow_dedicated_p (selected_window))) - Fswitch_to_buffer (Fother_buffer (buffer, Qnil, Qnil), Qnil); - else if (NILP (XWINDOW (selected_window)->parent)) - Ficonify_frame (Fwindow_frame (selected_window)); - else - call1 (Qdelete_window, selected_window); - } - } - else - { - buffer = Fget_buffer (buffer_or_name); - if (NILP (buffer)) - nsberror (buffer_or_name); - } - - /* Move buffer to the end of the buffer list. Do nothing if the - buffer is killed. */ - if (!NILP (BVAR (XBUFFER (buffer), name))) - { - Lisp_Object aelt, list; - - aelt = Frassq (buffer, Vbuffer_alist); - list = Fmemq (aelt, Vbuffer_alist); - Vbuffer_alist = Fdelq (aelt, Vbuffer_alist); - XSETCDR (list, Qnil); - Vbuffer_alist = nconc2 (Vbuffer_alist, list); - - XFRAME (selected_frame)->buffer_list - = Fdelq (buffer, XFRAME (selected_frame)->buffer_list); - XFRAME (selected_frame)->buried_buffer_list - = Fcons (buffer, Fdelq (buffer, XFRAME (selected_frame)->buried_buffer_list)); - } - - return Qnil; -} DEFUN ("erase-buffer", Ferase_buffer, Serase_buffer, 0, 0, "*", doc: /* Delete the entire contents of the current buffer. @@ -6101,6 +6031,15 @@ The function `kill-all-local-variables' runs this before doing anything else. * Qchange_major_mode_hook = intern_c_string ("change-major-mode-hook"); staticpro (&Qchange_major_mode_hook); + DEFVAR_LISP ("buffer-list-update-hook", Vbuffer_list_update_hook, + doc: /* Hook run when the buffer list changes. +Functions running this hook are `get-buffer-create', +`make-indirect-buffer', `rename-buffer', `kill-buffer', +`record-buffer' and `unrecord-buffer'. */); + Vbuffer_list_update_hook = Qnil; + Qbuffer_list_update_hook = intern_c_string ("buffer-list-update-hook"); + staticpro (&Qbuffer_list_update_hook); + defsubr (&Sbuffer_live_p); defsubr (&Sbuffer_list); defsubr (&Sget_buffer); @@ -6122,12 +6061,12 @@ The function `kill-all-local-variables' runs this before doing anything else. * defsubr (&Sother_buffer); defsubr (&Sbuffer_enable_undo); defsubr (&Skill_buffer); + defsubr (&Srecord_buffer); + defsubr (&Sunrecord_buffer); defsubr (&Sset_buffer_major_mode); - defsubr (&Sswitch_to_buffer); defsubr (&Scurrent_buffer); defsubr (&Sset_buffer); defsubr (&Sbarf_if_buffer_read_only); - defsubr (&Sbury_buffer); defsubr (&Serase_buffer); defsubr (&Sbuffer_swap_text); defsubr (&Sset_buffer_multibyte); -- cgit v1.2.1 From 4475bec4dd51b8da9884816d9ca06e4d60a35e15 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 11 Jun 2011 14:31:32 -0700 Subject: * buffer.c (Qclone_number): Remove for now, as it's unused. (record_buffer, Funrecord_buffer): Rename local to avoid shadowing. (record_buffer): Remove unused local. * frame.c (other_visible_frames, frame_buffer_list): Now static. (set_frame_buffer_list): Remove; unused. * frame.h (other_visible_frames): Remove decl. * keyboard.h (menu_items_inuse): Declare only if USE_GTK || USE_MOTIF. * lisp.h (frame_buffer_list, set_frame_buffer_list): Remove decls. (add_gpm_wait_descriptor, delete_gpm_wait_descriptor): Declare only if HAVE_GPM. * menu.c (menu_items_inuse): Now static unless USE_GTK || USE_MOTIF. * process.c (add_gpm_wait_descriptor, delete_gpm_wait_descriptor): Define only if HAVE_GPM. * widget.c (EmacsFrameResize, emacsFrameClassRec): Now static. (update_hints_inhibit): Remove; never set. All uses removed. * widgetprv.h (emacsFrameClassRec): Remove decl. * window.c (delete_deletable_window): Now returns void, since it wasn't returning anything. (compare_window_configurations): Remove unused locals. * xfns.c (x_set_scroll_bar_default_width): Remove unused locals. * xmenu.c (x_menu_set_in_use): Define only if USE_GTK || USE_MOTIF. Omit no-longer-needed #ifdef USE_X_TOOLKIT, since USE_X_TOOLKIT is implied by USE_GTK || USE_MOTIF. (dialog_selection_callback) [!USE_GTK]: Prefer intptr_t for integers the same widths as pointers. This follows up on the 2011-05-06 patch. * xterm.c (x_alloc_lighter_color_for_widget): Define only if USE_LUCID. * xterm.h: Likewise. (x_menu_set_in_use): Declare only if USE_GTK || USE_MOTIF. --- src/buffer.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index bd059cdbe14..7030fea1002 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -139,7 +139,7 @@ static Lisp_Object Qoverlayp; Lisp_Object Qpriority, Qbefore_string, Qafter_string; -static Lisp_Object Qclone_number, Qevaporate; +static Lisp_Object Qevaporate; Lisp_Object Qmodification_hooks; Lisp_Object Qinsert_in_front_hooks; @@ -1664,9 +1664,8 @@ with SIGHUP. */) void record_buffer (Lisp_Object buffer) { - Lisp_Object aelt, link, tem; + Lisp_Object aelt, aelt_cons, tem; register struct frame *f = XFRAME (selected_frame); - register struct window *w = XWINDOW (FRAME_SELECTED_WINDOW (f)); CHECK_BUFFER (buffer); @@ -1676,10 +1675,10 @@ record_buffer (Lisp_Object buffer) tem = Vinhibit_quit; Vinhibit_quit = Qt; aelt = Frassq (buffer, Vbuffer_alist); - link = Fmemq (aelt, Vbuffer_alist); + aelt_cons = Fmemq (aelt, Vbuffer_alist); Vbuffer_alist = Fdelq (aelt, Vbuffer_alist); - XSETCDR (link, Vbuffer_alist); - Vbuffer_alist = link; + XSETCDR (aelt_cons, Vbuffer_alist); + Vbuffer_alist = aelt_cons; Vinhibit_quit = tem; /* Update buffer list of selected frame. */ @@ -1714,7 +1713,7 @@ DEFUN ("unrecord-buffer", Funrecord_buffer, Sunrecord_buffer, 1, 1, 0, Return BUFFER. */) (Lisp_Object buffer) { - Lisp_Object aelt, link, tem; + Lisp_Object aelt, aelt_cons, tem; register struct frame *f = XFRAME (selected_frame); CHECK_BUFFER (buffer); @@ -1725,10 +1724,10 @@ Return BUFFER. */) tem = Vinhibit_quit; Vinhibit_quit = Qt; aelt = Frassq (buffer, Vbuffer_alist); - link = Fmemq (aelt, Vbuffer_alist); + aelt_cons = Fmemq (aelt, Vbuffer_alist); Vbuffer_alist = Fdelq (aelt, Vbuffer_alist); - XSETCDR (link, Qnil); - Vbuffer_alist = nconc2 (Vbuffer_alist, link); + XSETCDR (aelt_cons, Qnil); + Vbuffer_alist = nconc2 (Vbuffer_alist, aelt_cons); Vinhibit_quit = tem; /* Update buffer lists of selected frame. */ -- cgit v1.2.1