summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2011-02-21 17:34:51 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2011-02-21 17:34:51 -0500
commitf619ad4ca2ce943d53589469c010e451afab97dd (patch)
treee1b71f79518372ecab4c677ae948504450d8bf5d /src
parenta647cb26b695a542e3a546104afdf4c7c47eb061 (diff)
parent9f8370e63f65f76887b319ab6a0368d4a332777c (diff)
Merge from trunk
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog.trunk613
-rw-r--r--src/Makefile.in4
-rw-r--r--src/alloc.c25
-rw-r--r--src/buffer.c708
-rw-r--r--src/buffer.h155
-rw-r--r--src/bytecode.c23
-rw-r--r--src/callint.c22
-rw-r--r--src/callproc.c53
-rw-r--r--src/casefiddle.c12
-rw-r--r--src/casetab.c10
-rw-r--r--src/category.c8
-rw-r--r--src/category.h2
-rw-r--r--src/character.c4
-rw-r--r--src/character.h12
-rw-r--r--src/charset.c2
-rw-r--r--src/cmds.c24
-rw-r--r--src/coding.c36
-rw-r--r--src/composite.c8
-rw-r--r--src/config.in95
-rw-r--r--src/data.c24
-rw-r--r--src/deps.mk13
-rw-r--r--src/dired.c7
-rw-r--r--src/dispextern.h6
-rw-r--r--src/dispnew.c8
-rw-r--r--src/doc.c2
-rw-r--r--src/editfns.c74
-rw-r--r--src/fileio.c202
-rw-r--r--src/filelock.c14
-rw-r--r--src/filemode.c245
-rw-r--r--src/fns.c12
-rw-r--r--src/font.c2
-rw-r--r--src/frame.c18
-rw-r--r--src/fringe.c18
-rw-r--r--src/getloadavg.c1037
-rw-r--r--src/gtkutil.c2
-rw-r--r--src/indent.c62
-rw-r--r--src/insdel.c62
-rw-r--r--src/intervals.c4
-rw-r--r--src/intervals.h4
-rw-r--r--src/keyboard.c250
-rw-r--r--src/keyboard.h43
-rw-r--r--src/keymap.c40
-rw-r--r--src/lisp.h20
-rw-r--r--src/lread.c33
-rw-r--r--src/m/alpha.h7
-rw-r--r--src/m/amdx86-64.h7
-rw-r--r--src/m/ia64.h7
-rw-r--r--src/m/ibms390.h7
-rw-r--r--src/m/macppc.h7
-rw-r--r--src/m/sparc.h7
-rw-r--r--src/m/template.h7
-rw-r--r--src/m/vax.h10
-rw-r--r--src/macros.c42
-rw-r--r--src/makefile.w32-in18
-rw-r--r--src/marker.c12
-rw-r--r--src/md5.c430
-rw-r--r--src/md5.h148
-rw-r--r--src/minibuf.c22
-rw-r--r--src/msdos.c8
-rw-r--r--src/nsfns.m12
-rw-r--r--src/nsterm.m4
-rw-r--r--src/print.c48
-rw-r--r--src/process.c80
-rw-r--r--src/s/aix4-2.h7
-rw-r--r--src/s/bsd-common.h11
-rw-r--r--src/s/freebsd.h2
-rw-r--r--src/s/hpux10-20.h21
-rw-r--r--src/s/ms-w32.h4
-rw-r--r--src/s/msdos.h11
-rw-r--r--src/s/netbsd.h3
-rw-r--r--src/s/unixware.h10
-rw-r--r--src/s/usg5-4-common.h7
-rw-r--r--src/search.c48
-rw-r--r--src/syntax.c16
-rw-r--r--src/syntax.h6
-rw-r--r--src/term.c23
-rw-r--r--src/termcap.c1
-rw-r--r--src/terminal.c21
-rw-r--r--src/undo.c62
-rw-r--r--src/w32fns.c12
-rw-r--r--src/w32term.c2
-rw-r--r--src/window.c70
-rw-r--r--src/xdisp.c249
-rw-r--r--src/xfaces.c2
-rw-r--r--src/xfns.c10
-rw-r--r--src/xftfont.c8
-rw-r--r--src/xmenu.c42
-rw-r--r--src/xrdb.c6
-rw-r--r--src/xsettings.c23
-rw-r--r--src/xterm.c11
90 files changed, 2159 insertions, 3430 deletions
diff --git a/src/ChangeLog.trunk b/src/ChangeLog.trunk
index 68a12d4f55..9713a4a6ed 100644
--- a/src/ChangeLog.trunk
+++ b/src/ChangeLog.trunk
@@ -1,3 +1,574 @@
+2011-02-21 Eli Zaretskii <eliz@gnu.org>
+
+ * makefile.w32-in ($(BLD)/filemode.$(O)): Move recipe to
+ lib/makefilw.w32-in.
+ ($(BLD)/dired.$(O)): Depend on $(EMACS_ROOT)/lib/filemode.h.
+ (GLOBAL_SOURCES): Remove filemode.c.
+ (OBJ1): Remove $(BLD)/filemode.$(O).
+
+2011-02-21 Paul Eggert <eggert@cs.ucla.edu>
+
+ Import filemode module from gnulib.
+ * Makefile.in (base_obj): Remove filemode.o, as it's now in ../lib.
+ * deps.mk (dired.o): Depend on ../lib/filemode.h, too.
+ (filemode.o): Remove; this is now in ../lib.
+ * dired.c: Include <filemode.h>.
+ (filemodestring): Remove now-redundant decl.
+ * config.in: Regenerate.
+
+2011-02-20 Eli Zaretskii <eliz@gnu.org>
+
+ * makefile.w32-in ($(BLD)/fns.$(O)): Depend on
+ $(EMACS_ROOT)/lib/md5.h and on stamp_BLD.
+
+2011-02-20 Christoph Scholtes <cschol2112@gmail.com>
+
+ * makefile.w32-in: Remove md5.$(O).
+ ($(BLD)/md5.$(O)): Remove prerequisites, moved to
+ lib/makefile.w32-in.
+
+2011-02-20 Paul Eggert <eggert@cs.ucla.edu>
+
+ Import crypto/md5 and stdint modules from gnulib.
+ * Makefile.in (base_obj): Remove md5.o, since this file
+ is in lib now.
+ * config.in: Regenerate.
+ * md5.h, md5.h: Move to ../lib.
+ * deps.mk (md5.o): Remove.
+ (fns.o): Depend on ../lib/md5.h, not md5.h.
+
+2011-02-19 Eli Zaretskii <eliz@gnu.org>
+
+ * termcap.c (tputs): Don't declare baud_rate.
+
+ * s/msdos.h (strtold): Define to _strtold.
+
+2011-02-18 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * process.c (Fstart_process, Fmake_serial_process)
+ (Fmake_network_process, server_accept_connection):
+ Use empty_unibyte_string.
+
+ * alloc.c (make_unibyte_string): Don't SET_UNIBYTE redundantly.
+
+ * lread.c (Qdir_ok): New constant.
+ (syms_of_lread): Initialize it.
+ (openp): Don't ignore directories if the predicate returns dir-ok.
+
+2011-02-18 Eli Zaretskii <eliz@gnu.org>
+
+ * xdisp.c (display_line): Fix the change made for bug#7939.
+
+ * terminal.c (create_terminal): Use default-keyboard-coding-system
+ and default-terminal-coding-system to initialize coding systems of
+ the new terminal. (Bug#7840)
+
+2011-02-18 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * lisp.h (BYTE_MARK_STACK): New macro.
+ (mark_byte_stack): Only declare if BYTE_MARK_STACK is set.
+
+ * bytecode.c (BYTE_MAINTAIN_TOP): New macros.
+ (struct byte_stack): Only define `top' and `bottom' if used.
+ (mark_byte_stack): Only define if used.
+ (BEFORE_POTENTIAL_GC, AFTER_POTENTIAL_GC): Nullify if BYTE_MAINTAIN_TOP
+ is not set.
+ (Fbyte_code): Don't set `bottom' unless BYTE_MAINTAIN_TOP is set.
+
+ * term.c (OUTPUT_IF): Use OUTPUT.
+
+ * alloc.c (Fgarbage_collect): When using stack scanning, don't
+ redundantly scan byte-code stacks, catchlist, and handlerlist.
+
+2011-02-17 Jan Djärv <jan.h.d@swipnet.se>
+
+ * nsfns.m (Fx_create_frame, ns_set_name_as_filename)
+ (Fns_read_file_name): Replace B_ with BVAR.
+
+ * nsterm.m (ns_term_init): Use KVAR.
+
+2011-02-16 Eli Zaretskii <eliz@gnu.org>
+
+ * msdos.c (internal_terminal_init): Use KVAR.
+
+ * w32fns.c (Fx_create_frame): Use KVAR.
+
+ * w32term.c (w32_create_terminal): Use KVAR.
+
+ * s/ms-w32.h (MODE_LINE_BINARY_TEXT): Remove.
+ (getloadavg): Declare prototype which was removed from lisp.h.
+
+ * 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.
+
+2011-02-16 Tom Tromey <tromey@parfait>
+
+ * callint.c (Fcall_interactively): Update for change to field names.
+ * doc.c (Fsubstitute_command_keys): Update for change to field names.
+ * cmds.c (Fself_insert_command): Update for change to field names.
+ * keymap.c (Fcurrent_active_maps, Fkey_binding)
+ (Fdescribe_buffer_bindings): Update for change to field names.
+ * macros.c (Fstart_kbd_macro, end_kbd_macro, Fend_kbd_macro)
+ (store_kbd_macro_char, Fcall_last_kbd_macro, Fexecute_kbd_macro):
+ Update for change to field names.
+ * keyboard.c (echo_char, echo_dash, echo_now, cancel_echoing)
+ (echo_length, echo_truncate, cmd_error, command_loop_1)
+ (read_char, kbd_buffer_store_event_hold, make_lispy_event)
+ (menu_bar_items, tool_bar_items, read_char_minibuf_menu_prompt)
+ (read_key_sequence, Fcommand_execute, Fexecute_extended_command)
+ (Fdiscard_input, init_kboard, init_keyboard, mark_kboards):
+ Update for change to field names.
+ * xfns.c (Fx_create_frame): Update for change to field names.
+ * xterm.c (x_connection_closed, x_term_init): Update for change to
+ field names.
+ * term.c (term_get_fkeys_1, CONDITIONAL_REASSIGN, init_tty):
+ Update for change to field names.
+ * window.c (window_scroll_pixel_based, window_scroll_line_based):
+ Update for change to field names.
+ * frame.c (make_frame_without_minibuffer, Fhandle_switch_frame)
+ (delete_frame): Update for change to field names.
+ * lisp.h (DEFVAR_KBOARD): Update for change to field names.
+ * keyboard.h (struct kboard): Rename all Lisp_Object fields.
+ (KBOARD_INTERNAL_FIELD, KVAR): New macros.
+
+2011-02-16 Tom Tromey <tromey@redhat.com>
+
+ * lisp.h (DEFVAR_BUFFER_DEFAULTS): Use BVAR.
+
+2011-02-16 Tom Tromey <tromey@parfait>
+
+ * 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.
+
+2011-02-16 Eli Zaretskii <eliz@gnu.org>
+
+ * xdisp.c (redisplay_internal): Resynchronize `w' if the selected
+ window is changed inside calls to do_pending_window_change.
+ (Bug#8020)
+
+2011-02-16 Paul Eggert <eggert@cs.ucla.edu>
+
+ Remove no-longer needed getloadavg symbols.
+ * m/alpha.h (LOAD_AVE_TYPE, LOAD_AVE_CVT): Remove.
+ * m/amdx86-64.h (LOAD_AVE_TYPE, LOAD_AVE_CVT): Remove.
+ * m/ia64.h (LOAD_AVE_TYPE, LOAD_AVE_CVT): Remove.
+ * m/ibms390.h (LOAD_AVE_TYPE, LOAD_AVE_CVT): Remove.
+ * m/macppc.h (LOAD_AVE_TYPE, LOAD_AVE_CVT): Remove.
+ * m/sparc.h (LOAD_AVE_TYPE, LOAD_AVE_CVT): Remove.
+ * m/template.h (LOAD_AVE_TYPE, LOAD_AVE_CVT): Remove.
+ * m/vax.h (LOAD_AVE_TYPE, LOAD_AVE_CVT): Remove.
+ * s/aix4-2.h (KERNEL_FILE, LDAV_SYMBOL): Remove.
+ * s/bsd-common.h (KERNEL_FILE, LDAV_SYMBOL): Remove #undef.
+ * s/hpux10-20.h (KERNEL_FILE, LOAD_AVE_TYPE, LOAD_AVE_CVT):
+ (LDAV_SYMBOL): Remove.
+ * s/unixware.h (LOAD_AVE_TYPE, LOAD_AVE_CVT, FSCALE): Remove.
+ * s/usg5-4-common.h (KERNEL_FILE, LDAV_SYMBOL): Remove.
+
+ Import getloadavg module from gnulib.
+ * deps.mk (getloadavg.o): Remove; gnulib now does this.
+ * lisp.h (getloadavg) [!defined HAVE_GETLOADAVG]: Remove; gnulib
+ now does this.
+ * src/s/freebsd.h (HAVE_GETLOADAVG): Remove; gnulib now does this.
+ * src/s/netbsd.h (HAVE_GETLOADAVG): Likewise.
+ * config.in: Regenerate.
+
+2011-02-15 Eli Zaretskii <eliz@gnu.org>
+
+ * nsfns.m (ns_set_name_as_filename, Fns_read_file_name): Use B_.
+
+2011-02-14 Michael Welsh Duggan <md5i@md5i.com>
+
+ * print.c (float_to_string): Ensure that a decimal point is
+ printed if using dtoastr (Bug#8033).
+
+2011-02-14 Eli Zaretskii <eliz@gnu.org>
+
+ * msdos.c (IT_frame_up_to_date):
+ * s/msdos.h (MODE_LINE_BINARY_TEXT): Use B_ for the MS-DOS build.
+
+ * 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.
+
+2011-02-14 Jan Djärv <jan.h.d@swipnet.se>
+
+ * xrdb.c (x_load_resources): For LUCID and XFT, don't put a
+ resource that specifies helvetica for menus and dialogs.
+
+ * xmenu.c (apply_systemfont_to_dialog): Apply to *dialog.font.
+ (apply_systemfont_to_menu): Set resources *menubar*font and
+ *popup*font. Remove defflt.
+ (set_frame_menubar, create_and_show_popup_menu):
+ Call apply_systemfont_to_menu before lw_create_widget.
+
+2011-02-14 Tom Tromey <tromey@redhat.com>
+
+ * buffer.c (init_buffer_once, syms_of_buffer): Use B_ in DOS_NT case.
+
+ * keyboard.h: Remove obsolete comment.
+
+2011-02-14 Tom Tromey <tromey@parfait>
+
+ * 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_.
+
+2011-02-14 Jan Djärv <jan.h.d@swipnet.se>
+
+ * gtkutil.c (xg_tool_bar_menu_proxy): Handle case when tool bar label
+ is null.
+
+2011-02-13 Jan Djärv <jan.h.d@swipnet.se>
+
+ * callproc.c (Fcall_process):
+ * process.c (create_process): Replace Gtk with GConf in SIGPIPE
+ comment.
+
+2011-02-12 Martin Rudalics <rudalics@gmx.at>
+
+ * window.c (select_window): Check inhibit_point_swap argument when
+ deciding whether to return immediately.
+
+2011-02-12 Jan Djärv <jan.h.d@swipnet.se>
+
+ * nsterm.m (setFrame, initFrame): Make sure pixel_height doesn't become
+ zero (Bug#7348).
+
+2011-02-12 Chong Yidong <cyd@stupidchicken.com>
+
+ * config.in (TERMINFO): New definition.
+
+ * s/netbsd.h: Use it to choose between terminfo and termcap
+ (Bug#7642).
+
+2011-02-12 Paul Eggert <eggert@cs.ucla.edu>
+
+ * md5.c (md5_process_bytes): Use sizeof, not __alignof__.
+ The difference doesn't matter here, in practice, and sizeof is
+ more portable to non-GCC compilers. Also, this makes the code
+ match the already-existing comment.
+
+2011-02-12 Andreas Schwab <schwab@linux-m68k.org>
+
+ * process.c (create_process): Reset SIGPIPE handler in the child.
+ * callproc.c (Fcall_process): Likewise. (Bug#5238)
+
+2011-02-12 Eli Zaretskii <eliz@gnu.org>
+
+ * xdisp.c <this_line_min_pos>: New variable.
+ (move_it_in_display_line_to): Record in this_line_min_pos the
+ smallest position iterated across.
+ (display_line): Use this_line_min_pos to record the smallest
+ position in the line even if it is not displayed due to
+ hscrolling. (Bug#7939)
+
+2011-02-12 Paul Eggert <eggert@cs.ucla.edu>
+
+ Port to Sun C 5.11, which has __attribute__ ((__aligned (N))).
+ * md5.h (ATTRIBUTE_ALIGNED): New macro.
+ (struct md5_ctx): Use it.
+
+ Port to Solaris 10, which doesn't support FC_HINT_STYLE.
+ * xftfont.c (FC_HINT_STYLE): #define to "hintstyle" if not
+ defined.
+ * xsettings.c (parse_settings, apply_xft_settings): Don't assume
+ FC_HINT_STYLE is supported.
+
+2011-02-11 Jan Djärv <jan.h.d@swipnet.se>
+
+ * xterm.c (x_set_frame_alpha): Access data before it is free:d.
+ Make sure we don't do x_catch_errors twice.
+
2011-02-10 Glenn Morris <rgm@gnu.org>
* Makefile.in (really-lwlib): Depend on globals.h, for parallel builds.
@@ -112,8 +683,8 @@
callers changed.
* editfns.c (general_insert_function): Change signature to
match changes to insert functions' signatures.
- * keymap.c (map_keymap_char_table_item, map_keymap_internal): Use
- explicit cast when converting between void * and function pointer
+ * keymap.c (map_keymap_char_table_item, map_keymap_internal):
+ Use explicit cast when converting between void * and function pointer
types, as C89 requires this.
2011-02-05 Paul Eggert <eggert@cs.ucla.edu>
@@ -233,7 +804,7 @@
2011-02-01 Paul Eggert <eggert@cs.ucla.edu>
format-time-string now supports subsecond time stamp resolution
- * editfns.c (emacs_nmemftime): Renamed from emacs_memftimeu,
+ * editfns.c (emacs_nmemftime): Rename from emacs_memftimeu,
for consistency with its new argument and with gnulib nstrftime.
All callers changed. New argument NS.
(Fformat_time_string): Check that the time argument's microseconds
@@ -563,11 +1134,11 @@
(history_delete_duplicates, inhibit_x_resources)
(last_nonmenu_event, load_in_progress, max_specpdl_size)
(minibuffer_auto_raise, print_escape_newlines, scroll_margin)
- (use_dialog_box, use_file_dialog): Remove declaration. Include
- globals.h.
+ (use_dialog_box, use_file_dialog): Remove declaration.
+ Include globals.h.
* keymap.h (Voverriding_local_map)
- (Voverriding_local_map_menu_flag, meta_prefix_char): Remove
- declaration.
+ (Voverriding_local_map_menu_flag, meta_prefix_char):
+ Remove declaration.
* keyboard.h (Vdouble_click_time, Vfunction_key_map)
(Vinput_method_function, Vkey_translation_map)
(Vlucid_menu_bar_dirty_flag, Vthis_original_command)
@@ -585,16 +1156,16 @@
(focus_follows_mouse): Remove declaration.
* fontset.h (Valternate_fontname_alist, Vfontset_alias_alist)
(Vignore_relative_composition, Votf_script_alist)
- (Vuse_default_ascent, Vvertical_centering_font_regexp): Remove
- declaration.
+ (Vuse_default_ascent, Vvertical_centering_font_regexp):
+ Remove declaration.
* font.h (Vfont_log): Remove declaration.
* dosfns.h (Vdos_display_scancodes, Vdos_version)
(Vdos_windows_version, dos_codepage, dos_country_code)
(dos_decimal_point, dos_hyper_key, dos_keyboard_layout)
- (dos_keypad_mode, dos_super_key, dos_timezone_offset): Remove
- declaration.
- * disptab.h (Vglyph_table, Vstandard_display_table): Remove
- declaration.
+ (dos_keypad_mode, dos_super_key, dos_timezone_offset):
+ Remove declaration.
+ * disptab.h (Vglyph_table, Vstandard_display_table):
+ Remove declaration.
* dispextern.h (Vface_remapping_alist, Vglyphless_char_display)
(Vmouse_autoselect_window, Voverflow_newline_into_fringe)
(Vshow_trailing_whitespace, Vtool_bar_button_margin)
@@ -622,10 +1193,10 @@
(Vselect_safe_coding_system_function)
(Vtranslation_table_for_input, coding_system_require_warning)
(eol_mnemonic_dos, eol_mnemonic_mac, eol_mnemonic_undecided)
- (eol_mnemonic_unix, inherit_process_coding_system): Remove
- declaration.
- * charset.h (Vcharset_list, Vcurrent_iso639_language): Remove
- declaration.
+ (eol_mnemonic_unix, inherit_process_coding_system):
+ Remove declaration.
+ * charset.h (Vcharset_list, Vcurrent_iso639_language):
+ Remove declaration.
* character.h (Vauto_fill_chars, Vchar_direction_table)
(Vchar_script_table, Vchar_width_table, Vprintable_chars)
(Vscript_representative_chars, Vtranslation_table_vector)
@@ -740,8 +1311,8 @@
(w32_strict_fontnames, w32_strict_painting): Remove.
(Vhourglass_delay, Vmenu_bar_mode, Vtool_bar_mode)
(Vw32_recognize_altgr, Vwindow_system_version)
- (w32_num_mouse_buttons, w32_use_visible_system_caret): Remove
- declaration.
+ (w32_num_mouse_buttons, w32_use_visible_system_caret):
+ Remove declaration.
* w32console.c (syms_of_ntterm): Update.
(w32_use_full_screen_buffer): Remove.
(Vtty_defined_color_alist): Remove declaration.
@@ -1572,7 +2143,7 @@
* gtkutil.c (menubar_map_cb): New function (Bug#7425).
(xg_update_frame_menubar): Connect signal map to menubar_map_cb.
- Use 23 as menubar height if 0. (Bug#7425).
+ Use 23 as menubar height if 0. (Bug#7425).
2010-11-26 Eli Zaretskii <eliz@gnu.org>
@@ -2579,7 +3150,7 @@
is more portable.
* keyboard.c (gobble_input): Move call of xd_read_queued_messages ...
- (kbd_buffer_get_event): ... here. This is needed for cygwin, which
+ (kbd_buffer_get_event): ... here. This is needed for cygwin, which
has not defined SIGIO.
2010-10-08 Chong Yidong <cyd@stupidchicken.com>
diff --git a/src/Makefile.in b/src/Makefile.in
index fda65be708..e1195968f7 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -347,14 +347,14 @@ base_obj = dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \
cm.o term.o terminal.o xfaces.o $(XOBJ) $(GTK_OBJ) $(DBUS_OBJ) \
emacs.o keyboard.o macros.o keymap.o sysdep.o \
buffer.o filelock.o insdel.o marker.o \
- minibuf.o fileio.o dired.o filemode.o \
+ minibuf.o fileio.o dired.o \
cmds.o casetab.o casefiddle.o indent.o search.o regex.o undo.o \
alloc.o data.o doc.o editfns.o callint.o \
eval.o floatfns.o fns.o font.o print.o lread.o \
syntax.o $(UNEXEC_OBJ) bytecode.o \
process.o gnutls.o callproc.o \
region-cache.o sound.o atimer.o \
- doprnt.o intervals.o textprop.o composite.o md5.o xml.o \
+ doprnt.o intervals.o textprop.o composite.o xml.o \
$(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ)
obj = $(base_obj) $(NS_OBJC_OBJ)
diff --git a/src/alloc.c b/src/alloc.c
index 4c29ce0b4e..81a17b5c13 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -2301,7 +2301,6 @@ make_unibyte_string (const char *contents, EMACS_INT length)
register Lisp_Object val;
val = make_uninit_string (length);
memcpy (SDATA (val), contents, length);
- STRING_SET_UNIBYTE (val);
return val;
}
@@ -3943,7 +3942,7 @@ live_buffer_p (struct mem_node *m, void *p)
must not have been killed. */
return (m->type == MEM_TYPE_BUFFER
&& p == m->start
- && !NILP (((struct buffer *) p)->name));
+ && !NILP (((struct buffer *) p)->BUFFER_INTERNAL_FIELD (name)));
}
#endif /* GC_MARK_STACK || defined GC_MALLOC_CHECK */
@@ -4899,8 +4898,6 @@ returns nil, because real GC can't be done. */)
(void)
{
register struct specbinding *bind;
- struct catchtag *catch;
- struct handler *handler;
char stack_top_variable;
register int i;
int message_p;
@@ -4929,11 +4926,11 @@ returns nil, because real GC can't be done. */)
turned off in that buffer. Calling truncate_undo_list on
Qt tends to return NULL, which effectively turns undo back on.
So don't call truncate_undo_list if undo_list is Qt. */
- if (! NILP (nextb->name) && ! EQ (nextb->undo_list, Qt))
+ if (! NILP (nextb->BUFFER_INTERNAL_FIELD (name)) && ! EQ (nextb->BUFFER_INTERNAL_FIELD (undo_list), Qt))
truncate_undo_list (nextb);
/* Shrink buffer gaps, but skip indirect and dead buffers. */
- if (nextb->base_buffer == 0 && !NILP (nextb->name)
+ if (nextb->base_buffer == 0 && !NILP (nextb->BUFFER_INTERNAL_FIELD (name))
&& ! nextb->text->inhibit_shrinking)
{
/* If a buffer's gap size is more than 10% of the buffer
@@ -5030,7 +5027,9 @@ returns nil, because real GC can't be done. */)
mark_object (tail->var[i]);
}
mark_byte_stack ();
-#endif
+ {
+ struct catchtag *catch;
+ struct handler *handler;
for (catch = catchlist; catch; catch = catch->next)
{
@@ -5042,7 +5041,9 @@ returns nil, because real GC can't be done. */)
mark_object (handler->handler);
mark_object (handler->var);
}
+ }
mark_backtrace ();
+#endif
#ifdef HAVE_WINDOW_SYSTEM
mark_fringe_data ();
@@ -5066,10 +5067,10 @@ returns nil, because real GC can't be done. */)
turned off in that buffer. Calling truncate_undo_list on
Qt tends to return NULL, which effectively turns undo back on.
So don't call truncate_undo_list if undo_list is Qt. */
- if (! EQ (nextb->undo_list, Qt))
+ if (! EQ (nextb->BUFFER_INTERNAL_FIELD (undo_list), Qt))
{
Lisp_Object tail, prev;
- tail = nextb->undo_list;
+ tail = nextb->BUFFER_INTERNAL_FIELD (undo_list);
prev = Qnil;
while (CONSP (tail))
{
@@ -5078,7 +5079,7 @@ returns nil, because real GC can't be done. */)
&& !XMARKER (XCAR (XCAR (tail)))->gcmarkbit)
{
if (NILP (prev))
- nextb->undo_list = tail = XCDR (tail);
+ nextb->BUFFER_INTERNAL_FIELD (undo_list) = tail = XCDR (tail);
else
{
tail = XCDR (tail);
@@ -5094,7 +5095,7 @@ returns nil, because real GC can't be done. */)
}
/* Now that we have stripped the elements that need not be in the
undo_list any more, we can finally mark the list. */
- mark_object (nextb->undo_list);
+ mark_object (nextb->BUFFER_INTERNAL_FIELD (undo_list));
nextb = nextb->next;
}
@@ -5652,7 +5653,7 @@ mark_buffer (Lisp_Object buf)
/* buffer-local Lisp variables start at `undo_list',
tho only the ones from `name' on are GC'd normally. */
- for (ptr = &buffer->name;
+ for (ptr = &buffer->BUFFER_INTERNAL_FIELD (name);
(char *)ptr < (char *)buffer + sizeof (struct buffer);
ptr++)
mark_object (*ptr);
diff --git a/src/buffer.c b/src/buffer.c
index 5229f899e6..1b413ccb8b 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 (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 (XBUFFER (buf)->filename)) continue;
- tem = Fstring_equal (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 (XBUFFER (buf)->file_truename)) continue;
- tem = Fstring_equal (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->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->pt_marker = Qnil;
- b->begv_marker = Qnil;
- 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->name = name;
+ BVAR (b, name) = name;
- 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->mark = Fmake_marker ();
+ BVAR (b, mark) = Fmake_marker ();
BUF_MARKERS (b) = NULL;
- 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. */
- 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 (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->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->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->mark = Fmake_marker ();
- b->name = name;
+ BVAR (b, mark) = Fmake_marker ();
+ BVAR (b, name) = name;
/* The multibyte status belongs to the base buffer. */
- b->enable_multibyte_characters = 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->base_buffer->pt_marker))
+ if (NILP (BVAR (b->base_buffer, pt_marker)))
{
- b->base_buffer->pt_marker = Fmake_marker ();
- set_marker_both (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->base_buffer->begv_marker))
+ if (NILP (BVAR (b->base_buffer, begv_marker)))
{
- b->base_buffer->begv_marker = Fmake_marker ();
- set_marker_both (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->base_buffer->zv_marker))
+ if (NILP (BVAR (b->base_buffer, zv_marker)))
{
- b->base_buffer->zv_marker = Fmake_marker ();
- set_marker_both (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->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->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;
+ 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->filename = Qnil;
- b->file_truename = Qnil;
- b->display_count = make_number (0);
- b->backed_up = Qnil;
- 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->filename = Qnil;
- b->file_truename = Qnil;
- b->directory = (current_buffer) ? 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->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->backed_up = Qnil;
+ BVAR (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;
+ 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->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;
+ 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->major_mode = Qfundamental_mode;
- b->keymap = Qnil;
- b->mode_name = QSFundamental;
- 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,19 @@ 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;
-#ifndef DOS_NT
- b->buffer_file_type = Qnil;
-#endif
+ 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;
/* Reset all (or most) per-buffer variables to their defaults. */
if (permanent_too)
- b->local_var_alist = Qnil;
+ BVAR (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 = 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 +752,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);
+ BVAR (b, local_var_alist) = XCDR (tmp);
else
XSETCDR (last, XCDR (tmp));
}
@@ -830,9 +827,9 @@ Return nil if BUFFER has been killed. */)
(register Lisp_Object buffer)
{
if (NILP (buffer))
- return current_buffer->name;
+ return BVAR (current_buffer, name);
CHECK_BUFFER (buffer);
- return XBUFFER (buffer)->name;
+ return BVAR (XBUFFER (buffer), name);
}
DEFUN ("buffer-file-name", Fbuffer_file_name, Sbuffer_file_name, 0, 1, 0,
@@ -841,9 +838,9 @@ No argument or nil as argument means use the current buffer. */)
(register Lisp_Object buffer)
{
if (NILP (buffer))
- return current_buffer->filename;
+ return BVAR (current_buffer, filename);
CHECK_BUFFER (buffer);
- return XBUFFER (buffer)->filename;
+ return BVAR (XBUFFER (buffer), filename);
}
DEFUN ("buffer-base-buffer", Fbuffer_base_buffer, Sbuffer_base_buffer,
@@ -895,7 +892,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, BVAR (buf, local_var_alist));
if (!NILP (result))
{
if (blv->fwd)
@@ -944,7 +941,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 = BVAR (buf, local_var_alist); CONSP (tail); tail = XCDR (tail))
{
Lisp_Object val, elt;
@@ -1043,9 +1040,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 = BVAR (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 (BVAR (current_buffer, filename)))
{
already = SAVE_MODIFF < MODIFF;
if (!already && !NILP (flag))
@@ -1110,9 +1107,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 = BVAR (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 (BVAR (current_buffer, filename)))
{
int already = SAVE_MODIFF < MODIFF;
if (!already && !NILP (flag))
@@ -1199,14 +1196,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 BVAR (current_buffer, name);
if (!NILP (unique))
- newname = Fgenerate_new_buffer_name (newname, current_buffer->name);
+ newname = Fgenerate_new_buffer_name (newname, BVAR (current_buffer, name));
else
error ("Buffer name `%s' is in use", SDATA (newname));
}
- 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 +1211,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 (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 current_buffer->name;
+ return BVAR (current_buffer, name);
}
DEFUN ("other-buffer", Fother_buffer, Sother_buffer, 0, 3, 0,
@@ -1263,9 +1260,9 @@ If BUFFER is omitted or nil, some interesting buffer is returned. */)
continue;
if (NILP (buf))
continue;
- if (NILP (XBUFFER (buf)->name))
+ if (NILP (BVAR (XBUFFER (buf), name)))
continue;
- if (SREF (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 +1310,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 (BVAR (XBUFFER (real_buffer), undo_list), Qt))
+ BVAR (XBUFFER (real_buffer), undo_list) = Qnil;
return Qnil;
}
@@ -1359,16 +1356,16 @@ with SIGHUP. */)
b = XBUFFER (buffer);
/* Avoid trouble for buffer already dead. */
- if (NILP (b->name))
+ if (NILP (BVAR (b, name)))
return Qnil;
/* Query if the buffer is still modified. */
- if (INTERACTIVE && !NILP (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->name, make_number (0)));
+ BVAR (b, name), make_number (0)));
UNGCPRO;
if (NILP (tem))
return Qnil;
@@ -1402,7 +1399,7 @@ with SIGHUP. */)
if (EQ (buffer, XWINDOW (minibuf_window)->buffer))
return Qnil;
- if (NILP (b->name))
+ if (NILP (BVAR (b, name)))
return Qnil;
/* When we kill a base buffer, kill all its indirect buffers.
@@ -1417,7 +1414,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 (BVAR (other, name)))
{
Lisp_Object buffer;
XSETBUFFER (buffer, other);
@@ -1462,7 +1459,7 @@ with SIGHUP. */)
/* Killing buffer processes may run sentinels which may
have called kill-buffer. */
- if (NILP (b->name))
+ if (NILP (BVAR (b, name)))
return Qnil;
clear_charpos_cache (b);
@@ -1476,7 +1473,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 (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 +1482,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 (BVAR (b, auto_save_file_name));
}
if (b->base_buffer)
@@ -1525,7 +1522,7 @@ with SIGHUP. */)
swap_out_buffer_local_variables (b);
reset_buffer_local_variables (b, 1);
- b->name = Qnil;
+ BVAR (b, name) = Qnil;
BLOCK_INPUT;
if (! b->base_buffer)
@@ -1541,9 +1538,9 @@ with SIGHUP. */)
free_region_cache (b->width_run_cache);
b->width_run_cache = 0;
}
- b->width_table = Qnil;
+ BVAR (b, width_table) = Qnil;
UNBLOCK_INPUT;
- b->undo_list = Qnil;
+ BVAR (b, undo_list) = Qnil;
return Qt;
}
@@ -1637,15 +1634,15 @@ the current buffer's major mode. */)
CHECK_BUFFER (buffer);
- if (STRINGP (XBUFFER (buffer)->name)
- && strcmp (SSDATA (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 = buffer_defaults.major_mode;
+ function = BVAR (&buffer_defaults, major_mode);
if (NILP (function)
- && NILP (Fget (current_buffer->major_mode, Qmode_class)))
- function = 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 +1792,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;
+ 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 (old_buf->pt_marker))
+ if (! NILP (BVAR (old_buf, pt_marker)))
{
Lisp_Object obuf;
XSETBUFFER (obuf, old_buf);
- set_marker_both (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 (old_buf->begv_marker))
+ if (! NILP (BVAR (old_buf, begv_marker)))
{
Lisp_Object obuf;
XSETBUFFER (obuf, old_buf);
- set_marker_both (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 (old_buf->zv_marker))
+ if (! NILP (BVAR (old_buf, zv_marker)))
{
Lisp_Object obuf;
XSETBUFFER (obuf, old_buf);
- set_marker_both (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 +1822,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;
+ 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->pt_marker))
+ if (! NILP (BVAR (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 (BVAR (b, pt_marker));
+ BUF_PT_BYTE (b) = marker_byte_position (BVAR (b, pt_marker));
}
- if (! NILP (b->begv_marker))
+ if (! NILP (BVAR (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 (BVAR (b, begv_marker));
+ BUF_BEGV_BYTE (b) = marker_byte_position (BVAR (b, begv_marker));
}
- if (! NILP (b->zv_marker))
+ if (! NILP (BVAR (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 (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 +1847,7 @@ set_buffer_internal_1 (register struct buffer *b)
do
{
- for (tail = 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 +1880,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 (BVAR (old_buf, pt_marker)))
{
Lisp_Object obuf;
XSETBUFFER (obuf, old_buf);
- set_marker_both (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 (old_buf->begv_marker))
+ if (! NILP (BVAR (old_buf, begv_marker)))
{
Lisp_Object obuf;
XSETBUFFER (obuf, old_buf);
- set_marker_both (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 (old_buf->zv_marker))
+ if (! NILP (BVAR (old_buf, zv_marker)))
{
Lisp_Object obuf;
XSETBUFFER (obuf, old_buf);
- set_marker_both (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->pt_marker))
+ if (! NILP (BVAR (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 (BVAR (b, pt_marker));
+ BUF_PT_BYTE (b) = marker_byte_position (BVAR (b, pt_marker));
}
- if (! NILP (b->begv_marker))
+ if (! NILP (BVAR (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 (BVAR (b, begv_marker));
+ BUF_BEGV_BYTE (b) = marker_byte_position (BVAR (b, begv_marker));
}
- if (! NILP (b->zv_marker))
+ if (! NILP (BVAR (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 (BVAR (b, zv_marker));
+ BUF_ZV_BYTE (b) = marker_byte_position (BVAR (b, zv_marker));
}
}
@@ -1938,7 +1935,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 (BVAR (XBUFFER (buffer), name)))
error ("Selecting deleted buffer");
set_buffer_internal (XBUFFER (buffer));
return buffer;
@@ -1949,7 +1946,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 (BVAR (XBUFFER (buffer), name)))
Fset_buffer (buffer);
return Qnil;
}
@@ -1959,7 +1956,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 (BVAR (current_buffer, read_only))
&& NILP (Vinhibit_read_only))
xsignal1 (Qbuffer_read_only, Fcurrent_buffer ());
return Qnil;
@@ -2008,7 +2005,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 (BVAR (XBUFFER (buffer), name)))
{
Lisp_Object aelt, link;
@@ -2041,7 +2038,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 (BVAR (current_buffer, save_length), 0);
return Qnil;
}
@@ -2111,7 +2108,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 (BVAR (other_buffer, name)))
error ("Cannot swap a dead buffer's text");
/* Actually, it probably works just fine.
@@ -2138,6 +2135,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 = 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);
eassert (current_buffer->text == &current_buffer->own_text);
@@ -2165,18 +2168,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);
+ 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++;
@@ -2250,21 +2253,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 = 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 (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. */
- 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);
@@ -2286,7 +2289,7 @@ current buffer is cleared. */)
to calculate the old correspondences. */
set_intervals_multibyte (0);
- current_buffer->enable_multibyte_characters = Qnil;
+ BVAR (current_buffer, enable_multibyte_characters) = Qnil;
Z = Z_BYTE;
BEGV = BEGV_BYTE;
@@ -2424,7 +2427,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;
+ 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;
@@ -2482,7 +2485,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,
+ BVAR (current_buffer, undo_list) = Fcons (list3 (Qapply,
intern ("set-buffer-multibyte"),
NILP (flag) ? Qt : Qnil),
old_undo);
@@ -2498,10 +2501,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 (BVAR (other, name)))
{
- other->enable_multibyte_characters
- = current_buffer->enable_multibyte_characters;
+ BVAR (other, enable_multibyte_characters)
+ = BVAR (current_buffer, enable_multibyte_characters);
other->prevent_redisplay_optimizations_p = 1;
}
@@ -2568,7 +2571,7 @@ swap_out_buffer_local_variables (struct buffer *b)
Lisp_Object oalist, alist, buffer;
XSETBUFFER (buffer, b);
- oalist = b->local_var_alist;
+ oalist = BVAR (b, local_var_alist);
for (alist = oalist; CONSP (alist); alist = XCDR (alist))
{
@@ -3072,7 +3075,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 (BVAR (current_buffer, enable_multibyte_characters)))
nbytes = SCHARS (str);
else if (! STRING_MULTIBYTE (str))
nbytes = count_size_as_multibyte (SDATA (str),
@@ -3084,7 +3087,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 (BVAR (current_buffer, enable_multibyte_characters)))
nbytes = SCHARS (str2);
else if (! STRING_MULTIBYTE (str2))
nbytes = count_size_as_multibyte (SDATA (str2),
@@ -3114,7 +3117,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 (BVAR (current_buffer, enable_multibyte_characters));
overlay_heads.used = overlay_heads.bytes = 0;
overlay_tails.used = overlay_tails.bytes = 0;
@@ -4985,9 +4988,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 (BVAR (&buffer_defaults, name), make_number (0)));
reset_buffer_local_variables (&buffer_defaults, 1);
- eassert (EQ (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. */
@@ -5004,60 +5007,57 @@ 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;
+ 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
- buffer_defaults.selective_display_ellipses = Qt;
+ BVAR (&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;
+ 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 (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;
-
-#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;
+ 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;
+
+ 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
@@ -5069,73 +5069,68 @@ 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 (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 (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 (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 (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;
-#ifdef DOS_NT
- XSETFASTINT (buffer_local_flags.buffer_file_type, idx);
- /* Make this one a permanent local. */
- buffer_permanent_local_flags[idx++] = 1;
+ XSETFASTINT (BVAR (&buffer_local_flags, selective_display_ellipses), idx); ++idx;
#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 (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;
+ 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 (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 (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)
@@ -5149,7 +5144,7 @@ init_buffer_once (void)
QSFundamental = make_pure_c_string ("Fundamental");
Qfundamental_mode = intern_c_string ("fundamental-mode");
- buffer_defaults.major_mode = Qfundamental_mode;
+ BVAR (&buffer_defaults, major_mode) = Qfundamental_mode;
Qmode_class = intern_c_string ("mode-class");
@@ -5192,7 +5187,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 (BVAR (&buffer_defaults, enable_multibyte_characters)))
Fset_buffer_multibyte (Qnil);
pwd = get_current_dir_name ();
@@ -5213,28 +5208,28 @@ init_buffer (void)
pwd[len + 1] = '\0';
}
- current_buffer->directory = make_unibyte_string (pwd, strlen (pwd));
- if (! NILP (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. */
- current_buffer->directory
- = string_to_multibyte (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 (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 (current_buffer->directory)))
- current_buffer->directory
- = concat2 (build_string ("/:"), current_buffer->directory);
+ && strcmp ("/", SSDATA (BVAR (current_buffer, directory))))
+ BVAR (current_buffer, directory)
+ = concat2 (build_string ("/:"), BVAR (current_buffer, directory));
temp = get_minibuffer (0);
- XBUFFER (temp)->directory = current_buffer->directory;
+ BVAR (XBUFFER (temp), directory) = BVAR (current_buffer, directory);
free (pwd);
}
@@ -5410,14 +5405,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.
@@ -5486,13 +5473,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",
- &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", &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.
@@ -5549,7 +5536,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", &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.
@@ -5562,46 +5549,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", &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", &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", &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", &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", &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", &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", &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", &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",
- &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,
@@ -5615,7 +5602,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",
- &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'.
@@ -5633,11 +5620,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",
- &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",
- &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
@@ -5648,7 +5635,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", &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.
@@ -5656,7 +5643,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", &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.
@@ -5668,21 +5655,12 @@ 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", &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", &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", &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
@@ -5690,30 +5668,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", &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", &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",
- &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", &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", &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", &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.
@@ -5723,7 +5701,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", &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
@@ -5734,12 +5712,12 @@ in a file, save the ^M as a newline. */);
#ifndef old
DEFVAR_PER_BUFFER ("selective-display-ellipses",
- &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", &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.
@@ -5748,7 +5726,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", &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.
@@ -5785,39 +5763,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", &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", &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", &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", &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", &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", &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", &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;
@@ -5828,13 +5806,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",
- &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",
- &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
@@ -5859,7 +5837,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",
- &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
@@ -5878,7 +5856,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",
- &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
@@ -5893,7 +5871,7 @@ BITMAP is the corresponding fringe bitmap shown for the logical
cursor type. */);
DEFVAR_PER_BUFFER ("scroll-up-aggressively",
- &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,
@@ -5906,7 +5884,7 @@ window scrolls by a full window height. Meaningful values are
between 0.0 and 1.0, inclusive. */);
DEFVAR_PER_BUFFER ("scroll-down-aggressively",
- &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,
@@ -5961,7 +5939,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", &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.
@@ -6002,10 +5980,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", &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", &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
@@ -6033,23 +6011,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", &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", &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",
- &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",
- &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.
@@ -6060,12 +6038,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",
- &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",
- &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'.
@@ -6100,7 +6078,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", &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:
@@ -6119,7 +6097,7 @@ cursor's appearance is instead controlled by the variable
`cursor-in-non-selected-windows'. */);
DEFVAR_PER_BUFFER ("line-spacing",
- &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'.
@@ -6127,7 +6105,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",
- &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
diff --git a/src/buffer.h b/src/buffer.h
index 31f96040b2..65c7168d60 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -321,7 +321,7 @@ while (0)
/* Return character at byte position POS. */
#define FETCH_CHAR(pos) \
- (!NILP (current_buffer->enable_multibyte_characters) \
+ (!NILP (BVAR (current_buffer, enable_multibyte_characters)) \
? FETCH_MULTIBYTE_CHAR ((pos)) \
: FETCH_BYTE ((pos)))
@@ -346,7 +346,7 @@ extern unsigned char *_fetch_multibyte_char_p;
multibyte. */
#define FETCH_CHAR_AS_MULTIBYTE(pos) \
- (!NILP (current_buffer->enable_multibyte_characters) \
+ (!NILP (BVAR (current_buffer, enable_multibyte_characters)) \
? FETCH_MULTIBYTE_CHAR ((pos)) \
: UNIBYTE_TO_CHAR (FETCH_BYTE ((pos))))
@@ -464,6 +464,15 @@ struct buffer_text
int inhibit_shrinking;
};
+/* Lisp fields in struct buffer are hidden from most code and accessed
+ via the BVAR macro, below. Only select pieces of code, like the GC,
+ are allowed to use BUFFER_INTERNAL_FIELD. */
+#define BUFFER_INTERNAL_FIELD(field) field ## _
+
+/* Most code should use this macro to access Lisp fields in struct
+ buffer. */
+#define BVAR(buf, field) ((buf)->BUFFER_INTERNAL_FIELD (field))
+
/* This is the structure that the buffer Lisp object points to. */
struct buffer
@@ -587,138 +596,132 @@ struct buffer
because local variables have to be right in the struct buffer.
So we copy it around in set_buffer_internal.
This comes before `name' because it is marked in a special way. */
- Lisp_Object undo_list;
+ Lisp_Object BUFFER_INTERNAL_FIELD (undo_list);
/* The name of this buffer. */
- Lisp_Object name;
+ Lisp_Object BUFFER_INTERNAL_FIELD (name);
/* The name of the file visited in this buffer, or nil. */
- Lisp_Object filename;
+ Lisp_Object BUFFER_INTERNAL_FIELD (filename);
/* Dir for expanding relative file names. */
- Lisp_Object directory;
+ Lisp_Object BUFFER_INTERNAL_FIELD (directory);
/* True if this buffer has been backed up (if you write to the
visited file and it hasn't been backed up, then a backup will
be made). */
/* This isn't really used by the C code, so could be deleted. */
- Lisp_Object backed_up;
+ Lisp_Object BUFFER_INTERNAL_FIELD (backed_up);
/* Length of file when last read or saved.
-1 means auto saving turned off because buffer shrank a lot.
-2 means don't turn off auto saving if buffer shrinks.
(That value is used with buffer-swap-text.)
This is not in the struct buffer_text
because it's not used in indirect buffers at all. */
- Lisp_Object save_length;
+ Lisp_Object BUFFER_INTERNAL_FIELD (save_length);
/* File name used for auto-saving this buffer.
This is not in the struct buffer_text
because it's not used in indirect buffers at all. */
- Lisp_Object auto_save_file_name;
+ Lisp_Object BUFFER_INTERNAL_FIELD (auto_save_file_name);
/* Non-nil if buffer read-only. */
- Lisp_Object read_only;
+ Lisp_Object BUFFER_INTERNAL_FIELD (read_only);
/* "The mark". This is a marker which may
point into this buffer or may point nowhere. */
- Lisp_Object mark;
+ Lisp_Object BUFFER_INTERNAL_FIELD (mark);
/* Alist of elements (SYMBOL . VALUE-IN-THIS-BUFFER) for all
per-buffer variables of this buffer. For locally unbound
symbols, just the symbol appears as the element. */
- Lisp_Object local_var_alist;
+ Lisp_Object BUFFER_INTERNAL_FIELD (local_var_alist);
/* Symbol naming major mode (eg, lisp-mode). */
- Lisp_Object major_mode;
+ Lisp_Object BUFFER_INTERNAL_FIELD (major_mode);
/* Pretty name of major mode (eg, "Lisp"). */
- Lisp_Object mode_name;
+ Lisp_Object BUFFER_INTERNAL_FIELD (mode_name);
/* Mode line element that controls format of mode line. */
- Lisp_Object mode_line_format;
+ Lisp_Object BUFFER_INTERNAL_FIELD (mode_line_format);
/* Analogous to mode_line_format for the line displayed at the top
of windows. Nil means don't display that line. */
- Lisp_Object header_line_format;
+ Lisp_Object BUFFER_INTERNAL_FIELD (header_line_format);
/* Keys that are bound local to this buffer. */
- Lisp_Object keymap;
+ Lisp_Object BUFFER_INTERNAL_FIELD (keymap);
/* This buffer's local abbrev table. */
- Lisp_Object abbrev_table;
+ Lisp_Object BUFFER_INTERNAL_FIELD (abbrev_table);
/* This buffer's syntax table. */
- Lisp_Object syntax_table;
+ Lisp_Object BUFFER_INTERNAL_FIELD (syntax_table);
/* This buffer's category table. */
- Lisp_Object category_table;
+ Lisp_Object BUFFER_INTERNAL_FIELD (category_table);
/* Values of several buffer-local variables. */
/* tab-width is buffer-local so that redisplay can find it
in buffers that are not current. */
- Lisp_Object case_fold_search;
- Lisp_Object tab_width;
- Lisp_Object fill_column;
- Lisp_Object left_margin;
+ Lisp_Object BUFFER_INTERNAL_FIELD (case_fold_search);
+ Lisp_Object BUFFER_INTERNAL_FIELD (tab_width);
+ Lisp_Object BUFFER_INTERNAL_FIELD (fill_column);
+ Lisp_Object BUFFER_INTERNAL_FIELD (left_margin);
/* Function to call when insert space past fill column. */
- Lisp_Object auto_fill_function;
- /* nil: text, t: binary.
- This value is meaningful only on certain operating systems. */
- /* Actually, we don't need this flag any more because end-of-line
- is handled correctly according to the buffer-file-coding-system
- of the buffer. Just keeping it for backward compatibility. */
- Lisp_Object buffer_file_type;
+ Lisp_Object BUFFER_INTERNAL_FIELD (auto_fill_function);
/* Case table for case-conversion in this buffer.
This char-table maps each char into its lower-case version. */
- Lisp_Object downcase_table;
+ Lisp_Object BUFFER_INTERNAL_FIELD (downcase_table);
/* Char-table mapping each char to its upper-case version. */
- Lisp_Object upcase_table;
+ Lisp_Object BUFFER_INTERNAL_FIELD (upcase_table);
/* Char-table for conversion for case-folding search. */
- Lisp_Object case_canon_table;
+ Lisp_Object BUFFER_INTERNAL_FIELD (case_canon_table);
/* Char-table of equivalences for case-folding search. */
- Lisp_Object case_eqv_table;
+ Lisp_Object BUFFER_INTERNAL_FIELD (case_eqv_table);
/* Non-nil means do not display continuation lines. */
- Lisp_Object truncate_lines;
+ Lisp_Object BUFFER_INTERNAL_FIELD (truncate_lines);
/* Non-nil means to use word wrapping when displaying continuation lines. */
- Lisp_Object word_wrap;
+ Lisp_Object BUFFER_INTERNAL_FIELD (word_wrap);
/* Non-nil means display ctl chars with uparrow. */
- Lisp_Object ctl_arrow;
+ Lisp_Object BUFFER_INTERNAL_FIELD (ctl_arrow);
/* Non-nil means reorder bidirectional text for display in the
visual order. */
- Lisp_Object bidi_display_reordering;
+ Lisp_Object BUFFER_INTERNAL_FIELD (bidi_display_reordering);
/* If non-nil, specifies which direction of text to force in all the
paragraphs of the buffer. Nil means determine paragraph
direction dynamically for each paragraph. */
- Lisp_Object bidi_paragraph_direction;
+ Lisp_Object BUFFER_INTERNAL_FIELD (bidi_paragraph_direction);
/* Non-nil means do selective display;
see doc string in syms_of_buffer (buffer.c) for details. */
- Lisp_Object selective_display;
+ Lisp_Object BUFFER_INTERNAL_FIELD (selective_display);
#ifndef old
/* Non-nil means show ... at end of line followed by invisible lines. */
- Lisp_Object selective_display_ellipses;
+ Lisp_Object BUFFER_INTERNAL_FIELD (selective_display_ellipses);
#endif
/* Alist of (FUNCTION . STRING) for each minor mode enabled in buffer. */
- Lisp_Object minor_modes;
+ Lisp_Object BUFFER_INTERNAL_FIELD (minor_modes);
/* t if "self-insertion" should overwrite; `binary' if it should also
overwrite newlines and tabs - for editing executables and the like. */
- Lisp_Object overwrite_mode;
+ Lisp_Object BUFFER_INTERNAL_FIELD (overwrite_mode);
/* non-nil means abbrev mode is on. Expand abbrevs automatically. */
- Lisp_Object abbrev_mode;
+ Lisp_Object BUFFER_INTERNAL_FIELD (abbrev_mode);
/* Display table to use for text in this buffer. */
- Lisp_Object display_table;
+ Lisp_Object BUFFER_INTERNAL_FIELD (display_table);
/* t means the mark and region are currently active. */
- Lisp_Object mark_active;
+ Lisp_Object BUFFER_INTERNAL_FIELD (mark_active);
/* Non-nil means the buffer contents are regarded as multi-byte
form of characters, not a binary code. */
- Lisp_Object enable_multibyte_characters;
+ Lisp_Object BUFFER_INTERNAL_FIELD (enable_multibyte_characters);
/* Coding system to be used for encoding the buffer contents on
saving. */
- Lisp_Object buffer_file_coding_system;
+ Lisp_Object BUFFER_INTERNAL_FIELD (buffer_file_coding_system);
/* List of symbols naming the file format used for visited file. */
- Lisp_Object file_format;
+ Lisp_Object BUFFER_INTERNAL_FIELD (file_format);
/* List of symbols naming the file format used for auto-save file. */
- Lisp_Object auto_save_file_format;
+ Lisp_Object BUFFER_INTERNAL_FIELD (auto_save_file_format);
/* True if the newline position cache and width run cache are
enabled. See search.c and indent.c. */
- Lisp_Object cache_long_line_scans;
+ Lisp_Object BUFFER_INTERNAL_FIELD (cache_long_line_scans);
/* If the width run cache is enabled, this table contains the
character widths width_run_cache (see above) assumes. When we
@@ -726,99 +729,99 @@ struct buffer
current display table to see whether the display table has
affected the widths of any characters. If it has, we
invalidate the width run cache, and re-initialize width_table. */
- Lisp_Object width_table;
+ Lisp_Object BUFFER_INTERNAL_FIELD (width_table);
/* In an indirect buffer, or a buffer that is the base of an
indirect buffer, this holds a marker that records
PT for this buffer when the buffer is not current. */
- Lisp_Object pt_marker;
+ Lisp_Object BUFFER_INTERNAL_FIELD (pt_marker);
/* In an indirect buffer, or a buffer that is the base of an
indirect buffer, this holds a marker that records
BEGV for this buffer when the buffer is not current. */
- Lisp_Object begv_marker;
+ Lisp_Object BUFFER_INTERNAL_FIELD (begv_marker);
/* In an indirect buffer, or a buffer that is the base of an
indirect buffer, this holds a marker that records
ZV for this buffer when the buffer is not current. */
- Lisp_Object zv_marker;
+ Lisp_Object BUFFER_INTERNAL_FIELD (zv_marker);
/* This holds the point value before the last scroll operation.
Explicitly setting point sets this to nil. */
- Lisp_Object point_before_scroll;
+ Lisp_Object BUFFER_INTERNAL_FIELD (point_before_scroll);
/* Truename of the visited file, or nil. */
- Lisp_Object file_truename;
+ Lisp_Object BUFFER_INTERNAL_FIELD (file_truename);
/* Invisibility spec of this buffer.
t => any non-nil `invisible' property means invisible.
A list => `invisible' property means invisible
if it is memq in that list. */
- Lisp_Object invisibility_spec;
+ Lisp_Object BUFFER_INTERNAL_FIELD (invisibility_spec);
/* This is the last window that was selected with this buffer in it,
or nil if that window no longer displays this buffer. */
- Lisp_Object last_selected_window;
+ Lisp_Object BUFFER_INTERNAL_FIELD (last_selected_window);
/* Incremented each time the buffer is displayed in a window. */
- Lisp_Object display_count;
+ Lisp_Object BUFFER_INTERNAL_FIELD (display_count);
/* Widths of left and right marginal areas for windows displaying
this buffer. */
- Lisp_Object left_margin_cols, right_margin_cols;
+ Lisp_Object BUFFER_INTERNAL_FIELD (left_margin_cols), BUFFER_INTERNAL_FIELD (right_margin_cols);
/* Widths of left and right fringe areas for windows displaying
this buffer. */
- Lisp_Object left_fringe_width, right_fringe_width;
+ Lisp_Object BUFFER_INTERNAL_FIELD (left_fringe_width), BUFFER_INTERNAL_FIELD (right_fringe_width);
/* Non-nil means fringes are drawn outside display margins;
othersize draw them between margin areas and text. */
- Lisp_Object fringes_outside_margins;
+ Lisp_Object BUFFER_INTERNAL_FIELD (fringes_outside_margins);
/* Width and type of scroll bar areas for windows displaying
this buffer. */
- Lisp_Object scroll_bar_width, vertical_scroll_bar_type;
+ Lisp_Object BUFFER_INTERNAL_FIELD (scroll_bar_width), BUFFER_INTERNAL_FIELD (vertical_scroll_bar_type);
/* Non-nil means indicate lines not displaying text (in a style
like vi). */
- Lisp_Object indicate_empty_lines;
+ Lisp_Object BUFFER_INTERNAL_FIELD (indicate_empty_lines);
/* Non-nil means indicate buffer boundaries and scrolling. */
- Lisp_Object indicate_buffer_boundaries;
+ Lisp_Object BUFFER_INTERNAL_FIELD (indicate_buffer_boundaries);
/* Logical to physical fringe bitmap mappings. */
- Lisp_Object fringe_indicator_alist;
+ Lisp_Object BUFFER_INTERNAL_FIELD (fringe_indicator_alist);
/* Logical to physical cursor bitmap mappings. */
- Lisp_Object fringe_cursor_alist;
+ Lisp_Object BUFFER_INTERNAL_FIELD (fringe_cursor_alist);
/* Time stamp updated each time this buffer is displayed in a window. */
- Lisp_Object display_time;
+ Lisp_Object BUFFER_INTERNAL_FIELD (display_time);
/* If scrolling the display because point is below the bottom of a
window showing this buffer, try to choose a window start so
that point ends up this number of lines from the top of the
window. Nil means that scrolling method isn't used. */
- Lisp_Object scroll_up_aggressively;
+ Lisp_Object BUFFER_INTERNAL_FIELD (scroll_up_aggressively);
/* If scrolling the display because point is above the top of a
window showing this buffer, try to choose a window start so
that point ends up this number of lines from the bottom of the
window. Nil means that scrolling method isn't used. */
- Lisp_Object scroll_down_aggressively;
+ Lisp_Object BUFFER_INTERNAL_FIELD (scroll_down_aggressively);
/* Desired cursor type in this buffer. See the doc string of
per-buffer variable `cursor-type'. */
- Lisp_Object cursor_type;
+ Lisp_Object BUFFER_INTERNAL_FIELD (cursor_type);
/* An integer > 0 means put that number of pixels below text lines
in the display of this buffer. */
- Lisp_Object extra_line_spacing;
+ Lisp_Object BUFFER_INTERNAL_FIELD (extra_line_spacing);
/* *Cursor type to display in non-selected windows.
t means to use hollow box cursor.
See `cursor-type' for other values. */
- Lisp_Object cursor_in_non_selected_windows;
+ Lisp_Object BUFFER_INTERNAL_FIELD (cursor_in_non_selected_windows);
};
@@ -942,7 +945,7 @@ extern int last_per_buffer_idx;
from the start of a buffer structure. */
#define PER_BUFFER_VAR_OFFSET(VAR) \
- offsetof (struct buffer, VAR)
+ offsetof (struct buffer, BUFFER_INTERNAL_FIELD (VAR))
/* Return the index of buffer-local variable VAR. Each per-buffer
variable has an index > 0 associated with it, except when it always
diff --git a/src/bytecode.c b/src/bytecode.c
index b2e9e3c5b5..639c543dbf 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -51,7 +51,7 @@ by Hallvard:
*
* define BYTE_CODE_METER to enable generation of a byte-op usage histogram.
*/
-#define BYTE_CODE_SAFE
+/* #define BYTE_CODE_SAFE 1 */
/* #define BYTE_CODE_METER */
@@ -236,6 +236,8 @@ extern Lisp_Object Qand_optional, Qand_rest;
#define Bconstant 0300
#define CONSTANTLIM 0100
+/* Whether to maintain a `top' and `bottom' field in the stack frame. */
+#define BYTE_MAINTAIN_TOP (BYTE_CODE_SAFE || BYTE_MARK_STACK)
/* Structure describing a value stack used during byte-code execution
in Fbyte_code. */
@@ -248,7 +250,9 @@ struct byte_stack
/* Top and bottom of stack. The bottom points to an area of memory
allocated with alloca in Fbyte_code. */
+#if BYTE_MAINTAIN_TOP
Lisp_Object *top, *bottom;
+#endif
/* The string containing the byte-code, and its current address.
Storing this here protects it from GC because mark_byte_stack
@@ -275,6 +279,7 @@ struct byte_stack *byte_stack_list;
/* Mark objects on byte_stack_list. Called during GC. */
+#if BYTE_MARK_STACK
void
mark_byte_stack (void)
{
@@ -299,7 +304,7 @@ mark_byte_stack (void)
mark_object (stack->constants);
}
}
-
+#endif
/* Unmark objects in the stacks on byte_stack_list. Relocate program
counters. Called when GC has completed. */
@@ -353,8 +358,13 @@ unmark_byte_stack (void)
/* Actions that must be performed before and after calling a function
that might GC. */
+#if !BYTE_MAINTAIN_TOP
+#define BEFORE_POTENTIAL_GC() ((void)0)
+#define AFTER_POTENTIAL_GC() ((void)0)
+#else
#define BEFORE_POTENTIAL_GC() stack.top = top
#define AFTER_POTENTIAL_GC() stack.top = NULL
+#endif
/* Garbage collect if we have consed enough since the last time.
We do this at every branch, to avoid loops that never GC. */
@@ -478,10 +488,13 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
stack.byte_string = bytestr;
stack.pc = stack.byte_string_start = SDATA (bytestr);
stack.constants = vector;
- stack.bottom = (Lisp_Object *) alloca (XFASTINT (maxdepth)
+ top = (Lisp_Object *) alloca (XFASTINT (maxdepth)
* sizeof (Lisp_Object));
- top = stack.bottom - 1;
+#if BYTE_MAINTAIN_TOP
+ stack.bottom = top;
stack.top = NULL;
+#endif
+ top -= 1;
stack.next = byte_stack_list;
byte_stack_list = &stack;
@@ -1468,7 +1481,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
CHECK_CHARACTER (TOP);
AFTER_POTENTIAL_GC ();
c = XFASTINT (TOP);
- if (NILP (current_buffer->enable_multibyte_characters))
+ if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
MAKE_CHAR_MULTIBYTE (c);
XSETFASTINT (TOP, syntax_code_spec[(int) SYNTAX (c)]);
}
diff --git a/src/callint.c b/src/callint.c
index 36d295d750..253f2b9dd0 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -149,12 +149,12 @@ static void
check_mark (int for_region)
{
Lisp_Object tem;
- tem = Fmarker_buffer (current_buffer->mark);
+ tem = Fmarker_buffer (BVAR (current_buffer, mark));
if (NILP (tem) || (XBUFFER (tem) != current_buffer))
error (for_region ? "The mark is not set now, so there is no region"
: "The mark is not set now");
if (!NILP (Vtransient_mark_mode) && NILP (Vmark_even_if_inactive)
- && NILP (current_buffer->mark_active))
+ && NILP (BVAR (current_buffer, mark_active)))
xsignal0 (Qmark_inactive);
}
@@ -280,7 +280,7 @@ invoke it. If KEYS is omitted or nil, the return value of
save_this_command = Vthis_command;
save_this_original_command = Vthis_original_command;
save_real_this_command = real_this_command;
- save_last_command = current_kboard->Vlast_command;
+ save_last_command = KVAR (current_kboard, Vlast_command);
if (NILP (keys))
keys = this_command_keys, key_count = this_command_key_count;
@@ -363,7 +363,7 @@ invoke it. If KEYS is omitted or nil, the return value of
Vthis_command = save_this_command;
Vthis_original_command = save_this_original_command;
real_this_command= save_real_this_command;
- current_kboard->Vlast_command = save_last_command;
+ KVAR (current_kboard, Vlast_command) = save_last_command;
temporarily_switch_to_single_kboard (NULL);
return unbind_to (speccount, apply1 (function, specs));
@@ -385,7 +385,7 @@ invoke it. If KEYS is omitted or nil, the return value of
else if (*string == '*')
{
string++;
- if (!NILP (current_buffer->read_only))
+ if (!NILP (BVAR (current_buffer, read_only)))
{
if (!NILP (record_flag))
{
@@ -543,7 +543,7 @@ invoke it. If KEYS is omitted or nil, the return value of
case 'D': /* Directory name. */
args[i] = Fread_file_name (callint_message, Qnil,
- current_buffer->directory, Qlambda, Qnil,
+ BVAR (current_buffer, directory), Qlambda, Qnil,
Qfile_directory_p);
break;
@@ -661,7 +661,7 @@ invoke it. If KEYS is omitted or nil, the return value of
case 'm': /* Value of mark. Does not do I/O. */
check_mark (0);
/* visargs[i] = Qnil; */
- args[i] = current_buffer->mark;
+ args[i] = BVAR (current_buffer, mark);
varies[i] = 2;
break;
@@ -717,11 +717,11 @@ invoke it. If KEYS is omitted or nil, the return value of
check_mark (1);
set_marker_both (point_marker, Qnil, PT, PT_BYTE);
/* visargs[i+1] = Qnil; */
- foo = marker_position (current_buffer->mark);
+ foo = marker_position (BVAR (current_buffer, mark));
/* visargs[i] = Qnil; */
- args[i] = PT < foo ? point_marker : current_buffer->mark;
+ args[i] = PT < foo ? point_marker : BVAR (current_buffer, mark);
varies[i] = 3;
- args[++i] = PT > foo ? point_marker : current_buffer->mark;
+ args[++i] = PT > foo ? point_marker : BVAR (current_buffer, mark);
varies[i] = 4;
break;
@@ -832,7 +832,7 @@ invoke it. If KEYS is omitted or nil, the return value of
Vthis_command = save_this_command;
Vthis_original_command = save_this_original_command;
real_this_command= save_real_this_command;
- current_kboard->Vlast_command = save_last_command;
+ KVAR (current_kboard, Vlast_command) = save_last_command;
{
Lisp_Object val;
diff --git a/src/callproc.c b/src/callproc.c
index 925eefb4b0..c53a92bbaf 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -74,10 +74,6 @@ extern char **environ;
/* Pattern used by call-process-region to make temp files. */
static Lisp_Object Vtemp_file_name_pattern;
-#ifdef DOS_NT
-Lisp_Object Qbuffer_file_type;
-#endif /* DOS_NT */
-
/* True if we are about to fork off a synchronous process or if we
are waiting for it. */
int synch_process_alive;
@@ -265,7 +261,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
if (nargs >= 2 && ! NILP (args[1]))
{
- infile = Fexpand_file_name (args[1], current_buffer->directory);
+ infile = Fexpand_file_name (args[1], BVAR (current_buffer, directory));
CHECK_STRING (infile);
}
else
@@ -322,7 +318,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
{
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
- current_dir = current_buffer->directory;
+ current_dir = BVAR (current_buffer, directory);
GCPRO4 (infile, buffer, current_dir, error_file);
@@ -336,7 +332,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
if (NILP (Ffile_accessible_directory_p (current_dir)))
report_file_error ("Setting current directory",
- Fcons (current_buffer->directory, Qnil));
+ Fcons (BVAR (current_buffer, directory), Qnil));
if (STRING_MULTIBYTE (infile))
infile = ENCODE_FILE (infile);
@@ -445,6 +441,11 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
register char **save_environ = environ;
register int fd1 = fd[1];
int fd_error = fd1;
+#ifdef HAVE_WORKING_VFORK
+ sigset_t procmask;
+ sigset_t blocked;
+ struct sigaction sigpipe_action;
+#endif
#if 0 /* Some systems don't have sigblock. */
mask = sigblock (sigmask (SIGCHLD));
@@ -525,6 +526,18 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
pid = child_setup (filefd, fd1, fd_error, (char **) new_argv,
0, current_dir);
#else /* not WINDOWSNT */
+
+#ifdef HAVE_WORKING_VFORK
+ /* On many hosts (e.g. Solaris 2.4), if a vforked child calls `signal',
+ this sets the parent's signal handlers as well as the child's.
+ So delay all interrupts whose handlers the child might munge,
+ and record the current handlers so they can be restored later. */
+ sigemptyset (&blocked);
+ sigaddset (&blocked, SIGPIPE);
+ sigaction (SIGPIPE, 0, &sigpipe_action);
+ sigprocmask (SIG_BLOCK, &blocked, &procmask);
+#endif
+
BLOCK_INPUT;
pid = vfork ();
@@ -541,11 +554,26 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
#else
setpgrp (pid, pid);
#endif /* USG */
+
+ /* GConf causes us to ignore SIGPIPE, make sure it is restored
+ in the child. */
+ //signal (SIGPIPE, SIG_DFL);
+#ifdef HAVE_WORKING_VFORK
+ sigprocmask (SIG_SETMASK, &procmask, 0);
+#endif
+
child_setup (filefd, fd1, fd_error, (char **) new_argv,
0, current_dir);
}
UNBLOCK_INPUT;
+
+#ifdef HAVE_WORKING_VFORK
+ /* Restore the signal state. */
+ sigaction (SIGPIPE, &sigpipe_action, 0);
+ sigprocmask (SIG_SETMASK, &procmask, 0);
+#endif
+
#endif /* not WINDOWSNT */
/* The MSDOS case did this already. */
@@ -631,7 +659,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
/* In unibyte mode, character code conversion should not take
place but EOL conversion should. So, setup raw-text or one
of the subsidiary according to the information just setup. */
- if (NILP (current_buffer->enable_multibyte_characters)
+ if (NILP (BVAR (current_buffer, enable_multibyte_characters))
&& !NILP (val))
val = raw_text_coding_system (val);
setup_coding_system (val, &process_coding);
@@ -681,7 +709,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
if (!NILP (buffer))
{
- if (NILP (current_buffer->enable_multibyte_characters)
+ if (NILP (BVAR (current_buffer, enable_multibyte_characters))
&& ! CODING_MAY_REQUIRE_DECODING (&process_coding))
insert_1_both (buf, nread, nread, 0, 1, 0);
else
@@ -894,7 +922,7 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r
/* Decide coding-system of the contents of the temporary file. */
if (!NILP (Vcoding_system_for_write))
val = Vcoding_system_for_write;
- else if (NILP (current_buffer->enable_multibyte_characters))
+ else if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
val = Qraw_text;
else
{
@@ -1503,11 +1531,6 @@ set_initial_environment (void)
void
syms_of_callproc (void)
{
-#ifdef DOS_NT
- Qbuffer_file_type = intern_c_string ("buffer-file-type");
- staticpro (&Qbuffer_file_type);
-#endif /* DOS_NT */
-
#ifndef DOS_NT
Vtemp_file_name_pattern = build_string ("emacsXXXXXX");
#elif defined (WINDOWSNT)
diff --git a/src/casefiddle.c b/src/casefiddle.c
index 62d261278a..26fa0db2d7 100644
--- a/src/casefiddle.c
+++ b/src/casefiddle.c
@@ -39,15 +39,15 @@ casify_object (enum case_action flag, Lisp_Object obj)
register int inword = flag == CASE_DOWN;
/* If the case table is flagged as modified, rescan it. */
- if (NILP (XCHAR_TABLE (current_buffer->downcase_table)->extras[1]))
- Fset_case_table (current_buffer->downcase_table);
+ if (NILP (XCHAR_TABLE (BVAR (current_buffer, downcase_table))->extras[1]))
+ Fset_case_table (BVAR (current_buffer, downcase_table));
if (INTEGERP (obj))
{
int flagbits = (CHAR_ALT | CHAR_SUPER | CHAR_HYPER
| CHAR_SHIFT | CHAR_CTL | CHAR_META);
int flags = XINT (obj) & flagbits;
- int multibyte = ! NILP (current_buffer->enable_multibyte_characters);
+ int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
/* If the character has higher bits set
above the flags, return it unchanged.
@@ -198,7 +198,7 @@ casify_region (enum case_action flag, Lisp_Object b, Lisp_Object e)
{
register int c;
register int inword = flag == CASE_DOWN;
- register int multibyte = !NILP (current_buffer->enable_multibyte_characters);
+ register int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
EMACS_INT start, end;
EMACS_INT start_byte, end_byte;
EMACS_INT first = -1, last; /* Position of first and last changes. */
@@ -210,8 +210,8 @@ casify_region (enum case_action flag, Lisp_Object b, Lisp_Object e)
return;
/* If the case table is flagged as modified, rescan it. */
- if (NILP (XCHAR_TABLE (current_buffer->downcase_table)->extras[1]))
- Fset_case_table (current_buffer->downcase_table);
+ if (NILP (XCHAR_TABLE (BVAR (current_buffer, downcase_table))->extras[1]))
+ Fset_case_table (BVAR (current_buffer, downcase_table));
validate_region (&b, &e);
start = XFASTINT (b);
diff --git a/src/casetab.c b/src/casetab.c
index 0db9d63f7a..5207e5315a 100644
--- a/src/casetab.c
+++ b/src/casetab.c
@@ -71,7 +71,7 @@ DEFUN ("current-case-table", Fcurrent_case_table, Scurrent_case_table, 0, 0, 0,
doc: /* Return the case table of the current buffer. */)
(void)
{
- return current_buffer->downcase_table;
+ return BVAR (current_buffer, downcase_table);
}
DEFUN ("standard-case-table", Fstandard_case_table, Sstandard_case_table, 0, 0, 0,
@@ -160,10 +160,10 @@ set_case_table (Lisp_Object table, int standard)
}
else
{
- current_buffer->downcase_table = table;
- current_buffer->upcase_table = up;
- current_buffer->case_canon_table = canon;
- current_buffer->case_eqv_table = eqv;
+ BVAR (current_buffer, downcase_table) = table;
+ BVAR (current_buffer, upcase_table) = up;
+ BVAR (current_buffer, case_canon_table) = canon;
+ BVAR (current_buffer, case_eqv_table) = eqv;
}
return table;
diff --git a/src/category.c b/src/category.c
index 06046959b6..bcd73d3a48 100644
--- a/src/category.c
+++ b/src/category.c
@@ -190,7 +190,7 @@ Lisp_Object
check_category_table (Lisp_Object table)
{
if (NILP (table))
- return current_buffer->category_table;
+ return BVAR (current_buffer, category_table);
CHECK_TYPE (!NILP (Fcategory_table_p (table)), Qcategory_table_p, table);
return table;
}
@@ -200,7 +200,7 @@ DEFUN ("category-table", Fcategory_table, Scategory_table, 0, 0, 0,
This is the one specified by the current buffer. */)
(void)
{
- return current_buffer->category_table;
+ return BVAR (current_buffer, category_table);
}
DEFUN ("standard-category-table", Fstandard_category_table,
@@ -281,7 +281,7 @@ Return TABLE. */)
{
int idx;
table = check_category_table (table);
- current_buffer->category_table = table;
+ BVAR (current_buffer, category_table) = table;
/* Indicate that this buffer now has a specified category table. */
idx = PER_BUFFER_VAR_IDX (category_table);
SET_PER_BUFFER_VALUE_P (current_buffer, idx, 1);
@@ -292,7 +292,7 @@ Return TABLE. */)
Lisp_Object
char_category_set (int c)
{
- return CHAR_TABLE_REF (current_buffer->category_table, c);
+ return CHAR_TABLE_REF (BVAR (current_buffer, category_table), c);
}
DEFUN ("char-category-set", Fchar_category_set, Schar_category_set, 1, 1, 0,
diff --git a/src/category.h b/src/category.h
index 561b06b6f6..b279f3d9c5 100644
--- a/src/category.h
+++ b/src/category.h
@@ -91,7 +91,7 @@ extern Lisp_Object _temp_category_set;
/* The standard category table is stored where it will automatically
be used in all new buffers. */
-#define Vstandard_category_table buffer_defaults.category_table
+#define Vstandard_category_table BVAR (&buffer_defaults, category_table)
/* Return the category set of character C in the current category table. */
#define CATEGORY_SET(c) char_category_set (c)
diff --git a/src/character.c b/src/character.c
index 397481e5b3..f12c4f28d3 100644
--- a/src/character.c
+++ b/src/character.c
@@ -521,7 +521,7 @@ chars_in_text (const unsigned char *ptr, EMACS_INT nbytes)
{
/* current_buffer is null at early stages of Emacs initialization. */
if (current_buffer == 0
- || NILP (current_buffer->enable_multibyte_characters))
+ || NILP (BVAR (current_buffer, enable_multibyte_characters)))
return nbytes;
return multibyte_chars_in_text (ptr, nbytes);
@@ -987,7 +987,7 @@ character is not ASCII nor 8-bit character, an error is signalled. */)
pos = XFASTINT (position);
p = CHAR_POS_ADDR (pos);
}
- if (NILP (current_buffer->enable_multibyte_characters))
+ if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
return make_number (*p);
}
else
diff --git a/src/character.h b/src/character.h
index f2ccb28bb3..fb29ced66b 100644
--- a/src/character.h
+++ b/src/character.h
@@ -417,7 +417,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
do \
{ \
CHARIDX++; \
- if (!NILP (current_buffer->enable_multibyte_characters)) \
+ if (!NILP (BVAR (current_buffer, enable_multibyte_characters))) \
{ \
unsigned char *ptr = BYTE_POS_ADDR (BYTEIDX); \
int len; \
@@ -484,7 +484,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
do \
{ \
(charpos)++; \
- if (NILP (current_buffer->enable_multibyte_characters)) \
+ if (NILP (BVAR (current_buffer, enable_multibyte_characters))) \
(bytepos)++; \
else \
INC_POS ((bytepos)); \
@@ -498,7 +498,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
do \
{ \
(charpos)--; \
- if (NILP (current_buffer->enable_multibyte_characters)) \
+ if (NILP (BVAR (current_buffer, enable_multibyte_characters))) \
(bytepos)--; \
else \
DEC_POS ((bytepos)); \
@@ -561,11 +561,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#define ASCII_CHAR_WIDTH(c) \
(c < 0x20 \
? (c == '\t' \
- ? XFASTINT (current_buffer->tab_width) \
- : (c == '\n' ? 0 : (NILP (current_buffer->ctl_arrow) ? 4 : 2))) \
+ ? XFASTINT (BVAR (current_buffer, tab_width)) \
+ : (c == '\n' ? 0 : (NILP (BVAR (current_buffer, ctl_arrow)) ? 4 : 2))) \
: (c < 0x7f \
? 1 \
- : ((NILP (current_buffer->ctl_arrow) ? 4 : 2))))
+ : ((NILP (BVAR (current_buffer, ctl_arrow)) ? 4 : 2))))
/* Return the width of character C. The width is measured by how many
columns C will occupy on the screen when displayed in the current
diff --git a/src/charset.c b/src/charset.c
index 229f2c2cda..3624e740ac 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1554,7 +1554,7 @@ only `ascii', `eight-bit-control', and `eight-bit-graphic'. */)
EMACS_INT from, from_byte, to, stop, stop_byte;
int i;
Lisp_Object val;
- int multibyte = ! NILP (current_buffer->enable_multibyte_characters);
+ int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
validate_region (&beg, &end);
from = XFASTINT (beg);
diff --git a/src/cmds.c b/src/cmds.c
index 93b7e2b765..336bf1154f 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -277,7 +277,7 @@ After insertion, the value of `auto-fill-function' is called if the
int remove_boundary = 1;
CHECK_NATNUM (n);
- if (!EQ (Vthis_command, current_kboard->Vlast_command))
+ if (!EQ (Vthis_command, KVAR (current_kboard, Vlast_command)))
nonundocount = 0;
if (NILP (Vexecuting_kbd_macro)
@@ -292,10 +292,10 @@ After insertion, the value of `auto-fill-function' is called if the
}
if (remove_boundary
- && CONSP (current_buffer->undo_list)
- && NILP (XCAR (current_buffer->undo_list)))
+ && CONSP (BVAR (current_buffer, undo_list))
+ && NILP (XCAR (BVAR (current_buffer, undo_list))))
/* Remove the undo_boundary that was just pushed. */
- current_buffer->undo_list = XCDR (current_buffer->undo_list);
+ BVAR (current_buffer, undo_list) = XCDR (BVAR (current_buffer, undo_list));
/* Barf if the key that invoked this was not a character. */
if (!CHARACTERP (last_command_event))
@@ -335,12 +335,12 @@ internal_self_insert (int c, EMACS_INT n)
EMACS_INT chars_to_delete = 0;
EMACS_INT spaces_to_insert = 0;
- overwrite = current_buffer->overwrite_mode;
+ overwrite = BVAR (current_buffer, overwrite_mode);
if (!NILP (Vbefore_change_functions) || !NILP (Vafter_change_functions))
hairy = 1;
/* At first, get multi-byte form of C in STR. */
- if (!NILP (current_buffer->enable_multibyte_characters))
+ if (!NILP (BVAR (current_buffer, enable_multibyte_characters)))
{
len = CHAR_STRING (c, str);
if (len == 1)
@@ -416,11 +416,11 @@ internal_self_insert (int c, EMACS_INT n)
synt = SYNTAX (c);
- if (!NILP (current_buffer->abbrev_mode)
+ if (!NILP (BVAR (current_buffer, abbrev_mode))
&& synt != Sword
- && NILP (current_buffer->read_only)
+ && NILP (BVAR (current_buffer, read_only))
&& PT > BEGV
- && (SYNTAX (!NILP (current_buffer->enable_multibyte_characters)
+ && (SYNTAX (!NILP (BVAR (current_buffer, enable_multibyte_characters))
? XFASTINT (Fprevious_char ())
: UNIBYTE_TO_CHAR (XFASTINT (Fprevious_char ())))
== Sword))
@@ -448,7 +448,7 @@ internal_self_insert (int c, EMACS_INT n)
if (chars_to_delete)
{
- int mc = ((NILP (current_buffer->enable_multibyte_characters)
+ int mc = ((NILP (BVAR (current_buffer, enable_multibyte_characters))
&& SINGLE_BYTE_CHAR_P (c))
? UNIBYTE_TO_CHAR (c) : c);
Lisp_Object string = Fmake_string (make_number (n), make_number (mc));
@@ -479,7 +479,7 @@ internal_self_insert (int c, EMACS_INT n)
if ((CHAR_TABLE_P (Vauto_fill_chars)
? !NILP (CHAR_TABLE_REF (Vauto_fill_chars, c))
: (c == ' ' || c == '\n'))
- && !NILP (current_buffer->auto_fill_function))
+ && !NILP (BVAR (current_buffer, auto_fill_function)))
{
Lisp_Object tem;
@@ -488,7 +488,7 @@ internal_self_insert (int c, EMACS_INT n)
that. Must have the newline in place already so filling and
justification, if any, know where the end is going to be. */
SET_PT_BOTH (PT - 1, PT_BYTE - 1);
- tem = call0 (current_buffer->auto_fill_function);
+ tem = call0 (BVAR (current_buffer, auto_fill_function));
/* Test PT < ZV in case the auto-fill-function is strange. */
if (c == '\n' && PT < ZV)
SET_PT_BOTH (PT + 1, PT_BYTE + 1);
diff --git a/src/coding.c b/src/coding.c
index a9f16de56f..f6310369ad 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -7038,8 +7038,8 @@ decode_coding (struct coding_system *coding)
set_buffer_internal (XBUFFER (coding->dst_object));
if (GPT != PT)
move_gap_both (PT, PT_BYTE);
- undo_list = current_buffer->undo_list;
- current_buffer->undo_list = Qt;
+ undo_list = BVAR (current_buffer, undo_list);
+ BVAR (current_buffer, undo_list) = Qt;
}
coding->consumed = coding->consumed_char = 0;
@@ -7136,7 +7136,7 @@ decode_coding (struct coding_system *coding)
decode_eol (coding);
if (BUFFERP (coding->dst_object))
{
- current_buffer->undo_list = undo_list;
+ BVAR (current_buffer, undo_list) = undo_list;
record_insert (coding->dst_pos, coding->produced_char);
}
return coding->result;
@@ -7433,7 +7433,7 @@ encode_coding (struct coding_system *coding)
{
set_buffer_internal (XBUFFER (coding->dst_object));
coding->dst_multibyte
- = ! NILP (current_buffer->enable_multibyte_characters);
+ = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
}
coding->consumed = coding->consumed_char = 0;
@@ -7504,8 +7504,8 @@ make_conversion_work_buffer (int multibyte)
doesn't compile new regexps. */
Fset (Fmake_local_variable (Qinhibit_modification_hooks), Qt);
Ferase_buffer ();
- current_buffer->undo_list = Qt;
- current_buffer->enable_multibyte_characters = multibyte ? Qt : Qnil;
+ BVAR (current_buffer, undo_list) = Qt;
+ BVAR (current_buffer, enable_multibyte_characters) = multibyte ? Qt : Qnil;
set_buffer_internal (current);
return workbuf;
}
@@ -7562,7 +7562,7 @@ decode_coding_gap (struct coding_system *coding,
coding->dst_object = coding->src_object;
coding->dst_pos = PT;
coding->dst_pos_byte = PT_BYTE;
- coding->dst_multibyte = ! NILP (current_buffer->enable_multibyte_characters);
+ coding->dst_multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
if (CODING_REQUIRE_DETECTION (coding))
detect_coding (coding);
@@ -7728,7 +7728,7 @@ decode_coding_object (struct coding_system *coding,
coding->dst_pos = BUF_PT (XBUFFER (dst_object));
coding->dst_pos_byte = BUF_PT_BYTE (XBUFFER (dst_object));
coding->dst_multibyte
- = ! NILP (XBUFFER (dst_object)->enable_multibyte_characters);
+ = ! NILP (BVAR (XBUFFER (dst_object), enable_multibyte_characters));
}
else
{
@@ -7798,7 +7798,7 @@ decode_coding_object (struct coding_system *coding,
TEMP_SET_PT_BOTH (saved_pt, saved_pt_byte);
else if (saved_pt < from + chars)
TEMP_SET_PT_BOTH (from, from_byte);
- else if (! NILP (current_buffer->enable_multibyte_characters))
+ else if (! NILP (BVAR (current_buffer, enable_multibyte_characters)))
TEMP_SET_PT_BOTH (saved_pt + (coding->produced_char - chars),
saved_pt_byte + (coding->produced - bytes));
else
@@ -7822,7 +7822,7 @@ decode_coding_object (struct coding_system *coding,
{
tail->bytepos = from_byte + coding->produced;
tail->charpos
- = (NILP (current_buffer->enable_multibyte_characters)
+ = (NILP (BVAR (current_buffer, enable_multibyte_characters))
? tail->bytepos : from + coding->produced_char);
}
}
@@ -7960,7 +7960,7 @@ encode_coding_object (struct coding_system *coding,
set_buffer_temp (current);
}
coding->dst_multibyte
- = ! NILP (XBUFFER (dst_object)->enable_multibyte_characters);
+ = ! NILP (BVAR (XBUFFER (dst_object), enable_multibyte_characters));
}
else if (EQ (dst_object, Qt))
{
@@ -8003,7 +8003,7 @@ encode_coding_object (struct coding_system *coding,
TEMP_SET_PT_BOTH (saved_pt, saved_pt_byte);
else if (saved_pt < from + chars)
TEMP_SET_PT_BOTH (from, from_byte);
- else if (! NILP (current_buffer->enable_multibyte_characters))
+ else if (! NILP (BVAR (current_buffer, enable_multibyte_characters)))
TEMP_SET_PT_BOTH (saved_pt + (coding->produced_char - chars),
saved_pt_byte + (coding->produced - bytes));
else
@@ -8027,7 +8027,7 @@ encode_coding_object (struct coding_system *coding,
{
tail->bytepos = from_byte + coding->produced;
tail->charpos
- = (NILP (current_buffer->enable_multibyte_characters)
+ = (NILP (BVAR (current_buffer, enable_multibyte_characters))
? tail->bytepos : from + coding->produced_char);
}
}
@@ -8481,8 +8481,8 @@ highest priority. */)
return detect_coding_system (BYTE_POS_ADDR (from_byte),
to - from, to_byte - from_byte,
!NILP (highest),
- !NILP (current_buffer
- ->enable_multibyte_characters),
+ !NILP (BVAR (current_buffer
+ , enable_multibyte_characters)),
Qnil);
}
@@ -8564,7 +8564,7 @@ DEFUN ("find-coding-systems-region-internal",
CHECK_NUMBER_COERCE_MARKER (end);
if (XINT (start) < BEG || XINT (end) > Z || XINT (start) > XINT (end))
args_out_of_range (start, end);
- if (NILP (current_buffer->enable_multibyte_characters))
+ if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
return Qt;
start_byte = CHAR_TO_BYTE (XINT (start));
end_byte = CHAR_TO_BYTE (XINT (end));
@@ -8698,7 +8698,7 @@ to the string. */)
validate_region (&start, &end);
from = XINT (start);
to = XINT (end);
- if (NILP (current_buffer->enable_multibyte_characters)
+ if (NILP (BVAR (current_buffer, enable_multibyte_characters))
|| (ascii_compatible
&& (to - from) == (CHAR_TO_BYTE (to) - (CHAR_TO_BYTE (from)))))
return Qnil;
@@ -8814,7 +8814,7 @@ is nil. */)
CHECK_NUMBER_COERCE_MARKER (end);
if (XINT (start) < BEG || XINT (end) > Z || XINT (start) > XINT (end))
args_out_of_range (start, end);
- if (NILP (current_buffer->enable_multibyte_characters))
+ if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
return Qnil;
start_byte = CHAR_TO_BYTE (XINT (start));
end_byte = CHAR_TO_BYTE (XINT (end));
diff --git a/src/composite.c b/src/composite.c
index 58bc68597c..0b0602bf28 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -796,7 +796,7 @@ fill_gstring_header (Lisp_Object header, Lisp_Object start, Lisp_Object end, Lis
if (NILP (string))
{
- if (NILP (current_buffer->enable_multibyte_characters))
+ if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
error ("Attempt to shape unibyte text");
validate_region (&start, &end);
from = XFASTINT (start);
@@ -1028,7 +1028,7 @@ composition_compute_stop_pos (struct composition_it *cmp_it, EMACS_INT charpos,
cmp_it->stop_pos = endpos = start;
cmp_it->ch = -1;
}
- if (NILP (current_buffer->enable_multibyte_characters)
+ if (NILP (BVAR (current_buffer, enable_multibyte_characters))
|| NILP (Vauto_composition_mode))
return;
if (bytepos < 0)
@@ -1674,7 +1674,7 @@ composition_adjust_point (EMACS_INT last_pt, EMACS_INT new_pt)
return new_pt;
}
- if (NILP (current_buffer->enable_multibyte_characters)
+ if (NILP (BVAR (current_buffer, enable_multibyte_characters))
|| NILP (Vauto_composition_mode))
return new_pt;
@@ -1851,7 +1851,7 @@ See `find-composition' for more details. */)
if (!find_composition (from, to, &start, &end, &prop, string))
{
- if (!NILP (current_buffer->enable_multibyte_characters)
+ if (!NILP (BVAR (current_buffer, enable_multibyte_characters))
&& ! NILP (Vauto_composition_mode)
&& find_automatic_composition (from, to, &start, &end, &gstring,
string))
diff --git a/src/config.in b/src/config.in
index df492bf8f8..1fd1f89ede 100644
--- a/src/config.in
+++ b/src/config.in
@@ -31,6 +31,21 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define if building universal (internal helper macro) */
#undef AC_APPLE_UNIVERSAL_BUILD
+/* Define to the number of bits in type 'ptrdiff_t'. */
+#undef BITSIZEOF_PTRDIFF_T
+
+/* Define to the number of bits in type 'sig_atomic_t'. */
+#undef BITSIZEOF_SIG_ATOMIC_T
+
+/* Define to the number of bits in type 'size_t'. */
+#undef BITSIZEOF_SIZE_T
+
+/* Define to the number of bits in type 'wchar_t'. */
+#undef BITSIZEOF_WCHAR_T
+
+/* Define to the number of bits in type 'wint_t'. */
+#undef BITSIZEOF_WINT_T
+
/* Define if Emacs cannot be dumped on your system. */
#undef CANNOT_DUMP
@@ -42,9 +57,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if using `alloca.c'. */
#undef C_ALLOCA
-/* Define to 1 if using `getloadavg.c'. */
-#undef C_GETLOADAVG
-
/* Define to 1 for DGUX with <sys/dg_sys_info.h>. */
#undef DGUX
@@ -74,10 +86,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define this to check for short string overrun. */
#undef GC_CHECK_STRING_OVERRUN
-/* Define to 1 if the `getloadavg' function needs to be run setuid or setgid.
- */
-#undef GETLOADAVG_PRIVILEGED
-
/* Define to 1 if the `getpgrp' function requires zero arguments. */
#undef GETPGRP_VOID
@@ -144,6 +152,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
don't. */
#undef HAVE_DECL_LOCALTIME_R
+/* Define to 1 if you have the declaration of `strmode', and to 0 if you
+ don't. */
+#undef HAVE_DECL_STRMODE
+
/* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you
don't. */
#undef HAVE_DECL_SYS_SIGLIST
@@ -225,9 +237,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if you have the `getline' function. */
#undef HAVE_GETLINE
-/* Define to 1 if you have the `getloadavg' function. */
-#undef HAVE_GETLOADAVG
-
/* Define to 1 if you have the <getopt.h> header file. */
#undef HAVE_GETOPT_H
@@ -408,6 +417,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if using libotf. */
#undef HAVE_LIBOTF
+/* Define to 1 if you have the `perfstat' library (-lperfstat). */
+#undef HAVE_LIBPERFSTAT
+
/* Define to 1 if you have the <libpng/png.h> header file. */
#undef HAVE_LIBPNG_PNG_H
@@ -447,6 +459,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if you support file names longer than 14 characters. */
#undef HAVE_LONG_FILE_NAMES
+/* Define to 1 if the system has the type `long long int'. */
+#undef HAVE_LONG_LONG_INT
+
/* Define to 1 if you have the `lrand48' function. */
#undef HAVE_LRAND48
@@ -603,6 +618,15 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if you have the `shutdown' function. */
#undef HAVE_SHUTDOWN
+/* Define to 1 if 'sig_atomic_t' is a signed integer type. */
+#undef HAVE_SIGNED_SIG_ATOMIC_T
+
+/* Define to 1 if 'wchar_t' is a signed integer type. */
+#undef HAVE_SIGNED_WCHAR_T
+
+/* Define to 1 if 'wint_t' is a signed integer type. */
+#undef HAVE_SIGNED_WINT_T
+
/* Define to 1 if the system has the type `size_t'. */
#undef HAVE_SIZE_T
@@ -666,12 +690,24 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if `struct utimbuf' is declared by <utime.h>. */
#undef HAVE_STRUCT_UTIMBUF
+/* Define if struct stat has an st_dm_mode member. */
+#undef HAVE_ST_DM_MODE
+
/* Define to 1 if you have the `sync' function. */
#undef HAVE_SYNC
/* Define to 1 if you have the `sysinfo' function. */
#undef HAVE_SYSINFO
+/* Define to 1 if you have the <sys/bitypes.h> header file. */
+#undef HAVE_SYS_BITYPES_H
+
+/* Define to 1 if you have the <sys/inttypes.h> header file. */
+#undef HAVE_SYS_INTTYPES_H
+
+/* Define to 1 if you have the <sys/loadavg.h> header file. */
+#undef HAVE_SYS_LOADAVG_H
+
/* Define to 1 if you have the <sys/mman.h> header file. */
#undef HAVE_SYS_MMAN_H
@@ -749,6 +785,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
+/* Define to 1 if the system has the type `unsigned long long int'. */
+#undef HAVE_UNSIGNED_LONG_LONG_INT
+
/* Define to 1 if you have the <util.h> header file. */
#undef HAVE_UTIL_H
@@ -767,6 +806,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if you have the <vfork.h> header file. */
#undef HAVE_VFORK_H
+/* Define to 1 if you have the <wchar.h> header file. */
+#undef HAVE_WCHAR_H
+
/* Define if you have the 'wchar_t' type. */
#undef HAVE_WCHAR_T
@@ -870,10 +912,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to support POP mail retrieval. */
#undef MAIL_USE_POP
-/* Define to 1 if your `struct nlist' has an `n_un' member. Obsolete, depend
- on `HAVE_STRUCT_NLIST_N_UN_N_NAME */
-#undef NLIST_NAME_UNION
-
/* Define to 1 if you don't have struct exception in math.h. */
#undef NO_MATHERR
@@ -889,6 +927,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if you are using NS windowing under GNUstep. */
#undef NS_IMPL_GNUSTEP
+/* Define to 1 if the nlist n_name member is a pointer */
+#undef N_NAME_POINTER
+
/* Define if the C compiler is the linker. */
#undef ORDINARY_LINK
@@ -920,6 +961,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if the C compiler supports function prototypes. */
#undef PROTOTYPES
+/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
+ 'ptrdiff_t'. */
+#undef PTRDIFF_T_SUFFIX
+
/* Define REL_ALLOC if you want to use the relocating allocator for buffer
space. */
#undef REL_ALLOC
@@ -927,6 +972,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define as the return type of signal handlers (`int' or `void'). */
#undef RETSIGTYPE
+/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
+ 'sig_atomic_t'. */
+#undef SIG_ATOMIC_T_SUFFIX
+
+/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
+ 'size_t'. */
+#undef SIZE_T_SUFFIX
+
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at runtime.
@@ -935,6 +988,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
STACK_DIRECTION = 0 => direction of growth unknown */
#undef STACK_DIRECTION
+/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
+#undef STAT_MACROS_BROKEN
+
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
@@ -990,6 +1046,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Version number of package */
#undef VERSION
+/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
+ 'wchar_t'. */
+#undef WCHAR_T_SUFFIX
+
+/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
+ 'wint_t'. */
+#undef WINT_T_SUFFIX
+
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
@@ -1095,6 +1159,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to the name of the strftime replacement function. */
#undef my_strftime
+/* Define to the type of st_nlink in struct stat, or a supertype. */
+#undef nlink_t
+
/* Define to `int' if <sys/types.h> does not define. */
#undef pid_t
diff --git a/src/data.c b/src/data.c
index 2f17edd3fd..ecedba2410 100644
--- a/src/data.c
+++ b/src/data.c
@@ -1021,7 +1021,7 @@ swap_in_symval_forwarding (struct Lisp_Symbol *symbol, struct Lisp_Buffer_Local_
}
else
{
- tem1 = assq_no_quit (var, current_buffer->local_var_alist);
+ tem1 = assq_no_quit (var, BVAR (current_buffer, local_var_alist));
XSETBUFFER (blv->where, current_buffer);
}
}
@@ -1190,7 +1190,7 @@ set_internal (register Lisp_Object symbol, register Lisp_Object newval, register
tem1 = Fassq (symbol,
(blv->frame_local
? XFRAME (where)->param_alist
- : XBUFFER (where)->local_var_alist));
+ : BVAR (XBUFFER (where), local_var_alist)));
blv->where = where;
blv->found = 1;
@@ -1221,8 +1221,8 @@ set_internal (register Lisp_Object symbol, register Lisp_Object newval, register
bindings, not for frame-local bindings. */
eassert (!blv->frame_local);
tem1 = Fcons (symbol, XCDR (blv->defcell));
- XBUFFER (where)->local_var_alist
- = Fcons (tem1, XBUFFER (where)->local_var_alist);
+ BVAR (XBUFFER (where), local_var_alist)
+ = Fcons (tem1, BVAR (XBUFFER (where), local_var_alist));
}
}
@@ -1644,13 +1644,13 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */)
if (let_shadows_global_binding_p (symbol))
message ("Making %s local to %s while let-bound!",
SDATA (SYMBOL_NAME (variable)),
- SDATA (current_buffer->name));
+ SDATA (BVAR (current_buffer, name)));
}
}
/* Make sure this buffer has its own value of symbol. */
XSETSYMBOL (variable, sym); /* Update in case of aliasing. */
- tem = Fassq (variable, current_buffer->local_var_alist);
+ tem = Fassq (variable, BVAR (current_buffer, local_var_alist));
if (NILP (tem))
{
if (let_shadows_buffer_binding_p (sym))
@@ -1662,9 +1662,9 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */)
default value. */
find_symbol_value (variable);
- current_buffer->local_var_alist
+ BVAR (current_buffer, local_var_alist)
= Fcons (Fcons (variable, XCDR (blv->defcell)),
- current_buffer->local_var_alist);
+ BVAR (current_buffer, local_var_alist));
/* Make sure symbol does not think it is set up for this buffer;
force it to look once again for this buffer's value. */
@@ -1730,10 +1730,10 @@ From now on the default value will apply in this buffer. Return VARIABLE. */)
/* Get rid of this buffer's alist element, if any. */
XSETSYMBOL (variable, sym); /* Propagate variable indirection. */
- tem = Fassq (variable, current_buffer->local_var_alist);
+ tem = Fassq (variable, BVAR (current_buffer, local_var_alist));
if (!NILP (tem))
- current_buffer->local_var_alist
- = Fdelq (tem, current_buffer->local_var_alist);
+ BVAR (current_buffer, local_var_alist)
+ = Fdelq (tem, BVAR (current_buffer, local_var_alist));
/* If the symbol is set up with the current buffer's binding
loaded, recompute its value. We have to do it now, or else
@@ -1860,7 +1860,7 @@ BUFFER defaults to the current buffer. */)
XSETBUFFER (tmp, buf);
XSETSYMBOL (variable, sym); /* Update in case of aliasing. */
- for (tail = buf->local_var_alist; CONSP (tail); tail = XCDR (tail))
+ for (tail = BVAR (buf, local_var_alist); CONSP (tail); tail = XCDR (tail))
{
elt = XCAR (tail);
if (EQ (variable, XCAR (elt)))
diff --git a/src/deps.mk b/src/deps.mk
index e8ff3dd592..77994bcaad 100644
--- a/src/deps.mk
+++ b/src/deps.mk
@@ -9,17 +9,17 @@
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
-##
+##
## GNU Emacs is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
-##
+##
## You should have received a copy of the GNU General Public License
## along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
## Commentary:
-##
+##
## This file is inserted in src/Makefile if AUTO_DEPEND=no.
## It defines static dependencies between the various source files.
@@ -73,7 +73,7 @@ pre-crt0.o: pre-crt0.c
dbusbind.o: dbusbind.c termhooks.h frame.h keyboard.h lisp.h $(config_h)
dired.o: dired.c commands.h buffer.h lisp.h $(config_h) character.h charset.h \
coding.h regex.h systime.h blockinput.h atimer.h composite.h \
- ../lib/unistd.h globals.h
+ ../lib/filemode.h ../lib/unistd.h globals.h
dispnew.o: dispnew.c systime.h commands.h process.h frame.h coding.h \
window.h buffer.h termchar.h termopts.h termhooks.h cm.h \
disptab.h indent.h $(INTERVALS_H) nsgui.h ../lib/unistd.h \
@@ -98,7 +98,6 @@ fileio.o: fileio.c window.h buffer.h systime.h $(INTERVALS_H) character.h \
commands.h globals.h ../lib/unistd.h
filelock.o: filelock.c buffer.h character.h coding.h systime.h composite.h \
../lib/unistd.h lisp.h globals.h $(config_h)
-filemode.o: filemode.c $(config_h)
font.o: font.c dispextern.h frame.h window.h ccl.h character.h charset.h \
font.h lisp.h globals.h $(config_h) buffer.h composite.h fontset.h \
xterm.h nsgui.h msdos.h
@@ -115,7 +114,6 @@ fringe.o: fringe.c dispextern.h nsgui.h frame.h window.h buffer.h termhooks.h \
ftfont.o: ftfont.c dispextern.h frame.h character.h charset.h composite.h \
font.h lisp.h $(config_h) blockinput.h atimer.h systime.h coding.h \
fontset.h ccl.h ftfont.h globals.h
-getloadavg.o: getloadavg.c $(config_h)
gnutls.o: gnutls.c gnutls.h process.h ../lib/unistd.h \
lisp.h globals.h $(config_h)
gtkutil.o: gtkutil.c gtkutil.h xterm.h lisp.h frame.h lisp.h $(config_h) \
@@ -145,7 +143,6 @@ gmalloc.o: gmalloc.c $(config_h)
ralloc.o: ralloc.c lisp.h $(config_h)
vm-limit.o: vm-limit.c mem-limits.h lisp.h globals.h $(config_h)
marker.o: marker.c buffer.h character.h lisp.h globals.h $(config_h)
-md5.o: md5.c md5.h $(config_h)
minibuf.o: minibuf.c syntax.h frame.h window.h keyboard.h systime.h \
buffer.h commands.h character.h msdos.h $(INTERVALS_H) keymap.h \
termhooks.h lisp.h globals.h $(config_h) coding.h
@@ -284,7 +281,7 @@ eval.o: eval.c commands.h keyboard.h blockinput.h atimer.h systime.h frame.h \
msdos.h
floatfns.o: floatfns.c syssignal.h lisp.h globals.h $(config_h)
fns.o: fns.c commands.h lisp.h $(config_h) frame.h buffer.h character.h \
- keyboard.h keymap.h window.h $(INTERVALS_H) coding.h md5.h \
+ keyboard.h keymap.h window.h $(INTERVALS_H) coding.h ../lib/md5.h \
blockinput.h atimer.h systime.h xterm.h ../lib/unistd.h globals.h
print.o: print.c process.h frame.h window.h buffer.h keyboard.h character.h \
lisp.h globals.h $(config_h) termchar.h $(INTERVALS_H) msdos.h termhooks.h \
diff --git a/src/dired.c b/src/dired.c
index e37055258d..b01ce8d4d8 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -61,6 +61,8 @@ extern struct direct *readdir (DIR *);
#endif /* HAVE_DIRENT_H */
+#include <filemode.h>
+
#ifdef MSDOS
#define DIRENTRY_NONEMPTY(p) ((p)->d_name[0] != 0)
#else
@@ -82,9 +84,6 @@ extern struct re_pattern_buffer *compile_pattern (Lisp_Object,
struct re_registers *,
Lisp_Object, int, int);
-/* From filemode.c. Can't go in Lisp.h because of `stat'. */
-extern void filemodestring (struct stat *, char *);
-
/* if system does not have symbolic links, it does not have lstat.
In that case, use ordinary stat instead. */
@@ -158,7 +157,7 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, Lisp_Object m
# ifdef WINDOWSNT
/* Windows users want case-insensitive wildcards. */
bufp = compile_pattern (match, 0,
- buffer_defaults.case_canon_table, 0, 1);
+ BVAR (&buffer_defaults, case_canon_table), 0, 1);
# else /* !WINDOWSNT */
bufp = compile_pattern (match, 0, Qnil, 0, 1);
# endif /* !WINDOWSNT */
diff --git a/src/dispextern.h b/src/dispextern.h
index 6d54ebefd8..6bb0c3a6aa 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -1416,7 +1416,7 @@ struct glyph_string
&& !(W)->pseudo_window_p \
&& FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME ((W)))) \
&& BUFFERP ((W)->buffer) \
- && !NILP (XBUFFER ((W)->buffer)->mode_line_format) \
+ && !NILP (BVAR (XBUFFER ((W)->buffer), mode_line_format)) \
&& WINDOW_TOTAL_LINES (W) > 1)
/* Value is non-zero if window W wants a header line. */
@@ -1426,8 +1426,8 @@ struct glyph_string
&& !(W)->pseudo_window_p \
&& FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME ((W)))) \
&& BUFFERP ((W)->buffer) \
- && !NILP (XBUFFER ((W)->buffer)->header_line_format) \
- && WINDOW_TOTAL_LINES (W) > 1 + !NILP (XBUFFER ((W)->buffer)->mode_line_format))
+ && !NILP (BVAR (XBUFFER ((W)->buffer), header_line_format)) \
+ && WINDOW_TOTAL_LINES (W) > 1 + !NILP (BVAR (XBUFFER ((W)->buffer), mode_line_format)))
/* Return proper value to be used as baseline offset of font that has
diff --git a/src/dispnew.c b/src/dispnew.c
index 1aef70f1a5..4e068bde53 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -6129,7 +6129,7 @@ pass nil for VARIABLE. */)
{
buf = XCDR (XCAR (tail));
/* Ignore buffers that aren't included in buffer lists. */
- if (SREF (XBUFFER (buf)->name, 0) == ' ')
+ if (SREF (BVAR (XBUFFER (buf), name), 0) == ' ')
continue;
if (vecp == end)
goto changed;
@@ -6137,7 +6137,7 @@ pass nil for VARIABLE. */)
goto changed;
if (vecp == end)
goto changed;
- if (!EQ (*vecp++, XBUFFER (buf)->read_only))
+ if (!EQ (*vecp++, BVAR (XBUFFER (buf), read_only)))
goto changed;
if (vecp == end)
goto changed;
@@ -6184,10 +6184,10 @@ pass nil for VARIABLE. */)
{
buf = XCDR (XCAR (tail));
/* Ignore buffers that aren't included in buffer lists. */
- if (SREF (XBUFFER (buf)->name, 0) == ' ')
+ if (SREF (BVAR (XBUFFER (buf), name), 0) == ' ')
continue;
*vecp++ = buf;
- *vecp++ = XBUFFER (buf)->read_only;
+ *vecp++ = BVAR (XBUFFER (buf), read_only);
*vecp++ = Fbuffer_modified_p (buf);
}
/* Fill up the vector with lambdas (always at least one). */
diff --git a/src/doc.c b/src/doc.c
index c56f0b6c9d..834321108b 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -729,7 +729,7 @@ a new string, without any text properties, is returned. */)
or a specified local map (which means search just that and the
global map). If non-nil, it might come from Voverriding_local_map,
or from a \\<mapname> construct in STRING itself.. */
- keymap = current_kboard->Voverriding_terminal_local_map;
+ keymap = KVAR (current_kboard, Voverriding_terminal_local_map);
if (NILP (keymap))
keymap = Voverriding_local_map;
diff --git a/src/editfns.c b/src/editfns.c
index 30acc36f02..5d6189f2a3 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -306,10 +306,10 @@ region_limit (int beginningp)
if (!NILP (Vtransient_mark_mode)
&& NILP (Vmark_even_if_inactive)
- && NILP (current_buffer->mark_active))
+ && NILP (BVAR (current_buffer, mark_active)))
xsignal0 (Qmark_inactive);
- m = Fmarker_position (current_buffer->mark);
+ m = Fmarker_position (BVAR (current_buffer, mark));
if (NILP (m))
error ("The mark is not set now, so there is no region");
@@ -338,7 +338,7 @@ Watch out! Moving this marker changes the mark position.
If you set the marker not to point anywhere, the buffer will have no mark. */)
(void)
{
- return current_buffer->mark;
+ return BVAR (current_buffer, mark);
}
@@ -866,9 +866,9 @@ save_excursion_save (void)
== current_buffer);
return Fcons (Fpoint_marker (),
- Fcons (Fcopy_marker (current_buffer->mark, Qnil),
+ Fcons (Fcopy_marker (BVAR (current_buffer, mark), Qnil),
Fcons (visible ? Qt : Qnil,
- Fcons (current_buffer->mark_active,
+ Fcons (BVAR (current_buffer, mark_active),
selected_window))));
}
@@ -900,8 +900,8 @@ save_excursion_restore (Lisp_Object info)
/* Mark marker. */
info = XCDR (info);
tem = XCAR (info);
- omark = Fmarker_position (current_buffer->mark);
- Fset_marker (current_buffer->mark, tem, Fcurrent_buffer ());
+ omark = Fmarker_position (BVAR (current_buffer, mark));
+ Fset_marker (BVAR (current_buffer, mark), tem, Fcurrent_buffer ());
nmark = Fmarker_position (tem);
unchain_marker (XMARKER (tem));
@@ -922,14 +922,14 @@ save_excursion_restore (Lisp_Object info)
/* Mark active */
info = XCDR (info);
tem = XCAR (info);
- tem1 = current_buffer->mark_active;
- current_buffer->mark_active = tem;
+ tem1 = BVAR (current_buffer, mark_active);
+ BVAR (current_buffer, mark_active) = tem;
if (!NILP (Vrun_hooks))
{
/* If mark is active now, and either was not active
or was at a different place, run the activate hook. */
- if (! NILP (current_buffer->mark_active))
+ if (! NILP (BVAR (current_buffer, mark_active)))
{
if (! EQ (omark, nmark))
call1 (Vrun_hooks, intern ("activate-mark-hook"));
@@ -1114,7 +1114,7 @@ At the beginning of the buffer or accessible region, return 0. */)
Lisp_Object temp;
if (PT <= BEGV)
XSETFASTINT (temp, 0);
- else if (!NILP (current_buffer->enable_multibyte_characters))
+ else if (!NILP (BVAR (current_buffer, enable_multibyte_characters)))
{
EMACS_INT pos = PT_BYTE;
DEC_POS (pos);
@@ -1228,7 +1228,7 @@ If POS is out of range, the value is nil. */)
pos_byte = CHAR_TO_BYTE (XINT (pos));
}
- if (!NILP (current_buffer->enable_multibyte_characters))
+ if (!NILP (BVAR (current_buffer, enable_multibyte_characters)))
{
DEC_POS (pos_byte);
XSETFASTINT (val, FETCH_CHAR (pos_byte));
@@ -2135,7 +2135,7 @@ general_insert_function (void (*insert_func)
unsigned char str[MAX_MULTIBYTE_LENGTH];
int len;
- if (!NILP (current_buffer->enable_multibyte_characters))
+ if (!NILP (BVAR (current_buffer, enable_multibyte_characters)))
len = CHAR_STRING (XFASTINT (val), str);
else
{
@@ -2267,7 +2267,7 @@ from adjoining text, if those properties are sticky. */)
CHECK_NUMBER (character);
CHECK_NUMBER (count);
- if (!NILP (current_buffer->enable_multibyte_characters))
+ if (!NILP (BVAR (current_buffer, enable_multibyte_characters)))
len = CHAR_STRING (XFASTINT (character), str);
else
str[0] = XFASTINT (character), len = 1;
@@ -2316,7 +2316,7 @@ from adjoining text, if those properties are sticky. */)
if (XINT (byte) < 0 || XINT (byte) > 255)
args_out_of_range_3 (byte, make_number (0), make_number (255));
if (XINT (byte) >= 128
- && ! NILP (current_buffer->enable_multibyte_characters))
+ && ! NILP (BVAR (current_buffer, enable_multibyte_characters)))
XSETFASTINT (byte, BYTE8_TO_CHAR (XINT (byte)));
return Finsert_char (byte, count, inherit);
}
@@ -2370,7 +2370,7 @@ make_buffer_string_both (EMACS_INT start, EMACS_INT start_byte,
if (start < GPT && GPT < end)
move_gap (start);
- if (! NILP (current_buffer->enable_multibyte_characters))
+ if (! NILP (BVAR (current_buffer, enable_multibyte_characters)))
result = make_uninit_multibyte_string (end - start, end_byte - start_byte);
else
result = make_uninit_string (end - start);
@@ -2485,7 +2485,7 @@ They default to the values of (point-min) and (point-max) in BUFFER. */)
if (NILP (buf))
nsberror (buffer);
bp = XBUFFER (buf);
- if (NILP (bp->name))
+ if (NILP (BVAR (bp, name)))
error ("Selecting deleted buffer");
if (NILP (start))
@@ -2533,8 +2533,8 @@ determines whether case is significant or ignored. */)
register EMACS_INT begp1, endp1, begp2, endp2, temp;
register struct buffer *bp1, *bp2;
register Lisp_Object trt
- = (!NILP (current_buffer->case_fold_search)
- ? current_buffer->case_canon_table : Qnil);
+ = (!NILP (BVAR (current_buffer, case_fold_search))
+ ? BVAR (current_buffer, case_canon_table) : Qnil);
EMACS_INT chars = 0;
EMACS_INT i1, i2, i1_byte, i2_byte;
@@ -2549,7 +2549,7 @@ determines whether case is significant or ignored. */)
if (NILP (buf1))
nsberror (buffer1);
bp1 = XBUFFER (buf1);
- if (NILP (bp1->name))
+ if (NILP (BVAR (bp1, name)))
error ("Selecting deleted buffer");
}
@@ -2587,7 +2587,7 @@ determines whether case is significant or ignored. */)
if (NILP (buf2))
nsberror (buffer2);
bp2 = XBUFFER (buf2);
- if (NILP (bp2->name))
+ if (NILP (BVAR (bp2, name)))
error ("Selecting deleted buffer");
}
@@ -2627,7 +2627,7 @@ determines whether case is significant or ignored. */)
QUIT;
- if (! NILP (bp1->enable_multibyte_characters))
+ if (! NILP (BVAR (bp1, enable_multibyte_characters)))
{
c1 = BUF_FETCH_MULTIBYTE_CHAR (bp1, i1_byte);
BUF_INC_POS (bp1, i1_byte);
@@ -2640,7 +2640,7 @@ determines whether case is significant or ignored. */)
i1++;
}
- if (! NILP (bp2->enable_multibyte_characters))
+ if (! NILP (BVAR (bp2, enable_multibyte_characters)))
{
c2 = BUF_FETCH_MULTIBYTE_CHAR (bp2, i2_byte);
BUF_INC_POS (bp2, i2_byte);
@@ -2680,13 +2680,13 @@ determines whether case is significant or ignored. */)
static Lisp_Object
subst_char_in_region_unwind (Lisp_Object arg)
{
- return current_buffer->undo_list = arg;
+ return BVAR (current_buffer, undo_list) = arg;
}
static Lisp_Object
subst_char_in_region_unwind_1 (Lisp_Object arg)
{
- return current_buffer->filename = arg;
+ return BVAR (current_buffer, filename) = arg;
}
DEFUN ("subst-char-in-region", Fsubst_char_in_region,
@@ -2712,7 +2712,7 @@ Both characters must have the same length of multi-byte form. */)
#define COMBINING_BOTH (COMBINING_BEFORE | COMBINING_AFTER)
int maybe_byte_combining = COMBINING_NO;
EMACS_INT last_changed = 0;
- int multibyte_p = !NILP (current_buffer->enable_multibyte_characters);
+ int multibyte_p = !NILP (BVAR (current_buffer, enable_multibyte_characters));
restart:
@@ -2756,12 +2756,12 @@ Both characters must have the same length of multi-byte form. */)
if (!changed && !NILP (noundo))
{
record_unwind_protect (subst_char_in_region_unwind,
- current_buffer->undo_list);
- current_buffer->undo_list = Qt;
+ BVAR (current_buffer, undo_list));
+ BVAR (current_buffer, undo_list) = Qt;
/* Don't do file-locking. */
record_unwind_protect (subst_char_in_region_unwind_1,
- current_buffer->filename);
- current_buffer->filename = Qnil;
+ BVAR (current_buffer, filename));
+ BVAR (current_buffer, filename) = Qnil;
}
if (pos_byte < GPT_BYTE)
@@ -2824,7 +2824,7 @@ Both characters must have the same length of multi-byte form. */)
struct gcpro gcpro1;
- tem = current_buffer->undo_list;
+ tem = BVAR (current_buffer, undo_list);
GCPRO1 (tem);
/* Make a multibyte string containing this single character. */
@@ -2843,7 +2843,7 @@ Both characters must have the same length of multi-byte form. */)
INC_POS (pos_byte_next);
if (! NILP (noundo))
- current_buffer->undo_list = tem;
+ BVAR (current_buffer, undo_list) = tem;
UNGCPRO;
}
@@ -2945,7 +2945,7 @@ It returns the number of characters changed. */)
int cnt; /* Number of changes made. */
EMACS_INT size; /* Size of translate table. */
EMACS_INT pos, pos_byte, end_pos;
- int multibyte = !NILP (current_buffer->enable_multibyte_characters);
+ int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
int string_multibyte;
Lisp_Object val;
@@ -3206,7 +3206,7 @@ save_restriction_restore (Lisp_Object data)
? XMARKER (XCAR (data))->buffer
: XBUFFER (data));
- if (buf && buf != current_buffer && !NILP (buf->pt_marker))
+ if (buf && buf != current_buffer && !NILP (BVAR (buf, pt_marker)))
{ /* If `buf' uses markers to keep track of PT, BEGV, and ZV (as
is the case if it is or has an indirect buffer), then make
sure it is current before we update BEGV, so
@@ -4136,20 +4136,20 @@ Case is ignored if `case-fold-search' is non-nil in the current buffer. */)
if (XINT (c1) == XINT (c2))
return Qt;
- if (NILP (current_buffer->case_fold_search))
+ if (NILP (BVAR (current_buffer, case_fold_search)))
return Qnil;
/* Do these in separate statements,
then compare the variables.
because of the way DOWNCASE uses temp variables. */
i1 = XFASTINT (c1);
- if (NILP (current_buffer->enable_multibyte_characters)
+ if (NILP (BVAR (current_buffer, enable_multibyte_characters))
&& ! ASCII_CHAR_P (i1))
{
MAKE_CHAR_MULTIBYTE (i1);
}
i2 = XFASTINT (c2);
- if (NILP (current_buffer->enable_multibyte_characters)
+ if (NILP (BVAR (current_buffer, enable_multibyte_characters))
&& ! ASCII_CHAR_P (i2))
{
MAKE_CHAR_MULTIBYTE (i2);
diff --git a/src/fileio.c b/src/fileio.c
index 429fce9f5a..2ccad83f66 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -770,7 +770,7 @@ filesystem tree, not (expand-file-name ".." dirname). */)
/* Use the buffer's default-directory if DEFAULT_DIRECTORY is omitted. */
if (NILP (default_directory))
- default_directory = current_buffer->directory;
+ default_directory = BVAR (current_buffer, directory);
if (! STRINGP (default_directory))
{
#ifdef DOS_NT
@@ -2669,7 +2669,7 @@ See `file-symlink-p' to distinguish symlinks. */)
struct stat st;
Lisp_Object handler;
- absname = expand_and_dir_to_file (filename, current_buffer->directory);
+ absname = expand_and_dir_to_file (filename, BVAR (current_buffer, directory));
/* If the file name has special constructs in it,
call the corresponding file handler. */
@@ -2722,7 +2722,7 @@ See `file-symlink-p' to distinguish symlinks. */)
struct stat st;
Lisp_Object handler;
- absname = expand_and_dir_to_file (filename, current_buffer->directory);
+ absname = expand_and_dir_to_file (filename, BVAR (current_buffer, directory));
/* If the file name has special constructs in it,
call the corresponding file handler. */
@@ -2769,7 +2769,7 @@ if file does not exist, is not accessible, or SELinux is disabled */)
context_t context;
#endif
- absname = expand_and_dir_to_file (filename, current_buffer->directory);
+ absname = expand_and_dir_to_file (filename, BVAR (current_buffer, directory));
/* If the file name has special constructs in it,
call the corresponding file handler. */
@@ -2827,7 +2827,7 @@ is disabled. */)
context_t parsed_con;
#endif
- absname = Fexpand_file_name (filename, current_buffer->directory);
+ absname = Fexpand_file_name (filename, BVAR (current_buffer, directory));
/* If the file name has special constructs in it,
call the corresponding file handler. */
@@ -2894,7 +2894,7 @@ Return nil, if file does not exist or is not accessible. */)
struct stat st;
Lisp_Object handler;
- absname = expand_and_dir_to_file (filename, current_buffer->directory);
+ absname = expand_and_dir_to_file (filename, BVAR (current_buffer, directory));
/* If the file name has special constructs in it,
call the corresponding file handler. */
@@ -2923,7 +2923,7 @@ symbolic notation, like the `chmod' command from GNU Coreutils. */)
Lisp_Object absname, encoded_absname;
Lisp_Object handler;
- absname = Fexpand_file_name (filename, current_buffer->directory);
+ absname = Fexpand_file_name (filename, BVAR (current_buffer, directory));
CHECK_NUMBER (mode);
/* If the file name has special constructs in it,
@@ -2985,7 +2985,7 @@ Use the current time if TIME is nil. TIME is in the format of
if (! lisp_time_argument (time, &sec, &usec))
error ("Invalid time specification");
- absname = Fexpand_file_name (filename, current_buffer->directory);
+ absname = Fexpand_file_name (filename, BVAR (current_buffer, directory));
/* If the file name has special constructs in it,
call the corresponding file handler. */
@@ -3047,8 +3047,8 @@ otherwise, if FILE2 does not exist, the answer is t. */)
absname1 = Qnil;
GCPRO2 (absname1, file2);
- absname1 = expand_and_dir_to_file (file1, current_buffer->directory);
- absname2 = expand_and_dir_to_file (file2, current_buffer->directory);
+ absname1 = expand_and_dir_to_file (file1, BVAR (current_buffer, directory));
+ absname2 = expand_and_dir_to_file (file2, BVAR (current_buffer, directory));
UNGCPRO;
/* If the file name has special constructs in it,
@@ -3075,10 +3075,6 @@ otherwise, if FILE2 does not exist, the answer is t. */)
return (mtime1 > st.st_mtime) ? Qt : Qnil;
}
-#ifdef DOS_NT
-Lisp_Object Qfind_buffer_file_type;
-#endif /* DOS_NT */
-
#ifndef READ_BUF_SIZE
#define READ_BUF_SIZE (64 << 10)
#endif
@@ -3116,8 +3112,8 @@ decide_coding_unwind (Lisp_Object unwind_data)
TEMP_SET_PT_BOTH (BEG, BEG_BYTE);
/* Now we are safe to change the buffer's multibyteness directly. */
- current_buffer->enable_multibyte_characters = multibyte;
- current_buffer->undo_list = undo_list;
+ BVAR (current_buffer, enable_multibyte_characters) = multibyte;
+ BVAR (current_buffer, undo_list) = undo_list;
return Qnil;
}
@@ -3212,7 +3208,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
if (current_buffer->base_buffer && ! NILP (visit))
error ("Cannot do file visiting in an indirect buffer");
- if (!NILP (current_buffer->read_only))
+ if (!NILP (BVAR (current_buffer, read_only)))
Fbarf_if_buffer_read_only ();
val = Qnil;
@@ -3403,16 +3399,16 @@ variable `last-coding-system-used' to the coding system actually used. */)
buf = XBUFFER (buffer);
delete_all_overlays (buf);
- buf->directory = current_buffer->directory;
- buf->read_only = Qnil;
- buf->filename = Qnil;
- buf->undo_list = Qt;
+ BVAR (buf, directory) = BVAR (current_buffer, directory);
+ BVAR (buf, read_only) = Qnil;
+ BVAR (buf, filename) = Qnil;
+ BVAR (buf, undo_list) = Qt;
eassert (buf->overlays_before == NULL);
eassert (buf->overlays_after == NULL);
set_buffer_internal (buf);
Ferase_buffer ();
- buf->enable_multibyte_characters = Qnil;
+ BVAR (buf, enable_multibyte_characters) = Qnil;
insert_1_both ((char *) read_buf, nread, nread, 0, 0, 0);
TEMP_SET_PT_BOTH (BEG, BEG_BYTE);
@@ -3450,7 +3446,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
else
CHECK_CODING_SYSTEM (coding_system);
- if (NILP (current_buffer->enable_multibyte_characters))
+ if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
/* We must suppress all character code conversion except for
end-of-line conversion. */
coding_system = raw_text_coding_system (coding_system);
@@ -3598,7 +3594,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
we cannot use this method; giveup and try the other. */
if (same_at_end > same_at_start
&& FETCH_BYTE (same_at_end - 1) >= 0200
- && ! NILP (current_buffer->enable_multibyte_characters)
+ && ! NILP (BVAR (current_buffer, enable_multibyte_characters))
&& (CODING_MAY_REQUIRE_DECODING (&coding)))
giveup_match_end = 1;
break;
@@ -3617,14 +3613,14 @@ variable `last-coding-system-used' to the coding system actually used. */)
/* Extend the start of non-matching text area to multibyte
character boundary. */
- if (! NILP (current_buffer->enable_multibyte_characters))
+ if (! NILP (BVAR (current_buffer, enable_multibyte_characters)))
while (same_at_start > BEGV_BYTE
&& ! CHAR_HEAD_P (FETCH_BYTE (same_at_start)))
same_at_start--;
/* Extend the end of non-matching text area to multibyte
character boundary. */
- if (! NILP (current_buffer->enable_multibyte_characters))
+ if (! NILP (BVAR (current_buffer, enable_multibyte_characters)))
while (same_at_end < ZV_BYTE
&& ! CHAR_HEAD_P (FETCH_BYTE (same_at_end)))
same_at_end++;
@@ -3673,7 +3669,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
unsigned char *decoded;
EMACS_INT temp;
int this_count = SPECPDL_INDEX ();
- int multibyte = ! NILP (current_buffer->enable_multibyte_characters);
+ int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
Lisp_Object conversion_buffer;
conversion_buffer = code_conversion_save (1, multibyte);
@@ -3778,7 +3774,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
/* Extend the start of non-matching text area to the previous
multibyte character boundary. */
- if (! NILP (current_buffer->enable_multibyte_characters))
+ if (! NILP (BVAR (current_buffer, enable_multibyte_characters)))
while (same_at_start > BEGV_BYTE
&& ! CHAR_HEAD_P (FETCH_BYTE (same_at_start)))
same_at_start--;
@@ -3795,7 +3791,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
/* Extend the end of non-matching text area to the next
multibyte character boundary. */
- if (! NILP (current_buffer->enable_multibyte_characters))
+ if (! NILP (BVAR (current_buffer, enable_multibyte_characters)))
while (same_at_end < ZV_BYTE
&& ! CHAR_HEAD_P (FETCH_BYTE (same_at_end)))
same_at_end++;
@@ -3870,9 +3866,9 @@ variable `last-coding-system-used' to the coding system actually used. */)
if (NILP (visit) && inserted > 0)
{
#ifdef CLASH_DETECTION
- if (!NILP (current_buffer->file_truename)
+ if (!NILP (BVAR (current_buffer, file_truename))
/* Make binding buffer-file-name to nil effective. */
- && !NILP (current_buffer->filename)
+ && !NILP (BVAR (current_buffer, filename))
&& SAVE_MODIFF >= MODIFF)
we_locked_file = 1;
#endif /* CLASH_DETECTION */
@@ -3977,7 +3973,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
{
#ifdef CLASH_DETECTION
if (we_locked_file)
- unlock_file (current_buffer->file_truename);
+ unlock_file (BVAR (current_buffer, file_truename));
#endif
Vdeactivate_mark = old_Vdeactivate_mark;
}
@@ -4028,11 +4024,11 @@ variable `last-coding-system-used' to the coding system actually used. */)
Lisp_Object unwind_data;
int count = SPECPDL_INDEX ();
- unwind_data = Fcons (current_buffer->enable_multibyte_characters,
- Fcons (current_buffer->undo_list,
+ unwind_data = Fcons (BVAR (current_buffer, enable_multibyte_characters),
+ Fcons (BVAR (current_buffer, undo_list),
Fcurrent_buffer ()));
- current_buffer->enable_multibyte_characters = Qnil;
- current_buffer->undo_list = Qt;
+ BVAR (current_buffer, enable_multibyte_characters) = Qnil;
+ BVAR (current_buffer, undo_list) = Qt;
record_unwind_protect (decide_coding_unwind, unwind_data);
if (inserted > 0 && ! NILP (Vset_auto_coding_function))
@@ -4062,7 +4058,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
else
CHECK_CODING_SYSTEM (coding_system);
- if (NILP (current_buffer->enable_multibyte_characters))
+ if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
/* We must suppress all character code conversion except for
end-of-line conversion. */
coding_system = raw_text_coding_system (coding_system);
@@ -4080,10 +4076,10 @@ variable `last-coding-system-used' to the coding system actually used. */)
&& NILP (replace))
/* Visiting a file with these coding system makes the buffer
unibyte. */
- current_buffer->enable_multibyte_characters = Qnil;
+ BVAR (current_buffer, enable_multibyte_characters) = Qnil;
}
- coding.dst_multibyte = ! NILP (current_buffer->enable_multibyte_characters);
+ coding.dst_multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
if (CODING_MAY_REQUIRE_DECODING (&coding)
&& (inserted > 0 || CODING_REQUIRE_FLUSHING (&coding)))
{
@@ -4103,18 +4099,6 @@ variable `last-coding-system-used' to the coding system actually used. */)
/* Now INSERTED is measured in characters. */
-#ifdef DOS_NT
- /* Use the conversion type to determine buffer-file-type
- (find-buffer-file-type is now used to help determine the
- conversion). */
- if ((VECTORP (CODING_ID_EOL_TYPE (coding.id))
- || EQ (CODING_ID_EOL_TYPE (coding.id), Qunix))
- && ! CODING_REQUIRE_DECODING (&coding))
- current_buffer->buffer_file_type = Qt;
- else
- current_buffer->buffer_file_type = Qnil;
-#endif
-
handled:
if (deferred_remove_unwind_protect)
@@ -4124,24 +4108,24 @@ variable `last-coding-system-used' to the coding system actually used. */)
if (!NILP (visit))
{
- if (!EQ (current_buffer->undo_list, Qt) && !nochange)
- current_buffer->undo_list = Qnil;
+ if (!EQ (BVAR (current_buffer, undo_list), Qt) && !nochange)
+ BVAR (current_buffer, undo_list) = Qnil;
if (NILP (handler))
{
current_buffer->modtime = st.st_mtime;
current_buffer->modtime_size = st.st_size;
- current_buffer->filename = orig_filename;
+ BVAR (current_buffer, filename) = orig_filename;
}
SAVE_MODIFF = MODIFF;
BUF_AUTOSAVE_MODIFF (current_buffer) = MODIFF;
- XSETFASTINT (current_buffer->save_length, Z - BEG);
+ XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG);
#ifdef CLASH_DETECTION
if (NILP (handler))
{
- if (!NILP (current_buffer->file_truename))
- unlock_file (current_buffer->file_truename);
+ if (!NILP (BVAR (current_buffer, file_truename)))
+ unlock_file (BVAR (current_buffer, file_truename));
unlock_file (filename);
}
#endif /* CLASH_DETECTION */
@@ -4174,8 +4158,8 @@ variable `last-coding-system-used' to the coding system actually used. */)
specbind (Qinhibit_modification_hooks, Qt);
/* Save old undo list and don't record undo for decoding. */
- old_undo = current_buffer->undo_list;
- current_buffer->undo_list = Qt;
+ old_undo = BVAR (current_buffer, undo_list);
+ BVAR (current_buffer, undo_list) = Qt;
if (NILP (replace))
{
@@ -4263,7 +4247,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
if (NILP (visit))
{
- current_buffer->undo_list = old_undo;
+ BVAR (current_buffer, undo_list) = old_undo;
if (CONSP (old_undo) && inserted != old_inserted)
{
/* Adjust the last undo record for the size change during
@@ -4278,7 +4262,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
else
/* If undo_list was Qt before, keep it that way.
Otherwise start with an empty undo_list. */
- current_buffer->undo_list = EQ (old_undo, Qt) ? Qt : Qnil;
+ BVAR (current_buffer, undo_list) = EQ (old_undo, Qt) ? Qt : Qnil;
unbind_to (count, Qnil);
}
@@ -4332,8 +4316,8 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file
Lisp_Object eol_parent = Qnil;
if (auto_saving
- && NILP (Fstring_equal (current_buffer->filename,
- current_buffer->auto_save_file_name)))
+ && NILP (Fstring_equal (BVAR (current_buffer, filename),
+ BVAR (current_buffer, auto_save_file_name))))
{
val = Qutf_8_emacs;
eol_parent = Qunix;
@@ -4362,12 +4346,12 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file
int using_default_coding = 0;
int force_raw_text = 0;
- val = current_buffer->buffer_file_coding_system;
+ val = BVAR (current_buffer, buffer_file_coding_system);
if (NILP (val)
|| NILP (Flocal_variable_p (Qbuffer_file_coding_system, Qnil)))
{
val = Qnil;
- if (NILP (current_buffer->enable_multibyte_characters))
+ if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
force_raw_text = 1;
}
@@ -4388,7 +4372,7 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file
{
/* If we still have not decided a coding system, use the
default value of buffer-file-coding-system. */
- val = current_buffer->buffer_file_coding_system;
+ val = BVAR (current_buffer, buffer_file_coding_system);
using_default_coding = 1;
}
@@ -4412,9 +4396,9 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file
format, we use that of
`default-buffer-file-coding-system'. */
if (! using_default_coding
- && ! NILP (buffer_defaults.buffer_file_coding_system))
+ && ! NILP (BVAR (&buffer_defaults, buffer_file_coding_system)))
val = (coding_inherit_eol_type
- (val, buffer_defaults.buffer_file_coding_system));
+ (val, BVAR (&buffer_defaults, buffer_file_coding_system)));
/* If we decide not to encode text, use `raw-text' or one of its
subsidiaries. */
@@ -4425,7 +4409,7 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file
val = coding_inherit_eol_type (val, eol_parent);
setup_coding_system (val, coding);
- if (!STRINGP (start) && !NILP (current_buffer->selective_display))
+ if (!STRINGP (start) && !NILP (BVAR (current_buffer, selective_display)))
coding->mode |= CODING_MODE_SELECTIVE_DISPLAY;
return val;
}
@@ -4484,9 +4468,6 @@ This calls `write-region-annotate-functions' at the start, and
int quietly = !NILP (visit);
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
struct buffer *given_buffer;
-#ifdef DOS_NT
- int buffer_file_type = O_BINARY;
-#endif /* DOS_NT */
struct coding_system coding;
if (current_buffer->base_buffer && visiting)
@@ -4529,8 +4510,8 @@ This calls `write-region-annotate-functions' at the start, and
if (visiting)
{
SAVE_MODIFF = MODIFF;
- XSETFASTINT (current_buffer->save_length, Z - BEG);
- current_buffer->filename = visit_file;
+ XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG);
+ BVAR (current_buffer, filename) = visit_file;
}
UNGCPRO;
return val;
@@ -4596,7 +4577,7 @@ This calls `write-region-annotate-functions' at the start, and
desc = -1;
if (!NILP (append))
#ifdef DOS_NT
- desc = emacs_open (fn, O_WRONLY | buffer_file_type, 0);
+ desc = emacs_open (fn, O_WRONLY | O_BINARY, 0);
#else /* not DOS_NT */
desc = emacs_open (fn, O_WRONLY, 0);
#endif /* not DOS_NT */
@@ -4604,7 +4585,7 @@ This calls `write-region-annotate-functions' at the start, and
if (desc < 0 && (NILP (append) || errno == ENOENT))
#ifdef DOS_NT
desc = emacs_open (fn,
- O_WRONLY | O_CREAT | buffer_file_type
+ O_WRONLY | O_CREAT | O_BINARY
| (EQ (mustbenew, Qexcl) ? O_EXCL : O_TRUNC),
S_IREAD | S_IWRITE);
#else /* not DOS_NT */
@@ -4743,15 +4724,15 @@ This calls `write-region-annotate-functions' at the start, and
if (visiting)
{
SAVE_MODIFF = MODIFF;
- XSETFASTINT (current_buffer->save_length, Z - BEG);
- current_buffer->filename = visit_file;
+ XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG);
+ BVAR (current_buffer, filename) = visit_file;
update_mode_lines++;
}
else if (quietly)
{
if (auto_saving
- && ! NILP (Fstring_equal (current_buffer->filename,
- current_buffer->auto_save_file_name)))
+ && ! NILP (Fstring_equal (BVAR (current_buffer, filename),
+ BVAR (current_buffer, auto_save_file_name))))
SAVE_MODIFF = MODIFF;
return Qnil;
@@ -4833,10 +4814,10 @@ build_annotations (Lisp_Object start, Lisp_Object end)
}
/* Now do the same for annotation functions implied by the file-format */
- if (auto_saving && (!EQ (current_buffer->auto_save_file_format, Qt)))
- p = current_buffer->auto_save_file_format;
+ if (auto_saving && (!EQ (BVAR (current_buffer, auto_save_file_format), Qt)))
+ p = BVAR (current_buffer, auto_save_file_format);
else
- p = current_buffer->file_format;
+ p = BVAR (current_buffer, file_format);
for (i = 0; CONSP (p); p = XCDR (p), ++i)
{
struct buffer *given_buffer = current_buffer;
@@ -5015,17 +4996,17 @@ See Info node `(elisp)Modification Time' for more details. */)
b = XBUFFER (buf);
}
- if (!STRINGP (b->filename)) return Qt;
+ if (!STRINGP (BVAR (b, filename))) return Qt;
if (b->modtime == 0) return Qt;
/* If the file name has special constructs in it,
call the corresponding file handler. */
- handler = Ffind_file_name_handler (b->filename,
+ handler = Ffind_file_name_handler (BVAR (b, filename),
Qverify_visited_file_modtime);
if (!NILP (handler))
return call2 (handler, Qverify_visited_file_modtime, buf);
- filename = ENCODE_FILE (b->filename);
+ filename = ENCODE_FILE (BVAR (b, filename));
if (stat (SSDATA (filename), &st) < 0)
{
@@ -5093,7 +5074,7 @@ An argument specifies the modification time value to use
struct stat st;
Lisp_Object handler;
- filename = Fexpand_file_name (current_buffer->filename, Qnil);
+ filename = Fexpand_file_name (BVAR (current_buffer, filename), Qnil);
/* If the file name has special constructs in it,
call the corresponding file handler. */
@@ -5128,7 +5109,7 @@ auto_save_error (Lisp_Object error)
ring_bell (XFRAME (selected_frame));
args[0] = build_string ("Auto-saving %s: %s");
- args[1] = current_buffer->name;
+ args[1] = BVAR (current_buffer, name);
args[2] = Ferror_message_string (error);
msg = Fformat (3, args);
GCPRO1 (msg);
@@ -5159,19 +5140,19 @@ auto_save_1 (void)
auto_save_mode_bits = 0666;
/* Get visited file's mode to become the auto save file's mode. */
- if (! NILP (current_buffer->filename))
+ if (! NILP (BVAR (current_buffer, filename)))
{
- if (stat (SSDATA (current_buffer->filename), &st) >= 0)
+ if (stat (SSDATA (BVAR (current_buffer, filename)), &st) >= 0)
/* But make sure we can overwrite it later! */
auto_save_mode_bits = st.st_mode | 0600;
- else if ((modes = Ffile_modes (current_buffer->filename),
+ else if ((modes = Ffile_modes (BVAR (current_buffer, filename)),
INTEGERP (modes)))
/* Remote files don't cooperate with stat. */
auto_save_mode_bits = XINT (modes) | 0600;
}
return
- Fwrite_region (Qnil, Qnil, current_buffer->auto_save_file_name, Qnil,
+ Fwrite_region (Qnil, Qnil, BVAR (current_buffer, auto_save_file_name), Qnil,
NILP (Vauto_save_visited_file_name) ? Qlambda : Qt,
Qnil, Qnil);
}
@@ -5312,18 +5293,18 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
/* Record all the buffers that have auto save mode
in the special file that lists them. For each of these buffers,
Record visited name (if any) and auto save name. */
- if (STRINGP (b->auto_save_file_name)
+ if (STRINGP (BVAR (b, auto_save_file_name))
&& stream != NULL && do_handled_files == 0)
{
BLOCK_INPUT;
- if (!NILP (b->filename))
+ if (!NILP (BVAR (b, filename)))
{
- fwrite (SDATA (b->filename), 1,
- SBYTES (b->filename), stream);
+ fwrite (SDATA (BVAR (b, filename)), 1,
+ SBYTES (BVAR (b, filename)), stream);
}
putc ('\n', stream);
- fwrite (SDATA (b->auto_save_file_name), 1,
- SBYTES (b->auto_save_file_name), stream);
+ fwrite (SDATA (BVAR (b, auto_save_file_name)), 1,
+ SBYTES (BVAR (b, auto_save_file_name)), stream);
putc ('\n', stream);
UNBLOCK_INPUT;
}
@@ -5340,13 +5321,13 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
/* Check for auto save enabled
and file changed since last auto save
and file changed since last real save. */
- if (STRINGP (b->auto_save_file_name)
+ if (STRINGP (BVAR (b, auto_save_file_name))
&& BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)
&& BUF_AUTOSAVE_MODIFF (b) < BUF_MODIFF (b)
/* -1 means we've turned off autosaving for a while--see below. */
- && XINT (b->save_length) >= 0
+ && XINT (BVAR (b, save_length)) >= 0
&& (do_handled_files
- || NILP (Ffind_file_name_handler (b->auto_save_file_name,
+ || NILP (Ffind_file_name_handler (BVAR (b, auto_save_file_name),
Qwrite_region))))
{
EMACS_TIME before_time, after_time;
@@ -5360,23 +5341,23 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
set_buffer_internal (b);
if (NILP (Vauto_save_include_big_deletions)
- && (XFASTINT (b->save_length) * 10
+ && (XFASTINT (BVAR (b, save_length)) * 10
> (BUF_Z (b) - BUF_BEG (b)) * 13)
/* A short file is likely to change a large fraction;
spare the user annoying messages. */
- && XFASTINT (b->save_length) > 5000
+ && XFASTINT (BVAR (b, save_length)) > 5000
/* These messages are frequent and annoying for `*mail*'. */
- && !EQ (b->filename, Qnil)
+ && !EQ (BVAR (b, filename), Qnil)
&& NILP (no_message))
{
/* It has shrunk too much; turn off auto-saving here. */
minibuffer_auto_raise = orig_minibuffer_auto_raise;
message_with_string ("Buffer %s has shrunk a lot; auto save disabled in that buffer until next real save",
- b->name, 1);
+ BVAR (b, name), 1);
minibuffer_auto_raise = 0;
/* Turn off auto-saving until there's a real save,
and prevent any more warnings. */
- XSETINT (b->save_length, -1);
+ XSETINT (BVAR (b, save_length), -1);
Fsleep_for (make_number (1), Qnil);
continue;
}
@@ -5385,7 +5366,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
internal_condition_case (auto_save_1, Qt, auto_save_error);
auto_saved++;
BUF_AUTOSAVE_MODIFF (b) = BUF_MODIFF (b);
- XSETFASTINT (current_buffer->save_length, Z - BEG);
+ XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG);
set_buffer_internal (old);
EMACS_GET_TIME (after_time);
@@ -5432,7 +5413,7 @@ No auto-save file will be written until the buffer changes again. */)
/* FIXME: This should not be called in indirect buffers, since
they're not autosaved. */
BUF_AUTOSAVE_MODIFF (current_buffer) = MODIFF;
- XSETFASTINT (current_buffer->save_length, Z - BEG);
+ XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG);
current_buffer->auto_save_failure_time = -1;
return Qnil;
}
@@ -5586,11 +5567,6 @@ syms_of_fileio (void)
Qexcl = intern_c_string ("excl");
staticpro (&Qexcl);
-#ifdef DOS_NT
- Qfind_buffer_file_type = intern_c_string ("find-buffer-file-type");
- staticpro (&Qfind_buffer_file_type);
-#endif /* DOS_NT */
-
DEFVAR_LISP ("file-name-coding-system", Vfile_name_coding_system,
doc: /* *Coding system for encoding file names.
If it is nil, `default-file-name-coding-system' (which see) is used. */);
diff --git a/src/filelock.c b/src/filelock.c
index 8fa871f56e..8e18bb7b65 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -637,9 +637,9 @@ unlock_all_files (void)
for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail))
{
b = XBUFFER (XCDR (XCAR (tail)));
- if (STRINGP (b->file_truename) && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b))
+ if (STRINGP (BVAR (b, file_truename)) && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b))
{
- unlock_file(b->file_truename);
+ unlock_file(BVAR (b, file_truename));
}
}
}
@@ -652,7 +652,7 @@ or else nothing is done if current buffer isn't visiting a file. */)
(Lisp_Object file)
{
if (NILP (file))
- file = current_buffer->file_truename;
+ file = BVAR (current_buffer, file_truename);
else
CHECK_STRING (file);
if (SAVE_MODIFF < MODIFF
@@ -669,8 +669,8 @@ should not be locked in that case. */)
(void)
{
if (SAVE_MODIFF < MODIFF
- && STRINGP (current_buffer->file_truename))
- unlock_file (current_buffer->file_truename);
+ && STRINGP (BVAR (current_buffer, file_truename)))
+ unlock_file (BVAR (current_buffer, file_truename));
return Qnil;
}
@@ -680,8 +680,8 @@ void
unlock_buffer (struct buffer *buffer)
{
if (BUF_SAVE_MODIFF (buffer) < BUF_MODIFF (buffer)
- && STRINGP (buffer->file_truename))
- unlock_file (buffer->file_truename);
+ && STRINGP (BVAR (buffer, file_truename)))
+ unlock_file (BVAR (buffer, file_truename));
}
DEFUN ("file-locked-p", Ffile_locked_p, Sfile_locked_p, 1, 1, 0,
diff --git a/src/filemode.c b/src/filemode.c
deleted file mode 100644
index d41cd56c56..0000000000
--- a/src/filemode.c
+++ /dev/null
@@ -1,245 +0,0 @@
-/* filemode.c -- make a string describing file modes
- Copyright (C) 1985, 1990, 1993, 2001-2011 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- USA. */
-
-#include <config.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#if !S_IRUSR
-# if S_IREAD
-# define S_IRUSR S_IREAD
-# else
-# define S_IRUSR 00400
-# endif
-#endif
-
-#if !S_IWUSR
-# if S_IWRITE
-# define S_IWUSR S_IWRITE
-# else
-# define S_IWUSR 00200
-# endif
-#endif
-
-#if !S_IXUSR
-# if S_IEXEC
-# define S_IXUSR S_IEXEC
-# else
-# define S_IXUSR 00100
-# endif
-#endif
-
-#ifdef STAT_MACROS_BROKEN
-#undef S_ISBLK
-#undef S_ISCHR
-#undef S_ISDIR
-#undef S_ISFIFO
-#undef S_ISLNK
-#undef S_ISMPB
-#undef S_ISMPC
-#undef S_ISNWK
-#undef S_ISREG
-#undef S_ISSOCK
-#endif /* STAT_MACROS_BROKEN. */
-
-#if !defined(S_ISBLK) && defined(S_IFBLK)
-#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
-#endif
-#if !defined(S_ISCHR) && defined(S_IFCHR)
-#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
-#endif
-#if !defined(S_ISDIR) && defined(S_IFDIR)
-#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
-#endif
-#if !defined(S_ISREG) && defined(S_IFREG)
-#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
-#endif
-#if !defined(S_ISFIFO) && defined(S_IFIFO)
-#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
-#endif
-#if !defined(S_ISLNK) && defined(S_IFLNK)
-#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
-#endif
-#if !defined(S_ISSOCK) && defined(S_IFSOCK)
-#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
-#endif
-#if !defined(S_ISMPB) && defined(S_IFMPB) /* V7 */
-#define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
-#define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
-#endif
-#if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */
-#define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
-#endif
-
-void mode_string (short unsigned int mode, char *str);
-static char ftypelet (long int bits);
-static void rwx (short unsigned int bits, char *chars);
-static void setst (short unsigned int bits, char *chars);
-
-/* filemodestring - fill in string STR with an ls-style ASCII
- representation of the st_mode field of file stats block STATP.
- 10 characters are stored in STR; no terminating null is added.
- The characters stored in STR are:
-
- 0 File type. 'd' for directory, 'c' for character
- special, 'b' for block special, 'm' for multiplex,
- 'l' for symbolic link, 's' for socket, 'p' for fifo,
- '-' for regular, '?' for any other file type
-
- 1 'r' if the owner may read, '-' otherwise.
-
- 2 'w' if the owner may write, '-' otherwise.
-
- 3 'x' if the owner may execute, 's' if the file is
- set-user-id, '-' otherwise.
- 'S' if the file is set-user-id, but the execute
- bit isn't set.
-
- 4 'r' if group members may read, '-' otherwise.
-
- 5 'w' if group members may write, '-' otherwise.
-
- 6 'x' if group members may execute, 's' if the file is
- set-group-id, '-' otherwise.
- 'S' if it is set-group-id but not executable.
-
- 7 'r' if any user may read, '-' otherwise.
-
- 8 'w' if any user may write, '-' otherwise.
-
- 9 'x' if any user may execute, 't' if the file is "sticky"
- (will be retained in swap space after execution), '-'
- otherwise.
- 'T' if the file is sticky but not executable. */
-
-void
-filemodestring (struct stat *statp, char *str)
-{
- mode_string (statp->st_mode, str);
-}
-
-/* Like filemodestring, but only the relevant part of the `struct stat'
- is given as an argument. */
-
-void
-mode_string (short unsigned int mode, char *str)
-{
- str[0] = ftypelet ((long) mode);
- rwx ((mode & 0700) << 0, &str[1]);
- rwx ((mode & 0070) << 3, &str[4]);
- rwx ((mode & 0007) << 6, &str[7]);
- setst (mode, str);
-}
-
-/* Return a character indicating the type of file described by
- file mode BITS:
- 'd' for directories
- 'b' for block special files
- 'c' for character special files
- 'm' for multiplexor files
- 'l' for symbolic links
- 's' for sockets
- 'p' for fifos
- '-' for regular files
- '?' for any other file type. */
-
-static char
-ftypelet (long int bits)
-{
-#ifdef S_ISBLK
- if (S_ISBLK (bits))
- return 'b';
-#endif
- if (S_ISCHR (bits))
- return 'c';
- if (S_ISDIR (bits))
- return 'd';
- if (S_ISREG (bits))
- return '-';
-#ifdef S_ISFIFO
- if (S_ISFIFO (bits))
- return 'p';
-#endif
-#ifdef S_ISLNK
- if (S_ISLNK (bits))
- return 'l';
-#endif
-#ifdef S_ISSOCK
- if (S_ISSOCK (bits))
- return 's';
-#endif
-#ifdef S_ISMPC
- if (S_ISMPC (bits))
- return 'm';
-#endif
-#ifdef S_ISNWK
- if (S_ISNWK (bits))
- return 'n';
-#endif
- return '?';
-}
-
-/* Look at read, write, and execute bits in BITS and set
- flags in CHARS accordingly. */
-
-static void
-rwx (short unsigned int bits, char *chars)
-{
- chars[0] = (bits & S_IRUSR) ? 'r' : '-';
- chars[1] = (bits & S_IWUSR) ? 'w' : '-';
- chars[2] = (bits & S_IXUSR) ? 'x' : '-';
-}
-
-/* Set the 's' and 't' flags in file attributes string CHARS,
- according to the file mode BITS. */
-
-static void
-setst (short unsigned int bits, char *chars)
-{
-#ifdef S_ISUID
- if (bits & S_ISUID)
- {
- if (chars[3] != 'x')
- /* Set-uid, but not executable by owner. */
- chars[3] = 'S';
- else
- chars[3] = 's';
- }
-#endif
-#ifdef S_ISGID
- if (bits & S_ISGID)
- {
- if (chars[6] != 'x')
- /* Set-gid, but not executable by group. */
- chars[6] = 'S';
- else
- chars[6] = 's';
- }
-#endif
-#ifdef S_ISVTX
- if (bits & S_ISVTX)
- {
- if (chars[9] != 'x')
- /* Sticky, but not executable by others. */
- chars[9] = 'T';
- else
- chars[9] = 't';
- }
-#endif
-}
-
diff --git a/src/fns.c b/src/fns.c
index 326f210f84..5748c3d6e0 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -2987,7 +2987,7 @@ into shorter lines. */)
SAFE_ALLOCA (encoded, char *, allength);
encoded_length = base64_encode_1 ((char *) BYTE_POS_ADDR (ibeg),
encoded, length, NILP (no_line_break),
- !NILP (current_buffer->enable_multibyte_characters));
+ !NILP (BVAR (current_buffer, enable_multibyte_characters)));
if (encoded_length > allength)
abort ();
@@ -3169,7 +3169,7 @@ If the region can't be decoded, signal an error and don't modify the buffer. */
EMACS_INT old_pos = PT;
EMACS_INT decoded_length;
EMACS_INT inserted_chars;
- int multibyte = !NILP (current_buffer->enable_multibyte_characters);
+ int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
USE_SAFE_ALLOCA;
validate_region (&beg, &end);
@@ -4687,12 +4687,12 @@ guesswork fails. Normally, an error is signaled in such case. */)
{
int force_raw_text = 0;
- coding_system = XBUFFER (object)->buffer_file_coding_system;
+ coding_system = BVAR (XBUFFER (object), buffer_file_coding_system);
if (NILP (coding_system)
|| NILP (Flocal_variable_p (Qbuffer_file_coding_system, Qnil)))
{
coding_system = Qnil;
- if (NILP (current_buffer->enable_multibyte_characters))
+ if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
force_raw_text = 1;
}
@@ -4709,11 +4709,11 @@ guesswork fails. Normally, an error is signaled in such case. */)
}
if (NILP (coding_system)
- && !NILP (XBUFFER (object)->buffer_file_coding_system))
+ && !NILP (BVAR (XBUFFER (object), buffer_file_coding_system)))
{
/* If we still have not decided a coding system, use the
default value of buffer-file-coding-system. */
- coding_system = XBUFFER (object)->buffer_file_coding_system;
+ coding_system = BVAR (XBUFFER (object), buffer_file_coding_system);
}
if (!force_raw_text
diff --git a/src/font.c b/src/font.c
index 841125a058..d77eafb6ad 100644
--- a/src/font.c
+++ b/src/font.c
@@ -3637,7 +3637,7 @@ font_at (int c, EMACS_INT pos, struct face *face, struct window *w,
Lisp_Object font_object;
multibyte = (NILP (string)
- ? ! NILP (current_buffer->enable_multibyte_characters)
+ ? ! NILP (BVAR (current_buffer, enable_multibyte_characters))
: STRING_MULTIBYTE (string));
if (c < 0)
{
diff --git a/src/frame.c b/src/frame.c
index 20bad4cb8c..56e0e7ec91 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -428,20 +428,20 @@ make_frame_without_minibuffer (register Lisp_Object mini_window, KBOARD *kb, Lis
if (NILP (mini_window))
{
/* Use default-minibuffer-frame if possible. */
- if (!FRAMEP (kb->Vdefault_minibuffer_frame)
- || ! FRAME_LIVE_P (XFRAME (kb->Vdefault_minibuffer_frame)))
+ if (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame))
+ || ! FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame))))
{
Lisp_Object frame_dummy;
XSETFRAME (frame_dummy, f);
GCPRO1 (frame_dummy);
/* If there's no minibuffer frame to use, create one. */
- kb->Vdefault_minibuffer_frame =
+ KVAR (kb, Vdefault_minibuffer_frame) =
call1 (intern ("make-initial-minibuffer-frame"), display);
UNGCPRO;
}
- mini_window = XFRAME (kb->Vdefault_minibuffer_frame)->minibuffer_window;
+ mini_window = XFRAME (KVAR (kb, Vdefault_minibuffer_frame))->minibuffer_window;
}
f->minibuffer_window = mini_window;
@@ -889,7 +889,7 @@ to that frame. */)
(Lisp_Object event)
{
/* Preserve prefix arg that the command loop just cleared. */
- current_kboard->Vprefix_arg = Vcurrent_prefix_arg;
+ KVAR (current_kboard, Vprefix_arg) = Vcurrent_prefix_arg;
call1 (Vrun_hooks, Qmouse_leave_buffer_hook);
return do_switch_frame (event, 0, 0, Qnil);
}
@@ -1526,7 +1526,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
/* If we've deleted this keyboard's default_minibuffer_frame, try to
find another one. Prefer minibuffer-only frames, but also notice
frames with other windows. */
- if (kb != NULL && EQ (frame, kb->Vdefault_minibuffer_frame))
+ if (kb != NULL && EQ (frame, KVAR (kb, Vdefault_minibuffer_frame)))
{
Lisp_Object frames;
@@ -1575,11 +1575,11 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
if (NILP (frame_with_minibuf))
abort ();
- kb->Vdefault_minibuffer_frame = frame_with_minibuf;
+ KVAR (kb, Vdefault_minibuffer_frame) = frame_with_minibuf;
}
else
/* No frames left on this kboard--say no minibuffer either. */
- kb->Vdefault_minibuffer_frame = Qnil;
+ KVAR (kb, Vdefault_minibuffer_frame) = Qnil;
}
/* Cause frame titles to update--necessary if we now have just one frame. */
@@ -1817,7 +1817,7 @@ make_frame_visible_1 (Lisp_Object window)
w = XWINDOW (window);
if (!NILP (w->buffer))
- XBUFFER (w->buffer)->display_time = Fcurrent_time ();
+ BVAR (XBUFFER (w->buffer), display_time) = Fcurrent_time ();
if (!NILP (w->vchild))
make_frame_visible_1 (w->vchild);
diff --git a/src/fringe.c b/src/fringe.c
index 5c9088a924..d42d6467f3 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -660,7 +660,7 @@ get_logical_cursor_bitmap (struct window *w, Lisp_Object cursor)
{
Lisp_Object cmap, bm = Qnil;
- if ((cmap = XBUFFER (w->buffer)->fringe_cursor_alist), !NILP (cmap))
+ if ((cmap = BVAR (XBUFFER (w->buffer), fringe_cursor_alist)), !NILP (cmap))
{
bm = Fassq (cursor, cmap);
if (CONSP (bm))
@@ -670,9 +670,9 @@ get_logical_cursor_bitmap (struct window *w, Lisp_Object cursor)
return lookup_fringe_bitmap (bm);
}
}
- if (EQ (cmap, buffer_defaults.fringe_cursor_alist))
+ if (EQ (cmap, BVAR (&buffer_defaults, fringe_cursor_alist)))
return NO_FRINGE_BITMAP;
- bm = Fassq (cursor, buffer_defaults.fringe_cursor_alist);
+ bm = Fassq (cursor, BVAR (&buffer_defaults, fringe_cursor_alist));
if (!CONSP (bm) || ((bm = XCDR (bm)), NILP (bm)))
return NO_FRINGE_BITMAP;
return lookup_fringe_bitmap (bm);
@@ -697,7 +697,7 @@ get_logical_fringe_bitmap (struct window *w, Lisp_Object bitmap, int right_p, in
If partial, lookup partial bitmap in default value if not found here.
If not partial, or no partial spec is present, use non-partial bitmap. */
- if ((cmap = XBUFFER (w->buffer)->fringe_indicator_alist), !NILP (cmap))
+ if ((cmap = BVAR (XBUFFER (w->buffer), fringe_indicator_alist)), !NILP (cmap))
{
bm1 = Fassq (bitmap, cmap);
if (CONSP (bm1))
@@ -731,10 +731,10 @@ get_logical_fringe_bitmap (struct window *w, Lisp_Object bitmap, int right_p, in
}
}
- if (!EQ (cmap, buffer_defaults.fringe_indicator_alist)
- && !NILP (buffer_defaults.fringe_indicator_alist))
+ if (!EQ (cmap, BVAR (&buffer_defaults, fringe_indicator_alist))
+ && !NILP (BVAR (&buffer_defaults, fringe_indicator_alist)))
{
- bm2 = Fassq (bitmap, buffer_defaults.fringe_indicator_alist);
+ bm2 = Fassq (bitmap, BVAR (&buffer_defaults, fringe_indicator_alist));
if (CONSP (bm2))
{
if ((bm2 = XCDR (bm2)), !NILP (bm2))
@@ -919,7 +919,7 @@ update_window_fringes (struct window *w, int keep_current_p)
return 0;
if (!MINI_WINDOW_P (w)
- && (ind = XBUFFER (w->buffer)->indicate_buffer_boundaries, !NILP (ind)))
+ && (ind = BVAR (XBUFFER (w->buffer), indicate_buffer_boundaries), !NILP (ind)))
{
if (EQ (ind, Qleft) || EQ (ind, Qright))
boundary_top = boundary_bot = arrow_top = arrow_bot = ind;
@@ -988,7 +988,7 @@ update_window_fringes (struct window *w, int keep_current_p)
}
}
- empty_pos = XBUFFER (w->buffer)->indicate_empty_lines;
+ empty_pos = BVAR (XBUFFER (w->buffer), indicate_empty_lines);
if (!NILP (empty_pos) && !EQ (empty_pos, Qright))
empty_pos = WINDOW_LEFT_FRINGE_WIDTH (w) == 0 ? Qright : Qleft;
diff --git a/src/getloadavg.c b/src/getloadavg.c
deleted file mode 100644
index d9c24717b7..0000000000
--- a/src/getloadavg.c
+++ /dev/null
@@ -1,1037 +0,0 @@
-/* Get the system load averages.
- Copyright (C) 1985, 1986, 1987, 1988, 1989, 1991, 1992, 1993, 1994, 1995,
- 1997, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
- Free Software Foundation, Inc.
-
- NOTE: The canonical source of this file is maintained with gnulib.
- Bugs can be reported to bug-gnulib@gnu.org.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- USA. */
-
-/* Compile-time symbols that this file uses:
-
- HAVE_PSTAT_GETDYNAMIC Define this if your system has the
- pstat_getdynamic function. I think it
- is unique to HPUX9. The best way to get the
- definition is through the AC_FUNC_GETLOADAVG
- macro that comes with autoconf 2.13 or newer.
- If that isn't an option, then just put
- AC_CHECK_FUNCS(pstat_getdynamic) in your
- configure.in file.
- FIXUP_KERNEL_SYMBOL_ADDR() Adjust address in returned struct nlist.
- KERNEL_FILE Pathname of the kernel to nlist.
- LDAV_CVT() Scale the load average from the kernel.
- Returns a double.
- LDAV_SYMBOL Name of kernel symbol giving load average.
- LOAD_AVE_TYPE Type of the load average array in the kernel.
- Must be defined unless one of
- apollo, DGUX, NeXT, or UMAX is defined;
- or we have libkstat;
- otherwise, no load average is available.
- HAVE_NLIST_H nlist.h is available. NLIST_STRUCT defaults
- to this.
- NLIST_STRUCT Include nlist.h, not a.out.h, and
- the nlist n_name element is a pointer,
- not an array.
- HAVE_STRUCT_NLIST_N_UN_N_NAME `n_un.n_name' is member of `struct nlist'.
- LINUX_LDAV_FILE [__linux__]: File containing load averages.
- HAVE_LOCALE_H locale.h is available.
- HAVE_SETLOCALE The `setlocale' function is available.
-
- Specific system predefines this file uses, aside from setting
- default values if not emacs:
-
- apollo
- BSD Real BSD, not just BSD-like.
- convex
- DGUX
- eunice UNIX emulator under VMS.
- hpux
- __MSDOS__ No-op for MSDOS.
- NeXT
- sgi
- sequent Sequent Dynix 3.x.x (BSD)
- _SEQUENT_ Sequent DYNIX/ptx 1.x.x (SYSV)
- sony_news NEWS-OS (works at least for 4.1C)
- UMAX
- UMAX4_3
- VMS
- WINDOWS32 No-op for Windows95/NT.
- __linux__ Linux: assumes /proc filesystem mounted.
- Support from Michael K. Johnson.
- __NetBSD__ NetBSD: assumes /kern filesystem mounted.
-
- In addition, to avoid nesting many #ifdefs, we internally set
- LDAV_DONE to indicate that the load average has been computed.
-
- We also #define LDAV_PRIVILEGED if a program will require
- special installation to be able to call getloadavg. */
-
-/* This should always be first. */
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <sys/types.h>
-
-/* Both the Emacs and non-Emacs sections want this. Some
- configuration files' definitions for the LOAD_AVE_CVT macro (like
- sparc.h's) use macros like FSCALE, defined here. */
-#if defined (unix) || defined (__unix)
-# include <sys/param.h>
-#endif
-
-
-/* Exclude all the code except the test program at the end
- if the system has its own `getloadavg' function.
-
- The declaration of `errno' is needed by the test program
- as well as the function itself, so it comes first. */
-
-#include <errno.h>
-
-#ifndef errno
-extern int errno;
-#endif
-
-#ifdef HAVE_LOCALE_H
-# include <locale.h>
-#endif
-#ifndef HAVE_SETLOCALE
-# define setlocale(Category, Locale) /* empty */
-#endif
-
-#ifndef HAVE_GETLOADAVG
-
-/* The existing Emacs configuration files define a macro called
- LOAD_AVE_CVT, which accepts a value of type LOAD_AVE_TYPE, and
- returns the load average multiplied by 100. What we actually want
- is a macro called LDAV_CVT, which returns the load average as an
- unmultiplied double.
-
- For backwards compatibility, we'll define LDAV_CVT in terms of
- LOAD_AVE_CVT, but future machine config files should just define
- LDAV_CVT directly. */
-
-# if !defined(LDAV_CVT) && defined(LOAD_AVE_CVT)
-# define LDAV_CVT(n) (LOAD_AVE_CVT (n) / 100.0)
-# endif
-
-# if !defined (BSD) && defined (ultrix)
-/* Ultrix behaves like BSD on Vaxen. */
-# define BSD
-# endif
-
-# ifdef NeXT
-/* NeXT in the 2.{0,1,2} releases defines BSD in <sys/param.h>, which
- conflicts with the definition understood in this file, that this
- really is BSD. */
-# undef BSD
-
-/* NeXT defines FSCALE in <sys/param.h>. However, we take FSCALE being
- defined to mean that the nlist method should be used, which is not true. */
-# undef FSCALE
-# endif
-
-/* Same issues as for NeXT apply to the HURD-based GNU system. */
-# ifdef __GNU__
-# undef BSD
-# undef FSCALE
-# endif /* __GNU__ */
-
-/* Set values that are different from the defaults, which are
- set a little farther down with #ifndef. */
-
-
-/* Some shorthands. */
-
-# if defined (HPUX) && !defined (hpux)
-# define hpux
-# endif
-
-# if defined (__hpux) && !defined (hpux)
-# define hpux
-# endif
-
-# if defined (__sun) && !defined (sun)
-# define sun
-# endif
-
-# if defined(hp300) && !defined(hpux)
-# define MORE_BSD
-# endif
-
-# if defined(ultrix) && defined(mips)
-# define decstation
-# endif
-
-# if defined (__SVR4) && !defined (SVR4)
-# define SVR4
-# endif
-
-# if (defined(sun) && defined(SVR4)) || defined (SOLARIS2)
-# define SUNOS_5
-# endif
-
-# if defined (__osf__) && (defined (__alpha) || defined (__alpha__))
-# define OSF_ALPHA
-# include <sys/mbuf.h>
-# include <sys/socket.h>
-# include <net/route.h>
-# include <sys/table.h>
-# endif
-
-# if defined (__osf__) && (defined (mips) || defined (__mips__))
-# define OSF_MIPS
-# include <sys/table.h>
-# endif
-
-/* UTek's /bin/cc on the 4300 has no architecture specific cpp define by
- default, but _MACH_IND_SYS_TYPES is defined in <sys/types.h>. Combine
- that with a couple of other things and we'll have a unique match. */
-# if !defined (tek4300) && defined (unix) && defined (m68k) && defined (mc68000) && defined (mc68020) && defined (_MACH_IND_SYS_TYPES)
-# define tek4300 /* Define by emacs, but not by other users. */
-# endif
-
-
-/* VAX C can't handle multi-line #ifs, or lines longer than 256 chars. */
-# ifndef LOAD_AVE_TYPE
-
-# ifdef MORE_BSD
-# define LOAD_AVE_TYPE long
-# endif
-
-# ifdef sun
-# define LOAD_AVE_TYPE long
-# endif
-
-# ifdef decstation
-# define LOAD_AVE_TYPE long
-# endif
-
-# ifdef _SEQUENT_
-# define LOAD_AVE_TYPE long
-# endif
-
-# ifdef sgi
-# define LOAD_AVE_TYPE long
-# endif
-
-# ifdef SVR4
-# define LOAD_AVE_TYPE long
-# endif
-
-# ifdef sony_news
-# define LOAD_AVE_TYPE long
-# endif
-
-# ifdef sequent
-# define LOAD_AVE_TYPE long
-# endif
-
-# ifdef OSF_ALPHA
-# define LOAD_AVE_TYPE long
-# endif
-
-# if defined (ardent) && defined (titan)
-# define LOAD_AVE_TYPE long
-# endif
-
-# ifdef tek4300
-# define LOAD_AVE_TYPE long
-# endif
-
-# if defined(alliant) && defined(i860) /* Alliant FX/2800 */
-# define LOAD_AVE_TYPE long
-# endif
-
-# ifdef _AIX
-# define LOAD_AVE_TYPE long
-# endif
-
-# ifdef convex
-# define LOAD_AVE_TYPE double
-# ifndef LDAV_CVT
-# define LDAV_CVT(n) (n)
-# endif
-# endif
-
-# endif /* No LOAD_AVE_TYPE. */
-
-# ifdef OSF_ALPHA
-/* <sys/param.h> defines an incorrect value for FSCALE on Alpha OSF/1,
- according to ghazi@noc.rutgers.edu. */
-# undef FSCALE
-# define FSCALE 1024.0
-# endif
-
-# if defined(alliant) && defined(i860) /* Alliant FX/2800 */
-/* <sys/param.h> defines an incorrect value for FSCALE on an
- Alliant FX/2800 Concentrix 2.2, according to ghazi@noc.rutgers.edu. */
-# undef FSCALE
-# define FSCALE 100.0
-# endif
-
-
-# ifndef FSCALE
-
-/* SunOS and some others define FSCALE in sys/param.h. */
-
-# ifdef MORE_BSD
-# define FSCALE 2048.0
-# endif
-
-# if defined(MIPS) || defined(SVR4) || defined(decstation)
-# define FSCALE 256
-# endif
-
-# if defined (sgi) || defined (sequent)
-/* Sometimes both MIPS and sgi are defined, so FSCALE was just defined
- above under #ifdef MIPS. But we want the sgi value. */
-# undef FSCALE
-# define FSCALE 1000.0
-# endif
-
-# if defined (ardent) && defined (titan)
-# define FSCALE 65536.0
-# endif
-
-# ifdef tek4300
-# define FSCALE 100.0
-# endif
-
-# ifdef _AIX
-# define FSCALE 65536.0
-# endif
-
-# endif /* Not FSCALE. */
-
-# if !defined (LDAV_CVT) && defined (FSCALE)
-# define LDAV_CVT(n) (((double) (n)) / FSCALE)
-# endif
-
-# ifndef NLIST_STRUCT
-# if HAVE_NLIST_H
-# define NLIST_STRUCT
-# endif
-# endif
-
-# if defined(sgi) || (defined(mips) && !defined(BSD))
-# define FIXUP_KERNEL_SYMBOL_ADDR(nl) ((nl)[0].n_value &= ~(1 << 31))
-# endif
-
-
-# if !defined (KERNEL_FILE) && defined (sequent)
-# define KERNEL_FILE "/dynix"
-# endif
-
-# if !defined (KERNEL_FILE) && defined (hpux)
-# define KERNEL_FILE "/hp-ux"
-# endif
-
-# if !defined(KERNEL_FILE) && (defined(_SEQUENT_) || defined(MIPS) || defined(SVR4) || defined(ISC) || defined (sgi) || (defined (ardent) && defined (titan)))
-# define KERNEL_FILE "/unix"
-# endif
-
-
-# if !defined (LDAV_SYMBOL) && defined (alliant)
-# define LDAV_SYMBOL "_Loadavg"
-# endif
-
-# if !defined(LDAV_SYMBOL) && ((defined(hpux) && !defined(hp9000s300)) || defined(_SEQUENT_) || defined(SVR4) || defined(ISC) || defined(sgi) || (defined (ardent) && defined (titan)) || defined (_AIX))
-# define LDAV_SYMBOL "avenrun"
-# endif
-
-# include <unistd.h>
-# include <stdio.h>
-
-/* LOAD_AVE_TYPE should only get defined if we're going to use the
- nlist method. */
-# if !defined(LOAD_AVE_TYPE) && (defined(BSD) || defined(LDAV_CVT) || defined(KERNEL_FILE) || defined(LDAV_SYMBOL))
-# define LOAD_AVE_TYPE double
-# endif
-
-# ifdef LOAD_AVE_TYPE
-
-# ifndef VMS
-# ifndef __linux__
-# ifndef NLIST_STRUCT
-# include <a.out.h>
-# else /* NLIST_STRUCT */
-# include <nlist.h>
-# endif /* NLIST_STRUCT */
-
-# ifdef SUNOS_5
-# include <fcntl.h>
-# include <kvm.h>
-# include <kstat.h>
-# endif
-
-# if defined (hpux) && defined (HAVE_PSTAT_GETDYNAMIC)
-# include <sys/pstat.h>
-# endif
-
-# ifndef KERNEL_FILE
-# define KERNEL_FILE "/vmunix"
-# endif /* KERNEL_FILE */
-
-# ifndef LDAV_SYMBOL
-# define LDAV_SYMBOL "_avenrun"
-# endif /* LDAV_SYMBOL */
-# endif /* __linux__ */
-
-# else /* VMS */
-
-# ifndef eunice
-# include <iodef.h>
-# include <descrip.h>
-# else /* eunice */
-# include <vms/iodef.h>
-# endif /* eunice */
-# endif /* VMS */
-
-# ifndef LDAV_CVT
-# define LDAV_CVT(n) ((double) (n))
-# endif /* !LDAV_CVT */
-
-# endif /* LOAD_AVE_TYPE */
-
-# if defined(__GNU__) && !defined (NeXT)
-/* Note that NeXT Openstep defines __GNU__ even though it should not. */
-/* GNU system acts much like NeXT, for load average purposes,
- but not exactly. */
-# define NeXT
-# define host_self mach_host_self
-# endif
-
-# ifdef NeXT
-# ifdef HAVE_MACH_MACH_H
-# include <mach/mach.h>
-# else
-# include <mach.h>
-# endif
-# endif /* NeXT */
-
-# ifdef sgi
-# include <sys/sysmp.h>
-# endif /* sgi */
-
-# ifdef UMAX
-# include <stdio.h>
-# include <signal.h>
-# include <sys/time.h>
-# include <sys/wait.h>
-# include <sys/syscall.h>
-
-# ifdef UMAX_43
-# include <machine/cpu.h>
-# include <inq_stats/statistics.h>
-# include <inq_stats/sysstats.h>
-# include <inq_stats/cpustats.h>
-# include <inq_stats/procstats.h>
-# else /* Not UMAX_43. */
-# include <sys/sysdefs.h>
-# include <sys/statistics.h>
-# include <sys/sysstats.h>
-# include <sys/cpudefs.h>
-# include <sys/cpustats.h>
-# include <sys/procstats.h>
-# endif /* Not UMAX_43. */
-# endif /* UMAX */
-
-# ifdef DGUX
-# include <sys/dg_sys_info.h>
-# endif
-
-# if defined(HAVE_FCNTL_H) || defined(_POSIX_VERSION)
-# include <fcntl.h>
-# else
-# include <sys/file.h>
-# endif
-
-/* Avoid static vars inside a function since in HPUX they dump as pure. */
-
-# ifdef NeXT
-static processor_set_t default_set;
-static int getloadavg_initialized;
-# endif /* NeXT */
-
-# ifdef UMAX
-static unsigned int cpus = 0;
-static unsigned int samples;
-# endif /* UMAX */
-
-# ifdef DGUX
-static struct dg_sys_info_load_info load_info; /* what-a-mouthful! */
-# endif /* DGUX */
-
-#if !defined(HAVE_LIBKSTAT) && defined(LOAD_AVE_TYPE)
-/* File descriptor open to /dev/kmem or VMS load ave driver. */
-static int channel;
-/* Nonzero if channel is valid. */
-static int getloadavg_initialized;
-/* Offset in kmem to seek to read load average, or 0 means invalid. */
-static long offset;
-
-# if !defined(VMS) && !defined(sgi) && !defined(__linux__)
-static struct nlist name_list[2];
-# endif /* Not VMS or sgi */
-
-# ifdef SUNOS_5
-static kvm_t *kd;
-# endif /* SUNOS_5 */
-
-#endif /* LOAD_AVE_TYPE && !HAVE_LIBKSTAT */
-
-/* Put the 1 minute, 5 minute and 15 minute load averages
- into the first NELEM elements of LOADAVG.
- Return the number written (never more than 3, but may be less than NELEM),
- or -1 if an error occurred. */
-
-int
-getloadavg (loadavg, nelem)
- double loadavg[];
- int nelem;
-{
- int elem = 0; /* Return value. */
-
-# ifdef NO_GET_LOAD_AVG
-# define LDAV_DONE
- /* Set errno to zero to indicate that there was no particular error;
- this function just can't work at all on this system. */
- errno = 0;
- elem = -1;
-# endif
-
-# if !defined (LDAV_DONE) && defined (HAVE_LIBKSTAT)
-/* Use libkstat because we don't have to be root. */
-# define LDAV_DONE
- kstat_ctl_t *kc;
- kstat_t *ksp;
- kstat_named_t *kn;
-
- kc = kstat_open ();
- if (kc == 0)
- return -1;
- ksp = kstat_lookup (kc, "unix", 0, "system_misc");
- if (ksp == 0 )
- return -1;
- if (kstat_read (kc, ksp, 0) == -1)
- return -1;
-
-
- kn = kstat_data_lookup (ksp, "avenrun_1min");
- if (kn == 0)
- {
- /* Return -1 if no load average information is available. */
- nelem = 0;
- elem = -1;
- }
-
- if (nelem >= 1)
- loadavg[elem++] = (double) kn->value.ul/FSCALE;
-
- if (nelem >= 2)
- {
- kn = kstat_data_lookup (ksp, "avenrun_5min");
- if (kn != 0)
- {
- loadavg[elem++] = (double) kn->value.ul/FSCALE;
-
- if (nelem >= 3)
- {
- kn = kstat_data_lookup (ksp, "avenrun_15min");
- if (kn != 0)
- loadavg[elem++] = (double) kn->value.ul/FSCALE;
- }
- }
- }
-
- kstat_close (kc);
-# endif /* HAVE_LIBKSTAT */
-
-# if !defined (LDAV_DONE) && defined (hpux) && defined (HAVE_PSTAT_GETDYNAMIC)
-/* Use pstat_getdynamic() because we don't have to be root. */
-# define LDAV_DONE
-# undef LOAD_AVE_TYPE
-
- struct pst_dynamic dyn_info;
- if (pstat_getdynamic (&dyn_info, sizeof (dyn_info), 0, 0) < 0)
- return -1;
- if (nelem > 0)
- loadavg[elem++] = dyn_info.psd_avg_1_min;
- if (nelem > 1)
- loadavg[elem++] = dyn_info.psd_avg_5_min;
- if (nelem > 2)
- loadavg[elem++] = dyn_info.psd_avg_15_min;
-
-# endif /* hpux && HAVE_PSTAT_GETDYNAMIC */
-
-# if !defined (LDAV_DONE) && defined (__linux__)
-# define LDAV_DONE
-# undef LOAD_AVE_TYPE
-
-# ifndef LINUX_LDAV_FILE
-# define LINUX_LDAV_FILE "/proc/loadavg"
-# endif
-
- char ldavgbuf[40];
- double load_ave[3];
- int fd, count;
-
- fd = open (LINUX_LDAV_FILE, O_RDONLY);
- if (fd == -1)
- return -1;
- count = read (fd, ldavgbuf, 40);
- (void) close (fd);
- if (count <= 0)
- return -1;
-
- /* The following sscanf must use the C locale. */
- setlocale (LC_NUMERIC, "C");
- count = sscanf (ldavgbuf, "%lf %lf %lf",
- &load_ave[0], &load_ave[1], &load_ave[2]);
- setlocale (LC_NUMERIC, "");
- if (count < 1)
- return -1;
-
- for (elem = 0; elem < nelem && elem < count; elem++)
- loadavg[elem] = load_ave[elem];
-
- return elem;
-
-# endif /* __linux__ */
-
-# if !defined (LDAV_DONE) && defined (__NetBSD__)
-# define LDAV_DONE
-# undef LOAD_AVE_TYPE
-
-# ifndef NETBSD_LDAV_FILE
-# define NETBSD_LDAV_FILE "/kern/loadavg"
-# endif
-
- unsigned long int load_ave[3], scale;
- int count;
- FILE *fp;
-
- fp = fopen (NETBSD_LDAV_FILE, "r");
- if (fp == NULL)
- return -1;
- count = fscanf (fp, "%lu %lu %lu %lu\n",
- &load_ave[0], &load_ave[1], &load_ave[2],
- &scale);
- (void) fclose (fp);
- if (count != 4)
- return -1;
-
- for (elem = 0; elem < nelem; elem++)
- loadavg[elem] = (double) load_ave[elem] / (double) scale;
-
- return elem;
-
-# endif /* __NetBSD__ */
-
-# if !defined (LDAV_DONE) && defined (NeXT)
-# define LDAV_DONE
- /* The NeXT code was adapted from iscreen 3.2. */
-
- host_t host;
- struct processor_set_basic_info info;
- unsigned info_count;
-
- /* We only know how to get the 1-minute average for this system,
- so even if the caller asks for more than 1, we only return 1. */
-
- if (!getloadavg_initialized)
- {
- if (processor_set_default (host_self (), &default_set) == KERN_SUCCESS)
- getloadavg_initialized = 1;
- }
-
- if (getloadavg_initialized)
- {
- info_count = PROCESSOR_SET_BASIC_INFO_COUNT;
- if (processor_set_info (default_set, PROCESSOR_SET_BASIC_INFO, &host,
- (processor_set_info_t) &info, &info_count)
- != KERN_SUCCESS)
- getloadavg_initialized = 0;
- else
- {
- if (nelem > 0)
- loadavg[elem++] = (double) info.load_average / LOAD_SCALE;
- }
- }
-
- if (!getloadavg_initialized)
- return -1;
-# endif /* NeXT */
-
-# if !defined (LDAV_DONE) && defined (UMAX)
-# define LDAV_DONE
-/* UMAX 4.2, which runs on the Encore Multimax multiprocessor, does not
- have a /dev/kmem. Information about the workings of the running kernel
- can be gathered with inq_stats system calls.
- We only know how to get the 1-minute average for this system. */
-
- struct proc_summary proc_sum_data;
- struct stat_descr proc_info;
- double load;
- register unsigned int i, j;
-
- if (cpus == 0)
- {
- register unsigned int c, i;
- struct cpu_config conf;
- struct stat_descr desc;
-
- desc.sd_next = 0;
- desc.sd_subsys = SUBSYS_CPU;
- desc.sd_type = CPUTYPE_CONFIG;
- desc.sd_addr = (char *) &conf;
- desc.sd_size = sizeof conf;
-
- if (inq_stats (1, &desc))
- return -1;
-
- c = 0;
- for (i = 0; i < conf.config_maxclass; ++i)
- {
- struct class_stats stats;
- memset (&stats, 0, sizeof stats);
-
- desc.sd_type = CPUTYPE_CLASS;
- desc.sd_objid = i;
- desc.sd_addr = (char *) &stats;
- desc.sd_size = sizeof stats;
-
- if (inq_stats (1, &desc))
- return -1;
-
- c += stats.class_numcpus;
- }
- cpus = c;
- samples = cpus < 2 ? 3 : (2 * cpus / 3);
- }
-
- proc_info.sd_next = 0;
- proc_info.sd_subsys = SUBSYS_PROC;
- proc_info.sd_type = PROCTYPE_SUMMARY;
- proc_info.sd_addr = (char *) &proc_sum_data;
- proc_info.sd_size = sizeof (struct proc_summary);
- proc_info.sd_sizeused = 0;
-
- if (inq_stats (1, &proc_info) != 0)
- return -1;
-
- load = proc_sum_data.ps_nrunnable;
- j = 0;
- for (i = samples - 1; i > 0; --i)
- {
- load += proc_sum_data.ps_nrun[j];
- if (j++ == PS_NRUNSIZE)
- j = 0;
- }
-
- if (nelem > 0)
- loadavg[elem++] = load / samples / cpus;
-# endif /* UMAX */
-
-# if !defined (LDAV_DONE) && defined (DGUX)
-# define LDAV_DONE
- /* This call can return -1 for an error, but with good args
- it's not supposed to fail. The first argument is for no
- apparent reason of type `long int *'. */
- dg_sys_info ((long int *) &load_info,
- DG_SYS_INFO_LOAD_INFO_TYPE,
- DG_SYS_INFO_LOAD_VERSION_0);
-
- if (nelem > 0)
- loadavg[elem++] = load_info.one_minute;
- if (nelem > 1)
- loadavg[elem++] = load_info.five_minute;
- if (nelem > 2)
- loadavg[elem++] = load_info.fifteen_minute;
-# endif /* DGUX */
-
-# if !defined (LDAV_DONE) && defined (apollo)
-# define LDAV_DONE
-/* Apollo code from lisch@mentorg.com (Ray Lischner).
-
- This system call is not documented. The load average is obtained as
- three long integers, for the load average over the past minute,
- five minutes, and fifteen minutes. Each value is a scaled integer,
- with 16 bits of integer part and 16 bits of fraction part.
-
- I'm not sure which operating system first supported this system call,
- but I know that SR10.2 supports it. */
-
- extern void proc1_$get_loadav ();
- unsigned long load_ave[3];
-
- proc1_$get_loadav (load_ave);
-
- if (nelem > 0)
- loadavg[elem++] = load_ave[0] / 65536.0;
- if (nelem > 1)
- loadavg[elem++] = load_ave[1] / 65536.0;
- if (nelem > 2)
- loadavg[elem++] = load_ave[2] / 65536.0;
-# endif /* apollo */
-
-# if !defined (LDAV_DONE) && defined (OSF_MIPS)
-# define LDAV_DONE
-
- struct tbl_loadavg load_ave;
- table (TBL_LOADAVG, 0, &load_ave, 1, sizeof (load_ave));
- loadavg[elem++]
- = (load_ave.tl_lscale == 0
- ? load_ave.tl_avenrun.d[0]
- : (load_ave.tl_avenrun.l[0] / (double) load_ave.tl_lscale));
-# endif /* OSF_MIPS */
-
-# if !defined (LDAV_DONE) && (defined (__MSDOS__) || defined (WINDOWS32))
-# define LDAV_DONE
-
- /* A faithful emulation is going to have to be saved for a rainy day. */
- for ( ; elem < nelem; elem++)
- {
- loadavg[elem] = 0.0;
- }
-# endif /* __MSDOS__ || WINDOWS32 */
-
-# if !defined (LDAV_DONE) && defined (OSF_ALPHA)
-# define LDAV_DONE
-
- struct tbl_loadavg load_ave;
- table (TBL_LOADAVG, 0, &load_ave, 1, sizeof (load_ave));
- for (elem = 0; elem < nelem; elem++)
- loadavg[elem]
- = (load_ave.tl_lscale == 0
- ? load_ave.tl_avenrun.d[elem]
- : (load_ave.tl_avenrun.l[elem] / (double) load_ave.tl_lscale));
-# endif /* OSF_ALPHA */
-
-# if !defined (LDAV_DONE) && defined (VMS)
- /* VMS specific code -- read from the Load Ave driver. */
-
- LOAD_AVE_TYPE load_ave[3];
- static int getloadavg_initialized = 0;
-# ifdef eunice
- struct
- {
- int dsc$w_length;
- char *dsc$a_pointer;
- } descriptor;
-# endif
-
- /* Ensure that there is a channel open to the load ave device. */
- if (!getloadavg_initialized)
- {
- /* Attempt to open the channel. */
-# ifdef eunice
- descriptor.dsc$w_length = 18;
- descriptor.dsc$a_pointer = "$$VMS_LOAD_AVERAGE";
-# else
- $DESCRIPTOR (descriptor, "LAV0:");
-# endif
- if (sys$assign (&descriptor, &channel, 0, 0) & 1)
- getloadavg_initialized = 1;
- }
-
- /* Read the load average vector. */
- if (getloadavg_initialized
- && !(sys$qiow (0, channel, IO$_READVBLK, 0, 0, 0,
- load_ave, 12, 0, 0, 0, 0) & 1))
- {
- sys$dassgn (channel);
- getloadavg_initialized = 0;
- }
-
- if (!getloadavg_initialized)
- return -1;
-# endif /* VMS */
-
-# if !defined (LDAV_DONE) && defined(LOAD_AVE_TYPE) && !defined(VMS)
-
- /* UNIX-specific code -- read the average from /dev/kmem. */
-
-# define LDAV_PRIVILEGED /* This code requires special installation. */
-
- LOAD_AVE_TYPE load_ave[3];
-
- /* Get the address of LDAV_SYMBOL. */
- if (offset == 0)
- {
-# ifndef sgi
-# ifndef NLIST_STRUCT
- strcpy (name_list[0].n_name, LDAV_SYMBOL);
- strcpy (name_list[1].n_name, "");
-# else /* NLIST_STRUCT */
-# ifdef HAVE_STRUCT_NLIST_N_UN_N_NAME
- name_list[0].n_un.n_name = LDAV_SYMBOL;
- name_list[1].n_un.n_name = 0;
-# else /* not HAVE_STRUCT_NLIST_N_UN_N_NAME */
- name_list[0].n_name = LDAV_SYMBOL;
- name_list[1].n_name = 0;
-# endif /* not HAVE_STRUCT_NLIST_N_UN_N_NAME */
-# endif /* NLIST_STRUCT */
-
-# ifndef SUNOS_5
- if (
-# if !(defined (_AIX) && !defined (ps2))
- nlist (KERNEL_FILE, name_list)
-# else /* _AIX */
- knlist (name_list, 1, sizeof (name_list[0]))
-# endif
- >= 0)
- /* Omit "&& name_list[0].n_type != 0 " -- it breaks on Sun386i. */
- {
-# ifdef FIXUP_KERNEL_SYMBOL_ADDR
- FIXUP_KERNEL_SYMBOL_ADDR (name_list);
-# endif
- offset = name_list[0].n_value;
- }
-# endif /* !SUNOS_5 */
-# else /* sgi */
- int ldav_off;
-
- ldav_off = sysmp (MP_KERNADDR, MPKA_AVENRUN);
- if (ldav_off != -1)
- offset = (long) ldav_off & 0x7fffffff;
-# endif /* sgi */
- }
-
- /* Make sure we have /dev/kmem open. */
- if (!getloadavg_initialized)
- {
-# ifndef SUNOS_5
- channel = open ("/dev/kmem", 0);
- if (channel >= 0)
- {
- /* Set the channel to close on exec, so it does not
- litter any child's descriptor table. */
-# ifdef F_SETFD
-# ifndef FD_CLOEXEC
-# define FD_CLOEXEC 1
-# endif
- (void) fcntl (channel, F_SETFD, FD_CLOEXEC);
-# endif
- getloadavg_initialized = 1;
- }
-# else /* SUNOS_5 */
- /* We pass 0 for the kernel, corefile, and swapfile names
- to use the currently running kernel. */
- kd = kvm_open (0, 0, 0, O_RDONLY, 0);
- if (kd != 0)
- {
- /* nlist the currently running kernel. */
- kvm_nlist (kd, name_list);
- offset = name_list[0].n_value;
- getloadavg_initialized = 1;
- }
-# endif /* SUNOS_5 */
- }
-
- /* If we can, get the load average values. */
- if (offset && getloadavg_initialized)
- {
- /* Try to read the load. */
-# ifndef SUNOS_5
- if (lseek (channel, offset, 0) == -1L
- || read (channel, (char *) load_ave, sizeof (load_ave))
- != sizeof (load_ave))
- {
- close (channel);
- getloadavg_initialized = 0;
- }
-# else /* SUNOS_5 */
- if (kvm_read (kd, offset, (char *) load_ave, sizeof (load_ave))
- != sizeof (load_ave))
- {
- kvm_close (kd);
- getloadavg_initialized = 0;
- }
-# endif /* SUNOS_5 */
- }
-
- if (offset == 0 || !getloadavg_initialized)
- return -1;
-# endif /* LOAD_AVE_TYPE and not VMS */
-
-# if !defined (LDAV_DONE) && defined (LOAD_AVE_TYPE) /* Including VMS. */
- if (nelem > 0)
- loadavg[elem++] = LDAV_CVT (load_ave[0]);
- if (nelem > 1)
- loadavg[elem++] = LDAV_CVT (load_ave[1]);
- if (nelem > 2)
- loadavg[elem++] = LDAV_CVT (load_ave[2]);
-
-# define LDAV_DONE
-# endif /* !LDAV_DONE && LOAD_AVE_TYPE */
-
-# ifdef LDAV_DONE
- return elem;
-# else
- /* Set errno to zero to indicate that there was no particular error;
- this function just can't work at all on this system. */
- errno = 0;
- return -1;
-# endif
-}
-
-#endif /* ! HAVE_GETLOADAVG */
-
-#ifdef TEST
-void
-main (argc, argv)
- int argc;
- char **argv;
-{
- int naptime = 0;
-
- if (argc > 1)
- naptime = atoi (argv[1]);
-
- while (1)
- {
- double avg[3];
- int loads;
-
- errno = 0; /* Don't be misled if it doesn't set errno. */
- loads = getloadavg (avg, 3);
- if (loads == -1)
- {
- perror ("Error getting load average");
- exit (1);
- }
- if (loads > 0)
- printf ("1-minute: %f ", avg[0]);
- if (loads > 1)
- printf ("5-minute: %f ", avg[1]);
- if (loads > 2)
- printf ("15-minute: %f ", avg[2]);
- if (loads > 0)
- putchar ('\n');
-
- if (naptime == 0)
- break;
- sleep (naptime);
- }
-
- exit (0);
-}
-#endif /* TEST */
-
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 6367949a64..6ecd5d624a 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -3677,7 +3677,7 @@ xg_tool_bar_menu_proxy (GtkToolItem *toolitem, gpointer user_data)
GtkLabel *wlbl = GTK_LABEL (xg_get_tool_bar_widgets (vb, &c1));
GtkImage *wimage = GTK_IMAGE (c1);
GtkWidget *wmenuitem = gtk_image_menu_item_new_with_label
- (gtk_label_get_text (wlbl));
+ (wlbl ? gtk_label_get_text (wlbl) : "");
GtkWidget *wmenuimage;
diff --git a/src/indent.c b/src/indent.c
index 84ce140c5b..85d26520cf 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -70,7 +70,7 @@ buffer_display_table (void)
{
Lisp_Object thisbuf;
- thisbuf = current_buffer->display_table;
+ thisbuf = BVAR (current_buffer, display_table);
if (DISP_TABLE_P (thisbuf))
return XCHAR_TABLE (thisbuf);
if (DISP_TABLE_P (Vstandard_display_table))
@@ -140,9 +140,9 @@ recompute_width_table (struct buffer *buf, struct Lisp_Char_Table *disptab)
int i;
struct Lisp_Vector *widthtab;
- if (!VECTORP (buf->width_table))
- buf->width_table = Fmake_vector (make_number (256), make_number (0));
- widthtab = XVECTOR (buf->width_table);
+ if (!VECTORP (BVAR (buf, width_table)))
+ BVAR (buf, width_table) = Fmake_vector (make_number (256), make_number (0));
+ widthtab = XVECTOR (BVAR (buf, width_table));
if (widthtab->size != 256)
abort ();
@@ -156,17 +156,17 @@ recompute_width_table (struct buffer *buf, struct Lisp_Char_Table *disptab)
static void
width_run_cache_on_off (void)
{
- if (NILP (current_buffer->cache_long_line_scans)
+ if (NILP (BVAR (current_buffer, cache_long_line_scans))
/* And, for the moment, this feature doesn't work on multibyte
characters. */
- || !NILP (current_buffer->enable_multibyte_characters))
+ || !NILP (BVAR (current_buffer, enable_multibyte_characters)))
{
/* It should be off. */
if (current_buffer->width_run_cache)
{
free_region_cache (current_buffer->width_run_cache);
current_buffer->width_run_cache = 0;
- current_buffer->width_table = Qnil;
+ BVAR (current_buffer, width_table) = Qnil;
}
}
else
@@ -329,8 +329,8 @@ current_column (void)
register int tab_seen;
int post_tab;
register int c;
- register int tab_width = XINT (current_buffer->tab_width);
- int ctl_arrow = !NILP (current_buffer->ctl_arrow);
+ register int tab_width = XINT (BVAR (current_buffer, tab_width));
+ int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow));
register struct Lisp_Char_Table *dp = buffer_display_table ();
if (PT == last_known_column_point
@@ -417,7 +417,7 @@ current_column (void)
col++;
else if (c == '\n'
|| (c == '\r'
- && EQ (current_buffer->selective_display, Qt)))
+ && EQ (BVAR (current_buffer, selective_display), Qt)))
{
ptr++;
goto start_of_line_found;
@@ -512,10 +512,10 @@ check_display_width (EMACS_INT pos, EMACS_INT col, EMACS_INT *endpos)
static void
scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol)
{
- register EMACS_INT tab_width = XINT (current_buffer->tab_width);
- register int ctl_arrow = !NILP (current_buffer->ctl_arrow);
+ register EMACS_INT tab_width = XINT (BVAR (current_buffer, tab_width));
+ register int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow));
register struct Lisp_Char_Table *dp = buffer_display_table ();
- int multibyte = !NILP (current_buffer->enable_multibyte_characters);
+ int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
struct composition_it cmp_it;
Lisp_Object window;
struct window *w;
@@ -637,7 +637,7 @@ scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol)
if (c == '\n')
goto endloop;
- if (c == '\r' && EQ (current_buffer->selective_display, Qt))
+ if (c == '\r' && EQ (BVAR (current_buffer, selective_display), Qt))
goto endloop;
if (c == '\t')
{
@@ -655,7 +655,7 @@ scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol)
if (c == '\n')
goto endloop;
- if (c == '\r' && EQ (current_buffer->selective_display, Qt))
+ if (c == '\r' && EQ (BVAR (current_buffer, selective_display), Qt))
goto endloop;
if (c == '\t')
{
@@ -809,7 +809,7 @@ The return value is COLUMN. */)
{
int mincol;
register int fromcol;
- register int tab_width = XINT (current_buffer->tab_width);
+ register int tab_width = XINT (BVAR (current_buffer, tab_width));
CHECK_NUMBER (column);
if (NILP (minimum))
@@ -872,7 +872,7 @@ static double
position_indentation (register int pos_byte)
{
register EMACS_INT column = 0;
- register EMACS_INT tab_width = XINT (current_buffer->tab_width);
+ register EMACS_INT tab_width = XINT (BVAR (current_buffer, tab_width));
register unsigned char *p;
register unsigned char *stop;
unsigned char *start;
@@ -924,7 +924,7 @@ position_indentation (register int pos_byte)
switch (*p++)
{
case 0240:
- if (! NILP (current_buffer->enable_multibyte_characters))
+ if (! NILP (BVAR (current_buffer, enable_multibyte_characters)))
return column;
case ' ':
column++;
@@ -934,7 +934,7 @@ position_indentation (register int pos_byte)
break;
default:
if (ASCII_BYTE_P (p[-1])
- || NILP (current_buffer->enable_multibyte_characters))
+ || NILP (BVAR (current_buffer, enable_multibyte_characters)))
return column;
{
int c;
@@ -1123,13 +1123,13 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_
register EMACS_INT pos;
EMACS_INT pos_byte;
register int c = 0;
- register EMACS_INT tab_width = XFASTINT (current_buffer->tab_width);
- register int ctl_arrow = !NILP (current_buffer->ctl_arrow);
+ register EMACS_INT tab_width = XFASTINT (BVAR (current_buffer, tab_width));
+ register int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow));
register struct Lisp_Char_Table *dp = window_display_table (win);
int selective
- = (INTEGERP (current_buffer->selective_display)
- ? XINT (current_buffer->selective_display)
- : !NILP (current_buffer->selective_display) ? -1 : 0);
+ = (INTEGERP (BVAR (current_buffer, selective_display))
+ ? XINT (BVAR (current_buffer, selective_display))
+ : !NILP (BVAR (current_buffer, selective_display)) ? -1 : 0);
int selective_rlen
= (selective && dp && VECTORP (DISP_INVIS_VECTOR (dp))
? XVECTOR (DISP_INVIS_VECTOR (dp))->size : 0);
@@ -1151,7 +1151,7 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_
EMACS_INT next_width_run = from;
Lisp_Object window;
- int multibyte = !NILP (current_buffer->enable_multibyte_characters);
+ int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
/* If previous char scanned was a wide character,
this is the column where it ended. Otherwise, this is 0. */
EMACS_INT wide_column_end_hpos = 0;
@@ -1170,8 +1170,8 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_
width_run_cache_on_off ();
if (dp == buffer_display_table ())
- width_table = (VECTORP (current_buffer->width_table)
- ? XVECTOR (current_buffer->width_table)->contents
+ width_table = (VECTORP (BVAR (current_buffer, width_table))
+ ? XVECTOR (BVAR (current_buffer, width_table))->contents
: 0);
else
/* If the window has its own display table, we can't use the width
@@ -1337,7 +1337,7 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_
}
if (hscroll || truncate
- || !NILP (current_buffer->truncate_lines))
+ || !NILP (BVAR (current_buffer, truncate_lines)))
{
/* Truncating: skip to newline, unless we are already past
TO (we need to go back below). */
@@ -1838,9 +1838,9 @@ vmotion (register EMACS_INT from, register EMACS_INT vtarget, struct window *w)
EMACS_INT from_byte;
EMACS_INT lmargin = hscroll > 0 ? 1 - hscroll : 0;
int selective
- = (INTEGERP (current_buffer->selective_display)
- ? XINT (current_buffer->selective_display)
- : !NILP (current_buffer->selective_display) ? -1 : 0);
+ = (INTEGERP (BVAR (current_buffer, selective_display))
+ ? XINT (BVAR (current_buffer, selective_display))
+ : !NILP (BVAR (current_buffer, selective_display)) ? -1 : 0);
Lisp_Object window;
EMACS_INT start_hpos = 0;
int did_motion;
diff --git a/src/insdel.c b/src/insdel.c
index db76f770da..7fcf9522a3 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -78,7 +78,7 @@ void
check_markers (void)
{
register struct Lisp_Marker *tail;
- int multibyte = ! NILP (current_buffer->enable_multibyte_characters);
+ int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
for (tail = BUF_MARKERS (current_buffer); tail; tail = tail->next)
{
@@ -703,7 +703,7 @@ insert_char (int c)
unsigned char str[MAX_MULTIBYTE_LENGTH];
int len;
- if (! NILP (current_buffer->enable_multibyte_characters))
+ if (! NILP (BVAR (current_buffer, enable_multibyte_characters)))
len = CHAR_STRING (c, str);
else
{
@@ -891,7 +891,7 @@ insert_1_both (const char *string,
if (nchars == 0)
return;
- if (NILP (current_buffer->enable_multibyte_characters))
+ if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
nchars = nbytes;
if (prepare)
@@ -1011,7 +1011,7 @@ insert_from_string_1 (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte,
/* Make OUTGOING_NBYTES describe the text
as it will be inserted in this buffer. */
- if (NILP (current_buffer->enable_multibyte_characters))
+ if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
outgoing_nbytes = nchars;
else if (! STRING_MULTIBYTE (string))
outgoing_nbytes
@@ -1034,7 +1034,7 @@ insert_from_string_1 (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte,
between single-byte and multibyte. */
copy_text (SDATA (string) + pos_byte, GPT_ADDR, nbytes,
STRING_MULTIBYTE (string),
- ! NILP (current_buffer->enable_multibyte_characters));
+ ! NILP (BVAR (current_buffer, enable_multibyte_characters)));
#ifdef BYTE_COMBINING_DEBUG
/* We have copied text into the gap, but we have not altered
@@ -1094,7 +1094,7 @@ insert_from_string_1 (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte,
void
insert_from_gap (EMACS_INT nchars, EMACS_INT nbytes)
{
- if (NILP (current_buffer->enable_multibyte_characters))
+ if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
nchars = nbytes;
record_insert (GPT, nchars);
@@ -1162,9 +1162,9 @@ insert_from_buffer_1 (struct buffer *buf,
/* Make OUTGOING_NBYTES describe the text
as it will be inserted in this buffer. */
- if (NILP (current_buffer->enable_multibyte_characters))
+ if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
outgoing_nbytes = nchars;
- else if (NILP (buf->enable_multibyte_characters))
+ else if (NILP (BVAR (buf, enable_multibyte_characters)))
{
EMACS_INT outgoing_before_gap = 0;
EMACS_INT outgoing_after_gap = 0;
@@ -1215,8 +1215,8 @@ insert_from_buffer_1 (struct buffer *buf,
chunk_expanded
= copy_text (BUF_BYTE_ADDRESS (buf, from_byte),
GPT_ADDR, chunk,
- ! NILP (buf->enable_multibyte_characters),
- ! NILP (current_buffer->enable_multibyte_characters));
+ ! NILP (BVAR (buf, enable_multibyte_characters)),
+ ! NILP (BVAR (current_buffer, enable_multibyte_characters)));
}
else
chunk_expanded = chunk = 0;
@@ -1224,8 +1224,8 @@ insert_from_buffer_1 (struct buffer *buf,
if (chunk < incoming_nbytes)
copy_text (BUF_BYTE_ADDRESS (buf, from_byte + chunk),
GPT_ADDR + chunk_expanded, incoming_nbytes - chunk,
- ! NILP (buf->enable_multibyte_characters),
- ! NILP (current_buffer->enable_multibyte_characters));
+ ! NILP (BVAR (buf, enable_multibyte_characters)),
+ ! NILP (BVAR (current_buffer, enable_multibyte_characters)));
#ifdef BYTE_COMBINING_DEBUG
/* We have copied text into the gap, but we have not altered
@@ -1320,7 +1320,7 @@ adjust_after_replace (EMACS_INT from, EMACS_INT from_byte,
adjust_markers_for_insert (from, from_byte,
from + len, from_byte + len_byte, 0);
- if (! EQ (current_buffer->undo_list, Qt))
+ if (! EQ (BVAR (current_buffer, undo_list), Qt))
{
if (nchars_del > 0)
record_delete (from, prev_text);
@@ -1481,7 +1481,7 @@ replace_range (EMACS_INT from, EMACS_INT to, Lisp_Object new,
/* Make OUTGOING_INSBYTES describe the text
as it will be inserted in this buffer. */
- if (NILP (current_buffer->enable_multibyte_characters))
+ if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
outgoing_insbytes = inschars;
else if (! STRING_MULTIBYTE (new))
outgoing_insbytes
@@ -1503,7 +1503,7 @@ replace_range (EMACS_INT from, EMACS_INT to, Lisp_Object new,
/* Even if we don't record for undo, we must keep the original text
because we may have to recover it because of inappropriate byte
combining. */
- if (! EQ (current_buffer->undo_list, Qt))
+ if (! EQ (BVAR (current_buffer, undo_list), Qt))
deletion = make_buffer_string_both (from, from_byte, to, to_byte, 1);
GAP_SIZE += nbytes_del;
@@ -1530,7 +1530,7 @@ replace_range (EMACS_INT from, EMACS_INT to, Lisp_Object new,
between single-byte and multibyte. */
copy_text (SDATA (new), GPT_ADDR, insbytes,
STRING_MULTIBYTE (new),
- ! NILP (current_buffer->enable_multibyte_characters));
+ ! NILP (BVAR (current_buffer, enable_multibyte_characters)));
#ifdef BYTE_COMBINING_DEBUG
/* We have copied text into the gap, but we have not marked
@@ -1543,7 +1543,7 @@ replace_range (EMACS_INT from, EMACS_INT to, Lisp_Object new,
abort ();
#endif
- if (! EQ (current_buffer->undo_list, Qt))
+ if (! EQ (BVAR (current_buffer, undo_list), Qt))
{
/* Record the insertion first, so that when we undo,
the deletion will be undone first. Thus, undo
@@ -1886,7 +1886,7 @@ del_range_2 (EMACS_INT from, EMACS_INT from_byte,
abort ();
#endif
- if (ret_string || ! EQ (current_buffer->undo_list, Qt))
+ if (ret_string || ! EQ (BVAR (current_buffer, undo_list), Qt))
deletion = make_buffer_string_both (from, from_byte, to, to_byte, 1);
else
deletion = Qnil;
@@ -1897,7 +1897,7 @@ del_range_2 (EMACS_INT from, EMACS_INT from_byte,
so that undo handles this after reinserting the text. */
adjust_markers_for_delete (from, from_byte, to, to_byte);
- if (! EQ (current_buffer->undo_list, Qt))
+ if (! EQ (BVAR (current_buffer, undo_list), Qt))
record_delete (from, deletion);
MODIFF++;
CHARS_MODIFF = MODIFF;
@@ -1968,7 +1968,7 @@ modify_region (struct buffer *buffer, EMACS_INT start, EMACS_INT end,
if (! preserve_chars_modiff)
CHARS_MODIFF = MODIFF;
- buffer->point_before_scroll = Qnil;
+ BVAR (buffer, point_before_scroll) = Qnil;
if (buffer != old_buffer)
set_buffer_internal (old_buffer);
@@ -1990,7 +1990,7 @@ prepare_to_modify_buffer (EMACS_INT start, EMACS_INT end,
{
struct buffer *base_buffer;
- if (!NILP (current_buffer->read_only))
+ if (!NILP (BVAR (current_buffer, read_only)))
Fbarf_if_buffer_read_only ();
/* Let redisplay consider other windows than selected_window
@@ -2022,32 +2022,32 @@ prepare_to_modify_buffer (EMACS_INT start, EMACS_INT end,
base_buffer = current_buffer;
#ifdef CLASH_DETECTION
- if (!NILP (base_buffer->file_truename)
+ if (!NILP (BVAR (base_buffer, file_truename))
/* Make binding buffer-file-name to nil effective. */
- && !NILP (base_buffer->filename)
+ && !NILP (BVAR (base_buffer, filename))
&& SAVE_MODIFF >= MODIFF)
- lock_file (base_buffer->file_truename);
+ lock_file (BVAR (base_buffer, file_truename));
#else
/* At least warn if this file has changed on disk since it was visited. */
- if (!NILP (base_buffer->filename)
+ if (!NILP (BVAR (base_buffer, filename))
&& SAVE_MODIFF >= MODIFF
&& NILP (Fverify_visited_file_modtime (Fcurrent_buffer ()))
- && !NILP (Ffile_exists_p (base_buffer->filename)))
+ && !NILP (Ffile_exists_p (BVAR (base_buffer, filename))))
call1 (intern ("ask-user-about-supersession-threat"),
- base_buffer->filename);
+ BVAR (base_buffer,filename));
#endif /* not CLASH_DETECTION */
/* If `select-active-regions' is non-nil, save the region text. */
- if (!NILP (current_buffer->mark_active)
+ if (!NILP (BVAR (current_buffer, mark_active))
&& !inhibit_modification_hooks
- && XMARKER (current_buffer->mark)->buffer
+ && XMARKER (BVAR (current_buffer, mark))->buffer
&& NILP (Vsaved_region_selection)
&& (EQ (Vselect_active_regions, Qonly)
? EQ (CAR_SAFE (Vtransient_mark_mode), Qonly)
: (!NILP (Vselect_active_regions)
&& !NILP (Vtransient_mark_mode))))
{
- EMACS_INT b = XMARKER (current_buffer->mark)->charpos;
+ EMACS_INT b = XMARKER (BVAR (current_buffer, mark))->charpos;
EMACS_INT e = PT;
if (b < e)
Vsaved_region_selection = make_buffer_string (b, e, 0);
@@ -2290,7 +2290,7 @@ DEFUN ("combine-after-change-execute", Fcombine_after_change_execute,
non-nil, and insertion calls a file handler (e.g. through
lock_file) which scribbles into a temp file -- cyd */
if (!BUFFERP (combine_after_change_buffer)
- || NILP (XBUFFER (combine_after_change_buffer)->name))
+ || NILP (BVAR (XBUFFER (combine_after_change_buffer), name)))
{
combine_after_change_list = Qnil;
return Qnil;
diff --git a/src/intervals.c b/src/intervals.c
index ad46c17d58..6aee6e9d7f 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -1978,7 +1978,7 @@ set_point_both (EMACS_INT charpos, EMACS_INT bytepos)
int have_overlays;
EMACS_INT original_position;
- current_buffer->point_before_scroll = Qnil;
+ BVAR (current_buffer, point_before_scroll) = Qnil;
if (charpos == PT)
return;
@@ -2342,7 +2342,7 @@ get_local_map (register EMACS_INT position, register struct buffer *buffer,
if (EQ (type, Qkeymap))
return Qnil;
else
- return buffer->keymap;
+ return BVAR (buffer, keymap);
}
/* Produce an interval tree reflecting the intervals in
diff --git a/src/intervals.h b/src/intervals.h
index 0762c9d8dc..f6c1c002ce 100644
--- a/src/intervals.h
+++ b/src/intervals.h
@@ -236,9 +236,9 @@ struct interval
and 2 if it is invisible but with an ellipsis. */
#define TEXT_PROP_MEANS_INVISIBLE(prop) \
- (EQ (current_buffer->invisibility_spec, Qt) \
+ (EQ (BVAR (current_buffer, invisibility_spec), Qt) \
? !NILP (prop) \
- : invisible_p (prop, current_buffer->invisibility_spec))
+ : invisible_p (prop, BVAR (current_buffer, invisibility_spec)))
/* Declared in alloc.c */
diff --git a/src/keyboard.c b/src/keyboard.c
index eb586183f0..1f14af7884 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -461,7 +461,7 @@ echo_char (Lisp_Object c)
char *ptr = buffer;
Lisp_Object echo_string;
- echo_string = current_kboard->echo_string;
+ echo_string = KVAR (current_kboard, echo_string);
/* If someone has passed us a composite event, use its head symbol. */
c = EVENT_HEAD (c);
@@ -528,7 +528,7 @@ echo_char (Lisp_Object c)
else if (STRINGP (echo_string))
echo_string = concat2 (echo_string, build_string (" "));
- current_kboard->echo_string
+ KVAR (current_kboard, echo_string)
= concat2 (echo_string, make_string (buffer, ptr - buffer));
echo_now ();
@@ -542,31 +542,31 @@ void
echo_dash (void)
{
/* Do nothing if not echoing at all. */
- if (NILP (current_kboard->echo_string))
+ if (NILP (KVAR (current_kboard, echo_string)))
return;
if (this_command_key_count == 0)
return;
if (!current_kboard->immediate_echo
- && SCHARS (current_kboard->echo_string) == 0)
+ && SCHARS (KVAR (current_kboard, echo_string)) == 0)
return;
/* Do nothing if we just printed a prompt. */
if (current_kboard->echo_after_prompt
- == SCHARS (current_kboard->echo_string))
+ == SCHARS (KVAR (current_kboard, echo_string)))
return;
/* Do nothing if we have already put a dash at the end. */
- if (SCHARS (current_kboard->echo_string) > 1)
+ if (SCHARS (KVAR (current_kboard, echo_string)) > 1)
{
Lisp_Object last_char, prev_char, idx;
- idx = make_number (SCHARS (current_kboard->echo_string) - 2);
- prev_char = Faref (current_kboard->echo_string, idx);
+ idx = make_number (SCHARS (KVAR (current_kboard, echo_string)) - 2);
+ prev_char = Faref (KVAR (current_kboard, echo_string), idx);
- idx = make_number (SCHARS (current_kboard->echo_string) - 1);
- last_char = Faref (current_kboard->echo_string, idx);
+ idx = make_number (SCHARS (KVAR (current_kboard, echo_string)) - 1);
+ last_char = Faref (KVAR (current_kboard, echo_string), idx);
if (XINT (last_char) == '-' && XINT (prev_char) != ' ')
return;
@@ -574,7 +574,7 @@ echo_dash (void)
/* Put a dash at the end of the buffer temporarily,
but make it go away when the next character is added. */
- current_kboard->echo_string = concat2 (current_kboard->echo_string,
+ KVAR (current_kboard, echo_string) = concat2 (KVAR (current_kboard, echo_string),
build_string ("-"));
echo_now ();
}
@@ -617,9 +617,9 @@ echo_now (void)
}
echoing = 1;
- message3_nolog (current_kboard->echo_string,
- SBYTES (current_kboard->echo_string),
- STRING_MULTIBYTE (current_kboard->echo_string));
+ message3_nolog (KVAR (current_kboard, echo_string),
+ SBYTES (KVAR (current_kboard, echo_string)),
+ STRING_MULTIBYTE (KVAR (current_kboard, echo_string)));
echoing = 0;
/* Record in what buffer we echoed, and from which kboard. */
@@ -637,7 +637,7 @@ cancel_echoing (void)
{
current_kboard->immediate_echo = 0;
current_kboard->echo_after_prompt = -1;
- current_kboard->echo_string = Qnil;
+ KVAR (current_kboard, echo_string) = Qnil;
ok_to_echo_at_next_pause = NULL;
echo_kboard = NULL;
echo_message_buffer = Qnil;
@@ -648,8 +648,8 @@ cancel_echoing (void)
static int
echo_length (void)
{
- return (STRINGP (current_kboard->echo_string)
- ? SCHARS (current_kboard->echo_string)
+ return (STRINGP (KVAR (current_kboard, echo_string))
+ ? SCHARS (KVAR (current_kboard, echo_string))
: 0);
}
@@ -660,9 +660,9 @@ echo_length (void)
static void
echo_truncate (EMACS_INT nchars)
{
- if (STRINGP (current_kboard->echo_string))
- current_kboard->echo_string
- = Fsubstring (current_kboard->echo_string,
+ if (STRINGP (KVAR (current_kboard, echo_string)))
+ KVAR (current_kboard, echo_string)
+ = Fsubstring (KVAR (current_kboard, echo_string),
make_number (0), make_number (nchars));
truncate_echo_area (nchars);
}
@@ -993,8 +993,8 @@ cmd_error (Lisp_Object data)
Vstandard_input = Qt;
Vexecuting_kbd_macro = Qnil;
executing_kbd_macro = Qnil;
- current_kboard->Vprefix_arg = Qnil;
- current_kboard->Vlast_prefix_arg = Qnil;
+ KVAR (current_kboard, Vprefix_arg) = Qnil;
+ KVAR (current_kboard, Vlast_prefix_arg) = Qnil;
cancel_echoing ();
/* Avoid unquittable loop if data contains a circular list. */
@@ -1302,8 +1302,8 @@ command_loop_1 (void)
#endif
int already_adjusted = 0;
- current_kboard->Vprefix_arg = Qnil;
- current_kboard->Vlast_prefix_arg = Qnil;
+ KVAR (current_kboard, Vprefix_arg) = Qnil;
+ KVAR (current_kboard, Vlast_prefix_arg) = Qnil;
Vdeactivate_mark = Qnil;
waiting_for_input = 0;
cancel_echoing ();
@@ -1331,10 +1331,10 @@ command_loop_1 (void)
}
/* Do this after running Vpost_command_hook, for consistency. */
- current_kboard->Vlast_command = Vthis_command;
- current_kboard->Vreal_last_command = real_this_command;
+ KVAR (current_kboard, Vlast_command) = Vthis_command;
+ KVAR (current_kboard, Vreal_last_command) = real_this_command;
if (!CONSP (last_command_event))
- current_kboard->Vlast_repeatable_command = real_this_command;
+ KVAR (current_kboard, Vlast_repeatable_command) = real_this_command;
while (1)
{
@@ -1504,9 +1504,9 @@ command_loop_1 (void)
keys = Fkey_description (keys, Qnil);
bitch_at_user ();
message_with_string ("%s is undefined", keys, 0);
- current_kboard->defining_kbd_macro = Qnil;
+ KVAR (current_kboard, defining_kbd_macro) = Qnil;
update_mode_lines = 1;
- current_kboard->Vprefix_arg = Qnil;
+ KVAR (current_kboard, Vprefix_arg) = Qnil;
}
else
{
@@ -1523,7 +1523,7 @@ command_loop_1 (void)
}
#endif
- if (NILP (current_kboard->Vprefix_arg)) /* FIXME: Why? --Stef */
+ if (NILP (KVAR (current_kboard, Vprefix_arg))) /* FIXME: Why? --Stef */
Fundo_boundary ();
Fcommand_execute (Vthis_command, Qnil, Qnil, Qnil);
@@ -1537,7 +1537,7 @@ command_loop_1 (void)
unbind_to (scount, Qnil);
#endif
}
- current_kboard->Vlast_prefix_arg = Vcurrent_prefix_arg;
+ KVAR (current_kboard, Vlast_prefix_arg) = Vcurrent_prefix_arg;
/* Note that the value cell will never directly contain nil
if the symbol is a local variable. */
@@ -1565,19 +1565,19 @@ command_loop_1 (void)
If the command didn't actually create a prefix arg,
but is merely a frame event that is transparent to prefix args,
then the above doesn't apply. */
- if (NILP (current_kboard->Vprefix_arg) || CONSP (last_command_event))
+ if (NILP (KVAR (current_kboard, Vprefix_arg)) || CONSP (last_command_event))
{
- current_kboard->Vlast_command = Vthis_command;
- current_kboard->Vreal_last_command = real_this_command;
+ KVAR (current_kboard, Vlast_command) = Vthis_command;
+ KVAR (current_kboard, Vreal_last_command) = real_this_command;
if (!CONSP (last_command_event))
- current_kboard->Vlast_repeatable_command = real_this_command;
+ KVAR (current_kboard, Vlast_repeatable_command) = real_this_command;
cancel_echoing ();
this_command_key_count = 0;
this_command_key_count_reset = 0;
this_single_command_key_start = 0;
}
- if (!NILP (current_buffer->mark_active)
+ if (!NILP (BVAR (current_buffer, mark_active))
&& !NILP (Vrun_hooks))
{
/* In Emacs 22, setting transient-mark-mode to `only' was a
@@ -1599,7 +1599,7 @@ command_loop_1 (void)
if (!NILP (Fwindow_system (Qnil))
/* Even if mark_active is non-nil, the actual buffer
marker may not have been set yet (Bug#7044). */
- && XMARKER (current_buffer->mark)->buffer
+ && XMARKER (BVAR (current_buffer, mark))->buffer
&& (EQ (Vselect_active_regions, Qonly)
? EQ (CAR_SAFE (Vtransient_mark_mode), Qonly)
: (!NILP (Vselect_active_regions)
@@ -1607,7 +1607,7 @@ command_loop_1 (void)
&& !EQ (Vthis_command, Qhandle_switch_frame))
{
EMACS_INT beg =
- XINT (Fmarker_position (current_buffer->mark));
+ XINT (Fmarker_position (BVAR (current_buffer, mark)));
EMACS_INT end = PT;
if (beg < end)
call2 (Qx_set_selection, QPRIMARY,
@@ -1649,8 +1649,8 @@ command_loop_1 (void)
/* Install chars successfully executed in kbd macro. */
- if (!NILP (current_kboard->defining_kbd_macro)
- && NILP (current_kboard->Vprefix_arg))
+ if (!NILP (KVAR (current_kboard, defining_kbd_macro))
+ && NILP (KVAR (current_kboard, Vprefix_arg)))
finalize_kbd_macro_chars ();
#if 0 /* This shouldn't be necessary anymore. --lorentey */
if (!was_locked)
@@ -2461,7 +2461,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
KBOARD *kb = FRAME_KBOARD (XFRAME (selected_frame));
if (kb != current_kboard)
{
- Lisp_Object link = kb->kbd_queue;
+ Lisp_Object link = KVAR (kb, kbd_queue);
/* We shouldn't get here if we were in single-kboard mode! */
if (single_kboard)
abort ();
@@ -2473,7 +2473,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
abort ();
}
if (!CONSP (link))
- kb->kbd_queue = Fcons (c, Qnil);
+ KVAR (kb, kbd_queue) = Fcons (c, Qnil);
else
XSETCDR (link, Fcons (c, Qnil));
kb->kbd_queue_has_data = 1;
@@ -2645,12 +2645,12 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
{
if (current_kboard->kbd_queue_has_data)
{
- if (!CONSP (current_kboard->kbd_queue))
+ if (!CONSP (KVAR (current_kboard, kbd_queue)))
abort ();
- c = XCAR (current_kboard->kbd_queue);
- current_kboard->kbd_queue
- = XCDR (current_kboard->kbd_queue);
- if (NILP (current_kboard->kbd_queue))
+ c = XCAR (KVAR (current_kboard, kbd_queue));
+ KVAR (current_kboard, kbd_queue)
+ = XCDR (KVAR (current_kboard, kbd_queue));
+ if (NILP (KVAR (current_kboard, kbd_queue)))
current_kboard->kbd_queue_has_data = 0;
input_pending = readable_events (0);
if (EVENT_HAS_PARAMETERS (c)
@@ -2712,7 +2712,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
if (! NILP (c) && (kb != current_kboard))
{
- Lisp_Object link = kb->kbd_queue;
+ Lisp_Object link = KVAR (kb, kbd_queue);
if (CONSP (link))
{
while (CONSP (XCDR (link)))
@@ -2721,7 +2721,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
abort ();
}
if (!CONSP (link))
- kb->kbd_queue = Fcons (c, Qnil);
+ KVAR (kb, kbd_queue) = Fcons (c, Qnil);
else
XSETCDR (link, Fcons (c, Qnil));
kb->kbd_queue_has_data = 1;
@@ -2829,15 +2829,15 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
if (XINT (c) == -1)
goto exit;
- if ((STRINGP (current_kboard->Vkeyboard_translate_table)
- && SCHARS (current_kboard->Vkeyboard_translate_table) > (unsigned) XFASTINT (c))
- || (VECTORP (current_kboard->Vkeyboard_translate_table)
- && XVECTOR (current_kboard->Vkeyboard_translate_table)->size > (unsigned) XFASTINT (c))
- || (CHAR_TABLE_P (current_kboard->Vkeyboard_translate_table)
+ if ((STRINGP (KVAR (current_kboard, Vkeyboard_translate_table))
+ && SCHARS (KVAR (current_kboard, Vkeyboard_translate_table)) > (unsigned) XFASTINT (c))
+ || (VECTORP (KVAR (current_kboard, Vkeyboard_translate_table))
+ && XVECTOR (KVAR (current_kboard, Vkeyboard_translate_table))->size > (unsigned) XFASTINT (c))
+ || (CHAR_TABLE_P (KVAR (current_kboard, Vkeyboard_translate_table))
&& CHARACTERP (c)))
{
Lisp_Object d;
- d = Faref (current_kboard->Vkeyboard_translate_table, c);
+ d = Faref (KVAR (current_kboard, Vkeyboard_translate_table), c);
/* nil in keyboard-translate-table means no translation. */
if (!NILP (d))
c = d;
@@ -2918,7 +2918,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
/* Save the echo status. */
int saved_immediate_echo = current_kboard->immediate_echo;
struct kboard *saved_ok_to_echo = ok_to_echo_at_next_pause;
- Lisp_Object saved_echo_string = current_kboard->echo_string;
+ Lisp_Object saved_echo_string = KVAR (current_kboard, echo_string);
int saved_echo_after_prompt = current_kboard->echo_after_prompt;
#if 0
@@ -2973,7 +2973,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
cancel_echoing ();
ok_to_echo_at_next_pause = saved_ok_to_echo;
- current_kboard->echo_string = saved_echo_string;
+ KVAR (current_kboard, echo_string) = saved_echo_string;
current_kboard->echo_after_prompt = saved_echo_after_prompt;
if (saved_immediate_echo)
echo_now ();
@@ -3459,7 +3459,7 @@ kbd_buffer_store_event_hold (register struct input_event *event,
if (single_kboard && kb != current_kboard)
{
- kb->kbd_queue
+ KVAR (kb, kbd_queue)
= Fcons (make_lispy_switch_frame (event->frame_or_window),
Fcons (make_number (c), Qnil));
kb->kbd_queue_has_data = 1;
@@ -5322,13 +5322,13 @@ make_lispy_event (struct input_event *event)
{
/* We need to use an alist rather than a vector as the cache
since we can't make a vector long enuf. */
- if (NILP (current_kboard->system_key_syms))
- current_kboard->system_key_syms = Fcons (Qnil, Qnil);
+ if (NILP (KVAR (current_kboard, system_key_syms)))
+ KVAR (current_kboard, system_key_syms) = Fcons (Qnil, Qnil);
return modify_event_symbol (event->code,
event->modifiers,
Qfunction_key,
- current_kboard->Vsystem_key_alist,
- 0, &current_kboard->system_key_syms,
+ KVAR (current_kboard, Vsystem_key_alist),
+ 0, &KVAR (current_kboard, system_key_syms),
(unsigned) -1);
}
@@ -7360,8 +7360,8 @@ menu_bar_items (Lisp_Object old)
/* Yes, use them (if non-nil) as well as the global map. */
maps = (Lisp_Object *) alloca (3 * sizeof (maps[0]));
nmaps = 0;
- if (!NILP (current_kboard->Voverriding_terminal_local_map))
- maps[nmaps++] = current_kboard->Voverriding_terminal_local_map;
+ if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map)))
+ maps[nmaps++] = KVAR (current_kboard, Voverriding_terminal_local_map);
if (!NILP (Voverriding_local_map))
maps[nmaps++] = Voverriding_local_map;
}
@@ -7903,8 +7903,8 @@ tool_bar_items (Lisp_Object reuse, int *nitems)
/* Yes, use them (if non-nil) as well as the global map. */
maps = (Lisp_Object *) alloca (3 * sizeof (maps[0]));
nmaps = 0;
- if (!NILP (current_kboard->Voverriding_terminal_local_map))
- maps[nmaps++] = current_kboard->Voverriding_terminal_local_map;
+ if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map)))
+ maps[nmaps++] = KVAR (current_kboard, Voverriding_terminal_local_map);
if (!NILP (Voverriding_local_map))
maps[nmaps++] = Voverriding_local_map;
}
@@ -8614,18 +8614,18 @@ read_char_minibuf_menu_prompt (int commandflag, int nmaps, Lisp_Object *maps)
/* Prompt with that and read response. */
message2_nolog (menu, strlen (menu),
- ! NILP (current_buffer->enable_multibyte_characters));
+ ! NILP (BVAR (current_buffer, enable_multibyte_characters)));
/* Make believe its not a keyboard macro in case the help char
is pressed. Help characters are not recorded because menu prompting
is not used on replay.
*/
- orig_defn_macro = current_kboard->defining_kbd_macro;
- current_kboard->defining_kbd_macro = Qnil;
+ orig_defn_macro = KVAR (current_kboard, defining_kbd_macro);
+ KVAR (current_kboard, defining_kbd_macro) = Qnil;
do
obj = read_char (commandflag, 0, 0, Qt, 0, NULL);
while (BUFFERP (obj));
- current_kboard->defining_kbd_macro = orig_defn_macro;
+ KVAR (current_kboard, defining_kbd_macro) = orig_defn_macro;
if (!INTEGERP (obj))
return obj;
@@ -8638,7 +8638,7 @@ read_char_minibuf_menu_prompt (int commandflag, int nmaps, Lisp_Object *maps)
&& (!INTEGERP (menu_prompt_more_char)
|| ! EQ (obj, make_number (Ctl (XINT (menu_prompt_more_char))))))
{
- if (!NILP (current_kboard->defining_kbd_macro))
+ if (!NILP (KVAR (current_kboard, defining_kbd_macro)))
store_kbd_macro_char (obj);
return obj;
}
@@ -8980,7 +8980,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
/* Install the string STR as the beginning of the string of
echoing, so that it serves as a prompt for the next
character. */
- current_kboard->echo_string = prompt;
+ KVAR (current_kboard, echo_string) = prompt;
current_kboard->echo_after_prompt = SCHARS (prompt);
echo_now ();
}
@@ -9018,8 +9018,8 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
happens if we switch keyboards between rescans. */
replay_entire_sequence:
- indec.map = indec.parent = current_kboard->Vinput_decode_map;
- fkey.map = fkey.parent = current_kboard->Vlocal_function_key_map;
+ indec.map = indec.parent = KVAR (current_kboard, Vinput_decode_map);
+ fkey.map = fkey.parent = KVAR (current_kboard, Vlocal_function_key_map);
keytran.map = keytran.parent = Vkey_translation_map;
indec.start = indec.end = 0;
fkey.start = fkey.end = 0;
@@ -9040,7 +9040,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
the initial keymaps from the current buffer. */
nmaps = 0;
- if (!NILP (current_kboard->Voverriding_terminal_local_map))
+ if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map)))
{
if (2 > nmaps_allocated)
{
@@ -9048,7 +9048,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
defs = (Lisp_Object *) alloca (2 * sizeof (defs[0]));
nmaps_allocated = 2;
}
- submaps[nmaps++] = current_kboard->Voverriding_terminal_local_map;
+ submaps[nmaps++] = KVAR (current_kboard, Voverriding_terminal_local_map);
}
else if (!NILP (Voverriding_local_map))
{
@@ -9224,29 +9224,29 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
if (!NILP (delayed_switch_frame))
{
- interrupted_kboard->kbd_queue
+ KVAR (interrupted_kboard, kbd_queue)
= Fcons (delayed_switch_frame,
- interrupted_kboard->kbd_queue);
+ KVAR (interrupted_kboard, kbd_queue));
delayed_switch_frame = Qnil;
}
while (t > 0)
- interrupted_kboard->kbd_queue
- = Fcons (keybuf[--t], interrupted_kboard->kbd_queue);
+ KVAR (interrupted_kboard, kbd_queue)
+ = Fcons (keybuf[--t], KVAR (interrupted_kboard, kbd_queue));
/* If the side queue is non-empty, ensure it begins with a
switch-frame, so we'll replay it in the right context. */
- if (CONSP (interrupted_kboard->kbd_queue)
- && (key = XCAR (interrupted_kboard->kbd_queue),
+ if (CONSP (KVAR (interrupted_kboard, kbd_queue))
+ && (key = XCAR (KVAR (interrupted_kboard, kbd_queue)),
!(EVENT_HAS_PARAMETERS (key)
&& EQ (EVENT_HEAD_KIND (EVENT_HEAD (key)),
Qswitch_frame))))
{
Lisp_Object frame;
XSETFRAME (frame, interrupted_frame);
- interrupted_kboard->kbd_queue
+ KVAR (interrupted_kboard, kbd_queue)
= Fcons (make_lispy_switch_frame (frame),
- interrupted_kboard->kbd_queue);
+ KVAR (interrupted_kboard, kbd_queue));
}
mock_input = 0;
orig_local_map = get_local_map (PT, current_buffer, Qlocal_map);
@@ -9876,7 +9876,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
/* Treat uppercase keys as shifted. */
|| (INTEGERP (key)
&& (KEY_TO_CHAR (key)
- < XCHAR_TABLE (current_buffer->downcase_table)->size)
+ < XCHAR_TABLE (BVAR (current_buffer, downcase_table))->size)
&& UPPERCASEP (KEY_TO_CHAR (key))))
{
Lisp_Object new_key
@@ -10121,9 +10121,9 @@ a special event, so ignore the prefix argument and don't clear it. */)
if (NILP (special))
{
- prefixarg = current_kboard->Vprefix_arg;
+ prefixarg = KVAR (current_kboard, Vprefix_arg);
Vcurrent_prefix_arg = prefixarg;
- current_kboard->Vprefix_arg = Qnil;
+ KVAR (current_kboard, Vprefix_arg) = Qnil;
}
else
prefixarg = Qnil;
@@ -10257,7 +10257,7 @@ give to the command you invoke, if it asks for an argument. */)
UNGCPRO;
function = Fintern (function, Qnil);
- current_kboard->Vprefix_arg = prefixarg;
+ KVAR (current_kboard, Vprefix_arg) = prefixarg;
Vthis_command = function;
real_this_command = function;
@@ -10580,7 +10580,7 @@ DEFUN ("discard-input", Fdiscard_input, Sdiscard_input, 0, 0, 0,
Also end any kbd macro being defined. */)
(void)
{
- if (!NILP (current_kboard->defining_kbd_macro))
+ if (!NILP (KVAR (current_kboard, defining_kbd_macro)))
{
/* Discard the last command from the macro. */
Fcancel_kbd_macro_events ();
@@ -11230,30 +11230,30 @@ The `posn-' functions access elements of such lists. */)
void
init_kboard (KBOARD *kb)
{
- kb->Voverriding_terminal_local_map = Qnil;
- kb->Vlast_command = Qnil;
- kb->Vreal_last_command = Qnil;
- kb->Vkeyboard_translate_table = Qnil;
- kb->Vlast_repeatable_command = Qnil;
- kb->Vprefix_arg = Qnil;
- kb->Vlast_prefix_arg = Qnil;
- kb->kbd_queue = Qnil;
+ KVAR (kb, Voverriding_terminal_local_map) = Qnil;
+ KVAR (kb, Vlast_command) = Qnil;
+ KVAR (kb, Vreal_last_command) = Qnil;
+ KVAR (kb, Vkeyboard_translate_table) = Qnil;
+ KVAR (kb, Vlast_repeatable_command) = Qnil;
+ KVAR (kb, Vprefix_arg) = Qnil;
+ KVAR (kb, Vlast_prefix_arg) = Qnil;
+ KVAR (kb, kbd_queue) = Qnil;
kb->kbd_queue_has_data = 0;
kb->immediate_echo = 0;
- kb->echo_string = Qnil;
+ KVAR (kb, echo_string) = Qnil;
kb->echo_after_prompt = -1;
kb->kbd_macro_buffer = 0;
kb->kbd_macro_bufsize = 0;
- kb->defining_kbd_macro = Qnil;
- kb->Vlast_kbd_macro = Qnil;
+ KVAR (kb, defining_kbd_macro) = Qnil;
+ KVAR (kb, Vlast_kbd_macro) = Qnil;
kb->reference_count = 0;
- kb->Vsystem_key_alist = Qnil;
- kb->system_key_syms = Qnil;
- kb->Vwindow_system = Qt; /* Unset. */
- kb->Vinput_decode_map = Fmake_sparse_keymap (Qnil);
- kb->Vlocal_function_key_map = Fmake_sparse_keymap (Qnil);
- Fset_keymap_parent (kb->Vlocal_function_key_map, Vfunction_key_map);
- kb->Vdefault_minibuffer_frame = Qnil;
+ KVAR (kb, Vsystem_key_alist) = Qnil;
+ KVAR (kb, system_key_syms) = Qnil;
+ KVAR (kb, Vwindow_system) = Qt; /* Unset. */
+ KVAR (kb, Vinput_decode_map) = Fmake_sparse_keymap (Qnil);
+ KVAR (kb, Vlocal_function_key_map) = Fmake_sparse_keymap (Qnil);
+ Fset_keymap_parent (KVAR (kb, Vlocal_function_key_map), Vfunction_key_map);
+ KVAR (kb, Vdefault_minibuffer_frame) = Qnil;
}
/*
@@ -11329,7 +11329,7 @@ init_keyboard (void)
init_kboard (current_kboard);
/* A value of nil for Vwindow_system normally means a tty, but we also use
it for the initial terminal since there is no window system there. */
- current_kboard->Vwindow_system = Qnil;
+ KVAR (current_kboard, Vwindow_system) = Qnil;
if (!noninteractive)
{
@@ -12272,23 +12272,23 @@ mark_kboards (void)
if (kb->kbd_macro_buffer)
for (p = kb->kbd_macro_buffer; p < kb->kbd_macro_ptr; p++)
mark_object (*p);
- mark_object (kb->Voverriding_terminal_local_map);
- mark_object (kb->Vlast_command);
- mark_object (kb->Vreal_last_command);
- mark_object (kb->Vkeyboard_translate_table);
- mark_object (kb->Vlast_repeatable_command);
- mark_object (kb->Vprefix_arg);
- mark_object (kb->Vlast_prefix_arg);
- mark_object (kb->kbd_queue);
- mark_object (kb->defining_kbd_macro);
- mark_object (kb->Vlast_kbd_macro);
- mark_object (kb->Vsystem_key_alist);
- mark_object (kb->system_key_syms);
- mark_object (kb->Vwindow_system);
- mark_object (kb->Vinput_decode_map);
- mark_object (kb->Vlocal_function_key_map);
- mark_object (kb->Vdefault_minibuffer_frame);
- mark_object (kb->echo_string);
+ mark_object (KVAR (kb, Voverriding_terminal_local_map));
+ mark_object (KVAR (kb, Vlast_command));
+ mark_object (KVAR (kb, Vreal_last_command));
+ mark_object (KVAR (kb, Vkeyboard_translate_table));
+ mark_object (KVAR (kb, Vlast_repeatable_command));
+ mark_object (KVAR (kb, Vprefix_arg));
+ mark_object (KVAR (kb, Vlast_prefix_arg));
+ mark_object (KVAR (kb, kbd_queue));
+ mark_object (KVAR (kb, defining_kbd_macro));
+ mark_object (KVAR (kb, Vlast_kbd_macro));
+ mark_object (KVAR (kb, Vsystem_key_alist));
+ mark_object (KVAR (kb, system_key_syms));
+ mark_object (KVAR (kb, Vwindow_system));
+ mark_object (KVAR (kb, Vinput_decode_map));
+ mark_object (KVAR (kb, Vlocal_function_key_map));
+ mark_object (KVAR (kb, Vdefault_minibuffer_frame));
+ mark_object (KVAR (kb, echo_string));
}
{
struct input_event *event;
diff --git a/src/keyboard.h b/src/keyboard.h
index 166b3c0e9d..10bf16d5c5 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -19,7 +19,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "systime.h" /* for EMACS_TIME */
#include "coding.h" /* for ENCODE_UTF_8 and ENCODE_SYSTEM */
-/* Length of echobuf field in each KBOARD. */
+/* Lisp fields in struct keyboard are hidden from most code and accessed
+ via the KVAR macro, below. Only select pieces of code, like the GC,
+ are allowed to use KBOARD_INTERNAL_FIELD. */
+#define KBOARD_INTERNAL_FIELD(field) field ## _
+
+/* Most code should use this macro to access Lisp fields in struct
+ kboard. */
+#define KVAR(kboard, field) ((kboard)->KBOARD_INTERNAL_FIELD (field))
/* Each KBOARD represents one logical input stream from which Emacs
gets input. If we are using ordinary terminals, it has one KBOARD
@@ -72,32 +79,32 @@ struct kboard
can effectively wait for input in the any-kboard state, and hence
avoid blocking out the other KBOARDs. See universal-argument in
lisp/simple.el for an example. */
- Lisp_Object Voverriding_terminal_local_map;
+ Lisp_Object KBOARD_INTERNAL_FIELD (Voverriding_terminal_local_map);
/* Last command executed by the editor command loop, not counting
commands that set the prefix argument. */
- Lisp_Object Vlast_command;
+ Lisp_Object KBOARD_INTERNAL_FIELD (Vlast_command);
/* Normally same as last-command, but never modified by other commands. */
- Lisp_Object Vreal_last_command;
+ Lisp_Object KBOARD_INTERNAL_FIELD (Vreal_last_command);
/* User-supplied table to translate input characters through. */
- Lisp_Object Vkeyboard_translate_table;
+ Lisp_Object KBOARD_INTERNAL_FIELD (Vkeyboard_translate_table);
/* Last command that may be repeated by `repeat'. */
- Lisp_Object Vlast_repeatable_command;
+ Lisp_Object KBOARD_INTERNAL_FIELD (Vlast_repeatable_command);
/* The prefix argument for the next command, in raw form. */
- Lisp_Object Vprefix_arg;
+ Lisp_Object KBOARD_INTERNAL_FIELD (Vprefix_arg);
/* Saved prefix argument for the last command, in raw form. */
- Lisp_Object Vlast_prefix_arg;
+ Lisp_Object KBOARD_INTERNAL_FIELD (Vlast_prefix_arg);
/* Unread events specific to this kboard. */
- Lisp_Object kbd_queue;
+ Lisp_Object KBOARD_INTERNAL_FIELD (kbd_queue);
/* Non-nil while a kbd macro is being defined. */
- Lisp_Object defining_kbd_macro;
+ Lisp_Object KBOARD_INTERNAL_FIELD (defining_kbd_macro);
/* The start of storage for the current keyboard macro. */
Lisp_Object *kbd_macro_buffer;
@@ -119,28 +126,28 @@ struct kboard
int kbd_macro_bufsize;
/* Last anonymous kbd macro defined. */
- Lisp_Object Vlast_kbd_macro;
+ Lisp_Object KBOARD_INTERNAL_FIELD (Vlast_kbd_macro);
/* Alist of system-specific X windows key symbols. */
- Lisp_Object Vsystem_key_alist;
+ Lisp_Object KBOARD_INTERNAL_FIELD (Vsystem_key_alist);
/* Cache for modify_event_symbol. */
- Lisp_Object system_key_syms;
+ Lisp_Object KBOARD_INTERNAL_FIELD (system_key_syms);
/* The kind of display: x, w32, ... */
- Lisp_Object Vwindow_system;
+ Lisp_Object KBOARD_INTERNAL_FIELD (Vwindow_system);
/* Keymap mapping keys to alternative preferred forms.
See the DEFVAR for more documentation. */
- Lisp_Object Vlocal_function_key_map;
+ Lisp_Object KBOARD_INTERNAL_FIELD (Vlocal_function_key_map);
/* Keymap mapping ASCII function key sequences onto their preferred
forms. Initialized by the terminal-specific lisp files. See the
DEFVAR for more documentation. */
- Lisp_Object Vinput_decode_map;
+ Lisp_Object KBOARD_INTERNAL_FIELD (Vinput_decode_map);
/* Minibufferless frames on this display use this frame's minibuffer. */
- Lisp_Object Vdefault_minibuffer_frame;
+ Lisp_Object KBOARD_INTERNAL_FIELD (Vdefault_minibuffer_frame);
/* Number of displays using this KBOARD. Normally 1, but can be
larger when you have multiple screens on a single X display. */
@@ -148,7 +155,7 @@ struct kboard
/* The text we're echoing in the modeline - partial key sequences,
usually. This is nil when not echoing. */
- Lisp_Object echo_string;
+ Lisp_Object KBOARD_INTERNAL_FIELD (echo_string);
/* This flag indicates that events were put into kbd_queue
while Emacs was running for some other KBOARD.
diff --git a/src/keymap.c b/src/keymap.c
index 8ee4f41bd6..0e4715e4b8 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1565,8 +1565,8 @@ like in the respective argument of `key-binding'. */)
if (!NILP (olp))
{
- if (!NILP (current_kboard->Voverriding_terminal_local_map))
- keymaps = Fcons (current_kboard->Voverriding_terminal_local_map, keymaps);
+ if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map)))
+ keymaps = Fcons (KVAR (current_kboard, Voverriding_terminal_local_map), keymaps);
/* The doc said that overriding-terminal-local-map should
override overriding-local-map. The code used them both,
but it seems clearer to use just one. rms, jan 2005. */
@@ -1745,9 +1745,9 @@ specified buffer position instead of point are used.
}
}
- if (! NILP (current_kboard->Voverriding_terminal_local_map))
+ if (! NILP (KVAR (current_kboard, Voverriding_terminal_local_map)))
{
- value = Flookup_key (current_kboard->Voverriding_terminal_local_map,
+ value = Flookup_key (KVAR (current_kboard, Voverriding_terminal_local_map),
key, accept_default);
if (! NILP (value) && !INTEGERP (value))
goto done;
@@ -1883,7 +1883,7 @@ bindings; see the description of `lookup-key' for more details about this. */)
(Lisp_Object keys, Lisp_Object accept_default)
{
register Lisp_Object map;
- map = current_buffer->keymap;
+ map = BVAR (current_buffer, keymap);
if (NILP (map))
return Qnil;
return Flookup_key (map, keys, accept_default);
@@ -1988,7 +1988,7 @@ If KEYMAP is nil, that means no local keymap. */)
if (!NILP (keymap))
keymap = get_keymap (keymap, 1, 1);
- current_buffer->keymap = keymap;
+ BVAR (current_buffer, keymap) = keymap;
return Qnil;
}
@@ -1998,7 +1998,7 @@ DEFUN ("current-local-map", Fcurrent_local_map, Scurrent_local_map, 0, 0, 0,
Normally the local keymap is set by the major mode with `use-local-map'. */)
(void)
{
- return current_buffer->keymap;
+ return BVAR (current_buffer, keymap);
}
DEFUN ("current-global-map", Fcurrent_global_map, Scurrent_global_map, 0, 0, 0,
@@ -2379,7 +2379,7 @@ push_key_description (register unsigned int c, register char *p, int force_multi
*p++ = 'C';
}
else if (c < 128
- || (NILP (current_buffer->enable_multibyte_characters)
+ || (NILP (BVAR (current_buffer, enable_multibyte_characters))
&& SINGLE_BYTE_CHAR_P (c)
&& !force_multibyte))
{
@@ -2388,7 +2388,7 @@ push_key_description (register unsigned int c, register char *p, int force_multi
else
{
/* Now we are sure that C is a valid character code. */
- if (NILP (current_buffer->enable_multibyte_characters)
+ if (NILP (BVAR (current_buffer, enable_multibyte_characters))
&& ! force_multibyte)
*p++ = multibyte_char_to_unibyte (c, Qnil);
else
@@ -2941,11 +2941,11 @@ You type Translation\n\
outbuf = Fcurrent_buffer ();
/* Report on alternates for keys. */
- if (STRINGP (current_kboard->Vkeyboard_translate_table) && !NILP (prefix))
+ if (STRINGP (KVAR (current_kboard, Vkeyboard_translate_table)) && !NILP (prefix))
{
int c;
- const unsigned char *translate = SDATA (current_kboard->Vkeyboard_translate_table);
- int translate_len = SCHARS (current_kboard->Vkeyboard_translate_table);
+ const unsigned char *translate = SDATA (KVAR (current_kboard, Vkeyboard_translate_table));
+ int translate_len = SCHARS (KVAR (current_kboard, Vkeyboard_translate_table));
for (c = 0; c < translate_len; c++)
if (translate[c] != c)
@@ -2968,7 +2968,7 @@ You type Translation\n\
insert ("\n", 1);
/* Insert calls signal_after_change which may GC. */
- translate = SDATA (current_kboard->Vkeyboard_translate_table);
+ translate = SDATA (KVAR (current_kboard, Vkeyboard_translate_table));
}
insert ("\n", 1);
@@ -2981,8 +2981,8 @@ You type Translation\n\
/* Print the (major mode) local map. */
start1 = Qnil;
- if (!NILP (current_kboard->Voverriding_terminal_local_map))
- start1 = current_kboard->Voverriding_terminal_local_map;
+ if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map)))
+ start1 = KVAR (current_kboard, Voverriding_terminal_local_map);
else if (!NILP (Voverriding_local_map))
start1 = Voverriding_local_map;
@@ -3048,7 +3048,7 @@ You type Translation\n\
XBUFFER (buffer), Qlocal_map);
if (!NILP (start1))
{
- if (EQ (start1, XBUFFER (buffer)->keymap))
+ if (EQ (start1, BVAR (XBUFFER (buffer), keymap)))
describe_map_tree (start1, 1, shadow, prefix,
"\f\nMajor Mode Bindings", nomenu, 0, 0, 0);
else
@@ -3064,13 +3064,13 @@ You type Translation\n\
"\f\nGlobal Bindings", nomenu, 0, 1, 0);
/* Print the function-key-map translations under this prefix. */
- if (!NILP (current_kboard->Vlocal_function_key_map))
- describe_map_tree (current_kboard->Vlocal_function_key_map, 0, Qnil, prefix,
+ if (!NILP (KVAR (current_kboard, Vlocal_function_key_map)))
+ describe_map_tree (KVAR (current_kboard, Vlocal_function_key_map), 0, Qnil, prefix,
"\f\nFunction key map translations", nomenu, 1, 0, 0);
/* Print the input-decode-map translations under this prefix. */
- if (!NILP (current_kboard->Vinput_decode_map))
- describe_map_tree (current_kboard->Vinput_decode_map, 0, Qnil, prefix,
+ if (!NILP (KVAR (current_kboard, Vinput_decode_map)))
+ describe_map_tree (KVAR (current_kboard, Vinput_decode_map), 0, Qnil, prefix,
"\f\nInput decoding map translations", nomenu, 1, 0, 0);
UNGCPRO;
diff --git a/src/lisp.h b/src/lisp.h
index 0e7eeebc9d..badeb4258f 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1908,7 +1908,7 @@ extern void defvar_kboard (struct Lisp_Kboard_Objfwd *, const char *, int);
#define DEFVAR_BUFFER_DEFAULTS(lname, vname, doc) \
do { \
static struct Lisp_Objfwd o_fwd; \
- defvar_lisp_nopro (&o_fwd, lname, &buffer_defaults.vname); \
+ defvar_lisp_nopro (&o_fwd, lname, &BVAR (&buffer_defaults, vname)); \
} while (0)
#define DEFVAR_KBOARD(lname, vname, doc) \
@@ -1916,7 +1916,7 @@ extern void defvar_kboard (struct Lisp_Kboard_Objfwd *, const char *, int);
static struct Lisp_Kboard_Objfwd ko_fwd; \
defvar_kboard (&ko_fwd, \
lname, \
- (int)((char *)(&current_kboard->vname) \
+ (int)((char *)(&current_kboard->vname ## _) \
- (char *)current_kboard)); \
} while (0)
@@ -2073,11 +2073,11 @@ extern Lisp_Object case_temp2;
/* Current buffer's map from characters to lower-case characters. */
-#define DOWNCASE_TABLE current_buffer->downcase_table
+#define DOWNCASE_TABLE BVAR (current_buffer, downcase_table)
/* Current buffer's map from characters to upper-case characters. */
-#define UPCASE_TABLE current_buffer->upcase_table
+#define UPCASE_TABLE BVAR (current_buffer, upcase_table)
/* Downcase a character, or make no change if that cannot be done. */
@@ -2171,6 +2171,11 @@ struct gcpro
#define GC_MARK_STACK GC_USE_GCPROS_AS_BEFORE
#endif
+/* Whether we do the stack marking manually. */
+#define BYTE_MARK_STACK !(GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS \
+ || GC_MARK_STACK == GC_MARK_STACK_CHECK_GCPROS)
+
+
#if GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS
/* Do something silly with gcproN vars just so gcc shuts up. */
@@ -3282,7 +3287,9 @@ extern Lisp_Object Qbytecode;
EXFUN (Fbyte_code, MANY);
extern void syms_of_bytecode (void);
extern struct byte_stack *byte_stack_list;
+#ifdef BYTE_MARK_STACK
extern void mark_byte_stack (void);
+#endif
extern void unmark_byte_stack (void);
extern Lisp_Object exec_byte_code (Lisp_Object, Lisp_Object, Lisp_Object,
Lisp_Object, int, Lisp_Object *);
@@ -3438,11 +3445,6 @@ EXFUN (Fclear_face_cache, 1);
EXFUN (Fx_load_color_file, 1);
extern void syms_of_xfaces (void);
-#ifndef HAVE_GETLOADAVG
-/* Defined in getloadavg.c */
-extern int getloadavg (double *, int);
-#endif
-
#ifdef HAVE_X_WINDOWS
/* Defined in xfns.c */
extern void syms_of_xfns (void);
diff --git a/src/lread.c b/src/lread.c
index 02b2fa3907..b30a75b67c 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -212,7 +212,7 @@ readchar (Lisp_Object readcharfun, int *multibyte)
if (pt_byte >= BUF_ZV_BYTE (inbuffer))
return -1;
- if (! NILP (inbuffer->enable_multibyte_characters))
+ if (! NILP (BVAR (inbuffer, enable_multibyte_characters)))
{
/* Fetch the character code from the buffer. */
unsigned char *p = BUF_BYTE_ADDRESS (inbuffer, pt_byte);
@@ -241,7 +241,7 @@ readchar (Lisp_Object readcharfun, int *multibyte)
if (bytepos >= BUF_ZV_BYTE (inbuffer))
return -1;
- if (! NILP (inbuffer->enable_multibyte_characters))
+ if (! NILP (BVAR (inbuffer, enable_multibyte_characters)))
{
/* Fetch the character code from the buffer. */
unsigned char *p = BUF_BYTE_ADDRESS (inbuffer, bytepos);
@@ -373,7 +373,7 @@ unreadchar (Lisp_Object readcharfun, int c)
EMACS_INT bytepos = BUF_PT_BYTE (b);
BUF_PT (b)--;
- if (! NILP (b->enable_multibyte_characters))
+ if (! NILP (BVAR (b, enable_multibyte_characters)))
BUF_DEC_POS (b, bytepos);
else
bytepos--;
@@ -386,7 +386,7 @@ unreadchar (Lisp_Object readcharfun, int c)
EMACS_INT bytepos = XMARKER (readcharfun)->bytepos;
XMARKER (readcharfun)->charpos--;
- if (! NILP (b->enable_multibyte_characters))
+ if (! NILP (BVAR (b, enable_multibyte_characters)))
BUF_DEC_POS (b, bytepos);
else
bytepos--;
@@ -1375,7 +1375,9 @@ If SUFFIXES is non-nil, it should be a list of suffixes to append to
file name when searching.
If non-nil, PREDICATE is used instead of `file-readable-p'.
PREDICATE can also be an integer to pass to the access(2) function,
-in which case file-name-handlers are ignored. */)
+in which case file-name-handlers are ignored.
+This function will normally skip directories, so if you want it to find
+directories, make sure the PREDICATE function returns `dir-ok' for them. */)
(Lisp_Object filename, Lisp_Object path, Lisp_Object suffixes, Lisp_Object predicate)
{
Lisp_Object file;
@@ -1385,6 +1387,7 @@ in which case file-name-handlers are ignored. */)
return file;
}
+static Lisp_Object Qdir_ok;
/* Search for a file whose name is STR, looking in directories
in the Lisp list PATH, and trying suffixes from SUFFIX.
@@ -1447,7 +1450,7 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, Lisp_Object *sto
/* Of course, this could conceivably lose if luser sets
default-directory to be something non-absolute... */
{
- filename = Fexpand_file_name (filename, current_buffer->directory);
+ filename = Fexpand_file_name (filename, BVAR (current_buffer, directory));
if (!complete_filename_p (filename))
/* Give up on this path element! */
continue;
@@ -1502,9 +1505,12 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, Lisp_Object *sto
if (NILP (predicate))
exists = !NILP (Ffile_readable_p (string));
else
- exists = !NILP (call1 (predicate, string));
- if (exists && !NILP (Ffile_directory_p (string)))
- exists = 0;
+ {
+ Lisp_Object tmp = call1 (predicate, string);
+ exists = !NILP (tmp)
+ && (EQ (tmp, Qdir_ok)
+ || !NILP (Ffile_directory_p (string)));
+ }
if (exists)
{
@@ -1714,7 +1720,7 @@ readevalloop (Lisp_Object readcharfun,
{
int count1 = SPECPDL_INDEX ();
- if (b != 0 && NILP (b->name))
+ if (b != 0 && NILP (BVAR (b, name)))
error ("Reading from killed buffer");
if (!NILP (start))
@@ -1854,7 +1860,7 @@ This function preserves the position of point. */)
tem = printflag;
if (NILP (filename))
- filename = XBUFFER (buf)->filename;
+ filename = BVAR (XBUFFER (buf), filename);
specbind (Qeval_buffer_list, Fcons (buf, Veval_buffer_list));
specbind (Qstandard_output, tem);
@@ -1897,7 +1903,7 @@ This function does not move point. */)
specbind (Qeval_buffer_list, Fcons (cbuf, Veval_buffer_list));
/* readevalloop calls functions which check the type of start and end. */
- readevalloop (cbuf, 0, XBUFFER (cbuf)->filename,
+ readevalloop (cbuf, 0, BVAR (XBUFFER (cbuf), filename),
!NILP (printflag), Qnil, read_function,
start, end);
@@ -4542,6 +4548,9 @@ This variable is automatically set from the file variables of an interpreted
Qfile_truename = intern_c_string ("file-truename");
staticpro (&Qfile_truename) ;
+ Qdir_ok = intern_c_string ("dir-ok");
+ staticpro (&Qdir_ok);
+
Qdo_after_load_evaluation = intern_c_string ("do-after-load-evaluation");
staticpro (&Qdo_after_load_evaluation) ;
diff --git a/src/m/alpha.h b/src/m/alpha.h
index 9ae089bfc5..3a27cfd65d 100644
--- a/src/m/alpha.h
+++ b/src/m/alpha.h
@@ -29,12 +29,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* __alpha defined automatically */
-/* Data type of load average, as read out of kmem. */
-#define LOAD_AVE_TYPE long
-
-/* Convert that into an integer that is 100 for a load average of 1.0 */
-#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
-
#ifdef __ELF__
#if !defined(GNU_LINUX) && !defined(__NetBSD__)
@@ -57,4 +51,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
Define DBL_MIN_REPLACEMENT to be the next value larger than DBL_MIN:
this avoids the assembler bug. */
#define DBL_MIN_REPLACEMENT 2.2250738585072019e-308
-
diff --git a/src/m/amdx86-64.h b/src/m/amdx86-64.h
index 2ae5d07390..441f41b444 100644
--- a/src/m/amdx86-64.h
+++ b/src/m/amdx86-64.h
@@ -30,12 +30,5 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#define EMACS_INT long
#define EMACS_UINT unsigned long
-/* Data type of load average, as read out of kmem. */
-#define LOAD_AVE_TYPE long
-
-/* Convert that into an integer that is 100 for a load average of 1.0 */
-#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
-
/* Define XPNTR to avoid or'ing with DATA_SEG_BITS */
#undef DATA_SEG_BITS
-
diff --git a/src/m/ia64.h b/src/m/ia64.h
index 48ba3005cd..101d56e648 100644
--- a/src/m/ia64.h
+++ b/src/m/ia64.h
@@ -30,12 +30,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#define EMACS_INT long
#define EMACS_UINT unsigned long
-/* Data type of load average, as read out of kmem. */
-#define LOAD_AVE_TYPE long
-
-/* Convert that into an integer that is 100 for a load average of 1.0 */
-#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
-
#ifdef REL_ALLOC
#ifndef _MALLOC_INTERNAL
/* "char *" because ralloc.c defines it that way. gmalloc.c thinks it
@@ -45,4 +39,3 @@ extern char *r_alloc (), *r_re_alloc ();
extern void r_alloc_free ();
#endif /* not _MALLOC_INTERNAL */
#endif /* REL_ALLOC */
-
diff --git a/src/m/ibms390.h b/src/m/ibms390.h
index f2aef1ba51..c309035dc5 100644
--- a/src/m/ibms390.h
+++ b/src/m/ibms390.h
@@ -18,12 +18,6 @@ You should have received a copy of the GNU General Public License
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
-/* Data type of load average, as read out of kmem. */
-#define LOAD_AVE_TYPE long
-
-/* Convert that into an integer that is 100 for a load average of 1.0 */
-#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
-
/* Define VIRT_ADDR_VARIES if the virtual addresses of
pure and impure space as loaded can vary, and even their
relative order cannot be relied on.
@@ -31,4 +25,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
Otherwise Emacs assumes that text space precedes data space,
numerically. */
#define VIRT_ADDR_VARIES
-
diff --git a/src/m/macppc.h b/src/m/macppc.h
index 5d78e39bdb..aef781e2c3 100644
--- a/src/m/macppc.h
+++ b/src/m/macppc.h
@@ -17,15 +17,8 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
-/* Data type of load average, as read out of kmem. */
-#define LOAD_AVE_TYPE long
-
-/* Convert that into an integer that is 100 for a load average of 1.0 */
-#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
-
#ifdef _ARCH_PPC64
#ifndef _LP64
#define _LP64
#endif
#endif
-
diff --git a/src/m/sparc.h b/src/m/sparc.h
index 50e56f0f3d..99668043f3 100644
--- a/src/m/sparc.h
+++ b/src/m/sparc.h
@@ -19,12 +19,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* __sparc__ is defined by the compiler by default. */
-/* Data type of load average, as read out of kmem. */
-#define LOAD_AVE_TYPE long
-
-/* Convert that into an integer that is 100 for a load average of 1.0 */
-#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
-
#ifdef __arch64__ /* GCC, 64-bit ABI. */
#define BITS_PER_LONG 64
@@ -34,4 +28,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#endif
#endif /* __arch64__ */
-
diff --git a/src/m/template.h b/src/m/template.h
index f06f62b6cd..54fb0da952 100644
--- a/src/m/template.h
+++ b/src/m/template.h
@@ -21,12 +21,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
does not define it automatically.
Ones defined so far include m68k and many others */
-/* Data type of load average, as read out of kmem. */
-#define LOAD_AVE_TYPE long
-
-/* Convert that into an integer that is 100 for a load average of 1.0 */
-#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
-
/* Define VIRT_ADDR_VARIES if the virtual addresses of
pure and impure space as loaded can vary, and even their
relative order cannot be relied on.
@@ -46,4 +40,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
If you've just fixed a problem in an existing configuration file,
you should also check `etc/MACHINES' to make sure its descriptions
of known problems in that configuration should be updated. */
-
diff --git a/src/m/vax.h b/src/m/vax.h
index 2fecf17ca8..a375600cea 100644
--- a/src/m/vax.h
+++ b/src/m/vax.h
@@ -20,14 +20,4 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* #define vax -- appears to be done automatically */
-/* USG systems I know of running on Vaxes do not actually
- support the load average, so disable it for them. */
-
-/* Data type of load average, as read out of kmem. */
-#define LOAD_AVE_TYPE double
-
-/* Convert that into an integer that is 100 for a load average of 1.0 */
-#define LOAD_AVE_CVT(x) ((int) ((x) * 100.0))
-
#define HAVE_FTIME
-
diff --git a/src/macros.c b/src/macros.c
index 34ac08c328..d90b31b503 100644
--- a/src/macros.c
+++ b/src/macros.c
@@ -56,7 +56,7 @@ If optional second arg, NO-EXEC, is non-nil, do not re-execute last
macro before appending to it. */)
(Lisp_Object append, Lisp_Object no_exec)
{
- if (!NILP (current_kboard->defining_kbd_macro))
+ if (!NILP (KVAR (current_kboard, defining_kbd_macro)))
error ("Already defining kbd macro");
if (!current_kboard->kbd_macro_buffer)
@@ -85,9 +85,9 @@ macro before appending to it. */)
int cvt;
/* Check the type of last-kbd-macro in case Lisp code changed it. */
- CHECK_VECTOR_OR_STRING (current_kboard->Vlast_kbd_macro);
+ CHECK_VECTOR_OR_STRING (KVAR (current_kboard, Vlast_kbd_macro));
- len = XINT (Flength (current_kboard->Vlast_kbd_macro));
+ len = XINT (Flength (KVAR (current_kboard, Vlast_kbd_macro)));
/* Copy last-kbd-macro into the buffer, in case the Lisp code
has put another macro there. */
@@ -100,11 +100,11 @@ macro before appending to it. */)
}
/* Must convert meta modifier when copying string to vector. */
- cvt = STRINGP (current_kboard->Vlast_kbd_macro);
+ cvt = STRINGP (KVAR (current_kboard, Vlast_kbd_macro));
for (i = 0; i < len; i++)
{
Lisp_Object c;
- c = Faref (current_kboard->Vlast_kbd_macro, make_number (i));
+ c = Faref (KVAR (current_kboard, Vlast_kbd_macro), make_number (i));
if (cvt && NATNUMP (c) && (XFASTINT (c) & 0x80))
XSETFASTINT (c, CHAR_META | (XFASTINT (c) & ~0x80));
current_kboard->kbd_macro_buffer[i] = c;
@@ -116,12 +116,12 @@ macro before appending to it. */)
/* Re-execute the macro we are appending to,
for consistency of behavior. */
if (NILP (no_exec))
- Fexecute_kbd_macro (current_kboard->Vlast_kbd_macro,
+ Fexecute_kbd_macro (KVAR (current_kboard, Vlast_kbd_macro),
make_number (1), Qnil);
message ("Appending to kbd macro...");
}
- current_kboard->defining_kbd_macro = Qt;
+ KVAR (current_kboard, defining_kbd_macro) = Qt;
return Qnil;
}
@@ -131,9 +131,9 @@ macro before appending to it. */)
void
end_kbd_macro (void)
{
- current_kboard->defining_kbd_macro = Qnil;
+ KVAR (current_kboard, defining_kbd_macro) = Qnil;
update_mode_lines++;
- current_kboard->Vlast_kbd_macro
+ KVAR (current_kboard, Vlast_kbd_macro)
= make_event_array ((current_kboard->kbd_macro_end
- current_kboard->kbd_macro_buffer),
current_kboard->kbd_macro_buffer);
@@ -154,7 +154,7 @@ In Lisp, optional second arg LOOPFUNC may be a function that is called prior to
each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */)
(Lisp_Object repeat, Lisp_Object loopfunc)
{
- if (NILP (current_kboard->defining_kbd_macro))
+ if (NILP (KVAR (current_kboard, defining_kbd_macro)))
error ("Not defining kbd macro");
if (NILP (repeat))
@@ -162,19 +162,19 @@ each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */)
else
CHECK_NUMBER (repeat);
- if (!NILP (current_kboard->defining_kbd_macro))
+ if (!NILP (KVAR (current_kboard, defining_kbd_macro)))
{
end_kbd_macro ();
message ("Keyboard macro defined");
}
if (XFASTINT (repeat) == 0)
- Fexecute_kbd_macro (current_kboard->Vlast_kbd_macro, repeat, loopfunc);
+ Fexecute_kbd_macro (KVAR (current_kboard, Vlast_kbd_macro), repeat, loopfunc);
else
{
XSETINT (repeat, XINT (repeat)-1);
if (XINT (repeat) > 0)
- Fexecute_kbd_macro (current_kboard->Vlast_kbd_macro, repeat, loopfunc);
+ Fexecute_kbd_macro (KVAR (current_kboard, Vlast_kbd_macro), repeat, loopfunc);
}
return Qnil;
}
@@ -186,7 +186,7 @@ store_kbd_macro_char (Lisp_Object c)
{
struct kboard *kb = current_kboard;
- if (!NILP (kb->defining_kbd_macro))
+ if (!NILP (KVAR (kb, defining_kbd_macro)))
{
if (kb->kbd_macro_ptr - kb->kbd_macro_buffer == kb->kbd_macro_bufsize)
{
@@ -248,21 +248,21 @@ each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */)
{
/* Don't interfere with recognition of the previous command
from before this macro started. */
- Vthis_command = current_kboard->Vlast_command;
+ Vthis_command = KVAR (current_kboard, Vlast_command);
/* C-x z after the macro should repeat the macro. */
- real_this_command = current_kboard->Vlast_kbd_macro;
+ real_this_command = KVAR (current_kboard, Vlast_kbd_macro);
- if (! NILP (current_kboard->defining_kbd_macro))
+ if (! NILP (KVAR (current_kboard, defining_kbd_macro)))
error ("Can't execute anonymous macro while defining one");
- else if (NILP (current_kboard->Vlast_kbd_macro))
+ else if (NILP (KVAR (current_kboard, Vlast_kbd_macro)))
error ("No kbd macro has been defined");
else
- Fexecute_kbd_macro (current_kboard->Vlast_kbd_macro, prefix, loopfunc);
+ Fexecute_kbd_macro (KVAR (current_kboard, Vlast_kbd_macro), prefix, loopfunc);
/* command_loop_1 sets this to nil before it returns;
get back the last command within the macro
so that it can be last, again, after we return. */
- Vthis_command = current_kboard->Vlast_command;
+ Vthis_command = KVAR (current_kboard, Vlast_command);
return Qnil;
}
@@ -322,7 +322,7 @@ each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */)
executing_kbd_macro = final;
executing_kbd_macro_index = 0;
- current_kboard->Vprefix_arg = Qnil;
+ KVAR (current_kboard, Vprefix_arg) = Qnil;
if (!NILP (loopfunc))
{
diff --git a/src/makefile.w32-in b/src/makefile.w32-in
index ce4b9f35de..7a702fd45b 100644
--- a/src/makefile.w32-in
+++ b/src/makefile.w32-in
@@ -72,7 +72,6 @@ OBJ1 = $(BLD)/alloc.$(O) \
$(BLD)/eval.$(O) \
$(BLD)/fileio.$(O) \
$(BLD)/filelock.$(O) \
- $(BLD)/filemode.$(O) \
$(BLD)/fns.$(O) \
$(BLD)/indent.$(O) \
$(BLD)/insdel.$(O) \
@@ -81,7 +80,6 @@ OBJ1 = $(BLD)/alloc.$(O) \
$(BLD)/lread.$(O) \
$(BLD)/macros.$(O) \
$(BLD)/marker.$(O) \
- $(BLD)/md5.$(O) \
$(BLD)/minibuf.$(O) \
$(BLD)/w32.$(O) \
$(BLD)/w32heap.$(O) \
@@ -214,14 +212,14 @@ GLOBAL_SOURCES = dosfns.c msdos.c \
cm.c term.c terminal.c xfaces.c \
emacs.c keyboard.c macros.c keymap.c sysdep.c \
buffer.c filelock.c insdel.c marker.c \
- minibuf.c fileio.c dired.c filemode.c \
+ minibuf.c fileio.c dired.c \
cmds.c casetab.c casefiddle.c indent.c search.c regex.c undo.c \
alloc.c data.c doc.c editfns.c callint.c \
eval.c floatfns.c fns.c print.c lread.c \
syntax.c bytecode.c \
process.c callproc.c unexw32.c \
region-cache.c sound.c atimer.c \
- doprnt.c intervals.c textprop.c composite.c md5.c
+ doprnt.c intervals.c textprop.c composite.c
SOME_MACHINE_OBJECTS = dosfns.o msdos.o \
xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o dbusbind.o
obj = $(GLOBAL_SOURCES:.c=.o)
@@ -664,6 +662,7 @@ $(BLD)/dired.$(O) : \
$(SRC)/coding.h \
$(SRC)/commands.h \
$(SRC)/composite.h \
+ $(EMACS_ROOT)/lib/filemode.h \
$(SRC)/ndir.h \
$(SRC)/regex.h \
$(SRC)/systime.h
@@ -822,10 +821,6 @@ $(BLD)/filelock.$(O) : \
$(SRC)/composite.h \
$(SRC)/systime.h
-$(BLD)/filemode.$(O) : \
- $(SRC)/filemode.c \
- $(CONFIG_H)
-
$(BLD)/firstfile.$(O) : \
$(SRC)/firstfile.c \
$(CONFIG_H)
@@ -843,6 +838,7 @@ $(BLD)/fns.$(O) : \
$(EMACS_ROOT)/nt/inc/nl_types.h \
$(EMACS_ROOT)/nt/inc/unistd.h \
$(EMACS_ROOT)/nt/inc/sys/time.h \
+ $(EMACS_ROOT)/lib/md5.h \
$(LISP_H) \
$(SRC)/atimer.h \
$(SRC)/blockinput.h \
@@ -856,7 +852,6 @@ $(BLD)/fns.$(O) : \
$(SRC)/intervals.h \
$(SRC)/keyboard.h \
$(SRC)/keymap.h \
- $(SRC)/md5.h \
$(SRC)/systime.h \
$(SRC)/w32gui.h \
$(SRC)/window.h
@@ -1135,11 +1130,6 @@ $(BLD)/marker.$(O) : \
$(SRC)/buffer.h \
$(SRC)/character.h
-$(BLD)/md5.$(O) : \
- $(SRC)/md5.c \
- $(CONFIG_H) \
- $(SRC)/md5.h
-
$(BLD)/menu.$(O) : \
$(SRC)/menu.c \
$(CONFIG_H) \
diff --git a/src/marker.c b/src/marker.c
index 1e0e1404fd..72c564f420 100644
--- a/src/marker.c
+++ b/src/marker.c
@@ -439,7 +439,7 @@ Returns nil if MARKER points into a dead buffer. */)
does not preserve the buffer from being GC'd (it's weak), so
markers have to be unlinked from their buffer as soon as the buffer
is killed. */
- eassert (!NILP (XBUFFER (buf)->name));
+ eassert (!NILP (BVAR (XBUFFER (buf), name)));
return buf;
}
return Qnil;
@@ -488,7 +488,7 @@ Returns MARKER. */)
CHECK_BUFFER (buffer);
b = XBUFFER (buffer);
/* If buffer is dead, set marker to point nowhere. */
- if (EQ (b->name, Qnil))
+ if (EQ (BVAR (b, name), Qnil))
{
unchain_marker (m);
return marker;
@@ -563,7 +563,7 @@ set_marker_restricted (Lisp_Object marker, Lisp_Object pos, Lisp_Object buffer)
CHECK_BUFFER (buffer);
b = XBUFFER (buffer);
/* If buffer is dead, set marker to point nowhere. */
- if (EQ (b->name, Qnil))
+ if (EQ (BVAR (b, name), Qnil))
{
unchain_marker (m);
return marker;
@@ -628,7 +628,7 @@ set_marker_both (Lisp_Object marker, Lisp_Object buffer, EMACS_INT charpos, EMAC
CHECK_BUFFER (buffer);
b = XBUFFER (buffer);
/* If buffer is dead, set marker to point nowhere. */
- if (EQ (b->name, Qnil))
+ if (EQ (BVAR (b, name), Qnil))
{
unchain_marker (m);
return marker;
@@ -676,7 +676,7 @@ set_marker_restricted_both (Lisp_Object marker, Lisp_Object buffer, EMACS_INT ch
CHECK_BUFFER (buffer);
b = XBUFFER (buffer);
/* If buffer is dead, set marker to point nowhere. */
- if (EQ (b->name, Qnil))
+ if (EQ (BVAR (b, name), Qnil))
{
unchain_marker (m);
return marker;
@@ -731,7 +731,7 @@ unchain_marker (register struct Lisp_Marker *marker)
if (b == 0)
return;
- if (EQ (b->name, Qnil))
+ if (EQ (BVAR (b, name), Qnil))
abort ();
marker->buffer = 0;
diff --git a/src/md5.c b/src/md5.c
deleted file mode 100644
index 9d9d7d8f14..0000000000
--- a/src/md5.c
+++ /dev/null
@@ -1,430 +0,0 @@
-/* Functions to compute MD5 message digest of files or memory blocks.
- according to the definition of MD5 in RFC 1321 from April 1992.
- Copyright (C) 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004,
- 2005, 2006, 2007, 2010 Free Software Foundation, Inc.
-
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with the GNU C Library; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA. */
-
-/* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <sys/types.h>
-
-#if STDC_HEADERS || defined _LIBC
-# include <stdlib.h>
-# include <string.h>
-#else
-# ifndef HAVE_MEMCPY
-# define memcpy(d, s, n) bcopy ((s), (d), (n))
-# endif
-#endif
-
-#ifdef _LIBC
-# include <endian.h>
-# if __BYTE_ORDER == __BIG_ENDIAN
-# define WORDS_BIGENDIAN 1
-# endif
-/* We need to keep the namespace clean so define the MD5 function
- protected using leading __ . */
-# define md5_init_ctx __md5_init_ctx
-# define md5_process_block __md5_process_block
-# define md5_process_bytes __md5_process_bytes
-# define md5_finish_ctx __md5_finish_ctx
-# define md5_read_ctx __md5_read_ctx
-# define md5_stream __md5_stream
-# define md5_buffer __md5_buffer
-#endif
-
-#include "md5.h"
-
-#ifdef WORDS_BIGENDIAN
-# define SWAP(n) \
- (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
-#else
-# define SWAP(n) (n)
-#endif
-
-
-/* This array contains the bytes used to pad the buffer to the next
- 64-byte boundary. (RFC 1321, 3.1: Step 1) */
-static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ };
-
-
-/* Initialize structure containing state of computation.
- (RFC 1321, 3.3: Step 3) */
-void
-md5_init_ctx (struct md5_ctx *ctx)
-{
- ctx->A = 0x67452301;
- ctx->B = 0xefcdab89;
- ctx->C = 0x98badcfe;
- ctx->D = 0x10325476;
-
- ctx->total[0] = ctx->total[1] = 0;
- ctx->buflen = 0;
-}
-
-/* Put result from CTX in first 16 bytes following RESBUF. The result
- must be in little endian byte order.
-
- IMPORTANT: On some systems it is required that RESBUF is correctly
- aligned for a 32 bits value. */
-void *
-md5_read_ctx (const struct md5_ctx *ctx, void *resbuf)
-{
- ((md5_uint32 *) resbuf)[0] = SWAP (ctx->A);
- ((md5_uint32 *) resbuf)[1] = SWAP (ctx->B);
- ((md5_uint32 *) resbuf)[2] = SWAP (ctx->C);
- ((md5_uint32 *) resbuf)[3] = SWAP (ctx->D);
-
- return resbuf;
-}
-
-/* Process the remaining bytes in the internal buffer and the usual
- prolog according to the standard and write the result to RESBUF.
-
- IMPORTANT: On some systems it is required that RESBUF is correctly
- aligned for a 32 bits value. */
-void *
-md5_finish_ctx (struct md5_ctx *ctx, void *resbuf)
-{
- /* Take yet unprocessed bytes into account. */
- md5_uint32 bytes = ctx->buflen;
- size_t pad;
-
- /* Now count remaining bytes. */
- ctx->total[0] += bytes;
- if (ctx->total[0] < bytes)
- ++ctx->total[1];
-
- pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes;
- memcpy (&ctx->buffer[bytes], fillbuf, pad);
-
- /* Put the 64-bit file length in *bits* at the end of the buffer. */
- *(md5_uint32 *) &ctx->buffer[bytes + pad] = SWAP (ctx->total[0] << 3);
- *(md5_uint32 *) &ctx->buffer[bytes + pad + 4] = SWAP ((ctx->total[1] << 3) |
- (ctx->total[0] >> 29));
-
- /* Process last bytes. */
- md5_process_block (ctx->buffer, bytes + pad + 8, ctx);
-
- return md5_read_ctx (ctx, resbuf);
-}
-
-/* Compute MD5 message digest for bytes read from STREAM. The
- resulting message digest number will be written into the 16 bytes
- beginning at RESBLOCK. */
-int
-md5_stream (FILE *stream, void *resblock)
-{
- /* Important: BLOCKSIZE must be a multiple of 64. */
-#define BLOCKSIZE 4096
- struct md5_ctx ctx;
- char buffer[BLOCKSIZE + 72];
- size_t sum;
-
- /* Initialize the computation context. */
- md5_init_ctx (&ctx);
-
- /* Iterate over full file contents. */
- while (1)
- {
- /* We read the file in blocks of BLOCKSIZE bytes. One call of the
- computation function processes the whole buffer so that with the
- next round of the loop another block can be read. */
- size_t n;
- sum = 0;
-
- /* Read block. Take care for partial reads. */
- do
- {
- n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
-
- sum += n;
- }
- while (sum < BLOCKSIZE && n != 0);
- if (n == 0 && ferror (stream))
- return 1;
-
- /* If end of file is reached, end the loop. */
- if (n == 0)
- break;
-
- /* Process buffer with BLOCKSIZE bytes. Note that
- BLOCKSIZE % 64 == 0
- */
- md5_process_block (buffer, BLOCKSIZE, &ctx);
- }
-
- /* Add the last bytes if necessary. */
- if (sum > 0)
- md5_process_bytes (buffer, sum, &ctx);
-
- /* Construct result in desired memory. */
- md5_finish_ctx (&ctx, resblock);
- return 0;
-}
-
-/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
- result is always in little endian byte order, so that a byte-wise
- output yields to the wanted ASCII representation of the message
- digest. */
-void *
-md5_buffer (const char *buffer, size_t len, void *resblock)
-{
- struct md5_ctx ctx;
-
- /* Initialize the computation context. */
- md5_init_ctx (&ctx);
-
- /* Process whole buffer but last len % 64 bytes. */
- md5_process_bytes (buffer, len, &ctx);
-
- /* Put result in desired memory area. */
- return md5_finish_ctx (&ctx, resblock);
-}
-
-
-void
-md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx)
-{
- /* const void aligned_buffer = buffer; */
-
- /* When we already have some bits in our internal buffer concatenate
- both inputs first. */
- if (ctx->buflen != 0)
- {
- size_t left_over = ctx->buflen;
- size_t add = 128 - left_over > len ? len : 128 - left_over;
-
- /* Only put full words in the buffer. */
- add -= add % __alignof__ (md5_uint32);
-
- memcpy (&ctx->buffer[left_over], buffer, add);
- ctx->buflen += add;
-
- if (ctx->buflen > 64)
- {
- md5_process_block (ctx->buffer, ctx->buflen & ~63, ctx);
-
- ctx->buflen &= 63;
- /* The regions in the following copy operation cannot overlap. */
- memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63],
- ctx->buflen);
- }
-
- buffer = (const char *) buffer + add;
- len -= add;
- }
-
- /* Process available complete blocks. */
- if (len > 64)
- {
- md5_process_block (buffer, len & ~63, ctx);
- buffer = (const char *) buffer + (len & ~63);
- len &= 63;
- }
-
- /* Move remaining bytes in internal buffer. */
- if (len > 0)
- {
- size_t left_over = ctx->buflen;
-
- memcpy (&ctx->buffer[left_over], buffer, len);
- left_over += len;
- if (left_over >= 64)
- {
- md5_process_block (ctx->buffer, 64, ctx);
- left_over -= 64;
- memcpy (ctx->buffer, &ctx->buffer[64], left_over);
- }
- ctx->buflen = left_over;
- }
-}
-
-
-/* These are the four functions used in the four steps of the MD5 algorithm
- and defined in the RFC 1321. The first function is a little bit optimized
- (as found in Colin Plumbs public domain implementation). */
-/* #define FF(b, c, d) ((b & c) | (~b & d)) */
-#define FF(b, c, d) (d ^ (b & (c ^ d)))
-#define FG(b, c, d) FF (d, b, c)
-#define FH(b, c, d) (b ^ c ^ d)
-#define FI(b, c, d) (c ^ (b | ~d))
-
-/* Process LEN bytes of BUFFER, accumulating context into CTX.
- It is assumed that LEN % 64 == 0. */
-
-void
-md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx)
-{
- md5_uint32 correct_words[16];
- const md5_uint32 *words = buffer;
- size_t nwords = len / sizeof (md5_uint32);
- const md5_uint32 *endp = words + nwords;
- md5_uint32 A = ctx->A;
- md5_uint32 B = ctx->B;
- md5_uint32 C = ctx->C;
- md5_uint32 D = ctx->D;
-
- /* First increment the byte count. RFC 1321 specifies the possible
- length of the file up to 2^64 bits. Here we only compute the
- number of bytes. Do a double word increment. */
- ctx->total[0] += len;
- if (ctx->total[0] < len)
- ++ctx->total[1];
-
- /* Process all bytes in the buffer with 64 bytes in each round of
- the loop. */
- while (words < endp)
- {
- md5_uint32 *cwp = correct_words;
- md5_uint32 A_save = A;
- md5_uint32 B_save = B;
- md5_uint32 C_save = C;
- md5_uint32 D_save = D;
-
- /* First round: using the given function, the context and a constant
- the next context is computed. Because the algorithms processing
- unit is a 32-bit word and it is determined to work on words in
- little endian byte order we perhaps have to change the byte order
- before the computation. To reduce the work for the next steps
- we store the swapped words in the array CORRECT_WORDS. */
-
-#define OP(a, b, c, d, s, T) \
- do \
- { \
- a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T; \
- ++words; \
- CYCLIC (a, s); \
- a += b; \
- } \
- while (0)
-
- /* It is unfortunate that C does not provide an operator for
- cyclic rotation. Hope the C compiler is smart enough. */
-#define CYCLIC(w, s) (w = (w << s) | (w >> (32 - s)))
-
- /* Before we start, one word to the strange constants.
- They are defined in RFC 1321 as
-
- T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64
- */
-
- /* Round 1. */
- OP (A, B, C, D, 7, 0xd76aa478);
- OP (D, A, B, C, 12, 0xe8c7b756);
- OP (C, D, A, B, 17, 0x242070db);
- OP (B, C, D, A, 22, 0xc1bdceee);
- OP (A, B, C, D, 7, 0xf57c0faf);
- OP (D, A, B, C, 12, 0x4787c62a);
- OP (C, D, A, B, 17, 0xa8304613);
- OP (B, C, D, A, 22, 0xfd469501);
- OP (A, B, C, D, 7, 0x698098d8);
- OP (D, A, B, C, 12, 0x8b44f7af);
- OP (C, D, A, B, 17, 0xffff5bb1);
- OP (B, C, D, A, 22, 0x895cd7be);
- OP (A, B, C, D, 7, 0x6b901122);
- OP (D, A, B, C, 12, 0xfd987193);
- OP (C, D, A, B, 17, 0xa679438e);
- OP (B, C, D, A, 22, 0x49b40821);
-
- /* For the second to fourth round we have the possibly swapped words
- in CORRECT_WORDS. Redefine the macro to take an additional first
- argument specifying the function to use. */
-#undef OP
-#define OP(f, a, b, c, d, k, s, T) \
- do \
- { \
- a += f (b, c, d) + correct_words[k] + T; \
- CYCLIC (a, s); \
- a += b; \
- } \
- while (0)
-
- /* Round 2. */
- OP (FG, A, B, C, D, 1, 5, 0xf61e2562);
- OP (FG, D, A, B, C, 6, 9, 0xc040b340);
- OP (FG, C, D, A, B, 11, 14, 0x265e5a51);
- OP (FG, B, C, D, A, 0, 20, 0xe9b6c7aa);
- OP (FG, A, B, C, D, 5, 5, 0xd62f105d);
- OP (FG, D, A, B, C, 10, 9, 0x02441453);
- OP (FG, C, D, A, B, 15, 14, 0xd8a1e681);
- OP (FG, B, C, D, A, 4, 20, 0xe7d3fbc8);
- OP (FG, A, B, C, D, 9, 5, 0x21e1cde6);
- OP (FG, D, A, B, C, 14, 9, 0xc33707d6);
- OP (FG, C, D, A, B, 3, 14, 0xf4d50d87);
- OP (FG, B, C, D, A, 8, 20, 0x455a14ed);
- OP (FG, A, B, C, D, 13, 5, 0xa9e3e905);
- OP (FG, D, A, B, C, 2, 9, 0xfcefa3f8);
- OP (FG, C, D, A, B, 7, 14, 0x676f02d9);
- OP (FG, B, C, D, A, 12, 20, 0x8d2a4c8a);
-
- /* Round 3. */
- OP (FH, A, B, C, D, 5, 4, 0xfffa3942);
- OP (FH, D, A, B, C, 8, 11, 0x8771f681);
- OP (FH, C, D, A, B, 11, 16, 0x6d9d6122);
- OP (FH, B, C, D, A, 14, 23, 0xfde5380c);
- OP (FH, A, B, C, D, 1, 4, 0xa4beea44);
- OP (FH, D, A, B, C, 4, 11, 0x4bdecfa9);
- OP (FH, C, D, A, B, 7, 16, 0xf6bb4b60);
- OP (FH, B, C, D, A, 10, 23, 0xbebfbc70);
- OP (FH, A, B, C, D, 13, 4, 0x289b7ec6);
- OP (FH, D, A, B, C, 0, 11, 0xeaa127fa);
- OP (FH, C, D, A, B, 3, 16, 0xd4ef3085);
- OP (FH, B, C, D, A, 6, 23, 0x04881d05);
- OP (FH, A, B, C, D, 9, 4, 0xd9d4d039);
- OP (FH, D, A, B, C, 12, 11, 0xe6db99e5);
- OP (FH, C, D, A, B, 15, 16, 0x1fa27cf8);
- OP (FH, B, C, D, A, 2, 23, 0xc4ac5665);
-
- /* Round 4. */
- OP (FI, A, B, C, D, 0, 6, 0xf4292244);
- OP (FI, D, A, B, C, 7, 10, 0x432aff97);
- OP (FI, C, D, A, B, 14, 15, 0xab9423a7);
- OP (FI, B, C, D, A, 5, 21, 0xfc93a039);
- OP (FI, A, B, C, D, 12, 6, 0x655b59c3);
- OP (FI, D, A, B, C, 3, 10, 0x8f0ccc92);
- OP (FI, C, D, A, B, 10, 15, 0xffeff47d);
- OP (FI, B, C, D, A, 1, 21, 0x85845dd1);
- OP (FI, A, B, C, D, 8, 6, 0x6fa87e4f);
- OP (FI, D, A, B, C, 15, 10, 0xfe2ce6e0);
- OP (FI, C, D, A, B, 6, 15, 0xa3014314);
- OP (FI, B, C, D, A, 13, 21, 0x4e0811a1);
- OP (FI, A, B, C, D, 4, 6, 0xf7537e82);
- OP (FI, D, A, B, C, 11, 10, 0xbd3af235);
- OP (FI, C, D, A, B, 2, 15, 0x2ad7d2bb);
- OP (FI, B, C, D, A, 9, 21, 0xeb86d391);
-
- /* Add the starting values of the context. */
- A += A_save;
- B += B_save;
- C += C_save;
- D += D_save;
- }
-
- /* Put checksum in context given as argument. */
- ctx->A = A;
- ctx->B = B;
- ctx->C = C;
- ctx->D = D;
-}
-
diff --git a/src/md5.h b/src/md5.h
deleted file mode 100644
index 8ab7305037..0000000000
--- a/src/md5.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/* Declaration of functions and data types used for MD5 sum computing
- library functions.
- Copyright (C) 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004,
- 2005, 2006, 2007 Free Software Foundation, Inc.
- This file is part of GNU Emacs.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with the GNU C Library; see the file COPYING. If not,
- write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA. */
-
-#ifndef _MD5_H
-#define _MD5_H 1
-
-#include <stdio.h>
-
-#if defined HAVE_LIMITS_H || _LIBC
-# include <limits.h>
-#endif
-
-/* The following contortions are an attempt to use the C preprocessor
- to determine an unsigned integral type that is 32 bits wide. An
- alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but
- doing that would require that the configure script compile and *run*
- the resulting executable. Locally running cross-compiled executables
- is usually not possible. */
-
-#ifdef _LIBC
-# include <sys/types.h>
-typedef u_int32_t md5_uint32;
-#else
-# if defined __STDC__ && __STDC__
-# define UINT_MAX_32_BITS 4294967295U
-# else
-# define UINT_MAX_32_BITS 0xFFFFFFFF
-# endif
-
-/* If UINT_MAX isn't defined, assume it's a 32-bit type.
- This should be valid for all systems GNU cares about because
- that doesn't include 16-bit systems, and only modern systems
- (that certainly have <limits.h>) have 64+-bit integral types. */
-
-# ifndef UINT_MAX
-# define UINT_MAX UINT_MAX_32_BITS
-# endif
-
-# if UINT_MAX == UINT_MAX_32_BITS
- typedef unsigned int md5_uint32;
-# else
-# if USHRT_MAX == UINT_MAX_32_BITS
- typedef unsigned short md5_uint32;
-# else
-# if ULONG_MAX == UINT_MAX_32_BITS
- typedef unsigned long md5_uint32;
-# else
- /* The following line is intended to evoke an error.
- Using #error is not portable enough. */
- "Cannot determine unsigned 32-bit data type."
-# endif
-# endif
-# endif
-#endif
-
-
-#ifndef __GNUC__
-#define __attribute__(X)
-#define __alignof__(X) 1
-#endif
-
-/* Structure to save state of computation between the single steps. */
-struct md5_ctx
-{
- md5_uint32 A;
- md5_uint32 B;
- md5_uint32 C;
- md5_uint32 D;
-
- md5_uint32 total[2];
- md5_uint32 buflen;
- char buffer[128] __attribute__ ((__aligned__ (__alignof__ (md5_uint32))));
-};
-
-/*
- * The following three functions are build up the low level used in
- * the functions `md5_stream' and `md5_buffer'.
- */
-
-/* Initialize structure containing state of computation.
- (RFC 1321, 3.3: Step 3) */
-extern void md5_init_ctx (struct md5_ctx *ctx);
-
-/* Starting with the result of former calls of this function (or the
- initialization function update the context for the next LEN bytes
- starting at BUFFER.
- It is necessary that LEN is a multiple of 64!!! */
-extern void md5_process_block (const void *buffer, size_t len,
- struct md5_ctx *ctx);
-
-/* Starting with the result of former calls of this function (or the
- initialization function update the context for the next LEN bytes
- starting at BUFFER.
- It is NOT required that LEN is a multiple of 64. */
-extern void md5_process_bytes (const void *buffer, size_t len,
- struct md5_ctx *ctx);
-
-/* Process the remaining bytes in the buffer and put result from CTX
- in first 16 bytes following RESBUF. The result is always in little
- endian byte order, so that a byte-wise output yields to the wanted
- ASCII representation of the message digest.
-
- IMPORTANT: On some systems it is required that RESBUF is correctly
- aligned for a 32 bits value. */
-extern void *md5_finish_ctx (struct md5_ctx *ctx, void *resbuf);
-
-
-/* Put result from CTX in first 16 bytes following RESBUF. The result is
- always in little endian byte order, so that a byte-wise output yields
- to the wanted ASCII representation of the message digest.
-
- IMPORTANT: On some systems it is required that RESBUF is correctly
- aligned for a 32 bits value. */
-extern void *md5_read_ctx (const struct md5_ctx *ctx, void *resbuf);
-
-
-/* Compute MD5 message digest for bytes read from STREAM. The
- resulting message digest number will be written into the 16 bytes
- beginning at RESBLOCK. */
-extern int md5_stream (FILE *stream, void *resblock);
-
-/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
- result is always in little endian byte order, so that a byte-wise
- output yields to the wanted ASCII representation of the message
- digest. */
-extern void *md5_buffer (const char *buffer, size_t len,
- void *resblock);
-
-#endif /* md5.h */
-
diff --git a/src/minibuf.c b/src/minibuf.c
index 67b4e82456..9852900b60 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -415,7 +415,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
CHECK_STRING (initial);
}
val = Qnil;
- ambient_dir = current_buffer->directory;
+ ambient_dir = BVAR (current_buffer, directory);
input_method = Qnil;
enable_multibyte = Qnil;
@@ -525,7 +525,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
/* `current-input-method' is buffer local. So, remember it in
INPUT_METHOD before changing the current buffer. */
input_method = Fsymbol_value (Qcurrent_input_method);
- enable_multibyte = current_buffer->enable_multibyte_characters;
+ enable_multibyte = BVAR (current_buffer, enable_multibyte_characters);
}
/* Switch to the minibuffer. */
@@ -535,7 +535,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
/* If appropriate, copy enable-multibyte-characters into the minibuffer. */
if (inherit_input_method)
- current_buffer->enable_multibyte_characters = enable_multibyte;
+ BVAR (current_buffer, enable_multibyte_characters) = enable_multibyte;
/* The current buffer's default directory is usually the right thing
for our minibuffer here. However, if you're typing a command at
@@ -546,7 +546,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
you think of something better to do? Find another buffer with a
better directory, and use that one instead. */
if (STRINGP (ambient_dir))
- current_buffer->directory = ambient_dir;
+ BVAR (current_buffer, directory) = ambient_dir;
else
{
Lisp_Object buf_list;
@@ -558,9 +558,9 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
Lisp_Object other_buf;
other_buf = XCDR (XCAR (buf_list));
- if (STRINGP (XBUFFER (other_buf)->directory))
+ if (STRINGP (BVAR (XBUFFER (other_buf), directory)))
{
- current_buffer->directory = XBUFFER (other_buf)->directory;
+ BVAR (current_buffer, directory) = BVAR (XBUFFER (other_buf), directory);
break;
}
}
@@ -603,7 +603,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
specbind (Qinhibit_modification_hooks, Qt);
Ferase_buffer ();
- if (!NILP (current_buffer->enable_multibyte_characters)
+ if (!NILP (BVAR (current_buffer, enable_multibyte_characters))
&& ! STRING_MULTIBYTE (minibuf_prompt))
minibuf_prompt = Fstring_make_multibyte (minibuf_prompt);
@@ -633,7 +633,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
}
clear_message (1, 1);
- current_buffer->keymap = map;
+ BVAR (current_buffer, keymap) = map;
/* Turn on an input method stored in INPUT_METHOD if any. */
if (STRINGP (input_method) && !NILP (Ffboundp (Qactivate_input_method)))
@@ -647,7 +647,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
call1 (Vrun_hooks, Qminibuffer_setup_hook);
/* Don't allow the user to undo past this point. */
- current_buffer->undo_list = Qnil;
+ BVAR (current_buffer, undo_list) = Qnil;
recursive_edit_1 ();
@@ -764,7 +764,7 @@ get_minibuffer (int depth)
Vminibuffer_list = nconc2 (Vminibuffer_list, tail);
}
buf = Fcar (tail);
- if (NILP (buf) || NILP (XBUFFER (buf)->name))
+ if (NILP (buf) || NILP (BVAR (XBUFFER (buf), name)))
{
sprintf (name, " *Minibuf-%d*", depth);
buf = Fget_buffer_create (build_string (name));
@@ -1097,7 +1097,7 @@ function, instead of the usual behavior. */)
int count = SPECPDL_INDEX ();
if (BUFFERP (def))
- def = XBUFFER (def)->name;
+ def = BVAR (XBUFFER (def), name);
specbind (Qcompletion_ignore_case,
read_buffer_completion_ignore_case ? Qt : Qnil);
diff --git a/src/msdos.c b/src/msdos.c
index eb73f54838..8f0f6776aa 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -1317,12 +1317,12 @@ IT_frame_up_to_date (struct frame *f)
{
struct buffer *b = XBUFFER (sw->buffer);
- if (EQ (b->cursor_type, Qt))
+ if (EQ (BVAR (b,cursor_type), Qt))
new_cursor = frame_desired_cursor;
- else if (NILP (b->cursor_type)) /* nil means no cursor */
+ else if (NILP (BVAR (b, cursor_type))) /* nil means no cursor */
new_cursor = Fcons (Qbar, make_number (0));
else
- new_cursor = b->cursor_type;
+ new_cursor = BVAR (b, cursor_type);
}
IT_set_cursor_type (f, new_cursor);
@@ -1793,7 +1793,7 @@ internal_terminal_init (void)
}
tty = FRAME_TTY (sf);
- current_kboard->Vwindow_system = Qpc;
+ KVAR (current_kboard, Vwindow_system) = Qpc;
sf->output_method = output_msdos_raw;
if (init_needed)
{
diff --git a/src/nsfns.m b/src/nsfns.m
index f1bf8b6572..6a5adbd7bf 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -605,8 +605,8 @@ ns_set_name_as_filename (struct frame *f)
BLOCK_INPUT;
pool = [[NSAutoreleasePool alloc] init];
- filename = XBUFFER (buf)->filename;
- name = XBUFFER (buf)->name;
+ filename = BVAR (XBUFFER (buf), filename);
+ name = BVAR (XBUFFER (buf), name);
if (NILP (name))
{
@@ -1329,9 +1329,9 @@ be shared by the new frame. */)
}
if (FRAME_HAS_MINIBUF_P (f)
- && (!FRAMEP (kb->Vdefault_minibuffer_frame)
- || !FRAME_LIVE_P (XFRAME (kb->Vdefault_minibuffer_frame))))
- kb->Vdefault_minibuffer_frame = frame;
+ && (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame))
+ || !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame)))))
+ KVAR (kb, Vdefault_minibuffer_frame) = frame;
/* All remaining specified parameters, which have not been "used"
by x_get_arg and friends, now go in the misc. alist of the frame. */
@@ -1428,7 +1428,7 @@ Optional arg INIT, if non-nil, provides a default file name to use. */)
NSString *promptS = NILP (prompt) || !STRINGP (prompt) ? nil :
[NSString stringWithUTF8String: SDATA (prompt)];
NSString *dirS = NILP (dir) || !STRINGP (dir) ?
- [NSString stringWithUTF8String: SDATA (current_buffer->directory)] :
+ [NSString stringWithUTF8String: SDATA (BVAR (current_buffer, directory))] :
[NSString stringWithUTF8String: SDATA (dir)];
NSString *initS = NILP (init) || !STRINGP (init) ? nil :
[NSString stringWithUTF8String: SDATA (init)];
diff --git a/src/nsterm.m b/src/nsterm.m
index e83b14748d..a09c95c7d0 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -3762,7 +3762,7 @@ ns_term_init (Lisp_Object display_name)
terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
init_kboard (terminal->kboard);
- terminal->kboard->Vwindow_system = Qns;
+ KVAR (terminal->kboard, Vwindow_system) = Qns;
terminal->kboard->next_kboard = all_kboards;
all_kboards = terminal->kboard;
/* Don't let the initial kboard remain current longer than necessary.
@@ -5783,6 +5783,7 @@ ns_term_shutdown (int sig)
win = nwin;
condemned = NO;
pixel_height = NSHeight (r);
+ if (pixel_height == 0) pixel_height = 1;
min_portion = 20 / pixel_height;
frame = XFRAME (XWINDOW (win)->frame);
@@ -5812,6 +5813,7 @@ ns_term_shutdown (int sig)
NSTRACE (EmacsScroller_setFrame);
/* BLOCK_INPUT; */
pixel_height = NSHeight (newRect);
+ if (pixel_height == 0) pixel_height = 1;
min_portion = 20 / pixel_height;
[super setFrame: newRect];
[self display];
diff --git a/src/print.c b/src/print.c
index f48b618775..11bce153ff 100644
--- a/src/print.c
+++ b/src/print.c
@@ -111,7 +111,7 @@ int print_output_debug_flag EXTERNALLY_VISIBLE = 1;
EMACS_INT old_point_byte = -1, start_point_byte = -1; \
int specpdl_count = SPECPDL_INDEX (); \
int free_print_buffer = 0; \
- int multibyte = !NILP (current_buffer->enable_multibyte_characters); \
+ int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); \
Lisp_Object original
#define PRINTPREPARE \
@@ -144,10 +144,10 @@ int print_output_debug_flag EXTERNALLY_VISIBLE = 1;
if (NILP (printcharfun)) \
{ \
Lisp_Object string; \
- if (NILP (current_buffer->enable_multibyte_characters) \
+ if (NILP (BVAR (current_buffer, enable_multibyte_characters)) \
&& ! print_escape_multibyte) \
specbind (Qprint_escape_multibyte, Qt); \
- if (! NILP (current_buffer->enable_multibyte_characters) \
+ if (! NILP (BVAR (current_buffer, enable_multibyte_characters)) \
&& ! print_escape_nonascii) \
specbind (Qprint_escape_nonascii, Qt); \
if (print_buffer != 0) \
@@ -173,7 +173,7 @@ int print_output_debug_flag EXTERNALLY_VISIBLE = 1;
if (NILP (printcharfun)) \
{ \
if (print_buffer_pos != print_buffer_pos_byte \
- && NILP (current_buffer->enable_multibyte_characters)) \
+ && NILP (BVAR (current_buffer, enable_multibyte_characters))) \
{ \
unsigned char *temp \
= (unsigned char *) alloca (print_buffer_pos + 1); \
@@ -250,7 +250,7 @@ printchar (unsigned int ch, Lisp_Object fun)
else
{
int multibyte_p
- = !NILP (current_buffer->enable_multibyte_characters);
+ = !NILP (BVAR (current_buffer, enable_multibyte_characters));
setup_echo_area_for_printing (multibyte_p);
insert_char (ch);
@@ -302,7 +302,7 @@ strout (const char *ptr, EMACS_INT size, EMACS_INT size_byte,
job. */
int i;
int multibyte_p
- = !NILP (current_buffer->enable_multibyte_characters);
+ = !NILP (BVAR (current_buffer, enable_multibyte_characters));
setup_echo_area_for_printing (multibyte_p);
message_dolog (ptr, size_byte, 0, multibyte_p);
@@ -371,8 +371,8 @@ print_string (Lisp_Object string, Lisp_Object printcharfun)
chars = SCHARS (string);
else if (! print_escape_nonascii
&& (EQ (printcharfun, Qt)
- ? ! NILP (buffer_defaults.enable_multibyte_characters)
- : ! NILP (current_buffer->enable_multibyte_characters)))
+ ? ! NILP (BVAR (&buffer_defaults, enable_multibyte_characters))
+ : ! NILP (BVAR (current_buffer, enable_multibyte_characters))))
{
/* If unibyte string STRING contains 8-bit codes, we must
convert STRING to a multibyte string containing the same
@@ -504,14 +504,14 @@ temp_output_buffer_setup (const char *bufname)
Fkill_all_local_variables ();
delete_all_overlays (current_buffer);
- current_buffer->directory = old->directory;
- current_buffer->read_only = Qnil;
- current_buffer->filename = Qnil;
- current_buffer->undo_list = Qt;
+ BVAR (current_buffer, directory) = BVAR (old, directory);
+ BVAR (current_buffer, read_only) = Qnil;
+ BVAR (current_buffer, filename) = Qnil;
+ BVAR (current_buffer, undo_list) = Qt;
eassert (current_buffer->overlays_before == NULL);
eassert (current_buffer->overlays_after == NULL);
- current_buffer->enable_multibyte_characters
- = buffer_defaults.enable_multibyte_characters;
+ BVAR (current_buffer, enable_multibyte_characters)
+ = BVAR (&buffer_defaults, enable_multibyte_characters);
specbind (Qinhibit_read_only, Qt);
specbind (Qinhibit_modification_hooks, Qt);
Ferase_buffer ();
@@ -1009,7 +1009,10 @@ float_to_string (char *buf, double data)
{
/* Generate the fewest number of digits that represent the
floating point value without losing information. */
- dtoastr (buf, FLOAT_TO_STRING_BUFSIZE, 0, 0, data);
+ dtoastr (buf, FLOAT_TO_STRING_BUFSIZE - 2, 0, 0, data);
+ /* The decimal point must be printed, or the byte compiler can
+ get confused (Bug#8033). */
+ width = 1;
}
else /* oink oink */
{
@@ -1064,8 +1067,7 @@ float_to_string (char *buf, double data)
cp[1] = '0';
cp[2] = 0;
}
-
- if (*cp == 0)
+ else if (*cp == 0)
{
*cp++ = '.';
*cp++ = '0';
@@ -1801,7 +1803,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
if (!NILP (XWINDOW (obj)->buffer))
{
strout (" on ", -1, -1, printcharfun, 0);
- print_string (XBUFFER (XWINDOW (obj)->buffer)->name, printcharfun);
+ print_string (BVAR (XBUFFER (XWINDOW (obj)->buffer), name), printcharfun);
}
PRINTCHAR ('>');
}
@@ -1902,16 +1904,16 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
}
else if (BUFFERP (obj))
{
- if (NILP (XBUFFER (obj)->name))
+ if (NILP (BVAR (XBUFFER (obj), name)))
strout ("#<killed buffer>", -1, -1, printcharfun, 0);
else if (escapeflag)
{
strout ("#<buffer ", -1, -1, printcharfun, 0);
- print_string (XBUFFER (obj)->name, printcharfun);
+ print_string (BVAR (XBUFFER (obj), name), printcharfun);
PRINTCHAR ('>');
}
else
- print_string (XBUFFER (obj)->name, printcharfun);
+ print_string (BVAR (XBUFFER (obj), name), printcharfun);
}
else if (WINDOW_CONFIGURATIONP (obj))
{
@@ -2023,7 +2025,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
sprintf (buf, "at %ld", (long)marker_position (obj));
strout (buf, -1, -1, printcharfun, 0);
strout (" in ", -1, -1, printcharfun, 0);
- print_string (XMARKER (obj)->buffer->name, printcharfun);
+ print_string (BVAR (XMARKER (obj)->buffer, name), printcharfun);
}
PRINTCHAR ('>');
break;
@@ -2038,7 +2040,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
(long)marker_position (OVERLAY_START (obj)),
(long)marker_position (OVERLAY_END (obj)));
strout (buf, -1, -1, printcharfun, 0);
- print_string (XMARKER (OVERLAY_START (obj))->buffer->name,
+ print_string (BVAR (XMARKER (OVERLAY_START (obj))->buffer, name),
printcharfun);
}
PRINTCHAR ('>');
diff --git a/src/process.c b/src/process.c
index 80e70e49f8..210287a85f 100644
--- a/src/process.c
+++ b/src/process.c
@@ -719,7 +719,7 @@ get_process (register Lisp_Object name)
{
proc = Fget_buffer_process (obj);
if (NILP (proc))
- error ("Buffer %s has no process", SDATA (XBUFFER (obj)->name));
+ error ("Buffer %s has no process", SDATA (BVAR (XBUFFER (obj), name)));
}
else
{
@@ -1283,12 +1283,12 @@ list_processes_1 (Lisp_Object query_only)
w_proc = i;
if (!NILP (p->buffer))
{
- if (NILP (XBUFFER (p->buffer)->name))
+ if (NILP (BVAR (XBUFFER (p->buffer), name)))
{
if (w_buffer < 8)
w_buffer = 8; /* (Killed) */
}
- else if ((i = SCHARS (XBUFFER (p->buffer)->name), (i > w_buffer)))
+ else if ((i = SCHARS (BVAR (XBUFFER (p->buffer), name)), (i > w_buffer)))
w_buffer = i;
}
if (STRINGP (p->tty_name)
@@ -1312,9 +1312,9 @@ list_processes_1 (Lisp_Object query_only)
XSETFASTINT (minspace, 1);
set_buffer_internal (XBUFFER (Vstandard_output));
- current_buffer->undo_list = Qt;
+ BVAR (current_buffer, undo_list) = Qt;
- current_buffer->truncate_lines = Qt;
+ BVAR (current_buffer, truncate_lines) = Qt;
write_string ("Proc", -1);
Findent_to (i_status, minspace); write_string ("Status", -1);
@@ -1397,10 +1397,10 @@ list_processes_1 (Lisp_Object query_only)
Findent_to (i_buffer, minspace);
if (NILP (p->buffer))
insert_string ("(none)");
- else if (NILP (XBUFFER (p->buffer)->name))
+ else if (NILP (BVAR (XBUFFER (p->buffer), name)))
insert_string ("(Killed)");
else
- Finsert (1, &XBUFFER (p->buffer)->name);
+ Finsert (1, &BVAR (XBUFFER (p->buffer), name));
if (!NILP (i_tty))
{
@@ -1548,7 +1548,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
{
struct gcpro gcpro1, gcpro2;
- current_dir = current_buffer->directory;
+ current_dir = BVAR (current_buffer, directory);
GCPRO2 (buffer, current_dir);
@@ -1560,7 +1560,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
current_dir = expand_and_dir_to_file (current_dir, Qnil);
if (NILP (Ffile_accessible_directory_p (current_dir)))
report_file_error ("Setting current directory",
- Fcons (current_buffer->directory, Qnil));
+ Fcons (BVAR (current_buffer, directory), Qnil));
UNGCPRO;
}
@@ -1660,9 +1660,9 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
}
- XPROCESS (proc)->decoding_buf = make_uninit_string (0);
+ XPROCESS (proc)->decoding_buf = empty_unibyte_string;
XPROCESS (proc)->decoding_carryover = 0;
- XPROCESS (proc)->encoding_buf = make_uninit_string (0);
+ XPROCESS (proc)->encoding_buf = empty_unibyte_string;
XPROCESS (proc)->inherit_coding_system_flag
= !(NILP (buffer) || !inherit_process_coding_system);
@@ -1786,6 +1786,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
sigset_t blocked;
struct sigaction sigint_action;
struct sigaction sigquit_action;
+ struct sigaction sigpipe_action;
#ifdef AIX
struct sigaction sighup_action;
#endif
@@ -1898,6 +1899,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
and record the current handlers so they can be restored later. */
sigaddset (&blocked, SIGINT ); sigaction (SIGINT , 0, &sigint_action );
sigaddset (&blocked, SIGQUIT); sigaction (SIGQUIT, 0, &sigquit_action);
+ sigaddset (&blocked, SIGPIPE); sigaction (SIGPIPE, 0, &sigpipe_action);
#ifdef AIX
sigaddset (&blocked, SIGHUP ); sigaction (SIGHUP , 0, &sighup_action );
#endif
@@ -2054,6 +2056,9 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
signal (SIGINT, SIG_DFL);
signal (SIGQUIT, SIG_DFL);
+ /* GConf causes us to ignore SIGPIPE, make sure it is restored
+ in the child. */
+ signal (SIGPIPE, SIG_DFL);
/* Stop blocking signals in the child. */
sigprocmask (SIG_SETMASK, &procmask, 0);
@@ -2142,6 +2147,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
/* Restore the parent's signal handlers. */
sigaction (SIGINT, &sigint_action, 0);
sigaction (SIGQUIT, &sigquit_action, 0);
+ sigaction (SIGPIPE, &sigpipe_action, 0);
#ifdef AIX
sigaction (SIGHUP, &sighup_action, 0);
#endif
@@ -2892,8 +2898,8 @@ usage: (make-serial-process &rest ARGS) */)
}
else if (!NILP (Vcoding_system_for_read))
val = Vcoding_system_for_read;
- else if ((!NILP (buffer) && NILP (XBUFFER (buffer)->enable_multibyte_characters))
- || (NILP (buffer) && NILP (buffer_defaults.enable_multibyte_characters)))
+ else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters)))
+ || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters))))
val = Qnil;
p->decode_coding_system = val;
@@ -2906,15 +2912,15 @@ usage: (make-serial-process &rest ARGS) */)
}
else if (!NILP (Vcoding_system_for_write))
val = Vcoding_system_for_write;
- else if ((!NILP (buffer) && NILP (XBUFFER (buffer)->enable_multibyte_characters))
- || (NILP (buffer) && NILP (buffer_defaults.enable_multibyte_characters)))
+ else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters)))
+ || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters))))
val = Qnil;
p->encode_coding_system = val;
setup_process_coding_systems (proc);
- p->decoding_buf = make_uninit_string (0);
+ p->decoding_buf = empty_unibyte_string;
p->decoding_carryover = 0;
- p->encoding_buf = make_uninit_string (0);
+ p->encoding_buf = empty_unibyte_string;
p->inherit_coding_system_flag
= !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system);
@@ -3717,8 +3723,8 @@ usage: (make-network-process &rest ARGS) */)
}
else if (!NILP (Vcoding_system_for_read))
val = Vcoding_system_for_read;
- else if ((!NILP (buffer) && NILP (XBUFFER (buffer)->enable_multibyte_characters))
- || (NILP (buffer) && NILP (buffer_defaults.enable_multibyte_characters)))
+ else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters)))
+ || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters))))
/* We dare not decode end-of-line format by setting VAL to
Qraw_text, because the existing Emacs Lisp libraries
assume that they receive bare code including a sequene of
@@ -3753,7 +3759,7 @@ usage: (make-network-process &rest ARGS) */)
}
else if (!NILP (Vcoding_system_for_write))
val = Vcoding_system_for_write;
- else if (NILP (current_buffer->enable_multibyte_characters))
+ else if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
val = Qnil;
else
{
@@ -3781,9 +3787,9 @@ usage: (make-network-process &rest ARGS) */)
}
setup_process_coding_systems (proc);
- p->decoding_buf = make_uninit_string (0);
+ p->decoding_buf = empty_unibyte_string;
p->decoding_carryover = 0;
- p->encoding_buf = make_uninit_string (0);
+ p->encoding_buf = empty_unibyte_string;
p->inherit_coding_system_flag
= !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system);
@@ -4358,9 +4364,9 @@ server_accept_connection (Lisp_Object server, int channel)
p->encode_coding_system = ps->encode_coding_system;
setup_process_coding_systems (proc);
- p->decoding_buf = make_uninit_string (0);
+ p->decoding_buf = empty_unibyte_string;
p->decoding_carryover = 0;
- p->encoding_buf = make_uninit_string (0);
+ p->encoding_buf = empty_unibyte_string;
p->inherit_coding_system_flag
= (NILP (buffer) ? 0 : ps->inherit_coding_system_flag);
@@ -5262,7 +5268,7 @@ read_process_output (Lisp_Object proc, register int channel)
/* No need to gcpro these, because all we do with them later
is test them for EQness, and none of them should be a string. */
XSETBUFFER (obuffer, current_buffer);
- okeymap = current_buffer->keymap;
+ okeymap = BVAR (current_buffer, keymap);
/* We inhibit quit here instead of just catching it so that
hitting ^G when a filter happens to be running won't screw
@@ -5353,7 +5359,7 @@ read_process_output (Lisp_Object proc, register int channel)
}
/* If no filter, write into buffer if it isn't dead. */
- else if (!NILP (p->buffer) && !NILP (XBUFFER (p->buffer)->name))
+ else if (!NILP (p->buffer) && !NILP (BVAR (XBUFFER (p->buffer), name)))
{
Lisp_Object old_read_only;
EMACS_INT old_begv, old_zv;
@@ -5366,13 +5372,13 @@ read_process_output (Lisp_Object proc, register int channel)
Fset_buffer (p->buffer);
opoint = PT;
opoint_byte = PT_BYTE;
- old_read_only = current_buffer->read_only;
+ old_read_only = BVAR (current_buffer, read_only);
old_begv = BEGV;
old_zv = ZV;
old_begv_byte = BEGV_BYTE;
old_zv_byte = ZV_BYTE;
- current_buffer->read_only = Qnil;
+ BVAR (current_buffer, read_only) = Qnil;
/* Insert new output into buffer
at the current end-of-output marker,
@@ -5417,7 +5423,7 @@ read_process_output (Lisp_Object proc, register int channel)
p->decoding_carryover = coding->carryover_bytes;
}
/* Adjust the multibyteness of TEXT to that of the buffer. */
- if (NILP (current_buffer->enable_multibyte_characters)
+ if (NILP (BVAR (current_buffer, enable_multibyte_characters))
!= ! STRING_MULTIBYTE (text))
text = (STRING_MULTIBYTE (text)
? Fstring_as_unibyte (text)
@@ -5461,7 +5467,7 @@ read_process_output (Lisp_Object proc, register int channel)
Fnarrow_to_region (make_number (old_begv), make_number (old_zv));
- current_buffer->read_only = old_read_only;
+ BVAR (current_buffer, read_only) = old_read_only;
SET_PT_BOTH (opoint, opoint_byte);
}
/* Handling the process output should not deactivate the mark. */
@@ -5519,7 +5525,7 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
if ((STRINGP (object) && STRING_MULTIBYTE (object))
|| (BUFFERP (object)
- && !NILP (XBUFFER (object)->enable_multibyte_characters))
+ && !NILP (BVAR (XBUFFER (object), enable_multibyte_characters)))
|| EQ (object, Qt))
{
p->encode_coding_system
@@ -6558,7 +6564,7 @@ exec_sentinel (Lisp_Object proc, Lisp_Object reason)
is test them for EQness, and none of them should be a string. */
odeactivate = Vdeactivate_mark;
XSETBUFFER (obuffer, current_buffer);
- okeymap = current_buffer->keymap;
+ okeymap = BVAR (current_buffer, keymap);
/* There's no good reason to let sentinels change the current
buffer, and many callers of accept-process-output, sit-for, and
@@ -6708,7 +6714,7 @@ status_notify (struct Lisp_Process *deleting_process)
/* Avoid error if buffer is deleted
(probably that's why the process is dead, too) */
- if (NILP (XBUFFER (buffer)->name))
+ if (NILP (BVAR (XBUFFER (buffer), name)))
continue;
Fset_buffer (buffer);
@@ -6725,13 +6731,13 @@ status_notify (struct Lisp_Process *deleting_process)
before = PT;
before_byte = PT_BYTE;
- tem = current_buffer->read_only;
- current_buffer->read_only = Qnil;
+ tem = BVAR (current_buffer, read_only);
+ BVAR (current_buffer, read_only) = Qnil;
insert_string ("\nProcess ");
Finsert (1, &p->name);
insert_string (" ");
Finsert (1, &msg);
- current_buffer->read_only = tem;
+ BVAR (current_buffer, read_only) = tem;
set_marker_both (p->mark, p->buffer, PT, PT_BYTE);
if (opoint >= before)
@@ -7130,7 +7136,7 @@ setup_process_coding_systems (Lisp_Object process)
;
else if (BUFFERP (p->buffer))
{
- if (NILP (XBUFFER (p->buffer)->enable_multibyte_characters))
+ if (NILP (BVAR (XBUFFER (p->buffer), enable_multibyte_characters)))
coding_system = raw_text_coding_system (coding_system);
}
setup_coding_system (coding_system, proc_decode_coding_system[inch]);
diff --git a/src/s/aix4-2.h b/src/s/aix4-2.h
index c62aee249c..443fc03457 100644
--- a/src/s/aix4-2.h
+++ b/src/s/aix4-2.h
@@ -41,12 +41,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define HAVE_SOCKETS if system supports 4.2-compatible sockets. */
#define HAVE_SOCKETS
-
-/* The file containing the kernel's symbol table is called /unix. */
-#define KERNEL_FILE "/unix"
-
-/* The kernel symbol where the load average is found is named avenrun. */
-#define LDAV_SYMBOL "avenrun"
/* Special items needed to make Emacs run on this system. */
@@ -86,4 +80,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
Emacs currently calls xrealloc on the results of get_current_dir name,
to avoid a crash just use the Emacs implementation for that function. */
#define BROKEN_GET_CURRENT_DIR_NAME 1
-
diff --git a/src/s/bsd-common.h b/src/s/bsd-common.h
index 7d472c83ed..0cca005b42 100644
--- a/src/s/bsd-common.h
+++ b/src/s/bsd-common.h
@@ -37,10 +37,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#define TABDLY OXTABS
#define TAB3 OXTABS
-/* These aren't needed, since we have getloadavg. */
-#undef KERNEL_FILE
-#undef LDAV_SYMBOL
-
#define NO_TERMIO
/* If the system's imake configuration file defines `NeedWidePrototypes'
@@ -72,12 +68,5 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
a file that someone else has modified in his Emacs. */
#define CLASH_DETECTION
-/* The file containing the kernel's symbol table is called /vmunix. */
-#define KERNEL_FILE "/vmunix"
-
-/* The kernel symbol where the load average is found is named _avenrun. */
-#define LDAV_SYMBOL "_avenrun"
-
/* Send signals to subprocesses by "typing" special chars at them. */
#define SIGNALS_VIA_CHARACTERS
-
diff --git a/src/s/freebsd.h b/src/s/freebsd.h
index 222ebc91c4..24b34e02f6 100644
--- a/src/s/freebsd.h
+++ b/src/s/freebsd.h
@@ -25,8 +25,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)
-#define HAVE_GETLOADAVG 1
-
/* This silences a few compilation warnings. */
#undef BSD_SYSTEM
#if __FreeBSD__ == 1
diff --git a/src/s/hpux10-20.h b/src/s/hpux10-20.h
index d745f8d09c..1cd91a41b5 100644
--- a/src/s/hpux10-20.h
+++ b/src/s/hpux10-20.h
@@ -47,9 +47,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
a file that someone else has modified in his Emacs. */
#define CLASH_DETECTION
-/* The symbol in the kernel where the load average is found
- depends on the cpu type, so we let the m- files define LDAV_SYMBOL. */
-
/* Special hacks needed to make Emacs run on this system. */
/* In hpux, the symbol SIGIO is defined, but the feature
@@ -91,9 +88,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#undef random
#undef HAVE_RANDOM
-/* AlainF 20-Jul-1996 says this is right. */
-#define KERNEL_FILE "/stand/vmunix"
-
/* Rainer Malzbender <rainer@displaytech.com> says definining
HAVE_XRMSETDATABASE allows Emacs to compile on HP-UX 10.20 using GCC. */
@@ -119,18 +113,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#define DATA_SEG_BITS 0x40000000
#define DATA_START 0x40000000
-
-/* Data type of load average, as read out of kmem. */
-#define LOAD_AVE_TYPE double
-
-/* Convert that into an integer that is 100 for a load average of 1.0 */
-#define LOAD_AVE_CVT(x) ((int) (x * 100.0))
-
-/* The kernel symbol where the load average is found is named _avenrun.
- At this time there are two major flavors of hp-ux (there is the s800
- and s300 (s200) flavors). The differences are thusly moved to the
- corresponding machine description file. */
-
-/* No underscore please. */
-#define LDAV_SYMBOL "avenrun"
-
diff --git a/src/s/ms-w32.h b/src/s/ms-w32.h
index 4c3b84dfe4..8b189baea4 100644
--- a/src/s/ms-w32.h
+++ b/src/s/ms-w32.h
@@ -181,8 +181,6 @@ struct sigaction {
#define HAVE_MENUS 1
#endif
-#define MODE_LINE_BINARY_TEXT(_b_) (NILP ((_b_)->buffer_file_type) ? "T" : "B")
-
/* Get some redefinitions in place. */
#ifdef emacs
@@ -348,6 +346,8 @@ extern char *get_emacs_configuration_options (void);
#endif
#include <string.h>
+extern int getloadavg (double *, int);
+
/* We need a little extra space, see ../../lisp/loadup.el. */
#define SYSTEM_PURESIZE_EXTRA 50000
diff --git a/src/s/msdos.h b/src/s/msdos.h
index 88afaa8345..8debd28dcc 100644
--- a/src/s/msdos.h
+++ b/src/s/msdos.h
@@ -73,6 +73,15 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */
#define HAVE_INVERSE_HYPERBOLIC
#define FLOAT_CHECK_DOMAIN
+/* Start of gnulib-related stuff */
+
+/* lib/ftoastr.c wants strtold, but DJGPP only has _strtold. DJGPP >
+ 2.03 has it, but it also has _strtold as a stub that jumps to
+ strtold, so use _strtold in all versions. */
+#define strtold _strtold
+
+/* End of gnulib-related stuff. */
+
/* When $TERM is "internal" then this is substituted: */
#define INTERNAL_TERMINAL "pc|bios|IBM PC with color display:\
:co#80:li#25:Co#16:pa#256:km:ms:cm=<CM>:cl=<CL>:ce=<CE>:\
@@ -92,7 +101,7 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */
/* Mode line description of a buffer's type. */
-#define MODE_LINE_BINARY_TEXT(buf) (NILP(buf->buffer_file_type) ? "T" : "B")
+#define MODE_LINE_BINARY_TEXT(buf) (NILP(B_(buf,buffer_file_type)) ? "T" : "B")
/* We have (the code to control) a mouse. */
#define HAVE_MOUSE
diff --git a/src/s/netbsd.h b/src/s/netbsd.h
index 8a639b93c8..52cda717a2 100644
--- a/src/s/netbsd.h
+++ b/src/s/netbsd.h
@@ -21,8 +21,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Get most of the stuff from bsd-common. */
#include "bsd-common.h"
-#define HAVE_GETLOADAVG 1
-
#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)
#define DEFAULT_SOUND_DEVICE "/dev/audio"
@@ -43,4 +41,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method. */
#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
-
diff --git a/src/s/unixware.h b/src/s/unixware.h
index c6130669a9..407282ff78 100644
--- a/src/s/unixware.h
+++ b/src/s/unixware.h
@@ -49,14 +49,4 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
pty_name[sizeof(pty_name) - 1] = 0; \
}
-/* Data type of load average, as read out of kmem. */
-#define LOAD_AVE_TYPE long
-
-/* Convert that into an integer that is 100 for a load average of 1.0 */
-/* This is totally uncalibrated. */
-#define LOAD_AVE_CVT(x) ((int) (((double) (x)) * 100.0 / FSCALE))
-#define FSCALE 256.0
-
-
#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->__ptr - (FILE)->__base)
-
diff --git a/src/s/usg5-4-common.h b/src/s/usg5-4-common.h
index 12f73c1b3b..aeedd7f4b1 100644
--- a/src/s/usg5-4-common.h
+++ b/src/s/usg5-4-common.h
@@ -30,12 +30,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
It sets the Lisp variable system-type. */
#define SYSTEM_TYPE "usg-unix-v"
-/* The file containing the kernel's symbol table is called /unix. */
-#define KERNEL_FILE "/unix"
-
-/* The kernel symbol where the load average is found is named avenrun. */
-#define LDAV_SYMBOL "avenrun"
-
/* setjmp and longjmp can safely replace _setjmp and _longjmp,
but they will run slower. */
#define _setjmp setjmp
@@ -105,4 +99,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* This definition was suggested for next release. So give it a try. */
#define HAVE_SOCKETS
-
diff --git a/src/search.c b/src/search.c
index 09dae0ed0f..1e2036f6dc 100644
--- a/src/search.c
+++ b/src/search.c
@@ -157,7 +157,7 @@ compile_pattern_1 (struct regexp_cache *cp, Lisp_Object pattern, Lisp_Object tra
/* If the compiled pattern hard codes some of the contents of the
syntax-table, it can only be reused with *this* syntax table. */
- cp->syntax_table = cp->buf.used_syntax ? current_buffer->syntax_table : Qt;
+ cp->syntax_table = cp->buf.used_syntax ? BVAR (current_buffer, syntax_table) : Qt;
re_set_whitespace_regexp (NULL);
@@ -236,7 +236,7 @@ compile_pattern (Lisp_Object pattern, struct re_registers *regp, Lisp_Object tra
&& EQ (cp->buf.translate, (! NILP (translate) ? translate : make_number (0)))
&& cp->posix == posix
&& (EQ (cp->syntax_table, Qt)
- || EQ (cp->syntax_table, current_buffer->syntax_table))
+ || EQ (cp->syntax_table, BVAR (current_buffer, syntax_table)))
&& !NILP (Fequal (cp->whitespace_regexp, Vsearch_spaces_regexp))
&& cp->buf.charset_unibyte == charset_unibyte)
break;
@@ -285,17 +285,17 @@ looking_at_1 (Lisp_Object string, int posix)
save_search_regs ();
/* This is so set_image_of_range_1 in regex.c can find the EQV table. */
- XCHAR_TABLE (current_buffer->case_canon_table)->extras[2]
- = current_buffer->case_eqv_table;
+ XCHAR_TABLE (BVAR (current_buffer, case_canon_table))->extras[2]
+ = BVAR (current_buffer, case_eqv_table);
CHECK_STRING (string);
bufp = compile_pattern (string,
(NILP (Vinhibit_changing_match_data)
? &search_regs : NULL),
- (!NILP (current_buffer->case_fold_search)
- ? current_buffer->case_canon_table : Qnil),
+ (!NILP (BVAR (current_buffer, case_fold_search))
+ ? BVAR (current_buffer, case_canon_table) : Qnil),
posix,
- !NILP (current_buffer->enable_multibyte_characters));
+ !NILP (BVAR (current_buffer, enable_multibyte_characters)));
immediate_quit = 1;
QUIT; /* Do a pending quit right away, to avoid paradoxical behavior */
@@ -400,14 +400,14 @@ string_match_1 (Lisp_Object regexp, Lisp_Object string, Lisp_Object start, int p
}
/* This is so set_image_of_range_1 in regex.c can find the EQV table. */
- XCHAR_TABLE (current_buffer->case_canon_table)->extras[2]
- = current_buffer->case_eqv_table;
+ XCHAR_TABLE (BVAR (current_buffer, case_canon_table))->extras[2]
+ = BVAR (current_buffer, case_eqv_table);
bufp = compile_pattern (regexp,
(NILP (Vinhibit_changing_match_data)
? &search_regs : NULL),
- (!NILP (current_buffer->case_fold_search)
- ? current_buffer->case_canon_table : Qnil),
+ (!NILP (BVAR (current_buffer, case_fold_search))
+ ? BVAR (current_buffer, case_canon_table) : Qnil),
posix,
STRING_MULTIBYTE (string));
immediate_quit = 1;
@@ -586,7 +586,7 @@ fast_looking_at (Lisp_Object regexp, EMACS_INT pos, EMACS_INT pos_byte, EMACS_IN
s2 = 0;
}
re_match_object = Qnil;
- multibyte = ! NILP (current_buffer->enable_multibyte_characters);
+ multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
}
buf = compile_pattern (regexp, 0, Qnil, 0, multibyte);
@@ -608,7 +608,7 @@ fast_looking_at (Lisp_Object regexp, EMACS_INT pos, EMACS_INT pos_byte, EMACS_IN
static void
newline_cache_on_off (struct buffer *buf)
{
- if (NILP (buf->cache_long_line_scans))
+ if (NILP (BVAR (buf, cache_long_line_scans)))
{
/* It should be off. */
if (buf->newline_cache)
@@ -996,15 +996,15 @@ search_command (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror,
}
/* This is so set_image_of_range_1 in regex.c can find the EQV table. */
- XCHAR_TABLE (current_buffer->case_canon_table)->extras[2]
- = current_buffer->case_eqv_table;
+ XCHAR_TABLE (BVAR (current_buffer, case_canon_table))->extras[2]
+ = BVAR (current_buffer, case_eqv_table);
np = search_buffer (string, PT, PT_BYTE, lim, lim_byte, n, RE,
- (!NILP (current_buffer->case_fold_search)
- ? current_buffer->case_canon_table
+ (!NILP (BVAR (current_buffer, case_fold_search))
+ ? BVAR (current_buffer, case_canon_table)
: Qnil),
- (!NILP (current_buffer->case_fold_search)
- ? current_buffer->case_eqv_table
+ (!NILP (BVAR (current_buffer, case_fold_search))
+ ? BVAR (current_buffer, case_eqv_table)
: Qnil),
posix);
if (np <= 0)
@@ -1133,7 +1133,7 @@ search_buffer (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte,
(NILP (Vinhibit_changing_match_data)
? &search_regs : &search_regs_1),
trt, posix,
- !NILP (current_buffer->enable_multibyte_characters));
+ !NILP (BVAR (current_buffer, enable_multibyte_characters)));
immediate_quit = 1; /* Quit immediately if user types ^G,
because letting this function finish
@@ -1254,7 +1254,7 @@ search_buffer (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte,
EMACS_INT raw_pattern_size;
EMACS_INT raw_pattern_size_byte;
unsigned char *patbuf;
- int multibyte = !NILP (current_buffer->enable_multibyte_characters);
+ int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
unsigned char *base_pat;
/* Set to positive if we find a non-ASCII char that need
translation. Otherwise set to zero later. */
@@ -1451,7 +1451,7 @@ simple_search (EMACS_INT n, unsigned char *pat,
EMACS_INT pos, EMACS_INT pos_byte,
EMACS_INT lim, EMACS_INT lim_byte)
{
- int multibyte = ! NILP (current_buffer->enable_multibyte_characters);
+ int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
int forward = n > 0;
/* Number of buffer bytes matched. Note that this may be different
from len_byte in a multibyte buffer. */
@@ -1671,7 +1671,7 @@ boyer_moore (EMACS_INT n, unsigned char *base_pat,
register EMACS_INT i;
register int j;
unsigned char *pat, *pat_end;
- int multibyte = ! NILP (current_buffer->enable_multibyte_characters);
+ int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
unsigned char simple_translate[0400];
/* These are set to the preceding bytes of a byte to be translated
@@ -2639,7 +2639,7 @@ since only regular expressions have distinguished subexpressions. */)
EMACS_INT length = SBYTES (newtext);
unsigned char *substed;
EMACS_INT substed_alloc_size, substed_len;
- int buf_multibyte = !NILP (current_buffer->enable_multibyte_characters);
+ int buf_multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
int str_multibyte = STRING_MULTIBYTE (newtext);
Lisp_Object rev_tbl;
int really_changed = 0;
diff --git a/src/syntax.c b/src/syntax.c
index 2f47d73d69..707c2c19f3 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -277,7 +277,7 @@ update_syntax_table (EMACS_INT charpos, int count, int init,
else
{
gl_state.use_global = 0;
- gl_state.current_syntax_table = current_buffer->syntax_table;
+ gl_state.current_syntax_table = BVAR (current_buffer, syntax_table);
}
}
@@ -363,7 +363,7 @@ char_quoted (EMACS_INT charpos, EMACS_INT bytepos)
static INLINE EMACS_INT
dec_bytepos (EMACS_INT bytepos)
{
- if (NILP (current_buffer->enable_multibyte_characters))
+ if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
return bytepos - 1;
DEC_POS (bytepos);
@@ -779,7 +779,7 @@ DEFUN ("syntax-table", Fsyntax_table, Ssyntax_table, 0, 0, 0,
This is the one specified by the current buffer. */)
(void)
{
- return current_buffer->syntax_table;
+ return BVAR (current_buffer, syntax_table);
}
DEFUN ("standard-syntax-table", Fstandard_syntax_table,
@@ -824,7 +824,7 @@ One argument, a syntax table. */)
{
int idx;
check_syntax_table (table);
- current_buffer->syntax_table = table;
+ BVAR (current_buffer, syntax_table) = table;
/* Indicate that this buffer now has a specified syntax table. */
idx = PER_BUFFER_VAR_IDX (syntax_table);
SET_PER_BUFFER_VALUE_P (current_buffer, idx, 1);
@@ -1035,7 +1035,7 @@ usage: (modify-syntax-entry CHAR NEWENTRY &optional SYNTAX-TABLE) */)
CHECK_CHARACTER (c);
if (NILP (syntax_table))
- syntax_table = current_buffer->syntax_table;
+ syntax_table = BVAR (current_buffer, syntax_table);
else
check_syntax_table (syntax_table);
@@ -1450,7 +1450,7 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl
if (XINT (lim) < BEGV)
XSETFASTINT (lim, BEGV);
- multibyte = (!NILP (current_buffer->enable_multibyte_characters)
+ multibyte = (!NILP (BVAR (current_buffer, enable_multibyte_characters))
&& (XINT (lim) - PT != CHAR_TO_BYTE (XINT (lim)) - PT_BYTE));
string_multibyte = SBYTES (string) > SCHARS (string);
@@ -1936,7 +1936,7 @@ skip_syntaxes (int forwardp, Lisp_Object string, Lisp_Object lim)
if (forwardp ? (PT >= XFASTINT (lim)) : (PT <= XFASTINT (lim)))
return make_number (0);
- multibyte = (!NILP (current_buffer->enable_multibyte_characters)
+ multibyte = (!NILP (BVAR (current_buffer, enable_multibyte_characters))
&& (XINT (lim) - PT != CHAR_TO_BYTE (XINT (lim)) - PT_BYTE));
memset (fastmap, 0, sizeof fastmap);
@@ -2703,7 +2703,7 @@ scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpf
while (from > stop)
{
temp_pos = from_byte;
- if (! NILP (current_buffer->enable_multibyte_characters))
+ if (! NILP (BVAR (current_buffer, enable_multibyte_characters)))
DEC_POS (temp_pos);
else
temp_pos--;
diff --git a/src/syntax.h b/src/syntax.h
index bea66d1fad..e8726bb28a 100644
--- a/src/syntax.h
+++ b/src/syntax.h
@@ -24,7 +24,7 @@ extern void update_syntax_table (EMACS_INT, int, int, Lisp_Object);
/* The standard syntax table is stored where it will automatically
be used in all new buffers. */
-#define Vstandard_syntax_table buffer_defaults.syntax_table
+#define Vstandard_syntax_table BVAR (&buffer_defaults, syntax_table)
/* A syntax table is a chartable whose elements are cons cells
(CODE+FLAGS . MATCHING-CHAR). MATCHING-CHAR can be nil if the char
@@ -79,7 +79,7 @@ enum syntaxcode
# define CURRENT_SYNTAX_TABLE gl_state.current_syntax_table
#else
# define SYNTAX_ENTRY SYNTAX_ENTRY_INT
-# define CURRENT_SYNTAX_TABLE current_buffer->syntax_table
+# define CURRENT_SYNTAX_TABLE BVAR (current_buffer, syntax_table)
#endif
#define SYNTAX_ENTRY_INT(c) CHAR_TABLE_REF (CURRENT_SYNTAX_TABLE, (c))
@@ -204,7 +204,7 @@ extern char syntax_code_spec[16];
do \
{ \
gl_state.use_global = 0; \
- gl_state.current_syntax_table = current_buffer->syntax_table; \
+ gl_state.current_syntax_table = BVAR (current_buffer, syntax_table); \
} while (0)
/* This macro should be called with FROM at the start of forward
diff --git a/src/term.c b/src/term.c
index 1aefe02421..f082bb40e8 100644
--- a/src/term.c
+++ b/src/term.c
@@ -112,10 +112,7 @@ static void vfatal (const char *str, va_list ap) NO_RETURN;
#define OUTPUT_IF(tty, a) \
do { \
if (a) \
- emacs_tputs ((tty), a, \
- (int) (FRAME_LINES (XFRAME (selected_frame)) \
- - curY (tty) ), \
- cmputc); \
+ OUTPUT (tty, a); \
} while (0)
#define OUTPUT1_IF(tty, a) do { if (a) emacs_tputs ((tty), a, 1, cmputc); } while (0)
@@ -1350,14 +1347,14 @@ term_get_fkeys_1 (void)
KBOARD *kboard = term_get_fkeys_kboard;
/* This can happen if CANNOT_DUMP or with strange options. */
- if (!KEYMAPP (kboard->Vinput_decode_map))
- kboard->Vinput_decode_map = Fmake_sparse_keymap (Qnil);
+ if (!KEYMAPP (KVAR (kboard, Vinput_decode_map)))
+ KVAR (kboard, Vinput_decode_map) = Fmake_sparse_keymap (Qnil);
for (i = 0; i < (sizeof (keys)/sizeof (keys[0])); i++)
{
char *sequence = tgetstr (keys[i].cap, address);
if (sequence)
- Fdefine_key (kboard->Vinput_decode_map, build_string (sequence),
+ Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (sequence),
Fmake_vector (make_number (1),
intern (keys[i].name)));
}
@@ -1377,13 +1374,13 @@ term_get_fkeys_1 (void)
if (k0)
/* Define f0 first, so that f10 takes precedence in case the
key sequences happens to be the same. */
- Fdefine_key (kboard->Vinput_decode_map, build_string (k0),
+ Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (k0),
Fmake_vector (make_number (1), intern ("f0")));
- Fdefine_key (kboard->Vinput_decode_map, build_string (k_semi),
+ Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (k_semi),
Fmake_vector (make_number (1), intern ("f10")));
}
else if (k0)
- Fdefine_key (kboard->Vinput_decode_map, build_string (k0),
+ Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (k0),
Fmake_vector (make_number (1), intern (k0_name)));
}
@@ -1406,7 +1403,7 @@ term_get_fkeys_1 (void)
if (sequence)
{
sprintf (fkey, "f%d", i);
- Fdefine_key (kboard->Vinput_decode_map, build_string (sequence),
+ Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (sequence),
Fmake_vector (make_number (1),
intern (fkey)));
}
@@ -1423,7 +1420,7 @@ term_get_fkeys_1 (void)
{ \
char *sequence = tgetstr (cap2, address); \
if (sequence) \
- Fdefine_key (kboard->Vinput_decode_map, build_string (sequence), \
+ Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (sequence), \
Fmake_vector (make_number (1), \
intern (sym))); \
}
@@ -3418,7 +3415,7 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
init_kboard (terminal->kboard);
- terminal->kboard->Vwindow_system = Qnil;
+ KVAR (terminal->kboard, Vwindow_system) = Qnil;
terminal->kboard->next_kboard = all_kboards;
all_kboards = terminal->kboard;
terminal->kboard->reference_count++;
diff --git a/src/termcap.c b/src/termcap.c
index 9e64d02764..69ce56d93b 100644
--- a/src/termcap.c
+++ b/src/termcap.c
@@ -268,7 +268,6 @@ tputs (register char *str, int nlines, register int (*outfun) (/* ??? */))
register int padcount = 0;
register int speed;
- extern EMACS_INT baud_rate;
speed = baud_rate;
/* For quite high speeds, convert to the smaller
units to avoid overflow. */
diff --git a/src/terminal.c b/src/terminal.c
index 09c57bc2b0..309cc0095e 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -223,6 +223,7 @@ struct terminal *
create_terminal (void)
{
struct terminal *terminal = allocate_terminal ();
+ Lisp_Object terminal_coding, keyboard_coding;
terminal->name = NULL;
terminal->next_terminal = terminal_list;
@@ -235,8 +236,24 @@ create_terminal (void)
terminal->terminal_coding =
(struct coding_system *) xmalloc (sizeof (struct coding_system));
- setup_coding_system (Qno_conversion, terminal->keyboard_coding);
- setup_coding_system (Qundecided, terminal->terminal_coding);
+ /* If default coding systems for the terminal and the keyboard are
+ already defined, use them in preference to the defaults. This is
+ needed when Emacs runs in daemon mode. */
+ keyboard_coding =
+ find_symbol_value (intern ("default-keyboard-coding-system"));
+ if (NILP (keyboard_coding)
+ || EQ (keyboard_coding, Qunbound)
+ || NILP (Fcoding_system_p (keyboard_coding)))
+ keyboard_coding = Qno_conversion;
+ terminal_coding =
+ find_symbol_value (intern ("default-terminal-coding-system"));
+ if (NILP (terminal_coding)
+ || EQ (terminal_coding, Qunbound)
+ || NILP (Fcoding_system_p (terminal_coding)))
+ terminal_coding = Qundecided;
+
+ setup_coding_system (keyboard_coding, terminal->keyboard_coding);
+ setup_coding_system (terminal_coding, terminal->terminal_coding);
terminal->param_alist = Qnil;
return terminal;
diff --git a/src/undo.c b/src/undo.c
index 933982ec30..d11cd6f557 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -73,12 +73,12 @@ record_point (EMACS_INT pt)
Fundo_boundary ();
last_undo_buffer = current_buffer;
- if (CONSP (current_buffer->undo_list))
+ if (CONSP (BVAR (current_buffer, undo_list)))
{
/* Set AT_BOUNDARY to 1 only when we have nothing other than
marker adjustment before undo boundary. */
- Lisp_Object tail = current_buffer->undo_list, elt;
+ Lisp_Object tail = BVAR (current_buffer, undo_list), elt;
while (1)
{
@@ -103,8 +103,8 @@ record_point (EMACS_INT pt)
if (at_boundary
&& current_buffer == last_boundary_buffer
&& last_boundary_position != pt)
- current_buffer->undo_list
- = Fcons (make_number (last_boundary_position), current_buffer->undo_list);
+ BVAR (current_buffer, undo_list)
+ = Fcons (make_number (last_boundary_position), BVAR (current_buffer, undo_list));
}
/* Record an insertion that just happened or is about to happen,
@@ -117,17 +117,17 @@ record_insert (EMACS_INT beg, EMACS_INT length)
{
Lisp_Object lbeg, lend;
- if (EQ (current_buffer->undo_list, Qt))
+ if (EQ (BVAR (current_buffer, undo_list), Qt))
return;
record_point (beg);
/* If this is following another insertion and consecutive with it
in the buffer, combine the two. */
- if (CONSP (current_buffer->undo_list))
+ if (CONSP (BVAR (current_buffer, undo_list)))
{
Lisp_Object elt;
- elt = XCAR (current_buffer->undo_list);
+ elt = XCAR (BVAR (current_buffer, undo_list));
if (CONSP (elt)
&& INTEGERP (XCAR (elt))
&& INTEGERP (XCDR (elt))
@@ -140,8 +140,8 @@ record_insert (EMACS_INT beg, EMACS_INT length)
XSETFASTINT (lbeg, beg);
XSETINT (lend, beg + length);
- current_buffer->undo_list = Fcons (Fcons (lbeg, lend),
- current_buffer->undo_list);
+ BVAR (current_buffer, undo_list) = Fcons (Fcons (lbeg, lend),
+ BVAR (current_buffer, undo_list));
}
/* Record that a deletion is about to take place,
@@ -152,7 +152,7 @@ record_delete (EMACS_INT beg, Lisp_Object string)
{
Lisp_Object sbeg;
- if (EQ (current_buffer->undo_list, Qt))
+ if (EQ (BVAR (current_buffer, undo_list), Qt))
return;
if (PT == beg + SCHARS (string))
@@ -166,8 +166,8 @@ record_delete (EMACS_INT beg, Lisp_Object string)
record_point (beg);
}
- current_buffer->undo_list
- = Fcons (Fcons (string, sbeg), current_buffer->undo_list);
+ BVAR (current_buffer, undo_list)
+ = Fcons (Fcons (string, sbeg), BVAR (current_buffer, undo_list));
}
/* Record the fact that MARKER is about to be adjusted by ADJUSTMENT.
@@ -178,7 +178,7 @@ record_delete (EMACS_INT beg, Lisp_Object string)
void
record_marker_adjustment (Lisp_Object marker, EMACS_INT adjustment)
{
- if (EQ (current_buffer->undo_list, Qt))
+ if (EQ (BVAR (current_buffer, undo_list), Qt))
return;
/* Allocate a cons cell to be the undo boundary after this command. */
@@ -189,9 +189,9 @@ record_marker_adjustment (Lisp_Object marker, EMACS_INT adjustment)
Fundo_boundary ();
last_undo_buffer = current_buffer;
- current_buffer->undo_list
+ BVAR (current_buffer, undo_list)
= Fcons (Fcons (marker, make_number (adjustment)),
- current_buffer->undo_list);
+ BVAR (current_buffer, undo_list));
}
/* Record that a replacement is about to take place,
@@ -215,7 +215,7 @@ record_first_change (void)
Lisp_Object high, low;
struct buffer *base_buffer = current_buffer;
- if (EQ (current_buffer->undo_list, Qt))
+ if (EQ (BVAR (current_buffer, undo_list), Qt))
return;
if (current_buffer != last_undo_buffer)
@@ -227,7 +227,7 @@ record_first_change (void)
XSETFASTINT (high, (base_buffer->modtime >> 16) & 0xffff);
XSETFASTINT (low, base_buffer->modtime & 0xffff);
- current_buffer->undo_list = Fcons (Fcons (Qt, Fcons (high, low)), current_buffer->undo_list);
+ BVAR (current_buffer, undo_list) = Fcons (Fcons (Qt, Fcons (high, low)), BVAR (current_buffer, undo_list));
}
/* Record a change in property PROP (whose old value was VAL)
@@ -242,7 +242,7 @@ record_property_change (EMACS_INT beg, EMACS_INT length,
struct buffer *obuf = current_buffer, *buf = XBUFFER (buffer);
int boundary = 0;
- if (EQ (buf->undo_list, Qt))
+ if (EQ (BVAR (buf, undo_list), Qt))
return;
/* Allocate a cons cell to be the undo boundary after this command. */
@@ -265,7 +265,7 @@ record_property_change (EMACS_INT beg, EMACS_INT length,
XSETINT (lbeg, beg);
XSETINT (lend, beg + length);
entry = Fcons (Qnil, Fcons (prop, Fcons (value, Fcons (lbeg, lend))));
- current_buffer->undo_list = Fcons (entry, current_buffer->undo_list);
+ BVAR (current_buffer, undo_list) = Fcons (entry, BVAR (current_buffer, undo_list));
current_buffer = obuf;
}
@@ -277,9 +277,9 @@ but another undo command will undo to the previous boundary. */)
(void)
{
Lisp_Object tem;
- if (EQ (current_buffer->undo_list, Qt))
+ if (EQ (BVAR (current_buffer, undo_list), Qt))
return Qnil;
- tem = Fcar (current_buffer->undo_list);
+ tem = Fcar (BVAR (current_buffer, undo_list));
if (!NILP (tem))
{
/* One way or another, cons nil onto the front of the undo list. */
@@ -287,12 +287,12 @@ but another undo command will undo to the previous boundary. */)
{
/* If we have preallocated the cons cell to use here,
use that one. */
- XSETCDR (pending_boundary, current_buffer->undo_list);
- current_buffer->undo_list = pending_boundary;
+ XSETCDR (pending_boundary, BVAR (current_buffer, undo_list));
+ BVAR (current_buffer, undo_list) = pending_boundary;
pending_boundary = Qnil;
}
else
- current_buffer->undo_list = Fcons (Qnil, current_buffer->undo_list);
+ BVAR (current_buffer, undo_list) = Fcons (Qnil, BVAR (current_buffer, undo_list));
}
last_boundary_position = PT;
last_boundary_buffer = current_buffer;
@@ -321,7 +321,7 @@ truncate_undo_list (struct buffer *b)
record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ());
set_buffer_internal (b);
- list = b->undo_list;
+ list = BVAR (b, undo_list);
prev = Qnil;
next = list;
@@ -433,7 +433,7 @@ truncate_undo_list (struct buffer *b)
XSETCDR (last_boundary, Qnil);
/* There's nothing we decided to keep, so clear it out. */
else
- b->undo_list = Qnil;
+ BVAR (b, undo_list) = Qnil;
unbind_to (count, Qnil);
}
@@ -470,13 +470,13 @@ Return what remains of the list. */)
/* In a writable buffer, enable undoing read-only text that is so
because of text properties. */
- if (NILP (current_buffer->read_only))
+ if (NILP (BVAR (current_buffer, read_only)))
specbind (Qinhibit_read_only, Qt);
/* Don't let `intangible' properties interfere with undo. */
specbind (Qinhibit_point_motion_hooks, Qt);
- oldlist = current_buffer->undo_list;
+ oldlist = BVAR (current_buffer, undo_list);
while (arg > 0)
{
@@ -631,9 +631,9 @@ Return what remains of the list. */)
so the test in `undo' for continuing an undo series
will work right. */
if (did_apply
- && EQ (oldlist, current_buffer->undo_list))
- current_buffer->undo_list
- = Fcons (list3 (Qapply, Qcdr, Qnil), current_buffer->undo_list);
+ && EQ (oldlist, BVAR (current_buffer, undo_list)))
+ BVAR (current_buffer, undo_list)
+ = Fcons (list3 (Qapply, Qcdr, Qnil), BVAR (current_buffer, undo_list));
UNGCPRO;
return unbind_to (count, list);
diff --git a/src/w32fns.c b/src/w32fns.c
index b09bb0b5b5..ec48397657 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -4348,9 +4348,9 @@ This function is an internal primitive--use `make-frame' instead. */)
/* Initialize `default-minibuffer-frame' in case this is the first
frame on this terminal. */
if (FRAME_HAS_MINIBUF_P (f)
- && (!FRAMEP (kb->Vdefault_minibuffer_frame)
- || !FRAME_LIVE_P (XFRAME (kb->Vdefault_minibuffer_frame))))
- kb->Vdefault_minibuffer_frame = frame;
+ && (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame))
+ || !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame)))))
+ KVAR (kb, Vdefault_minibuffer_frame) = frame;
/* All remaining specified parameters, which have not been "used"
by x_get_arg and friends, now go in the misc. alist of the frame. */
@@ -5225,7 +5225,7 @@ x_create_tip_frame (struct w32_display_info *dpyinfo,
Fset_window_buffer (FRAME_ROOT_WINDOW (f), buffer, Qnil);
old_buffer = current_buffer;
set_buffer_internal_1 (XBUFFER (buffer));
- current_buffer->truncate_lines = Qnil;
+ BVAR (current_buffer, truncate_lines) = Qnil;
specbind (Qinhibit_read_only, Qt);
specbind (Qinhibit_modification_hooks, Qt);
Ferase_buffer ();
@@ -5655,7 +5655,7 @@ Text larger than the specified size is clipped. */)
/* Display the tooltip text in a temporary buffer. */
old_buffer = current_buffer;
set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer));
- current_buffer->truncate_lines = Qnil;
+ BVAR (current_buffer, truncate_lines) = Qnil;
clear_glyph_matrix (w->desired_matrix);
clear_glyph_matrix (w->current_matrix);
SET_TEXT_POS (pos, BEGV, BEGV_BYTE);
@@ -6162,7 +6162,7 @@ an integer representing a ShowWindow flag:
CHECK_STRING (document);
/* Encode filename, current directory and parameters. */
- current_dir = ENCODE_FILE (current_buffer->directory);
+ current_dir = ENCODE_FILE (BVAR (current_buffer, directory));
document = ENCODE_FILE (document);
if (STRINGP (parameters))
parameters = ENCODE_SYSTEM (parameters);
diff --git a/src/w32term.c b/src/w32term.c
index cd4ee54fd2..692130b514 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -6082,7 +6082,7 @@ w32_create_terminal (struct w32_display_info *dpyinfo)
terminal like X does. */
terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
init_kboard (terminal->kboard);
- terminal->kboard->Vwindow_system = intern ("w32");
+ KVAR (terminal->kboard, Vwindow_system) = intern ("w32");
terminal->kboard->next_kboard = all_kboards;
all_kboards = terminal->kboard;
/* Don't let the initial kboard remain current longer than necessary.
diff --git a/src/window.c b/src/window.c
index d21cbb164e..f0555d5c96 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1359,8 +1359,8 @@ window_display_table (struct window *w)
{
struct buffer *b = XBUFFER (w->buffer);
- if (DISP_TABLE_P (b->display_table))
- dp = XCHAR_TABLE (b->display_table);
+ if (DISP_TABLE_P (BVAR (b, display_table)))
+ dp = XCHAR_TABLE (BVAR (b, display_table));
else if (DISP_TABLE_P (Vstandard_display_table))
dp = XCHAR_TABLE (Vstandard_display_table);
}
@@ -1414,9 +1414,9 @@ unshow_buffer (register struct window *w)
So don't clobber point in that buffer. */
if (! EQ (buf, XWINDOW (selected_window)->buffer)
/* This line helps to fix Horsley's testbug.el bug. */
- && !(WINDOWP (b->last_selected_window)
- && w != XWINDOW (b->last_selected_window)
- && EQ (buf, XWINDOW (b->last_selected_window)->buffer)))
+ && !(WINDOWP (BVAR (b, last_selected_window))
+ && w != XWINDOW (BVAR (b, last_selected_window))
+ && EQ (buf, XWINDOW (BVAR (b, last_selected_window))->buffer)))
temp_set_point_both (b,
clip_to_bounds (BUF_BEGV (b),
XMARKER (w->pointm)->charpos,
@@ -1425,9 +1425,9 @@ unshow_buffer (register struct window *w)
marker_byte_position (w->pointm),
BUF_ZV_BYTE (b)));
- if (WINDOWP (b->last_selected_window)
- && w == XWINDOW (b->last_selected_window))
- b->last_selected_window = Qnil;
+ if (WINDOWP (BVAR (b, last_selected_window))
+ && w == XWINDOW (BVAR (b, last_selected_window)))
+ BVAR (b, last_selected_window) = Qnil;
}
/* Put replacement into the window structure in place of old. */
@@ -2325,7 +2325,7 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame
/* Check for a window that has a killed buffer. */
case CHECK_ALL_WINDOWS:
if (! NILP (w->buffer)
- && NILP (XBUFFER (w->buffer)->name))
+ && NILP (BVAR (XBUFFER (w->buffer), name)))
abort ();
break;
@@ -2729,7 +2729,7 @@ window_min_size_2 (struct window *w, int width_p, int safe_p)
{
int safe_size = (MIN_SAFE_WINDOW_HEIGHT
+ ((BUFFERP (w->buffer)
- && !NILP (XBUFFER (w->buffer)->mode_line_format))
+ && !NILP (BVAR (XBUFFER (w->buffer), mode_line_format)))
? 1 : 0));
return safe_p ? safe_size : max (window_min_height, safe_size);
@@ -3360,15 +3360,15 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
w->buffer = buffer;
if (EQ (window, selected_window))
- b->last_selected_window = window;
+ BVAR (b, last_selected_window) = window;
/* Let redisplay errors through. */
b->display_error_modiff = 0;
/* Update time stamps of buffer display. */
- if (INTEGERP (b->display_count))
- XSETINT (b->display_count, XINT (b->display_count) + 1);
- b->display_time = Fcurrent_time ();
+ if (INTEGERP (BVAR (b, display_count)))
+ XSETINT (BVAR (b, display_count), XINT (BVAR (b, display_count)) + 1);
+ BVAR (b, display_time) = Fcurrent_time ();
XSETFASTINT (w->window_end_pos, 0);
XSETFASTINT (w->window_end_vpos, 0);
@@ -3421,18 +3421,18 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
w->left_margin_cols = w->right_margin_cols = Qnil;
Fset_window_fringes (window,
- b->left_fringe_width, b->right_fringe_width,
- b->fringes_outside_margins);
+ BVAR (b, left_fringe_width), BVAR (b, right_fringe_width),
+ BVAR (b, fringes_outside_margins));
Fset_window_scroll_bars (window,
- b->scroll_bar_width,
- b->vertical_scroll_bar_type, Qnil);
+ BVAR (b, scroll_bar_width),
+ BVAR (b, vertical_scroll_bar_type), Qnil);
w->left_margin_cols = save_left;
w->right_margin_cols = save_right;
Fset_window_margins (window,
- b->left_margin_cols, b->right_margin_cols);
+ BVAR (b, left_margin_cols), BVAR (b, right_margin_cols));
}
if (run_hooks_p)
@@ -3469,7 +3469,7 @@ This function runs `window-scroll-functions' before running
XSETWINDOW (window, w);
buffer = Fget_buffer (buffer_or_name);
CHECK_BUFFER (buffer);
- if (NILP (XBUFFER (buffer)->name))
+ if (NILP (BVAR (XBUFFER (buffer), name)))
error ("Attempt to display deleted buffer");
tem = w->buffer;
@@ -3481,7 +3481,7 @@ This function runs `window-scroll-functions' before running
if (EQ (tem, buffer))
return Qnil;
else if (EQ (w->dedicated, Qt))
- error ("Window is dedicated to `%s'", SDATA (XBUFFER (tem)->name));
+ error ("Window is dedicated to `%s'", SDATA (BVAR (XBUFFER (tem), name)));
else
w->dedicated = Qnil;
@@ -3517,7 +3517,7 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap)
record_buffer (w->buffer);
}
- if (EQ (window, selected_window))
+ if (EQ (window, selected_window) && !inhibit_point_swap)
return window;
sf = SELECTED_FRAME ();
@@ -3552,7 +3552,7 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap)
Fset_buffer (w->buffer);
- XBUFFER (w->buffer)->last_selected_window = window;
+ BVAR (XBUFFER (w->buffer), last_selected_window) = window;
/* Go to the point recorded in the window.
This is important when the buffer is in more
@@ -3640,7 +3640,7 @@ displaying that buffer. */)
if (STRINGP (object))
object = Fget_buffer (object);
- if (BUFFERP (object) && !NILP (XBUFFER (object)->name))
+ if (BUFFERP (object) && !NILP (BVAR (XBUFFER (object), name)))
{
/* Walk all windows looking for buffer, and force update
of each of those windows. */
@@ -3662,7 +3662,7 @@ temp_output_buffer_show (register Lisp_Object buf)
register Lisp_Object window;
register struct window *w;
- XBUFFER (buf)->directory = current_buffer->directory;
+ BVAR (XBUFFER (buf), directory) = BVAR (current_buffer, directory);
Fset_buffer (buf);
BUF_SAVE_MODIFF (XBUFFER (buf)) = MODIFF;
@@ -4843,8 +4843,8 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
possibility of point becoming "stuck" on a tall line when
scrolling by one line. */
if (window_scroll_pixel_based_preserve_y < 0
- || !SYMBOLP (current_kboard->Vlast_command)
- || NILP (Fget (current_kboard->Vlast_command, Qscroll_command)))
+ || !SYMBOLP (KVAR (current_kboard, Vlast_command))
+ || NILP (Fget (KVAR (current_kboard, Vlast_command), Qscroll_command)))
{
start_display (&it, w, start);
move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS);
@@ -5100,8 +5100,8 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror)
if (!NILP (Vscroll_preserve_screen_position))
{
if (window_scroll_preserve_vpos <= 0
- || !SYMBOLP (current_kboard->Vlast_command)
- || NILP (Fget (current_kboard->Vlast_command, Qscroll_command)))
+ || !SYMBOLP (KVAR (current_kboard, Vlast_command))
+ || NILP (Fget (KVAR (current_kboard, Vlast_command), Qscroll_command)))
{
struct position posit
= *compute_motion (startpos, 0, 0, 0,
@@ -5887,7 +5887,7 @@ the return value is nil. Otherwise the value is t. */)
saved_windows = XVECTOR (data->saved_windows);
new_current_buffer = data->current_buffer;
- if (NILP (XBUFFER (new_current_buffer)->name))
+ if (NILP (BVAR (XBUFFER (new_current_buffer), name)))
new_current_buffer = Qnil;
else
{
@@ -6072,14 +6072,14 @@ the return value is nil. Otherwise the value is t. */)
w->buffer = p->buffer;
else
{
- if (!NILP (XBUFFER (p->buffer)->name))
+ if (!NILP (BVAR (XBUFFER (p->buffer), name)))
/* If saved buffer is alive, install it. */
{
w->buffer = p->buffer;
w->start_at_line_beg = p->start_at_line_beg;
set_marker_restricted (w->start, p->start, w->buffer);
set_marker_restricted (w->pointm, p->pointm, w->buffer);
- Fset_marker (XBUFFER (w->buffer)->mark,
+ Fset_marker (BVAR (XBUFFER (w->buffer), mark),
p->mark, w->buffer);
/* As documented in Fcurrent_window_configuration, don't
@@ -6089,7 +6089,7 @@ the return value is nil. Otherwise the value is t. */)
&& XBUFFER (p->buffer) == current_buffer)
Fgoto_char (w->pointm);
}
- else if (NILP (w->buffer) || NILP (XBUFFER (w->buffer)->name))
+ else if (NILP (w->buffer) || NILP (BVAR (XBUFFER (w->buffer), name)))
/* Else unless window has a live buffer, get one. */
{
w->buffer = Fcdr (Fcar (Vbuffer_alist));
@@ -6130,7 +6130,7 @@ the return value is nil. Otherwise the value is t. */)
has been restored into it. We already swapped out that point
from that window's old buffer. */
select_window (data->current_window, Qnil, 1);
- XBUFFER (XWINDOW (selected_window)->buffer)->last_selected_window
+ BVAR (XBUFFER (XWINDOW (selected_window)->buffer), last_selected_window)
= selected_window;
if (NILP (data->focus_frame)
@@ -6331,7 +6331,7 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i)
p->start = Fcopy_marker (w->start, Qnil);
p->start_at_line_beg = w->start_at_line_beg;
- tem = XBUFFER (w->buffer)->mark;
+ tem = BVAR (XBUFFER (w->buffer), mark);
p->mark = Fcopy_marker (tem, Qnil);
}
else
diff --git a/src/xdisp.c b/src/xdisp.c
index 630c1dcda8..e144237d34 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -444,6 +444,12 @@ static int this_line_pixel_height;
static int this_line_start_x;
+/* The smallest character position seen by move_it_* functions as they
+ move across display lines. Used to set MATRIX_ROW_START_CHARPOS of
+ hscrolled lines, see display_line. */
+
+static struct text_pos this_line_min_pos;
+
/* Buffer that this_line_.* variables are referring to. */
static struct buffer *this_line_buffer;
@@ -1204,12 +1210,12 @@ pos_visible_p (struct window *w, EMACS_INT charpos, int *x, int *y,
if (WINDOW_WANTS_MODELINE_P (w))
current_mode_line_height
= display_mode_line (w, CURRENT_MODE_LINE_FACE_ID (w),
- current_buffer->mode_line_format);
+ BVAR (current_buffer, mode_line_format));
if (WINDOW_WANTS_HEADER_LINE_P (w))
current_header_line_height
= display_mode_line (w, HEADER_LINE_FACE_ID,
- current_buffer->header_line_format);
+ BVAR (current_buffer, header_line_format));
start_display (&it, w, top);
move_it_to (&it, charpos, -1, it.last_visible_y-1, -1,
@@ -2399,10 +2405,10 @@ init_iterator (struct it *it, struct window *w,
if (base_face_id == DEFAULT_FACE_ID
&& FRAME_WINDOW_P (it->f))
{
- if (NATNUMP (current_buffer->extra_line_spacing))
- it->extra_line_spacing = XFASTINT (current_buffer->extra_line_spacing);
- else if (FLOATP (current_buffer->extra_line_spacing))
- it->extra_line_spacing = (XFLOAT_DATA (current_buffer->extra_line_spacing)
+ if (NATNUMP (BVAR (current_buffer, extra_line_spacing)))
+ it->extra_line_spacing = XFASTINT (BVAR (current_buffer, extra_line_spacing));
+ else if (FLOATP (BVAR (current_buffer, extra_line_spacing)))
+ it->extra_line_spacing = (XFLOAT_DATA (BVAR (current_buffer, extra_line_spacing))
* FRAME_LINE_HEIGHT (it->f));
else if (it->f->extra_line_spacing > 0)
it->extra_line_spacing = it->f->extra_line_spacing;
@@ -2425,36 +2431,36 @@ init_iterator (struct it *it, struct window *w,
it->override_ascent = -1;
/* Are control characters displayed as `^C'? */
- it->ctl_arrow_p = !NILP (current_buffer->ctl_arrow);
+ it->ctl_arrow_p = !NILP (BVAR (current_buffer, ctl_arrow));
/* -1 means everything between a CR and the following line end
is invisible. >0 means lines indented more than this value are
invisible. */
- it->selective = (INTEGERP (current_buffer->selective_display)
- ? XFASTINT (current_buffer->selective_display)
- : (!NILP (current_buffer->selective_display)
+ it->selective = (INTEGERP (BVAR (current_buffer, selective_display))
+ ? XFASTINT (BVAR (current_buffer, selective_display))
+ : (!NILP (BVAR (current_buffer, selective_display))
? -1 : 0));
it->selective_display_ellipsis_p
- = !NILP (current_buffer->selective_display_ellipses);
+ = !NILP (BVAR (current_buffer, selective_display_ellipses));
/* Display table to use. */
it->dp = window_display_table (w);
/* Are multibyte characters enabled in current_buffer? */
- it->multibyte_p = !NILP (current_buffer->enable_multibyte_characters);
+ it->multibyte_p = !NILP (BVAR (current_buffer, enable_multibyte_characters));
/* Do we need to reorder bidirectional text? Not if this is a
unibyte buffer: by definition, none of the single-byte characters
are strong R2L, so no reordering is needed. And bidi.c doesn't
support unibyte buffers anyway. */
it->bidi_p
- = !NILP (current_buffer->bidi_display_reordering) && it->multibyte_p;
+ = !NILP (BVAR (current_buffer, bidi_display_reordering)) && it->multibyte_p;
/* Non-zero if we should highlight the region. */
highlight_region_p
= (!NILP (Vtransient_mark_mode)
- && !NILP (current_buffer->mark_active)
- && XMARKER (current_buffer->mark)->buffer != 0);
+ && !NILP (BVAR (current_buffer, mark_active))
+ && XMARKER (BVAR (current_buffer, mark))->buffer != 0);
/* Set IT->region_beg_charpos and IT->region_end_charpos to the
start and end of a visible region in window IT->w. Set both to
@@ -2471,7 +2477,7 @@ init_iterator (struct it *it, struct window *w,
&& WINDOWP (minibuf_selected_window)
&& w == XWINDOW (minibuf_selected_window))))
{
- EMACS_INT charpos = marker_position (current_buffer->mark);
+ EMACS_INT charpos = marker_position (BVAR (current_buffer, mark));
it->region_beg_charpos = min (PT, charpos);
it->region_end_charpos = max (PT, charpos);
}
@@ -2488,7 +2494,7 @@ init_iterator (struct it *it, struct window *w,
it->redisplay_end_trigger_charpos = XINT (w->redisplay_end_trigger);
/* Correct bogus values of tab_width. */
- it->tab_width = XINT (current_buffer->tab_width);
+ it->tab_width = XINT (BVAR (current_buffer, tab_width));
if (it->tab_width <= 0 || it->tab_width > 1000)
it->tab_width = 8;
@@ -2502,8 +2508,8 @@ init_iterator (struct it *it, struct window *w,
&& (WINDOW_TOTAL_COLS (it->w)
< XINT (Vtruncate_partial_width_windows))))))
it->line_wrap = TRUNCATE;
- else if (NILP (current_buffer->truncate_lines))
- it->line_wrap = NILP (current_buffer->word_wrap)
+ else if (NILP (BVAR (current_buffer, truncate_lines)))
+ it->line_wrap = NILP (BVAR (current_buffer, word_wrap))
? WINDOW_WRAP : WORD_WRAP;
else
it->line_wrap = TRUNCATE;
@@ -2605,9 +2611,9 @@ init_iterator (struct it *it, struct window *w,
{
/* Note the paragraph direction that this buffer wants to
use. */
- if (EQ (current_buffer->bidi_paragraph_direction, Qleft_to_right))
+ if (EQ (BVAR (current_buffer, bidi_paragraph_direction), Qleft_to_right))
it->paragraph_embedding = L2R;
- else if (EQ (current_buffer->bidi_paragraph_direction, Qright_to_left))
+ else if (EQ (BVAR (current_buffer, bidi_paragraph_direction), Qright_to_left))
it->paragraph_embedding = R2L;
else
it->paragraph_embedding = NEUTRAL_DIR;
@@ -5405,7 +5411,7 @@ reseat_1 (struct it *it, struct text_pos pos, int set_stop_p)
it->method = GET_FROM_BUFFER;
it->object = it->w->buffer;
it->area = TEXT_AREA;
- it->multibyte_p = !NILP (current_buffer->enable_multibyte_characters);
+ it->multibyte_p = !NILP (BVAR (current_buffer, enable_multibyte_characters));
it->sp = 0;
it->string_from_display_prop_p = 0;
it->face_before_selective_p = 0;
@@ -6909,6 +6915,9 @@ move_it_in_display_line_to (struct it *it,
&& it->current_y < it->last_visible_y)
handle_line_prefix (it);
+ if (IT_CHARPOS (*it) < CHARPOS (this_line_min_pos))
+ SET_TEXT_POS (this_line_min_pos, IT_CHARPOS (*it), IT_BYTEPOS (*it));
+
while (1)
{
int x, i, ascent = 0, descent = 0;
@@ -7013,6 +7022,9 @@ move_it_in_display_line_to (struct it *it,
if (it->area != TEXT_AREA)
{
set_iterator_to_next (it, 1);
+ if (IT_CHARPOS (*it) < CHARPOS (this_line_min_pos))
+ SET_TEXT_POS (this_line_min_pos,
+ IT_CHARPOS (*it), IT_BYTEPOS (*it));
continue;
}
@@ -7121,6 +7133,9 @@ move_it_in_display_line_to (struct it *it,
}
set_iterator_to_next (it, 1);
+ if (IT_CHARPOS (*it) < CHARPOS (this_line_min_pos))
+ SET_TEXT_POS (this_line_min_pos,
+ IT_CHARPOS (*it), IT_BYTEPOS (*it));
/* On graphical terminals, newlines may
"overflow" into the fringe if
overflow-newline-into-fringe is non-nil.
@@ -7219,6 +7234,8 @@ move_it_in_display_line_to (struct it *it,
/* The current display element has been consumed. Advance
to the next. */
set_iterator_to_next (it, 1);
+ if (IT_CHARPOS (*it) < CHARPOS (this_line_min_pos))
+ SET_TEXT_POS (this_line_min_pos, IT_CHARPOS (*it), IT_BYTEPOS (*it));
/* Stop if lines are truncated and IT's current x-position is
past the right edge of the window now. */
@@ -7902,7 +7919,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte)
old_deactivate_mark = Vdeactivate_mark;
oldbuf = current_buffer;
Fset_buffer (Fget_buffer_create (Vmessages_buffer_name));
- current_buffer->undo_list = Qt;
+ BVAR (current_buffer, undo_list) = Qt;
oldpoint = message_dolog_marker1;
set_marker_restricted (oldpoint, make_number (PT), Qnil);
@@ -7926,7 +7943,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte)
/* Insert the string--maybe converting multibyte to single byte
or vice versa, so that all the text fits the buffer. */
if (multibyte
- && NILP (current_buffer->enable_multibyte_characters))
+ && NILP (BVAR (current_buffer, enable_multibyte_characters)))
{
EMACS_INT i;
int c, char_bytes;
@@ -7944,7 +7961,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte)
}
}
else if (! multibyte
- && ! NILP (current_buffer->enable_multibyte_characters))
+ && ! NILP (BVAR (current_buffer, enable_multibyte_characters)))
{
EMACS_INT i;
int c, char_bytes;
@@ -8443,7 +8460,7 @@ update_echo_area (void)
Lisp_Object string;
string = Fcurrent_message ();
message3 (string, SBYTES (string),
- !NILP (current_buffer->enable_multibyte_characters));
+ !NILP (BVAR (current_buffer, enable_multibyte_characters)));
}
}
@@ -8458,7 +8475,7 @@ ensure_echo_area_buffers (void)
for (i = 0; i < 2; ++i)
if (!BUFFERP (echo_buffer[i])
- || NILP (XBUFFER (echo_buffer[i])->name))
+ || NILP (BVAR (XBUFFER (echo_buffer[i]), name)))
{
char name[30];
Lisp_Object old_buffer;
@@ -8467,7 +8484,7 @@ ensure_echo_area_buffers (void)
old_buffer = echo_buffer[i];
sprintf (name, " *Echo Area %d*", i);
echo_buffer[i] = Fget_buffer_create (build_string (name));
- XBUFFER (echo_buffer[i])->truncate_lines = Qnil;
+ BVAR (XBUFFER (echo_buffer[i]), truncate_lines) = Qnil;
/* to force word wrap in echo area -
it was decided to postpone this*/
/* XBUFFER (echo_buffer[i])->word_wrap = Qt; */
@@ -8560,8 +8577,8 @@ with_echo_area_buffer (struct window *w, int which,
set_marker_both (w->pointm, buffer, BEG, BEG_BYTE);
}
- current_buffer->undo_list = Qt;
- current_buffer->read_only = Qnil;
+ BVAR (current_buffer, undo_list) = Qt;
+ BVAR (current_buffer, read_only) = Qnil;
specbind (Qinhibit_read_only, Qt);
specbind (Qinhibit_modification_hooks, Qt);
@@ -8674,7 +8691,7 @@ setup_echo_area_for_printing (int multibyte_p)
/* Switch to that buffer and clear it. */
set_buffer_internal (XBUFFER (echo_area_buffer[0]));
- current_buffer->truncate_lines = Qnil;
+ BVAR (current_buffer, truncate_lines) = Qnil;
if (Z > BEG)
{
@@ -8688,7 +8705,7 @@ setup_echo_area_for_printing (int multibyte_p)
/* Set up the buffer for the multibyteness we need. */
if (multibyte_p
- != !NILP (current_buffer->enable_multibyte_characters))
+ != !NILP (BVAR (current_buffer, enable_multibyte_characters)))
Fset_buffer_multibyte (multibyte_p ? Qt : Qnil);
/* Raise the frame containing the echo area. */
@@ -8717,7 +8734,7 @@ setup_echo_area_for_printing (int multibyte_p)
{
/* Someone switched buffers between print requests. */
set_buffer_internal (XBUFFER (echo_area_buffer[0]));
- current_buffer->truncate_lines = Qnil;
+ BVAR (current_buffer, truncate_lines) = Qnil;
}
}
}
@@ -9160,12 +9177,12 @@ set_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT nbytes, EMACS_INT multiby
/* Change multibyteness of the echo buffer appropriately. */
if (message_enable_multibyte
- != !NILP (current_buffer->enable_multibyte_characters))
+ != !NILP (BVAR (current_buffer, enable_multibyte_characters)))
Fset_buffer_multibyte (message_enable_multibyte ? Qt : Qnil);
- current_buffer->truncate_lines = message_truncate_lines ? Qt : Qnil;
- if (!NILP (current_buffer->bidi_display_reordering))
- current_buffer->bidi_paragraph_direction = Qleft_to_right;
+ BVAR (current_buffer, truncate_lines) = message_truncate_lines ? Qt : Qnil;
+ if (!NILP (BVAR (current_buffer, bidi_display_reordering)))
+ BVAR (current_buffer, bidi_paragraph_direction) = Qleft_to_right;
/* Insert new message at BEG. */
TEMP_SET_PT_BOTH (BEG, BEG_BYTE);
@@ -9188,7 +9205,7 @@ set_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT nbytes, EMACS_INT multiby
if (nbytes == 0)
nbytes = strlen (s);
- if (multibyte_p && NILP (current_buffer->enable_multibyte_characters))
+ if (multibyte_p && NILP (BVAR (current_buffer, enable_multibyte_characters)))
{
/* Convert from multi-byte to single-byte. */
EMACS_INT i;
@@ -9206,7 +9223,7 @@ set_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT nbytes, EMACS_INT multiby
}
}
else if (!multibyte_p
- && !NILP (current_buffer->enable_multibyte_characters))
+ && !NILP (BVAR (current_buffer, enable_multibyte_characters)))
{
/* Convert from single-byte to multi-byte. */
EMACS_INT i;
@@ -9791,7 +9808,7 @@ update_menu_bar (struct frame *f, int save_match_data, int hooks_run)
< BUF_MODIFF (XBUFFER (w->buffer)))
!= !NILP (w->last_had_star))
|| ((!NILP (Vtransient_mark_mode)
- && !NILP (XBUFFER (w->buffer)->mark_active))
+ && !NILP (BVAR (XBUFFER (w->buffer), mark_active)))
!= !NILP (w->region_showing)))
{
struct buffer *prev = current_buffer;
@@ -9989,7 +10006,7 @@ update_tool_bar (struct frame *f, int save_match_data)
< BUF_MODIFF (XBUFFER (w->buffer)))
!= !NILP (w->last_had_star))
|| ((!NILP (Vtransient_mark_mode)
- && !NILP (XBUFFER (w->buffer)->mark_active))
+ && !NILP (BVAR (XBUFFER (w->buffer), mark_active)))
!= !NILP (w->region_showing)))
{
struct buffer *prev = current_buffer;
@@ -11080,8 +11097,8 @@ text_outside_line_unchanged_p (struct window *w,
/* If selective display, can't optimize if changes start at the
beginning of the line. */
if (unchanged_p
- && INTEGERP (current_buffer->selective_display)
- && XINT (current_buffer->selective_display) > 0
+ && INTEGERP (BVAR (current_buffer, selective_display))
+ && XINT (BVAR (current_buffer, selective_display)) > 0
&& (BEG_UNCHANGED < start || GPT <= start))
unchanged_p = 0;
@@ -11109,8 +11126,8 @@ text_outside_line_unchanged_p (struct window *w,
require to redisplay the whole paragraph. It might be worthwhile
to find the paragraph limits and widen the range of redisplayed
lines to that, but for now just give up this optimization. */
- if (!NILP (XBUFFER (w->buffer)->bidi_display_reordering)
- && NILP (XBUFFER (w->buffer)->bidi_paragraph_direction))
+ if (!NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering))
+ && NILP (BVAR (XBUFFER (w->buffer), bidi_paragraph_direction)))
unchanged_p = 0;
}
@@ -11402,6 +11419,7 @@ static void
redisplay_internal (int preserve_echo_area)
{
struct window *w = XWINDOW (selected_window);
+ struct window *sw;
struct frame *f;
int pause;
int must_finish = 0;
@@ -11462,6 +11480,9 @@ redisplay_internal (int preserve_echo_area)
}
retry:
+ /* Remember the currently selected window. */
+ sw = w;
+
if (!EQ (old_frame, selected_frame)
&& FRAME_LIVE_P (XFRAME (old_frame)))
/* When running redisplay, we play a bit fast-and-loose and allow e.g.
@@ -11529,6 +11550,14 @@ redisplay_internal (int preserve_echo_area)
/* Notice any pending interrupt request to change frame size. */
do_pending_window_change (1);
+ /* do_pending_window_change could change the selected_window due to
+ frame resizing which makes the selected window too small. */
+ if (WINDOWP (selected_window) && (w = XWINDOW (selected_window)) != sw)
+ {
+ sw = w;
+ reconsider_clip_changes (w, current_buffer);
+ }
+
/* Clear frames marked as garbaged. */
if (frame_garbaged)
clear_garbaged_frames ();
@@ -11645,11 +11674,11 @@ redisplay_internal (int preserve_echo_area)
the whole window. The assignment to this_line_start_pos prevents
the optimization directly below this if-statement. */
if (((!NILP (Vtransient_mark_mode)
- && !NILP (XBUFFER (w->buffer)->mark_active))
+ && !NILP (BVAR (XBUFFER (w->buffer), mark_active)))
!= !NILP (w->region_showing))
|| (!NILP (w->region_showing)
&& !EQ (w->region_showing,
- Fmarker_position (XBUFFER (w->buffer)->mark))))
+ Fmarker_position (BVAR (XBUFFER (w->buffer), mark)))))
CHARPOS (this_line_start_pos) = 0;
/* Optimize the case that only the line containing the cursor in the
@@ -11798,6 +11827,10 @@ redisplay_internal (int preserve_echo_area)
if (!must_finish)
{
do_pending_window_change (1);
+ /* If selected_window changed, redisplay again. */
+ if (WINDOWP (selected_window)
+ && (w = XWINDOW (selected_window)) != sw)
+ goto retry;
/* We used to always goto end_of_redisplay here, but this
isn't enough if we have a blinking cursor. */
@@ -11809,8 +11842,8 @@ redisplay_internal (int preserve_echo_area)
/* If highlighting the region, or if the cursor is in the echo area,
then we can't just move the cursor. */
else if (! (!NILP (Vtransient_mark_mode)
- && !NILP (current_buffer->mark_active))
- && (EQ (selected_window, current_buffer->last_selected_window)
+ && !NILP (BVAR (current_buffer, mark_active)))
+ && (EQ (selected_window, BVAR (current_buffer, last_selected_window))
|| highlight_nonselected_windows)
&& NILP (w->region_showing)
&& NILP (Vshow_trailing_whitespace)
@@ -12092,8 +12125,9 @@ redisplay_internal (int preserve_echo_area)
do_pending_window_change (1);
/* If we just did a pending size change, or have additional
- visible frames, redisplay again. */
- if (windows_or_buffers_changed && !pause)
+ visible frames, or selected_window changed, redisplay again. */
+ if ((windows_or_buffers_changed && !pause)
+ || (WINDOWP (selected_window) && (w = XWINDOW (selected_window)) != sw))
goto retry;
/* Clear the face and image caches.
@@ -13016,8 +13050,8 @@ try_scrolling (Lisp_Object window, int just_this_one_p,
scroll_max = (max (scroll_step,
max (arg_scroll_conservatively, temp_scroll_step))
* FRAME_LINE_HEIGHT (f));
- else if (NUMBERP (current_buffer->scroll_down_aggressively)
- || NUMBERP (current_buffer->scroll_up_aggressively))
+ else if (NUMBERP (BVAR (current_buffer, scroll_down_aggressively))
+ || NUMBERP (BVAR (current_buffer, scroll_up_aggressively)))
/* We're trying to scroll because of aggressive scrolling but no
scroll_step is set. Choose an arbitrary one. */
scroll_max = 10 * FRAME_LINE_HEIGHT (f);
@@ -13082,7 +13116,7 @@ try_scrolling (Lisp_Object window, int just_this_one_p,
amount_to_scroll = scroll_max;
else
{
- aggressive = current_buffer->scroll_up_aggressively;
+ aggressive = BVAR (current_buffer, scroll_up_aggressively);
height = WINDOW_BOX_TEXT_HEIGHT (w);
if (NUMBERP (aggressive))
{
@@ -13165,7 +13199,7 @@ try_scrolling (Lisp_Object window, int just_this_one_p,
amount_to_scroll = scroll_max;
else
{
- aggressive = current_buffer->scroll_down_aggressively;
+ aggressive = BVAR (current_buffer, scroll_down_aggressively);
height = WINDOW_BOX_TEXT_HEIGHT (w);
if (NUMBERP (aggressive))
{
@@ -13346,7 +13380,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
region exists, cursor movement has to do more than just
set the cursor. */
&& !(!NILP (Vtransient_mark_mode)
- && !NILP (current_buffer->mark_active))
+ && !NILP (BVAR (current_buffer, mark_active)))
&& NILP (w->region_showing)
&& NILP (Vshow_trailing_whitespace)
/* Right after splitting windows, last_point may be nil. */
@@ -13501,7 +13535,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
must_scroll = 1;
}
else if (rc != CURSOR_MOVEMENT_SUCCESS
- && !NILP (XBUFFER (w->buffer)->bidi_display_reordering))
+ && !NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering)))
{
/* If rows are bidi-reordered and point moved, back up
until we find a row that does not belong to a
@@ -13559,7 +13593,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
else if (scroll_p)
rc = CURSOR_MOVEMENT_MUST_SCROLL;
else if (rc != CURSOR_MOVEMENT_SUCCESS
- && !NILP (XBUFFER (w->buffer)->bidi_display_reordering))
+ && !NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering)))
{
/* With bidi-reordered rows, there could be more than
one candidate row whose start and end positions
@@ -13859,7 +13893,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
struct Lisp_Char_Table *disptab = buffer_display_table ();
if (! disptab_matches_widthtab (disptab,
- XVECTOR (current_buffer->width_table)))
+ XVECTOR (BVAR (current_buffer, width_table))))
{
invalidate_region_cache (current_buffer,
current_buffer->width_run_cache,
@@ -13981,7 +14015,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
/* If we are highlighting the region, then we just changed
the region, so redisplay to show it. */
if (!NILP (Vtransient_mark_mode)
- && !NILP (current_buffer->mark_active))
+ && !NILP (BVAR (current_buffer, mark_active)))
{
clear_glyph_matrix (w->desired_matrix);
if (!try_window (window, startp, 0))
@@ -14144,8 +14178,8 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
if ((scroll_conservatively
|| emacs_scroll_step
|| temp_scroll_step
- || NUMBERP (current_buffer->scroll_up_aggressively)
- || NUMBERP (current_buffer->scroll_down_aggressively))
+ || NUMBERP (BVAR (current_buffer, scroll_up_aggressively))
+ || NUMBERP (BVAR (current_buffer, scroll_down_aggressively)))
&& !current_buffer->clip_changed
&& CHARPOS (startp) >= BEGV
&& CHARPOS (startp) <= ZV)
@@ -14588,7 +14622,7 @@ try_window_reusing_current_matrix (struct window *w)
/* Can't do this if region may have changed. */
if ((!NILP (Vtransient_mark_mode)
- && !NILP (current_buffer->mark_active))
+ && !NILP (BVAR (current_buffer, mark_active)))
|| !NILP (w->region_showing)
|| !NILP (Vshow_trailing_whitespace))
return 0;
@@ -14931,7 +14965,7 @@ try_window_reusing_current_matrix (struct window *w)
/* Can't use this optimization with bidi-reordered glyph
rows, unless cursor is already at point. */
- if (!NILP (XBUFFER (w->buffer)->bidi_display_reordering))
+ if (!NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering)))
{
if (!(w->cursor.hpos >= 0
&& w->cursor.hpos < row->used[TEXT_AREA]
@@ -15245,7 +15279,7 @@ row_containing_pos (struct window *w, EMACS_INT charpos,
{
struct glyph *g;
- if (NILP (XBUFFER (w->buffer)->bidi_display_reordering)
+ if (NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering))
|| (!best_row && !row->continued_p))
return row;
/* In bidi-reordered rows, there could be several rows
@@ -15392,7 +15426,7 @@ try_window_id (struct window *w)
/* Can't use this if highlighting a region because a cursor movement
will do more than just set the cursor. */
if (!NILP (Vtransient_mark_mode)
- && !NILP (current_buffer->mark_active))
+ && !NILP (BVAR (current_buffer, mark_active)))
GIVE_UP (9);
/* Likewise if highlighting trailing whitespace. */
@@ -15412,7 +15446,7 @@ try_window_id (struct window *w)
wrapped line can change the wrap position, altering the line
above it. It might be worthwhile to handle this more
intelligently, but for now just redisplay from scratch. */
- if (!NILP (XBUFFER (w->buffer)->word_wrap))
+ if (!NILP (BVAR (XBUFFER (w->buffer), word_wrap)))
GIVE_UP (21);
/* Under bidi reordering, adding or deleting a character in the
@@ -15423,8 +15457,8 @@ try_window_id (struct window *w)
to find the paragraph limits and widen the range of redisplayed
lines to that, but for now just give up this optimization and
redisplay from scratch. */
- if (!NILP (XBUFFER (w->buffer)->bidi_display_reordering)
- && NILP (XBUFFER (w->buffer)->bidi_paragraph_direction))
+ if (!NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering))
+ && NILP (BVAR (XBUFFER (w->buffer), bidi_paragraph_direction)))
GIVE_UP (22);
/* Make sure beg_unchanged and end_unchanged are up to date. Do it
@@ -16395,7 +16429,7 @@ get_overlay_arrow_glyph_row (struct window *w, Lisp_Object overlay_arrow_string)
it.glyph_row->used[TEXT_AREA] = 0;
SET_TEXT_POS (it.position, 0, 0);
- multibyte_p = !NILP (buffer->enable_multibyte_characters);
+ multibyte_p = !NILP (BVAR (buffer, enable_multibyte_characters));
p = arrow_string;
while (p < arrow_end)
{
@@ -17139,18 +17173,15 @@ find_row_edges (struct it *it, struct glyph_row *row,
if (min_pos <= ZV)
SET_TEXT_POS (row->minpos, min_pos, min_bpos);
else
- {
- /* We didn't find _any_ valid buffer positions in any of the
- glyphs, so we must trust the iterator's computed
- positions. */
+ /* We didn't find _any_ valid buffer positions in any of the
+ glyphs, so we must trust the iterator's computed positions. */
row->minpos = row->start.pos;
+ if (max_pos <= 0)
+ {
max_pos = CHARPOS (it->current.pos);
max_bpos = BYTEPOS (it->current.pos);
}
- if (!max_pos)
- abort ();
-
/* Here are the various use-cases for ending the row, and the
corresponding values for ROW->maxpos:
@@ -17263,8 +17294,18 @@ display_line (struct it *it)
if the first glyph is partially visible or if we hit a line end. */
if (it->current_x < it->first_visible_x)
{
+ this_line_min_pos = row->start.pos;
move_it_in_display_line_to (it, ZV, it->first_visible_x,
MOVE_TO_POS | MOVE_TO_X);
+ /* Record the smallest positions seen while we moved over
+ display elements that are not visible. This is needed by
+ redisplay_internal for optimizing the case where the cursor
+ stays inside the same line. The rest of this function only
+ considers positions that are actually displayed, so
+ RECORD_MAX_MIN_POS will not otherwise record positions that
+ are hscrolled to the left of the left edge of the window. */
+ min_pos = CHARPOS (this_line_min_pos);
+ min_bpos = BYTEPOS (this_line_min_pos);
}
else
{
@@ -17323,7 +17364,7 @@ display_line (struct it *it)
row->glyphs[TEXT_AREA]->charpos = -1;
row->displays_text_p = 0;
- if (!NILP (XBUFFER (it->w->buffer)->indicate_empty_lines)
+ if (!NILP (BVAR (XBUFFER (it->w->buffer), indicate_empty_lines))
&& (!MINI_WINDOW_P (it->w)
|| (minibuf_level && EQ (it->window, minibuf_window))))
row->indicate_empty_line_p = 1;
@@ -17901,10 +17942,10 @@ See also `bidi-paragraph-direction'. */)
old = current_buffer;
}
- if (NILP (buf->bidi_display_reordering))
+ if (NILP (BVAR (buf, bidi_display_reordering)))
return Qleft_to_right;
- else if (!NILP (buf->bidi_paragraph_direction))
- return buf->bidi_paragraph_direction;
+ else if (!NILP (BVAR (buf, bidi_paragraph_direction)))
+ return BVAR (buf, bidi_paragraph_direction);
else
{
/* Determine the direction from buffer text. We could try to
@@ -18163,14 +18204,14 @@ display_mode_lines (struct window *w)
/* Select mode line face based on the real selected window. */
display_mode_line (w, CURRENT_MODE_LINE_FACE_ID_3 (sel_w, sel_w, w),
- current_buffer->mode_line_format);
+ BVAR (current_buffer, mode_line_format));
++n;
}
if (WINDOW_WANTS_HEADER_LINE_P (w))
{
display_mode_line (w, HEADER_LINE_FACE_ID,
- current_buffer->header_line_format);
+ BVAR (current_buffer, header_line_format));
++n;
}
@@ -19105,7 +19146,7 @@ static char *
decode_mode_spec_coding (Lisp_Object coding_system, register char *buf, int eol_flag)
{
Lisp_Object val;
- int multibyte = !NILP (current_buffer->enable_multibyte_characters);
+ int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
const unsigned char *eol_str;
int eol_str_len;
/* The EOL conversion we are using. */
@@ -19201,7 +19242,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
switch (c)
{
case '*':
- if (!NILP (b->read_only))
+ if (!NILP (BVAR (b, read_only)))
return "%";
if (BUF_MODIFF (b) > BUF_SAVE_MODIFF (b))
return "*";
@@ -19211,7 +19252,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
/* This differs from %* only for a modified read-only buffer. */
if (BUF_MODIFF (b) > BUF_SAVE_MODIFF (b))
return "*";
- if (!NILP (b->read_only))
+ if (!NILP (BVAR (b, read_only)))
return "%";
return "-";
@@ -19273,7 +19314,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
}
case 'b':
- obj = b->name;
+ obj = BVAR (b, name);
break;
case 'c':
@@ -19313,7 +19354,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
return "Emacs";
case 'f':
- obj = b->filename;
+ obj = BVAR (b, filename);
break;
case 'i':
@@ -19449,7 +19490,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
break;
case 'm':
- obj = b->mode_name;
+ obj = BVAR (b, mode_name);
break;
case 'n':
@@ -19534,7 +19575,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
{
int count = inhibit_garbage_collection ();
Lisp_Object val = call1 (intern ("file-remote-p"),
- current_buffer->directory);
+ BVAR (current_buffer, directory));
unbind_to (count, Qnil);
if (NILP (val))
@@ -19544,11 +19585,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
}
case 't': /* indicate TEXT or BINARY */
-#ifdef MODE_LINE_BINARY_TEXT
- return MODE_LINE_BINARY_TEXT (b);
-#else
return "T";
-#endif
case 'z':
/* coding-system (not including end-of-line format) */
@@ -19569,7 +19606,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
(FRAME_TERMINAL_CODING (f)->id),
p, 0);
}
- p = decode_mode_spec_coding (b->buffer_file_coding_system,
+ p = decode_mode_spec_coding (BVAR (b, buffer_file_coding_system),
p, eol_flag);
#if 0 /* This proves to be annoying; I think we can do without. -- rms. */
@@ -19619,8 +19656,8 @@ display_count_lines (EMACS_INT start, EMACS_INT start_byte,
/* If we are not in selective display mode,
check only for newlines. */
- int selective_display = (!NILP (current_buffer->selective_display)
- && !INTEGERP (current_buffer->selective_display));
+ int selective_display = (!NILP (BVAR (current_buffer, selective_display))
+ && !INTEGERP (BVAR (current_buffer, selective_display)));
if (count > 0)
{
@@ -23267,13 +23304,13 @@ get_window_cursor_type (struct window *w, struct glyph *glyph, int *width,
{
if (w == XWINDOW (echo_area_window))
{
- if (EQ (b->cursor_type, Qt) || NILP (b->cursor_type))
+ if (EQ (BVAR (b, cursor_type), Qt) || NILP (BVAR (b, cursor_type)))
{
*width = FRAME_CURSOR_WIDTH (f);
return FRAME_DESIRED_CURSOR (f);
}
else
- return get_specified_cursor_type (b->cursor_type, width);
+ return get_specified_cursor_type (BVAR (b, cursor_type), width);
}
*active_cursor = 0;
@@ -23293,23 +23330,23 @@ get_window_cursor_type (struct window *w, struct glyph *glyph, int *width,
}
/* Never display a cursor in a window in which cursor-type is nil. */
- if (NILP (b->cursor_type))
+ if (NILP (BVAR (b, cursor_type)))
return NO_CURSOR;
/* Get the normal cursor type for this window. */
- if (EQ (b->cursor_type, Qt))
+ if (EQ (BVAR (b, cursor_type), Qt))
{
cursor_type = FRAME_DESIRED_CURSOR (f);
*width = FRAME_CURSOR_WIDTH (f);
}
else
- cursor_type = get_specified_cursor_type (b->cursor_type, width);
+ cursor_type = get_specified_cursor_type (BVAR (b, cursor_type), width);
/* Use cursor-in-non-selected-windows instead
for non-selected window or frame. */
if (non_selected)
{
- alt_cursor = b->cursor_in_non_selected_windows;
+ alt_cursor = BVAR (b, cursor_in_non_selected_windows);
if (!EQ (Qt, alt_cursor))
return get_specified_cursor_type (alt_cursor, width);
/* t means modify the normal cursor type. */
@@ -23356,7 +23393,7 @@ get_window_cursor_type (struct window *w, struct glyph *glyph, int *width,
/* Cursor is blinked off, so determine how to "toggle" it. */
/* First look for an entry matching the buffer's cursor-type in blink-cursor-alist. */
- if ((alt_cursor = Fassoc (b->cursor_type, Vblink_cursor_alist), !NILP (alt_cursor)))
+ if ((alt_cursor = Fassoc (BVAR (b, cursor_type), Vblink_cursor_alist), !NILP (alt_cursor)))
return get_specified_cursor_type (XCDR (alt_cursor), width);
/* Then see if frame has specified a specific blink off cursor type. */
@@ -25472,11 +25509,11 @@ note_mouse_highlight (struct frame *f, int x, int y)
necessarily display the character whose position
is the smallest. */
Lisp_Object lim1 =
- NILP (XBUFFER (buffer)->bidi_display_reordering)
+ NILP (BVAR (XBUFFER (buffer), bidi_display_reordering))
? Fmarker_position (w->start)
: Qnil;
Lisp_Object lim2 =
- NILP (XBUFFER (buffer)->bidi_display_reordering)
+ NILP (BVAR (XBUFFER (buffer), bidi_display_reordering))
? make_number (BUF_Z (XBUFFER (buffer))
- XFASTINT (w->window_end_pos))
: Qnil;
diff --git a/src/xfaces.c b/src/xfaces.c
index 82ad0b9aeb..4cc47c8505 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -5970,7 +5970,7 @@ compute_char_face (struct frame *f, int ch, Lisp_Object prop)
{
int face_id;
- if (NILP (current_buffer->enable_multibyte_characters))
+ if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
ch = 0;
if (NILP (prop))
diff --git a/src/xfns.c b/src/xfns.c
index ce2d91e0df..deb0e192a5 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -3473,9 +3473,9 @@ This function is an internal primitive--use `make-frame' instead. */)
/* Initialize `default-minibuffer-frame' in case this is the first
frame on this terminal. */
if (FRAME_HAS_MINIBUF_P (f)
- && (!FRAMEP (kb->Vdefault_minibuffer_frame)
- || !FRAME_LIVE_P (XFRAME (kb->Vdefault_minibuffer_frame))))
- kb->Vdefault_minibuffer_frame = frame;
+ && (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame))
+ || !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame)))))
+ KVAR (kb, Vdefault_minibuffer_frame) = frame;
/* All remaining specified parameters, which have not been "used"
by x_get_arg and friends, now go in the misc. alist of the frame. */
@@ -4610,7 +4610,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
Fset_window_buffer (FRAME_ROOT_WINDOW (f), buffer, Qnil);
old_buffer = current_buffer;
set_buffer_internal_1 (XBUFFER (buffer));
- current_buffer->truncate_lines = Qnil;
+ BVAR (current_buffer, truncate_lines) = Qnil;
specbind (Qinhibit_read_only, Qt);
specbind (Qinhibit_modification_hooks, Qt);
Ferase_buffer ();
@@ -5106,7 +5106,7 @@ Text larger than the specified size is clipped. */)
/* Display the tooltip text in a temporary buffer. */
old_buffer = current_buffer;
set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer));
- current_buffer->truncate_lines = Qnil;
+ BVAR (current_buffer, truncate_lines) = Qnil;
clear_glyph_matrix (w->desired_matrix);
clear_glyph_matrix (w->current_matrix);
SET_TEXT_POS (pos, BEGV, BEGV_BYTE);
diff --git a/src/xftfont.c b/src/xftfont.c
index 084ca73517..695527c423 100644
--- a/src/xftfont.c
+++ b/src/xftfont.c
@@ -187,17 +187,20 @@ xftfont_fix_match (FcPattern *pat, FcPattern *match)
double dpi;
FcPatternGetBool (pat, FC_ANTIALIAS, 0, &b);
- if (! b)
+ if (! b)
{
FcPatternDel (match, FC_ANTIALIAS);
FcPatternAddBool (match, FC_ANTIALIAS, FcFalse);
}
FcPatternGetBool (pat, FC_HINTING, 0, &b);
- if (! b)
+ if (! b)
{
FcPatternDel (match, FC_HINTING);
FcPatternAddBool (match, FC_HINTING, FcFalse);
}
+#ifndef FC_HINT_STYLE
+# define FC_HINT_STYLE "hintstyle"
+#endif
if (FcResultMatch == FcPatternGetInteger (pat, FC_HINT_STYLE, 0, &i))
{
FcPatternDel (match, FC_HINT_STYLE);
@@ -781,4 +784,3 @@ syms_of_xftfont (void)
register_font_driver (&xftfont_driver, NULL);
}
-
diff --git a/src/xmenu.c b/src/xmenu.c
index ad1a764eab..934db0f040 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -887,31 +887,26 @@ apply_systemfont_to_dialog (Widget w)
{
XrmDatabase db = XtDatabase (XtDisplay (w));
if (db)
- XrmPutStringResource (&db, "*dialog.faceName", fn);
+ XrmPutStringResource (&db, "*dialog.font", fn);
}
}
static void
-apply_systemfont_to_menu (Widget w)
+apply_systemfont_to_menu (struct frame *f, Widget w)
{
const char *fn = xsettings_get_system_normal_font ();
- int defflt;
- if (!fn) return;
-
- if (XtIsShell (w)) /* popup menu */
+ if (fn)
{
- Widget *childs = NULL;
-
- XtVaGetValues (w, XtNchildren, &childs, NULL);
- if (*childs) w = *childs;
+ XrmDatabase db = XtDatabase (XtDisplay (w));
+ if (db)
+ {
+ XrmPutStringResource (&db, "*menubar*font", fn);
+ XrmPutStringResource (&db, "*popup*font", fn);
+ }
}
-
- /* Only use system font if the default is used for the menu. */
- XtVaGetValues (w, XtNdefaultFace, &defflt, NULL);
- if (defflt)
- XtVaSetValues (w, XtNfaceName, fn, NULL);
}
+
#endif
/* Set the contents of the menubar widgets of frame F.
@@ -1210,7 +1205,11 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
char menuOverride[] = "Ctrl<KeyPress>g: MenuGadgetEscape()";
XtTranslations override = XtParseTranslationTable (menuOverride);
- menubar_widget = lw_create_widget ("menubar", "menubar", id, first_wv,
+#ifdef USE_LUCID
+ apply_systemfont_to_menu (f, f->output_data.x->column_widget);
+#endif
+ menubar_widget = lw_create_widget ("menubar", "menubar", id,
+ first_wv,
f->output_data.x->column_widget,
0,
popup_activate_callback,
@@ -1221,9 +1220,6 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
/* Make menu pop down on C-g. */
XtOverrideTranslations (menubar_widget, override);
-#ifdef USE_LUCID
- apply_systemfont_to_menu (menubar_widget);
-#endif
}
{
@@ -1542,6 +1538,10 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv,
if (! FRAME_X_P (f))
abort ();
+#ifdef USE_LUCID
+ apply_systemfont_to_menu (f, f->output_data.x->widget);
+#endif
+
menu_id = widget_id_tick++;
menu = lw_create_widget ("popup", first_wv->name, menu_id, first_wv,
f->output_data.x->widget, 1, 0,
@@ -1549,10 +1549,6 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv,
popup_deactivate_callback,
menu_highlight_callback);
-#ifdef USE_LUCID
- apply_systemfont_to_menu (menu);
-#endif
-
dummy.type = ButtonPress;
dummy.serial = 0;
dummy.send_event = 0;
diff --git a/src/xrdb.c b/src/xrdb.c
index 90afe32bb6..0171490075 100644
--- a/src/xrdb.c
+++ b/src/xrdb.c
@@ -546,12 +546,14 @@ x_load_resources (Display *display, const char *xrm_string,
#else /* not USE_MOTIF */
- sprintf (line, "Emacs.dialog*.font: %s", helv);
- XrmPutLineResource (&rdb, line);
sprintf (line, "Emacs.dialog*.background: grey75");
XrmPutLineResource (&rdb, line);
+#if !defined (HAVE_XFT) || !defined (USE_LUCID)
+ sprintf (line, "Emacs.dialog*.font: %s", helv);
+ XrmPutLineResource (&rdb, line);
sprintf (line, "*XlwMenu*font: %s", helv);
XrmPutLineResource (&rdb, line);
+#endif
sprintf (line, "*XlwMenu*background: grey75");
XrmPutLineResource (&rdb, line);
sprintf (line, "Emacs*verticalScrollBar.background: grey75");
diff --git a/src/xsettings.c b/src/xsettings.c
index e3d2c6e9ef..097b2477e0 100644
--- a/src/xsettings.c
+++ b/src/xsettings.c
@@ -75,7 +75,7 @@ enum {
SEEN_FONT = 0x40,
SEEN_TB_STYLE = 0x80,
};
-struct xsettings
+struct xsettings
{
#ifdef HAVE_XFT
FcBool aa, hinting;
@@ -104,7 +104,7 @@ something_changedCB (GConfClient *client,
gpointer user_data)
{
GConfValue *v = gconf_entry_get_value (entry);
-
+
if (!v) return;
if (v->type == GCONF_VALUE_STRING)
{
@@ -196,7 +196,7 @@ get_prop_window (struct x_display_info *dpyinfo)
4 CARD32 last-change-serial
and then the value, For string:
-
+
bytes type what
------------------------------------
4 CARD32 n = value-length
@@ -280,7 +280,7 @@ parse_settings (unsigned char *prop,
(strcmp (XSETTINGS_FONT_NAME, name) == 0)
|| (strcmp (XSETTINGS_TOOL_BAR_STYLE, name) == 0);
- switch (type)
+ switch (type)
{
case 0: /* Integer */
if (bytes_parsed+4 > bytes) return BadLength;
@@ -310,14 +310,14 @@ parse_settings (unsigned char *prop,
case 2: /* RGB value */
/* No need to parse this */
if (bytes_parsed+8 > bytes) return BadLength;
- bytes_parsed += 8; /* 4 values (r, b, g, alpha), 2 bytes each. */
+ bytes_parsed += 8; /* 4 values (r, b, g, alpha), 2 bytes each. */
break;
default: /* Parse Error */
return BadValue;
}
- if (want_this)
+ if (want_this)
{
++settings_seen;
if (strcmp (name, XSETTINGS_FONT_NAME) == 0)
@@ -341,6 +341,7 @@ parse_settings (unsigned char *prop,
settings->seen |= SEEN_HINTING;
settings->hinting = ival != 0;
}
+# ifdef FC_HINT_STYLE
else if (strcmp (name, "Xft/HintStyle") == 0)
{
settings->seen |= SEEN_HINTSTYLE;
@@ -355,6 +356,7 @@ parse_settings (unsigned char *prop,
else
settings->seen &= ~SEEN_HINTSTYLE;
}
+# endif
else if (strcmp (name, "Xft/RGBA") == 0)
{
settings->seen |= SEEN_RGBA;
@@ -442,7 +444,9 @@ apply_xft_settings (struct x_display_info *dpyinfo,
pat);
FcPatternGetBool (pat, FC_ANTIALIAS, 0, &oldsettings.aa);
FcPatternGetBool (pat, FC_HINTING, 0, &oldsettings.hinting);
+# ifdef FC_HINT_STYLE
FcPatternGetInteger (pat, FC_HINT_STYLE, 0, &oldsettings.hintstyle);
+# endif
FcPatternGetInteger (pat, FC_LCD_FILTER, 0, &oldsettings.lcdfilter);
FcPatternGetInteger (pat, FC_RGBA, 0, &oldsettings.rgba);
FcPatternGetDouble (pat, FC_DPI, 0, &oldsettings.dpi);
@@ -488,6 +492,7 @@ apply_xft_settings (struct x_display_info *dpyinfo,
if (strlen (buf) > 0) strcat (buf, ", ");
sprintf (buf+strlen (buf), "LCDFilter: %d", oldsettings.lcdfilter);
+# ifdef FC_HINT_STYLE
if ((settings->seen & SEEN_HINTSTYLE) != 0
&& oldsettings.hintstyle != settings->hintstyle)
{
@@ -496,6 +501,7 @@ apply_xft_settings (struct x_display_info *dpyinfo,
++changed;
oldsettings.hintstyle = settings->hintstyle;
}
+# endif
if (strlen (buf) > 0) strcat (buf, ", ");
sprintf (buf+strlen (buf), "Hintstyle: %d", oldsettings.hintstyle);
@@ -508,7 +514,7 @@ apply_xft_settings (struct x_display_info *dpyinfo,
FcPatternAddDouble (pat, FC_DPI, settings->dpi);
++changed;
oldsettings.dpi = settings->dpi;
-
+
/* Change the DPI on this display and all frames on the display. */
dpyinfo->resy = dpyinfo->resx = settings->dpi;
FOR_EACH_FRAME (tail, frame)
@@ -565,7 +571,7 @@ read_and_apply_settings (struct x_display_info *dpyinfo, int send_event_p)
if (settings.seen & SEEN_FONT)
{
- if (!current_font || strcmp (current_font, settings.font) != 0)
+ if (!current_font || strcmp (current_font, settings.font) != 0)
{
free (current_font);
current_font = settings.font;
@@ -774,4 +780,3 @@ If this variable is nil, Emacs ignores system font changes. */);
Fprovide (intern_c_string ("dynamic-setting"), Qnil);
}
-
diff --git a/src/xterm.c b/src/xterm.c
index 31f002fa05..909b6978f5 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -488,17 +488,16 @@ x_set_frame_alpha (struct frame *f)
if (rc == Success && actual != None)
{
+ unsigned long value = *(unsigned long *)data;
XFree ((void *) data);
- if (*(unsigned long *)data == opac)
+ if (value == opac)
{
x_uncatch_errors ();
return;
}
}
- x_uncatch_errors ();
}
- x_catch_errors (dpy);
XChangeProperty (dpy, win, dpyinfo->Xatom_net_wm_window_opacity,
XA_CARDINAL, 32, PropModeReplace,
(unsigned char *) &opac, 1L);
@@ -7728,7 +7727,7 @@ x_connection_closed (Display *dpy, const char *error_message)
{
/* Set this to t so that delete_frame won't get confused
trying to find a replacement. */
- FRAME_KBOARD (XFRAME (frame))->Vdefault_minibuffer_frame = Qt;
+ KVAR (FRAME_KBOARD (XFRAME (frame)), Vdefault_minibuffer_frame) = Qt;
delete_frame (frame, Qnoelisp);
}
@@ -9967,7 +9966,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
{
terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
init_kboard (terminal->kboard);
- terminal->kboard->Vwindow_system = Qx;
+ KVAR (terminal->kboard, Vwindow_system) = Qx;
/* Add the keyboard to the list before running Lisp code (via
Qvendor_specific_keysyms below), since these are not traced
@@ -9989,7 +9988,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
/* Temporarily hide the partially initialized terminal. */
terminal_list = terminal->next_terminal;
UNBLOCK_INPUT;
- terminal->kboard->Vsystem_key_alist
+ KVAR (terminal->kboard, Vsystem_key_alist)
= call1 (Qvendor_specific_keysyms,
vendor ? build_string (vendor) : empty_unibyte_string);
BLOCK_INPUT;