Now on revision 109673. ------------------------------------------------------------ revno: 109673 fixes bug: http://debbugs.gnu.org/12215 committer: Paul Eggert branch nick: trunk timestamp: Fri 2012-08-17 23:06:39 -0700 message: * buffer.h (BSET): Remove. Replace all uses with calls to new setter functions. (bset_bidi_paragraph_direction, bset_case_canon_table) (bset_case_eqv_table, bset_directory, bset_display_count) (bset_display_time, bset_downcase_table) (bset_enable_multibyte_characters, bset_filename, bset_keymap) (bset_last_selected_window, bset_local_var_alist) (bset_mark_active, bset_point_before_scroll, bset_read_only) (bset_truncate_lines, bset_undo_list, bset_upcase_table) (bset_width_table): * buffer.c (bset_abbrev_mode, bset_abbrev_table) (bset_auto_fill_function, bset_auto_save_file_format) (bset_auto_save_file_name, bset_backed_up, bset_begv_marker) (bset_bidi_display_reordering, bset_buffer_file_coding_system) (bset_cache_long_line_scans, bset_case_fold_search) (bset_ctl_arrow, bset_cursor_in_non_selected_windows) (bset_cursor_type, bset_display_table, bset_extra_line_spacing) (bset_file_format, bset_file_truename, bset_fringe_cursor_alist) (bset_fringe_indicator_alist, bset_fringes_outside_margins) (bset_header_line_format, bset_indicate_buffer_boundaries) (bset_indicate_empty_lines, bset_invisibility_spec) (bset_left_fringe_width, bset_major_mode, bset_mark) (bset_minor_modes, bset_mode_line_format, bset_mode_name) (bset_name, bset_overwrite_mode, bset_pt_marker) (bset_right_fringe_width, bset_save_length) (bset_scroll_bar_width, bset_scroll_down_aggressively) (bset_scroll_up_aggressively, bset_selective_display) (bset_selective_display_ellipses, bset_vertical_scroll_bar_type) (bset_word_wrap, bset_zv_marker): * category.c (bset_category_table): * syntax.c (bset_syntax_table): New setter functions. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-08-18 02:49:24 +0000 +++ src/ChangeLog 2012-08-18 06:06:39 +0000 @@ -1,5 +1,38 @@ 2012-08-18 Paul Eggert + * buffer.h (BSET): Remove (Bug#12215). + Replace all uses with calls to new setter functions. + (bset_bidi_paragraph_direction, bset_case_canon_table) + (bset_case_eqv_table, bset_directory, bset_display_count) + (bset_display_time, bset_downcase_table) + (bset_enable_multibyte_characters, bset_filename, bset_keymap) + (bset_last_selected_window, bset_local_var_alist) + (bset_mark_active, bset_point_before_scroll, bset_read_only) + (bset_truncate_lines, bset_undo_list, bset_upcase_table) + (bset_width_table): + * buffer.c (bset_abbrev_mode, bset_abbrev_table) + (bset_auto_fill_function, bset_auto_save_file_format) + (bset_auto_save_file_name, bset_backed_up, bset_begv_marker) + (bset_bidi_display_reordering, bset_buffer_file_coding_system) + (bset_cache_long_line_scans, bset_case_fold_search) + (bset_ctl_arrow, bset_cursor_in_non_selected_windows) + (bset_cursor_type, bset_display_table, bset_extra_line_spacing) + (bset_file_format, bset_file_truename, bset_fringe_cursor_alist) + (bset_fringe_indicator_alist, bset_fringes_outside_margins) + (bset_header_line_format, bset_indicate_buffer_boundaries) + (bset_indicate_empty_lines, bset_invisibility_spec) + (bset_left_fringe_width, bset_major_mode, bset_mark) + (bset_minor_modes, bset_mode_line_format, bset_mode_name) + (bset_name, bset_overwrite_mode, bset_pt_marker) + (bset_right_fringe_width, bset_save_length) + (bset_scroll_bar_width, bset_scroll_down_aggressively) + (bset_scroll_up_aggressively, bset_selective_display) + (bset_selective_display_ellipses, bset_vertical_scroll_bar_type) + (bset_word_wrap, bset_zv_marker): + * category.c (bset_category_table): + * syntax.c (bset_syntax_table): + New setter functions. + * process.h (PSET): Remove (Bug#12215). Replace all uses with calls to new setter functions. Use INLINE_HEADER_BEGIN, INLINE_HEADER_END. === modified file 'src/buffer.c' --- src/buffer.c 2012-08-17 21:52:15 +0000 +++ src/buffer.c 2012-08-18 06:06:39 +0000 @@ -157,6 +157,228 @@ static void modify_overlay (struct buffer *, ptrdiff_t, ptrdiff_t); static Lisp_Object buffer_lisp_local_variables (struct buffer *, int); +/* These setters are used only in this file, so they can be private. */ +static inline void +bset_abbrev_mode (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (abbrev_mode) = val; +} +static inline void +bset_abbrev_table (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (abbrev_table) = val; +} +static inline void +bset_auto_fill_function (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (auto_fill_function) = val; +} +static inline void +bset_auto_save_file_format (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (auto_save_file_format) = val; +} +static inline void +bset_auto_save_file_name (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (auto_save_file_name) = val; +} +static inline void +bset_backed_up (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (backed_up) = val; +} +static inline void +bset_begv_marker (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (begv_marker) = val; +} +static inline void +bset_bidi_display_reordering (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (bidi_display_reordering) = val; +} +static inline void +bset_buffer_file_coding_system (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (buffer_file_coding_system) = val; +} +static inline void +bset_cache_long_line_scans (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (cache_long_line_scans) = val; +} +static inline void +bset_case_fold_search (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (case_fold_search) = val; +} +static inline void +bset_ctl_arrow (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (ctl_arrow) = val; +} +static inline void +bset_cursor_in_non_selected_windows (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (cursor_in_non_selected_windows) = val; +} +static inline void +bset_cursor_type (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (cursor_type) = val; +} +static inline void +bset_display_table (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (display_table) = val; +} +static inline void +bset_extra_line_spacing (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (extra_line_spacing) = val; +} +static inline void +bset_file_format (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (file_format) = val; +} +static inline void +bset_file_truename (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (file_truename) = val; +} +static inline void +bset_fringe_cursor_alist (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (fringe_cursor_alist) = val; +} +static inline void +bset_fringe_indicator_alist (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (fringe_indicator_alist) = val; +} +static inline void +bset_fringes_outside_margins (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (fringes_outside_margins) = val; +} +static inline void +bset_header_line_format (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (header_line_format) = val; +} +static inline void +bset_indicate_buffer_boundaries (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (indicate_buffer_boundaries) = val; +} +static inline void +bset_indicate_empty_lines (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (indicate_empty_lines) = val; +} +static inline void +bset_invisibility_spec (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (invisibility_spec) = val; +} +static inline void +bset_left_fringe_width (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (left_fringe_width) = val; +} +static inline void +bset_major_mode (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (major_mode) = val; +} +static inline void +bset_mark (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (mark) = val; +} +static inline void +bset_minor_modes (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (minor_modes) = val; +} +static inline void +bset_mode_line_format (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (mode_line_format) = val; +} +static inline void +bset_mode_name (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (mode_name) = val; +} +static inline void +bset_name (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (name) = val; +} +static inline void +bset_overwrite_mode (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (overwrite_mode) = val; +} +static inline void +bset_pt_marker (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (pt_marker) = val; +} +static inline void +bset_right_fringe_width (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (right_fringe_width) = val; +} +static inline void +bset_save_length (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (save_length) = val; +} +static inline void +bset_scroll_bar_width (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (scroll_bar_width) = val; +} +static inline void +bset_scroll_down_aggressively (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (scroll_down_aggressively) = val; +} +static inline void +bset_scroll_up_aggressively (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (scroll_up_aggressively) = val; +} +static inline void +bset_selective_display (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (selective_display) = val; +} +static inline void +bset_selective_display_ellipses (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (selective_display_ellipses) = val; +} +static inline void +bset_vertical_scroll_bar_type (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (vertical_scroll_bar_type) = val; +} +static inline void +bset_word_wrap (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (word_wrap) = val; +} +static inline void +bset_zv_marker (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (zv_marker) = val; +} + /* For debugging; temporary. See set_buffer_internal. */ /* Lisp_Object Qlisp_mode, Vcheck_symbol; */ @@ -370,7 +592,7 @@ b->newline_cache = 0; b->width_run_cache = 0; - BSET (b, width_table, Qnil); + bset_width_table (b, Qnil); b->prevent_redisplay_optimizations_p = 1; /* Put this on the chain of all buffers including killed ones. */ @@ -379,20 +601,20 @@ /* An ordinary buffer normally doesn't need markers to handle BEGV and ZV. */ - BSET (b, pt_marker, Qnil); - BSET (b, begv_marker, Qnil); - BSET (b, zv_marker, Qnil); + bset_pt_marker (b, Qnil); + bset_begv_marker (b, Qnil); + bset_zv_marker (b, Qnil); name = Fcopy_sequence (buffer_or_name); set_string_intervals (name, NULL); - BSET (b, name, name); + bset_name (b, name); - BSET (b, undo_list, (SREF (name, 0) != ' ') ? Qnil : Qt); + bset_undo_list (b, SREF (name, 0) != ' ' ? Qnil : Qt); reset_buffer (b); reset_buffer_local_variables (b, 1); - BSET (b, mark, Fmake_marker ()); + bset_mark (b, Fmake_marker ()); BUF_MARKERS (b) = NULL; /* Put this in the alist of all live buffers. */ @@ -492,7 +714,7 @@ /* Get (a copy of) the alist of Lisp-level local variables of FROM and install that in TO. */ - BSET (to, local_var_alist, buffer_lisp_local_variables (from, 1)); + bset_local_var_alist (to, buffer_lisp_local_variables (from, 1)); } @@ -595,7 +817,7 @@ b->newline_cache = 0; b->width_run_cache = 0; - BSET (b, width_table, Qnil); + bset_width_table (b, Qnil); /* Put this on the chain of all buffers including killed ones. */ b->header.next.buffer = all_buffers; @@ -603,7 +825,7 @@ name = Fcopy_sequence (name); set_string_intervals (name, NULL); - BSET (b, name, name); + bset_name (b, name); reset_buffer (b); reset_buffer_local_variables (b, 1); @@ -612,10 +834,11 @@ XSETBUFFER (buf, b); Vbuffer_alist = nconc2 (Vbuffer_alist, Fcons (Fcons (name, buf), Qnil)); - BSET (b, mark, Fmake_marker ()); + bset_mark (b, Fmake_marker ()); /* The multibyte status belongs to the base buffer. */ - BSET (b, enable_multibyte_characters, BVAR (b->base_buffer, enable_multibyte_characters)); + bset_enable_multibyte_characters + (b, BVAR (b->base_buffer, enable_multibyte_characters)); /* Make sure the base buffer has markers for its narrowing. */ if (NILP (BVAR (b->base_buffer, pt_marker))) @@ -623,14 +846,17 @@ eassert (NILP (BVAR (b->base_buffer, begv_marker))); eassert (NILP (BVAR (b->base_buffer, zv_marker))); - BSET (b->base_buffer, pt_marker, - build_marker (b->base_buffer, b->base_buffer->pt, b->base_buffer->pt_byte)); - - BSET (b->base_buffer, begv_marker, - build_marker (b->base_buffer, b->base_buffer->begv, b->base_buffer->begv_byte)); - - BSET (b->base_buffer, zv_marker, - build_marker (b->base_buffer, b->base_buffer->zv, b->base_buffer->zv_byte)); + bset_pt_marker (b->base_buffer, + build_marker (b->base_buffer, b->base_buffer->pt, + b->base_buffer->pt_byte)); + + bset_begv_marker (b->base_buffer, + build_marker (b->base_buffer, b->base_buffer->begv, + b->base_buffer->begv_byte)); + + bset_zv_marker (b->base_buffer, + build_marker (b->base_buffer, b->base_buffer->zv, + b->base_buffer->zv_byte)); XMARKER (BVAR (b->base_buffer, zv_marker))->insertion_type = 1; } @@ -638,9 +864,9 @@ if (NILP (clone)) { /* Give the indirect buffer markers for its narrowing. */ - BSET (b, pt_marker, build_marker (b, b->pt, b->pt_byte)); - BSET (b, begv_marker, build_marker (b, b->begv, b->begv_byte)); - BSET (b, zv_marker, build_marker (b, b->zv, b->zv_byte)); + bset_pt_marker (b, build_marker (b, b->pt, b->pt_byte)); + bset_begv_marker (b, build_marker (b, b->begv, b->begv_byte)); + bset_zv_marker (b, build_marker (b, b->zv, b->zv_byte)); XMARKER (BVAR (b, zv_marker))->insertion_type = 1; } else @@ -648,11 +874,11 @@ struct buffer *old_b = current_buffer; clone_per_buffer_values (b->base_buffer, b); - BSET (b, filename, Qnil); - BSET (b, file_truename, Qnil); - BSET (b, display_count, make_number (0)); - BSET (b, backed_up, Qnil); - BSET (b, auto_save_file_name, Qnil); + bset_filename (b, Qnil); + bset_file_truename (b, Qnil); + bset_display_count (b, make_number (0)); + bset_backed_up (b, Qnil); + bset_auto_save_file_name (b, Qnil); set_buffer_internal_1 (b); Fset (intern ("buffer-save-without-query"), Qnil); Fset (intern ("buffer-file-number"), Qnil); @@ -715,10 +941,9 @@ void reset_buffer (register struct buffer *b) { - BSET (b, filename, Qnil); - BSET (b, file_truename, Qnil); - BSET (b, directory, - (current_buffer) ? BVAR (current_buffer, directory) : Qnil); + bset_filename (b, Qnil); + bset_file_truename (b, Qnil); + bset_directory (b, current_buffer ? BVAR (current_buffer, directory) : Qnil); b->modtime = make_emacs_time (0, UNKNOWN_MODTIME_NSECS); b->modtime_size = -1; XSETFASTINT (BVAR (b, save_length), 0); @@ -726,25 +951,25 @@ /* It is more conservative to start out "changed" than "unchanged". */ b->clip_changed = 0; b->prevent_redisplay_optimizations_p = 1; - BSET (b, backed_up, Qnil); + bset_backed_up (b, Qnil); BUF_AUTOSAVE_MODIFF (b) = 0; b->auto_save_failure_time = 0; - BSET (b, auto_save_file_name, Qnil); - BSET (b, read_only, Qnil); + bset_auto_save_file_name (b, Qnil); + bset_read_only (b, Qnil); set_buffer_overlays_before (b, NULL); set_buffer_overlays_after (b, NULL); b->overlay_center = BEG; - BSET (b, mark_active, Qnil); - BSET (b, point_before_scroll, Qnil); - BSET (b, file_format, Qnil); - BSET (b, auto_save_file_format, Qt); - BSET (b, last_selected_window, Qnil); - BSET (b, display_count, make_number (0)); - BSET (b, display_time, Qnil); - BSET (b, enable_multibyte_characters, - BVAR (&buffer_defaults, enable_multibyte_characters)); - BSET (b, cursor_type, BVAR (&buffer_defaults, cursor_type)); - BSET (b, extra_line_spacing, BVAR (&buffer_defaults, extra_line_spacing)); + bset_mark_active (b, Qnil); + bset_point_before_scroll (b, Qnil); + bset_file_format (b, Qnil); + bset_auto_save_file_format (b, Qt); + bset_last_selected_window (b, Qnil); + bset_display_count (b, make_number (0)); + bset_display_time (b, Qnil); + bset_enable_multibyte_characters + (b, BVAR (&buffer_defaults, enable_multibyte_characters)); + bset_cursor_type (b, BVAR (&buffer_defaults, cursor_type)); + bset_extra_line_spacing (b, BVAR (&buffer_defaults, extra_line_spacing)); b->display_error_modiff = 0; } @@ -768,10 +993,10 @@ things that depend on the major mode. default-major-mode is handled at a higher level. We ignore it here. */ - BSET (b, major_mode, Qfundamental_mode); - BSET (b, keymap, Qnil); - BSET (b, mode_name, QSFundamental); - BSET (b, minor_modes, Qnil); + bset_major_mode (b, Qfundamental_mode); + bset_keymap (b, Qnil); + bset_mode_name (b, QSFundamental); + bset_minor_modes (b, Qnil); /* If the standard case table has been altered and invalidated, fix up its insides first. */ @@ -780,15 +1005,15 @@ && CHAR_TABLE_P (XCHAR_TABLE (Vascii_downcase_table)->extras[2]))) Fset_standard_case_table (Vascii_downcase_table); - BSET (b, downcase_table, Vascii_downcase_table); - BSET (b, upcase_table, XCHAR_TABLE (Vascii_downcase_table)->extras[0]); - BSET (b, case_canon_table, XCHAR_TABLE (Vascii_downcase_table)->extras[1]); - BSET (b, case_eqv_table, XCHAR_TABLE (Vascii_downcase_table)->extras[2]); - BSET (b, invisibility_spec, Qt); + bset_downcase_table (b, Vascii_downcase_table); + bset_upcase_table (b, XCHAR_TABLE (Vascii_downcase_table)->extras[0]); + bset_case_canon_table (b, XCHAR_TABLE (Vascii_downcase_table)->extras[1]); + bset_case_eqv_table (b, XCHAR_TABLE (Vascii_downcase_table)->extras[2]); + bset_invisibility_spec (b, Qt); /* Reset all (or most) per-buffer variables to their defaults. */ if (permanent_too) - BSET (b, local_var_alist, Qnil); + bset_local_var_alist (b, Qnil); else { Lisp_Object tmp, prop, last = Qnil; @@ -822,7 +1047,7 @@ } /* Delete this local variable. */ else if (NILP (last)) - BSET (b, local_var_alist, XCDR (tmp)); + bset_local_var_alist (b, XCDR (tmp)); else XSETCDR (last, XCDR (tmp)); } @@ -1299,7 +1524,7 @@ error ("Buffer name `%s' is in use", SDATA (newname)); } - BSET (current_buffer, name, newname); + bset_name (current_buffer, newname); /* Catch redisplay's attention. Unless we do this, the mode lines for any windows displaying current_buffer will stay unchanged. */ @@ -1444,7 +1669,7 @@ } if (EQ (BVAR (XBUFFER (real_buffer), undo_list), Qt)) - BSET (XBUFFER (real_buffer), undo_list, Qnil); + bset_undo_list (XBUFFER (real_buffer), Qnil); return Qnil; } @@ -1716,7 +1941,7 @@ swap_out_buffer_local_variables (b); reset_buffer_local_variables (b, 1); - BSET (b, name, Qnil); + bset_name (b, Qnil); BLOCK_INPUT; if (b->base_buffer) @@ -1740,9 +1965,9 @@ free_region_cache (b->width_run_cache); b->width_run_cache = 0; } - BSET (b, width_table, Qnil); + bset_width_table (b, Qnil); UNBLOCK_INPUT; - BSET (b, undo_list, Qnil); + bset_undo_list (b, Qnil); /* Run buffer-list-update-hook. */ if (!NILP (Vrun_hooks)) @@ -1923,7 +2148,7 @@ /* 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) - BSET (old_buf->base_buffer, undo_list, BVAR (old_buf, undo_list)); + bset_undo_list (old_buf->base_buffer, 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. */ @@ -1933,7 +2158,7 @@ /* 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) - BSET (b, undo_list, BVAR (b->base_buffer, undo_list)); + bset_undo_list (b, 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. */ @@ -2131,8 +2356,8 @@ #define swapfield_(field, type) \ do { \ type tmp##field = BVAR (other_buffer, field); \ - BSET (other_buffer, field, BVAR (current_buffer, field)); \ - BSET (current_buffer, field, tmp##field); \ + bset_##field (other_buffer, BVAR (current_buffer, field)); \ + bset_##field (current_buffer, tmp##field); \ } while (0) swapfield (own_text, struct buffer_text); @@ -2172,8 +2397,8 @@ swapfield_ (pt_marker, Lisp_Object); swapfield_ (begv_marker, Lisp_Object); swapfield_ (zv_marker, Lisp_Object); - BSET (current_buffer, point_before_scroll, Qnil); - BSET (other_buffer, point_before_scroll, Qnil); + bset_point_before_scroll (current_buffer, Qnil); + bset_point_before_scroll (other_buffer, Qnil); current_buffer->text->modiff++; other_buffer->text->modiff++; current_buffer->text->chars_modiff++; other_buffer->text->chars_modiff++; @@ -2262,7 +2487,7 @@ /* Don't record these buffer changes. We will put a special undo entry instead. */ - BSET (current_buffer, undo_list, Qt); + bset_undo_list (current_buffer, Qt); /* If the cached position is for this buffer, clear it out. */ clear_charpos_cache (current_buffer); @@ -2284,7 +2509,7 @@ to calculate the old correspondences. */ set_intervals_multibyte (0); - BSET (current_buffer, enable_multibyte_characters, Qnil); + bset_enable_multibyte_characters (current_buffer, Qnil); Z = Z_BYTE; BEGV = BEGV_BYTE; @@ -2422,7 +2647,7 @@ /* Do this first, so that chars_in_text asks the right question. set_intervals_multibyte needs it too. */ - BSET (current_buffer, enable_multibyte_characters, Qt); + bset_enable_multibyte_characters (current_buffer, Qt); GPT_BYTE = advance_to_char_boundary (GPT_BYTE); GPT = chars_in_text (BEG_ADDR, GPT_BYTE - BEG_BYTE) + BEG; @@ -2480,11 +2705,11 @@ if (!EQ (old_undo, Qt)) { /* Represent all the above changes by a special undo entry. */ - BSET (current_buffer, undo_list, - Fcons (list3 (Qapply, - intern ("set-buffer-multibyte"), - NILP (flag) ? Qt : Qnil), - old_undo)); + bset_undo_list (current_buffer, + Fcons (list3 (Qapply, + intern ("set-buffer-multibyte"), + NILP (flag) ? Qt : Qnil), + old_undo)); } UNGCPRO; @@ -4937,55 +5162,55 @@ /* Must do these before making the first buffer! */ /* real setup is done in bindings.el */ - BSET (&buffer_defaults, mode_line_format, build_pure_c_string ("%-")); - BSET (&buffer_defaults, header_line_format, Qnil); - BSET (&buffer_defaults, abbrev_mode, Qnil); - BSET (&buffer_defaults, overwrite_mode, Qnil); - BSET (&buffer_defaults, case_fold_search, Qt); - BSET (&buffer_defaults, auto_fill_function, Qnil); - BSET (&buffer_defaults, selective_display, Qnil); - BSET (&buffer_defaults, selective_display_ellipses, Qt); - BSET (&buffer_defaults, abbrev_table, Qnil); - BSET (&buffer_defaults, display_table, Qnil); - BSET (&buffer_defaults, undo_list, Qnil); - BSET (&buffer_defaults, mark_active, Qnil); - BSET (&buffer_defaults, file_format, Qnil); - BSET (&buffer_defaults, auto_save_file_format, Qt); + bset_mode_line_format (&buffer_defaults, build_pure_c_string ("%-")); + bset_header_line_format (&buffer_defaults, Qnil); + bset_abbrev_mode (&buffer_defaults, Qnil); + bset_overwrite_mode (&buffer_defaults, Qnil); + bset_case_fold_search (&buffer_defaults, Qt); + bset_auto_fill_function (&buffer_defaults, Qnil); + bset_selective_display (&buffer_defaults, Qnil); + bset_selective_display_ellipses (&buffer_defaults, Qt); + bset_abbrev_table (&buffer_defaults, Qnil); + bset_display_table (&buffer_defaults, Qnil); + bset_undo_list (&buffer_defaults, Qnil); + bset_mark_active (&buffer_defaults, Qnil); + bset_file_format (&buffer_defaults, Qnil); + bset_auto_save_file_format (&buffer_defaults, Qt); set_buffer_overlays_before (&buffer_defaults, NULL); set_buffer_overlays_after (&buffer_defaults, NULL); buffer_defaults.overlay_center = BEG; XSETFASTINT (BVAR (&buffer_defaults, tab_width), 8); - BSET (&buffer_defaults, truncate_lines, Qnil); - BSET (&buffer_defaults, word_wrap, Qnil); - BSET (&buffer_defaults, ctl_arrow, Qt); - BSET (&buffer_defaults, bidi_display_reordering, Qt); - BSET (&buffer_defaults, bidi_paragraph_direction, Qnil); - BSET (&buffer_defaults, cursor_type, Qt); - BSET (&buffer_defaults, extra_line_spacing, Qnil); - BSET (&buffer_defaults, cursor_in_non_selected_windows, Qt); + bset_truncate_lines (&buffer_defaults, Qnil); + bset_word_wrap (&buffer_defaults, Qnil); + bset_ctl_arrow (&buffer_defaults, Qt); + bset_bidi_display_reordering (&buffer_defaults, Qt); + bset_bidi_paragraph_direction (&buffer_defaults, Qnil); + bset_cursor_type (&buffer_defaults, Qt); + bset_extra_line_spacing (&buffer_defaults, Qnil); + bset_cursor_in_non_selected_windows (&buffer_defaults, Qt); - BSET (&buffer_defaults, enable_multibyte_characters, Qt); - BSET (&buffer_defaults, buffer_file_coding_system, Qnil); + bset_enable_multibyte_characters (&buffer_defaults, Qt); + bset_buffer_file_coding_system (&buffer_defaults, Qnil); XSETFASTINT (BVAR (&buffer_defaults, fill_column), 70); XSETFASTINT (BVAR (&buffer_defaults, left_margin), 0); - BSET (&buffer_defaults, cache_long_line_scans, Qnil); - BSET (&buffer_defaults, file_truename, Qnil); + bset_cache_long_line_scans (&buffer_defaults, Qnil); + bset_file_truename (&buffer_defaults, Qnil); XSETFASTINT (BVAR (&buffer_defaults, display_count), 0); XSETFASTINT (BVAR (&buffer_defaults, left_margin_cols), 0); XSETFASTINT (BVAR (&buffer_defaults, right_margin_cols), 0); - BSET (&buffer_defaults, left_fringe_width, Qnil); - BSET (&buffer_defaults, right_fringe_width, Qnil); - BSET (&buffer_defaults, fringes_outside_margins, Qnil); - BSET (&buffer_defaults, scroll_bar_width, Qnil); - BSET (&buffer_defaults, vertical_scroll_bar_type, Qt); - BSET (&buffer_defaults, indicate_empty_lines, Qnil); - BSET (&buffer_defaults, indicate_buffer_boundaries, Qnil); - BSET (&buffer_defaults, fringe_indicator_alist, Qnil); - BSET (&buffer_defaults, fringe_cursor_alist, Qnil); - BSET (&buffer_defaults, scroll_up_aggressively, Qnil); - BSET (&buffer_defaults, scroll_down_aggressively, Qnil); - BSET (&buffer_defaults, display_time, Qnil); + bset_left_fringe_width (&buffer_defaults, Qnil); + bset_right_fringe_width (&buffer_defaults, Qnil); + bset_fringes_outside_margins (&buffer_defaults, Qnil); + bset_scroll_bar_width (&buffer_defaults, Qnil); + bset_vertical_scroll_bar_type (&buffer_defaults, Qt); + bset_indicate_empty_lines (&buffer_defaults, Qnil); + bset_indicate_buffer_boundaries (&buffer_defaults, Qnil); + bset_fringe_indicator_alist (&buffer_defaults, Qnil); + bset_fringe_cursor_alist (&buffer_defaults, Qnil); + bset_scroll_up_aggressively (&buffer_defaults, Qnil); + bset_scroll_down_aggressively (&buffer_defaults, Qnil); + bset_display_time (&buffer_defaults, Qnil); /* Assign the local-flags to the slots that have default values. The local flag is a bit that is used in the buffer @@ -4997,24 +5222,24 @@ /* 0 means not a lisp var, -1 means always local, else mask */ memset (&buffer_local_flags, 0, sizeof buffer_local_flags); - BSET (&buffer_local_flags, filename, make_number (-1)); - BSET (&buffer_local_flags, directory, make_number (-1)); - BSET (&buffer_local_flags, backed_up, make_number (-1)); - BSET (&buffer_local_flags, save_length, make_number (-1)); - BSET (&buffer_local_flags, auto_save_file_name, make_number (-1)); - BSET (&buffer_local_flags, read_only, make_number (-1)); - BSET (&buffer_local_flags, major_mode, make_number (-1)); - BSET (&buffer_local_flags, mode_name, make_number (-1)); - BSET (&buffer_local_flags, undo_list, make_number (-1)); - BSET (&buffer_local_flags, mark_active, make_number (-1)); - BSET (&buffer_local_flags, point_before_scroll, make_number (-1)); - BSET (&buffer_local_flags, file_truename, make_number (-1)); - BSET (&buffer_local_flags, invisibility_spec, make_number (-1)); - BSET (&buffer_local_flags, file_format, make_number (-1)); - BSET (&buffer_local_flags, auto_save_file_format, make_number (-1)); - BSET (&buffer_local_flags, display_count, make_number (-1)); - BSET (&buffer_local_flags, display_time, make_number (-1)); - BSET (&buffer_local_flags, enable_multibyte_characters, make_number (-1)); + bset_filename (&buffer_local_flags, make_number (-1)); + bset_directory (&buffer_local_flags, make_number (-1)); + bset_backed_up (&buffer_local_flags, make_number (-1)); + bset_save_length (&buffer_local_flags, make_number (-1)); + bset_auto_save_file_name (&buffer_local_flags, make_number (-1)); + bset_read_only (&buffer_local_flags, make_number (-1)); + bset_major_mode (&buffer_local_flags, make_number (-1)); + bset_mode_name (&buffer_local_flags, make_number (-1)); + bset_undo_list (&buffer_local_flags, make_number (-1)); + bset_mark_active (&buffer_local_flags, make_number (-1)); + bset_point_before_scroll (&buffer_local_flags, make_number (-1)); + bset_file_truename (&buffer_local_flags, make_number (-1)); + bset_invisibility_spec (&buffer_local_flags, make_number (-1)); + bset_file_format (&buffer_local_flags, make_number (-1)); + bset_auto_save_file_format (&buffer_local_flags, make_number (-1)); + bset_display_count (&buffer_local_flags, make_number (-1)); + bset_display_time (&buffer_local_flags, make_number (-1)); + bset_enable_multibyte_characters (&buffer_local_flags, make_number (-1)); idx = 1; XSETFASTINT (BVAR (&buffer_local_flags, mode_line_format), idx); ++idx; @@ -5070,7 +5295,7 @@ QSFundamental = build_pure_c_string ("Fundamental"); Qfundamental_mode = intern_c_string ("fundamental-mode"); - BSET (&buffer_defaults, major_mode, Qfundamental_mode); + bset_major_mode (&buffer_defaults, Qfundamental_mode); Qmode_class = intern_c_string ("mode-class"); @@ -5133,13 +5358,13 @@ len++; } - BSET (current_buffer, directory, make_unibyte_string (pwd, len)); + bset_directory (current_buffer, make_unibyte_string (pwd, len)); 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. */ - BSET (current_buffer, directory, - string_to_multibyte (BVAR (current_buffer, directory))); + bset_directory + (current_buffer, string_to_multibyte (BVAR (current_buffer, directory))); /* Add /: to the front of the name if it would otherwise be treated as magic. */ @@ -5150,11 +5375,12 @@ However, it is not necessary to turn / into /:/. So avoid doing that. */ && strcmp ("/", SSDATA (BVAR (current_buffer, directory)))) - BSET (current_buffer, directory, - concat2 (build_string ("/:"), BVAR (current_buffer, directory))); + bset_directory + (current_buffer, + concat2 (build_string ("/:"), BVAR (current_buffer, directory))); temp = get_minibuffer (0); - BSET (XBUFFER (temp), directory, BVAR (current_buffer, directory)); + bset_directory (XBUFFER (temp), BVAR (current_buffer, directory)); free (pwd); } === modified file 'src/buffer.h' --- src/buffer.h 2012-08-17 21:12:11 +0000 +++ src/buffer.h 2012-08-18 06:06:39 +0000 @@ -477,7 +477,6 @@ /* Most code should use this macro to access Lisp fields in struct buffer. */ #define BVAR(buf, field) ((buf)->INTERNAL_FIELD (field)) -#define BSET(buf, field, value) ((buf)->INTERNAL_FIELD (field) = (value)) /* This is the structure that the buffer Lisp object points to. */ @@ -862,6 +861,104 @@ Lisp_Object INTERNAL_FIELD (undo_list); }; +/* Most code should use these functions to set Lisp fields in struct + buffer. */ +BUFFER_INLINE void +bset_bidi_paragraph_direction (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (bidi_paragraph_direction) = val; +} +BUFFER_INLINE void +bset_case_canon_table (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (case_canon_table) = val; +} +BUFFER_INLINE void +bset_case_eqv_table (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (case_eqv_table) = val; +} +BUFFER_INLINE void +bset_directory (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (directory) = val; +} +BUFFER_INLINE void +bset_display_count (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (display_count) = val; +} +BUFFER_INLINE void +bset_display_time (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (display_time) = val; +} +BUFFER_INLINE void +bset_downcase_table (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (downcase_table) = val; +} +BUFFER_INLINE void +bset_enable_multibyte_characters (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (enable_multibyte_characters) = val; +} +BUFFER_INLINE void +bset_filename (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (filename) = val; +} +BUFFER_INLINE void +bset_keymap (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (keymap) = val; +} +BUFFER_INLINE void +bset_last_selected_window (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (last_selected_window) = val; +} +BUFFER_INLINE void +bset_local_var_alist (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (local_var_alist) = val; +} +BUFFER_INLINE void +bset_mark_active (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (mark_active) = val; +} +BUFFER_INLINE void +bset_point_before_scroll (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (point_before_scroll) = val; +} +BUFFER_INLINE void +bset_read_only (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (read_only) = val; +} +BUFFER_INLINE void +bset_truncate_lines (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (truncate_lines) = val; +} +BUFFER_INLINE void +bset_undo_list (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (undo_list) = val; +} +BUFFER_INLINE void +bset_upcase_table (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (upcase_table) = val; +} +BUFFER_INLINE void +bset_width_table (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (width_table) = val; +} + /* Chain of all buffers, including killed ones. */ === modified file 'src/casetab.c' --- src/casetab.c 2012-08-17 17:08:30 +0000 +++ src/casetab.c 2012-08-18 06:06:39 +0000 @@ -158,10 +158,10 @@ } else { - BSET (current_buffer, downcase_table, table); - BSET (current_buffer, upcase_table, up); - BSET (current_buffer, case_canon_table, canon); - BSET (current_buffer, case_eqv_table, eqv); + bset_downcase_table (current_buffer, table); + bset_upcase_table (current_buffer, up); + bset_case_canon_table (current_buffer, canon); + bset_case_eqv_table (current_buffer, eqv); } return table; === modified file 'src/category.c' --- src/category.c 2012-08-17 17:08:30 +0000 +++ src/category.c 2012-08-18 06:06:39 +0000 @@ -40,6 +40,13 @@ #include "category.h" #include "keymap.h" +/* This setter is used only in this file, so it can be private. */ +static inline void +bset_category_table (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (category_table) = val; +} + /* The version number of the latest category table. Each category table has a unique version number. It is assigned a new number also when it is modified. When a regular expression is compiled @@ -285,7 +292,7 @@ { int idx; table = check_category_table (table); - BSET (current_buffer, category_table, table); + bset_category_table (current_buffer, 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); === modified file 'src/cmds.c' --- src/cmds.c 2012-08-13 03:39:07 +0000 +++ src/cmds.c 2012-08-18 06:06:39 +0000 @@ -301,7 +301,7 @@ added be explicit calls to undo-boundary. */ && EQ (BVAR (current_buffer, undo_list), last_undo_boundary)) /* Remove the undo_boundary that was just pushed. */ - BSET (current_buffer, undo_list, XCDR (BVAR (current_buffer, undo_list))); + bset_undo_list (current_buffer, XCDR (BVAR (current_buffer, undo_list))); /* Barf if the key that invoked this was not a character. */ if (!CHARACTERP (last_command_event)) === modified file 'src/coding.c' --- src/coding.c 2012-08-18 00:07:52 +0000 +++ src/coding.c 2012-08-18 06:06:39 +0000 @@ -7112,7 +7112,7 @@ record_first_change (); undo_list = BVAR (current_buffer, undo_list); - BSET (current_buffer, undo_list, Qt); + bset_undo_list (current_buffer, Qt); } coding->consumed = coding->consumed_char = 0; @@ -7209,7 +7209,7 @@ decode_eol (coding); if (BUFFERP (coding->dst_object)) { - BSET (current_buffer, undo_list, undo_list); + bset_undo_list (current_buffer, undo_list); record_insert (coding->dst_pos, coding->produced_char); } return coding->result; @@ -7577,8 +7577,8 @@ doesn't compile new regexps. */ Fset (Fmake_local_variable (Qinhibit_modification_hooks), Qt); Ferase_buffer (); - BSET (current_buffer, undo_list, Qt); - BSET (current_buffer, enable_multibyte_characters, multibyte ? Qt : Qnil); + bset_undo_list (current_buffer, Qt); + bset_enable_multibyte_characters (current_buffer, multibyte ? Qt : Qnil); set_buffer_internal (current); return workbuf; } === modified file 'src/data.c' --- src/data.c 2012-08-17 14:24:43 +0000 +++ src/data.c 2012-08-18 06:06:39 +0000 @@ -1213,8 +1213,9 @@ bindings, not for frame-local bindings. */ eassert (!blv->frame_local); tem1 = Fcons (symbol, XCDR (blv->defcell)); - BSET (XBUFFER (where), local_var_alist, - Fcons (tem1, BVAR (XBUFFER (where), local_var_alist))); + bset_local_var_alist + (XBUFFER (where), + Fcons (tem1, BVAR (XBUFFER (where), local_var_alist))); } } @@ -1653,9 +1654,10 @@ default value. */ find_symbol_value (variable); - BSET (current_buffer, local_var_alist, - Fcons (Fcons (variable, XCDR (blv->defcell)), - BVAR (current_buffer, local_var_alist))); + bset_local_var_alist + (current_buffer, + Fcons (Fcons (variable, XCDR (blv->defcell)), + 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. */ @@ -1721,8 +1723,9 @@ XSETSYMBOL (variable, sym); /* Propagate variable indirection. */ tem = Fassq (variable, BVAR (current_buffer, local_var_alist)); if (!NILP (tem)) - BSET (current_buffer, local_var_alist, - Fdelq (tem, BVAR (current_buffer, local_var_alist))); + bset_local_var_alist + (current_buffer, + 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 === modified file 'src/editfns.c' --- src/editfns.c 2012-08-17 21:12:11 +0000 +++ src/editfns.c 2012-08-18 06:06:39 +0000 @@ -881,7 +881,7 @@ info = XCDR (info); tem = XCAR (info); tem1 = BVAR (current_buffer, mark_active); - BSET (current_buffer, mark_active, tem); + bset_mark_active (current_buffer, tem); /* If mark is active now, and either was not active or was at a different place, run the activate hook. */ @@ -2815,13 +2815,15 @@ static Lisp_Object subst_char_in_region_unwind (Lisp_Object arg) { - return BSET (current_buffer, undo_list, arg); + bset_undo_list (current_buffer, arg); + return arg; } static Lisp_Object subst_char_in_region_unwind_1 (Lisp_Object arg) { - return BSET (current_buffer, filename, arg); + bset_filename (current_buffer, arg); + return arg; } DEFUN ("subst-char-in-region", Fsubst_char_in_region, @@ -2895,11 +2897,11 @@ { record_unwind_protect (subst_char_in_region_unwind, BVAR (current_buffer, undo_list)); - BSET (current_buffer, undo_list, Qt); + bset_undo_list (current_buffer, Qt); /* Don't do file-locking. */ record_unwind_protect (subst_char_in_region_unwind_1, BVAR (current_buffer, filename)); - BSET (current_buffer, filename, Qnil); + bset_filename (current_buffer, Qnil); } if (pos_byte < GPT_BYTE) @@ -2981,7 +2983,7 @@ INC_POS (pos_byte_next); if (! NILP (noundo)) - BSET (current_buffer, undo_list, tem); + bset_undo_list (current_buffer, tem); UNGCPRO; } === modified file 'src/fileio.c' --- src/fileio.c 2012-08-17 21:12:11 +0000 +++ src/fileio.c 2012-08-18 06:06:39 +0000 @@ -3150,8 +3150,8 @@ TEMP_SET_PT_BOTH (BEG, BEG_BYTE); /* Now we are safe to change the buffer's multibyteness directly. */ - BSET (current_buffer, enable_multibyte_characters, multibyte); - BSET (current_buffer, undo_list, undo_list); + bset_enable_multibyte_characters (current_buffer, multibyte); + bset_undo_list (current_buffer, undo_list); return Qnil; } @@ -3487,16 +3487,16 @@ buf = XBUFFER (workbuf); delete_all_overlays (buf); - BSET (buf, directory, BVAR (current_buffer, directory)); - BSET (buf, read_only, Qnil); - BSET (buf, filename, Qnil); - BSET (buf, undo_list, Qt); + bset_directory (buf, BVAR (current_buffer, directory)); + bset_read_only (buf, Qnil); + bset_filename (buf, Qnil); + bset_undo_list (buf, Qt); eassert (buf->overlays_before == NULL); eassert (buf->overlays_after == NULL); set_buffer_internal (buf); Ferase_buffer (); - BSET (buf, enable_multibyte_characters, Qnil); + bset_enable_multibyte_characters (buf, Qnil); insert_1_both ((char *) read_buf, nread, nread, 0, 0, 0); TEMP_SET_PT_BOTH (BEG, BEG_BYTE); @@ -4105,8 +4105,8 @@ unwind_data = Fcons (BVAR (current_buffer, enable_multibyte_characters), Fcons (BVAR (current_buffer, undo_list), Fcurrent_buffer ())); - BSET (current_buffer, enable_multibyte_characters, Qnil); - BSET (current_buffer, undo_list, Qt); + bset_enable_multibyte_characters (current_buffer, Qnil); + bset_undo_list (current_buffer, Qt); record_unwind_protect (decide_coding_unwind, unwind_data); if (inserted > 0 && ! NILP (Vset_auto_coding_function)) @@ -4154,7 +4154,7 @@ && NILP (replace)) /* Visiting a file with these coding system makes the buffer unibyte. */ - BSET (current_buffer, enable_multibyte_characters, Qnil); + bset_enable_multibyte_characters (current_buffer, Qnil); } coding.dst_multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); @@ -4197,13 +4197,13 @@ if (!NILP (visit)) { if (!EQ (BVAR (current_buffer, undo_list), Qt) && !nochange) - BSET (current_buffer, undo_list, Qnil); + bset_undo_list (current_buffer, Qnil); if (NILP (handler)) { current_buffer->modtime = mtime; current_buffer->modtime_size = st.st_size; - BSET (current_buffer, filename, orig_filename); + bset_filename (current_buffer, orig_filename); } SAVE_MODIFF = MODIFF; @@ -4248,7 +4248,7 @@ /* Save old undo list and don't record undo for decoding. */ old_undo = BVAR (current_buffer, undo_list); - BSET (current_buffer, undo_list, Qt); + bset_undo_list (current_buffer, Qt); if (NILP (replace)) { @@ -4340,7 +4340,7 @@ if (NILP (visit)) { - BSET (current_buffer, undo_list, old_undo); + bset_undo_list (current_buffer, old_undo); if (CONSP (old_undo) && inserted != old_inserted) { /* Adjust the last undo record for the size change during @@ -4355,7 +4355,7 @@ else /* If undo_list was Qt before, keep it that way. Otherwise start with an empty undo_list. */ - BSET (current_buffer, undo_list, EQ (old_undo, Qt) ? Qt : Qnil); + bset_undo_list (current_buffer, EQ (old_undo, Qt) ? Qt : Qnil); unbind_to (count1, Qnil); } @@ -4595,7 +4595,7 @@ { SAVE_MODIFF = MODIFF; XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG); - BSET (current_buffer, filename, visit_file); + bset_filename (current_buffer, visit_file); } UNGCPRO; return val; @@ -4811,7 +4811,7 @@ { SAVE_MODIFF = MODIFF; XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG); - BSET (current_buffer, filename, visit_file); + bset_filename (current_buffer, visit_file); update_mode_lines++; } else if (quietly) === modified file 'src/frame.c' --- src/frame.c 2012-08-18 01:42:52 +0000 +++ src/frame.c 2012-08-18 06:06:39 +0000 @@ -1700,7 +1700,7 @@ w = XWINDOW (window); if (!NILP (w->buffer)) - BSET (XBUFFER (w->buffer), display_time, Fcurrent_time ()); + bset_display_time (XBUFFER (w->buffer), Fcurrent_time ()); if (!NILP (w->vchild)) make_frame_visible_1 (w->vchild); === modified file 'src/indent.c' --- src/indent.c 2012-08-18 01:42:52 +0000 +++ src/indent.c 2012-08-18 06:06:39 +0000 @@ -141,7 +141,7 @@ struct Lisp_Vector *widthtab; if (!VECTORP (BVAR (buf, width_table))) - BSET (buf, width_table, Fmake_vector (make_number (256), make_number (0))); + bset_width_table (buf, Fmake_vector (make_number (256), make_number (0))); widthtab = XVECTOR (BVAR (buf, width_table)); if (widthtab->header.size != 256) abort (); @@ -166,7 +166,7 @@ { free_region_cache (current_buffer->width_run_cache); current_buffer->width_run_cache = 0; - BSET (current_buffer, width_table, Qnil); + bset_width_table (current_buffer, Qnil); } } else === modified file 'src/insdel.c' --- src/insdel.c 2012-08-17 21:12:11 +0000 +++ src/insdel.c 2012-08-18 06:06:39 +0000 @@ -1792,7 +1792,7 @@ if (! preserve_chars_modiff) CHARS_MODIFF = MODIFF; - BSET (buffer, point_before_scroll, Qnil); + bset_point_before_scroll (buffer, Qnil); if (buffer != old_buffer) set_buffer_internal (old_buffer); === modified file 'src/intervals.c' --- src/intervals.c 2012-08-17 21:12:11 +0000 +++ src/intervals.c 2012-08-18 06:06:39 +0000 @@ -1887,7 +1887,7 @@ int have_overlays; ptrdiff_t original_position; - BSET (current_buffer, point_before_scroll, Qnil); + bset_point_before_scroll (current_buffer, Qnil); if (charpos == PT) return; === modified file 'src/keymap.c' --- src/keymap.c 2012-08-13 03:39:07 +0000 +++ src/keymap.c 2012-08-18 06:06:39 +0000 @@ -1854,7 +1854,7 @@ if (!NILP (keymap)) keymap = get_keymap (keymap, 1, 1); - BSET (current_buffer, keymap, keymap); + bset_keymap (current_buffer, keymap); return Qnil; } === modified file 'src/minibuf.c' --- src/minibuf.c 2012-08-15 04:02:14 +0000 +++ src/minibuf.c 2012-08-18 06:06:39 +0000 @@ -565,11 +565,11 @@ /* Defeat (setq-default truncate-lines t), since truncated lines do not work correctly in minibuffers. (Bug#5715, etc) */ - BSET (current_buffer, truncate_lines, Qnil); + bset_truncate_lines (current_buffer, Qnil); /* If appropriate, copy enable-multibyte-characters into the minibuffer. */ if (inherit_input_method) - BSET (current_buffer, enable_multibyte_characters, enable_multibyte); + bset_enable_multibyte_characters (current_buffer, 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 @@ -580,7 +580,7 @@ you think of something better to do? Find another buffer with a better directory, and use that one instead. */ if (STRINGP (ambient_dir)) - BSET (current_buffer, directory, ambient_dir); + bset_directory (current_buffer, ambient_dir); else { Lisp_Object buf_list; @@ -594,8 +594,8 @@ other_buf = XCDR (XCAR (buf_list)); if (STRINGP (BVAR (XBUFFER (other_buf), directory))) { - BSET (current_buffer, directory, - BVAR (XBUFFER (other_buf), directory)); + bset_directory (current_buffer, + BVAR (XBUFFER (other_buf), directory)); break; } } @@ -672,7 +672,7 @@ } clear_message (1, 1); - BSET (current_buffer, keymap, map); + bset_keymap (current_buffer, map); /* Turn on an input method stored in INPUT_METHOD if any. */ if (STRINGP (input_method) && !NILP (Ffboundp (Qactivate_input_method))) @@ -681,7 +681,7 @@ Frun_hooks (1, &Qminibuffer_setup_hook); /* Don't allow the user to undo past this point. */ - BSET (current_buffer, undo_list, Qnil); + bset_undo_list (current_buffer, Qnil); recursive_edit_1 (); === modified file 'src/print.c' --- src/print.c 2012-08-17 21:12:11 +0000 +++ src/print.c 2012-08-18 06:06:39 +0000 @@ -494,14 +494,14 @@ Fkill_all_local_variables (); delete_all_overlays (current_buffer); - BSET (current_buffer, directory, BVAR (old, directory)); - BSET (current_buffer, read_only, Qnil); - BSET (current_buffer, filename, Qnil); - BSET (current_buffer, undo_list, Qt); + bset_directory (current_buffer, BVAR (old, directory)); + bset_read_only (current_buffer, Qnil); + bset_filename (current_buffer, Qnil); + bset_undo_list (current_buffer, Qt); eassert (current_buffer->overlays_before == NULL); eassert (current_buffer->overlays_after == NULL); - BSET (current_buffer, enable_multibyte_characters, - BVAR (&buffer_defaults, enable_multibyte_characters)); + bset_enable_multibyte_characters + (current_buffer, BVAR (&buffer_defaults, enable_multibyte_characters)); specbind (Qinhibit_read_only, Qt); specbind (Qinhibit_modification_hooks, Qt); Ferase_buffer (); === modified file 'src/process.c' --- src/process.c 2012-08-18 02:49:24 +0000 +++ src/process.c 2012-08-18 06:06:39 +0000 @@ -5330,7 +5330,7 @@ old_begv_byte = BEGV_BYTE; old_zv_byte = ZV_BYTE; - BSET (current_buffer, read_only, Qnil); + bset_read_only (current_buffer, Qnil); /* Insert new output into buffer at the current end-of-output marker, @@ -5421,7 +5421,7 @@ Fnarrow_to_region (make_number (old_begv), make_number (old_zv)); - BSET (current_buffer, read_only, old_read_only); + bset_read_only (current_buffer, old_read_only); SET_PT_BOTH (opoint, opoint_byte); } /* Handling the process output should not deactivate the mark. */ @@ -6755,13 +6755,13 @@ before_byte = PT_BYTE; tem = BVAR (current_buffer, read_only); - BSET (current_buffer, read_only, Qnil); + bset_read_only (current_buffer, Qnil); insert_string ("\nProcess "); { /* FIXME: temporary kludge */ Lisp_Object tem2 = p->name; Finsert (1, &tem2); } insert_string (" "); Finsert (1, &msg); - BSET (current_buffer, read_only, tem); + bset_read_only (current_buffer, tem); set_marker_both (p->mark, p->buffer, PT, PT_BYTE); if (opoint >= before) === modified file 'src/syntax.c' --- src/syntax.c 2012-08-17 16:48:22 +0000 +++ src/syntax.c 2012-08-18 06:06:39 +0000 @@ -149,6 +149,13 @@ ptrdiff_t, ptrdiff_t, ptrdiff_t, EMACS_INT, int, Lisp_Object, int); static int in_classes (int, Lisp_Object); + +/* This setter is used only in this file, so it can be private. */ +static inline void +bset_syntax_table (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (syntax_table) = val; +} /* Whether the syntax of the character C has the prefix flag set. */ int syntax_prefix_flag_p (int c) @@ -835,7 +842,7 @@ { int idx; check_syntax_table (table); - BSET (current_buffer, syntax_table, table); + bset_syntax_table (current_buffer, 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); === modified file 'src/undo.c' --- src/undo.c 2012-08-13 03:39:07 +0000 +++ src/undo.c 2012-08-18 06:06:39 +0000 @@ -104,9 +104,9 @@ if (at_boundary && current_buffer == last_boundary_buffer && last_boundary_position != pt) - BSET (current_buffer, undo_list, - Fcons (make_number (last_boundary_position), - BVAR (current_buffer, undo_list))); + bset_undo_list (current_buffer, + Fcons (make_number (last_boundary_position), + BVAR (current_buffer, undo_list))); } /* Record an insertion that just happened or is about to happen, @@ -142,8 +142,8 @@ XSETFASTINT (lbeg, beg); XSETINT (lend, beg + length); - BSET (current_buffer, undo_list, - Fcons (Fcons (lbeg, lend), BVAR (current_buffer, undo_list))); + bset_undo_list (current_buffer, + Fcons (Fcons (lbeg, lend), BVAR (current_buffer, undo_list))); } /* Record that a deletion is about to take place, @@ -168,8 +168,9 @@ record_point (beg); } - BSET (current_buffer, undo_list, - Fcons (Fcons (string, sbeg), BVAR (current_buffer, undo_list))); + bset_undo_list + (current_buffer, + Fcons (Fcons (string, sbeg), BVAR (current_buffer, undo_list))); } /* Record the fact that MARKER is about to be adjusted by ADJUSTMENT. @@ -191,9 +192,10 @@ Fundo_boundary (); last_undo_buffer = current_buffer; - BSET (current_buffer, undo_list, - Fcons (Fcons (marker, make_number (adjustment)), - BVAR (current_buffer, undo_list))); + bset_undo_list + (current_buffer, + Fcons (Fcons (marker, make_number (adjustment)), + BVAR (current_buffer, undo_list))); } /* Record that a replacement is about to take place, @@ -226,9 +228,10 @@ if (base_buffer->base_buffer) base_buffer = base_buffer->base_buffer; - BSET (current_buffer, undo_list, - Fcons (Fcons (Qt, make_lisp_time (base_buffer->modtime)), - BVAR (current_buffer, undo_list))); + bset_undo_list + (current_buffer, + Fcons (Fcons (Qt, make_lisp_time (base_buffer->modtime)), + BVAR (current_buffer, undo_list))); } /* Record a change in property PROP (whose old value was VAL) @@ -266,8 +269,8 @@ XSETINT (lbeg, beg); XSETINT (lend, beg + length); entry = Fcons (Qnil, Fcons (prop, Fcons (value, Fcons (lbeg, lend)))); - BSET (current_buffer, undo_list, - Fcons (entry, BVAR (current_buffer, undo_list))); + bset_undo_list (current_buffer, + Fcons (entry, BVAR (current_buffer, undo_list))); current_buffer = obuf; } @@ -290,11 +293,12 @@ /* If we have preallocated the cons cell to use here, use that one. */ XSETCDR (pending_boundary, BVAR (current_buffer, undo_list)); - BSET (current_buffer, undo_list, pending_boundary); + bset_undo_list (current_buffer, pending_boundary); pending_boundary = Qnil; } else - BSET (current_buffer, undo_list, Fcons (Qnil, BVAR (current_buffer, undo_list))); + bset_undo_list (current_buffer, + Fcons (Qnil, BVAR (current_buffer, undo_list))); } last_boundary_position = PT; last_boundary_buffer = current_buffer; @@ -435,7 +439,7 @@ XSETCDR (last_boundary, Qnil); /* There's nothing we decided to keep, so clear it out. */ else - BSET (b, undo_list, Qnil); + bset_undo_list (b, Qnil); unbind_to (count, Qnil); } @@ -650,8 +654,9 @@ will work right. */ if (did_apply && EQ (oldlist, BVAR (current_buffer, undo_list))) - BSET (current_buffer, undo_list, - Fcons (list3 (Qapply, Qcdr, Qnil), BVAR (current_buffer, undo_list))); + bset_undo_list + (current_buffer, + Fcons (list3 (Qapply, Qcdr, Qnil), BVAR (current_buffer, undo_list))); UNGCPRO; return unbind_to (count, list); === modified file 'src/w32fns.c' --- src/w32fns.c 2012-08-18 01:42:52 +0000 +++ src/w32fns.c 2012-08-18 06:06:39 +0000 @@ -5242,7 +5242,7 @@ set_window_buffer (FRAME_ROOT_WINDOW (f), buffer, 0, 0); old_buffer = current_buffer; set_buffer_internal_1 (XBUFFER (buffer)); - BSET (current_buffer, truncate_lines, Qnil); + bset_truncate_lines (current_buffer, Qnil); specbind (Qinhibit_read_only, Qt); specbind (Qinhibit_modification_hooks, Qt); Ferase_buffer (); @@ -5672,7 +5672,7 @@ /* Display the tooltip text in a temporary buffer. */ old_buffer = current_buffer; set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer)); - BSET (current_buffer, truncate_lines, Qnil); + bset_truncate_lines (current_buffer, Qnil); clear_glyph_matrix (w->desired_matrix); clear_glyph_matrix (w->current_matrix); SET_TEXT_POS (pos, BEGV, BEGV_BYTE); === modified file 'src/window.c' --- src/window.c 2012-08-18 01:42:52 +0000 +++ src/window.c 2012-08-18 06:06:39 +0000 @@ -512,7 +512,7 @@ Fset_buffer (w->buffer); - BSET (XBUFFER (w->buffer), last_selected_window, window); + bset_last_selected_window (XBUFFER (w->buffer), window); /* Go to the point recorded in the window. This is important when the buffer is in more @@ -1972,7 +1972,7 @@ if (WINDOWP (BVAR (b, last_selected_window)) && w == XWINDOW (BVAR (b, last_selected_window))) - BSET (b, last_selected_window, Qnil); + bset_last_selected_window (b, Qnil); } /* Put NEW into the window structure in place of OLD. SETFLAG zero @@ -3148,15 +3148,15 @@ wset_buffer (w, buffer); if (EQ (window, selected_window)) - BSET (b, last_selected_window, window); + bset_last_selected_window (b, window); /* Let redisplay errors through. */ b->display_error_modiff = 0; /* Update time stamps of buffer display. */ if (INTEGERP (BVAR (b, display_count))) - BSET (b, display_count, make_number (XINT (BVAR (b, display_count)) + 1)); - BSET (b, display_time, Fcurrent_time ()); + bset_display_count (b, make_number (XINT (BVAR (b, display_count)) + 1)); + bset_display_time (b, Fcurrent_time ()); wset_window_end_pos (w, make_number (0)); wset_window_end_vpos (w, make_number (0)); @@ -3347,7 +3347,7 @@ register Lisp_Object window; register struct window *w; - BSET (XBUFFER (buf), directory, BVAR (current_buffer, directory)); + bset_directory (XBUFFER (buf), BVAR (current_buffer, directory)); Fset_buffer (buf); BUF_SAVE_MODIFF (XBUFFER (buf)) = MODIFF; === modified file 'src/xdisp.c' --- src/xdisp.c 2012-08-18 01:42:52 +0000 +++ src/xdisp.c 2012-08-18 06:06:39 +0000 @@ -9340,7 +9340,7 @@ old_deactivate_mark = Vdeactivate_mark; oldbuf = current_buffer; Fset_buffer (Fget_buffer_create (Vmessages_buffer_name)); - BSET (current_buffer, undo_list, Qt); + bset_undo_list (current_buffer, Qt); oldpoint = message_dolog_marker1; set_marker_restricted (oldpoint, make_number (PT), Qnil); @@ -9902,7 +9902,7 @@ old_buffer = echo_buffer[i]; echo_buffer[i] = Fget_buffer_create (make_formatted_string (name, " *Echo Area %d*", i)); - BSET (XBUFFER (echo_buffer[i]), truncate_lines, Qnil); + bset_truncate_lines (XBUFFER (echo_buffer[i]), Qnil); /* to force word wrap in echo area - it was decided to postpone this*/ /* XBUFFER (echo_buffer[i])->word_wrap = Qt; */ @@ -9995,8 +9995,8 @@ set_marker_both (w->pointm, buffer, BEG, BEG_BYTE); } - BSET (current_buffer, undo_list, Qt); - BSET (current_buffer, read_only, Qnil); + bset_undo_list (current_buffer, Qt); + bset_read_only (current_buffer, Qnil); specbind (Qinhibit_read_only, Qt); specbind (Qinhibit_modification_hooks, Qt); @@ -10109,7 +10109,7 @@ /* Switch to that buffer and clear it. */ set_buffer_internal (XBUFFER (echo_area_buffer[0])); - BSET (current_buffer, truncate_lines, Qnil); + bset_truncate_lines (current_buffer, Qnil); if (Z > BEG) { @@ -10152,7 +10152,7 @@ { /* Someone switched buffers between print requests. */ set_buffer_internal (XBUFFER (echo_area_buffer[0])); - BSET (current_buffer, truncate_lines, Qnil); + bset_truncate_lines (current_buffer, Qnil); } } } @@ -10604,9 +10604,9 @@ != !NILP (BVAR (current_buffer, enable_multibyte_characters))) Fset_buffer_multibyte (message_enable_multibyte ? Qt : Qnil); - BSET (current_buffer, truncate_lines, message_truncate_lines ? Qt : Qnil); + bset_truncate_lines (current_buffer, message_truncate_lines ? Qt : Qnil); if (!NILP (BVAR (current_buffer, bidi_display_reordering))) - BSET (current_buffer, bidi_paragraph_direction, Qleft_to_right); + bset_bidi_paragraph_direction (current_buffer, Qleft_to_right); /* Insert new message at BEG. */ TEMP_SET_PT_BOTH (BEG, BEG_BYTE); === modified file 'src/xfns.c' --- src/xfns.c 2012-08-18 01:42:52 +0000 +++ src/xfns.c 2012-08-18 06:06:39 +0000 @@ -4590,7 +4590,7 @@ set_window_buffer (FRAME_ROOT_WINDOW (f), buffer, 0, 0); old_buffer = current_buffer; set_buffer_internal_1 (XBUFFER (buffer)); - BSET (current_buffer, truncate_lines, Qnil); + bset_truncate_lines (current_buffer, Qnil); specbind (Qinhibit_read_only, Qt); specbind (Qinhibit_modification_hooks, Qt); Ferase_buffer (); @@ -5087,7 +5087,7 @@ /* Display the tooltip text in a temporary buffer. */ old_buffer = current_buffer; set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer)); - BSET (current_buffer, truncate_lines, Qnil); + bset_truncate_lines (current_buffer, Qnil); clear_glyph_matrix (w->desired_matrix); clear_glyph_matrix (w->current_matrix); SET_TEXT_POS (pos, BEGV, BEGV_BYTE); ------------------------------------------------------------ revno: 109672 committer: Chong Yidong branch nick: trunk timestamp: Sat 2012-08-18 13:11:38 +0800 message: Add yank-handled-properties; use it for `font-lock-face' and `category' properties, instead of hard-coding these properties' special handling. * lisp/simple.el (yank-handled-properties): New defcustom. (yank-excluded-properties): Add font-lock-face and category. (yank): Doc fix. * lisp/subr.el (remove-yank-excluded-properties): Obey yank-handled-properties. The special handling of font-lock-face and category is now done this way, instead of being hard-coded. (insert-for-yank-1): Remove font-lock-face handling. (yank-handle-font-lock-face-property) (yank-handle-category-property): New function. diff: === modified file 'etc/NEWS' --- etc/NEWS 2012-08-15 16:33:12 +0000 +++ etc/NEWS 2012-08-18 05:11:38 +0000 @@ -160,6 +160,10 @@ * Editing Changes in Emacs 24.3 +** New option `yank-handled-properties' allows processing of text +properties on yanked text, in more ways that are more general than +just removing them, as done by `yank-excluded-properties'. + ** New option `delete-trailing-lines' specifies whether the M-x delete-trailing-whitespace command should delete trailing lines at the end of the buffer. It defaults to t. === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-08-17 20:38:47 +0000 +++ lisp/ChangeLog 2012-08-18 05:11:38 +0000 @@ -1,3 +1,16 @@ +2012-08-18 Chong Yidong + + * simple.el (yank-handled-properties): New defcustom. + (yank-excluded-properties): Add font-lock-face and category. + (yank): Doc fix. + + * subr.el (remove-yank-excluded-properties): Obey + yank-handled-properties. The special handling of font-lock-face + and category is now done this way, instead of being hard-coded. + (insert-for-yank-1): Remove font-lock-face handling. + (yank-handle-font-lock-face-property) + (yank-handle-category-property): New function. + 2012-08-17 Glenn Morris * mail/rmailout.el (rmail-output-read-file-name): === modified file 'lisp/simple.el' --- lisp/simple.el 2012-08-15 16:29:11 +0000 +++ lisp/simple.el 2012-08-18 05:11:38 +0000 @@ -3474,16 +3474,36 @@ ;; Yanking. +(defcustom yank-handled-properties + '((font-lock-face . yank-handle-font-lock-face-property) + (category . yank-handle-category-property)) + "List of special text property handling conditions for yanking. +Each element should have the form (PROP . FUN), where PROP is a +property symbol and FUN is a function. When the `yank' command +inserts text into the buffer, it scans the inserted text for +stretches of text that have `eq' values of the text property +PROP; for each such stretch of text, FUN is called with three +arguments: the property's value in that text, and the start and +end positions of the text. + +This is done prior to removing the properties specified by +`yank-excluded-properties'." + :group 'killing + :version "24.3") + ;; This is actually used in subr.el but defcustom does not work there. (defcustom yank-excluded-properties - '(read-only invisible intangible field mouse-face help-echo local-map keymap - yank-handler follow-link fontified) + '(category field follow-link fontified font-lock-face help-echo + intangible invisible keymap local-map mouse-face read-only + yank-handler) "Text properties to discard when yanking. The value should be a list of text properties to discard or t, -which means to discard all text properties." +which means to discard all text properties. + +See also `yank-handled-properties'." :type '(choice (const :tag "All" t) (repeat symbol)) :group 'killing - :version "22.1") + :version "24.3") (defvar yank-window-start nil) (defvar yank-undo-function nil @@ -3535,15 +3555,16 @@ (defun yank (&optional arg) "Reinsert (\"paste\") the last stretch of killed text. -More precisely, reinsert the stretch of killed text most recently -killed OR yanked. Put point at end, and set mark at beginning. -With just \\[universal-argument] as argument, same but put point at beginning (and mark at end). -With argument N, reinsert the Nth most recently killed stretch of killed -text. +More precisely, reinsert the most recent kill, which is the +stretch of killed text most recently killed OR yanked. Put point +at the end, and set mark at the beginning without activating it. +With just \\[universal-argument] as argument, put point at beginning, and mark at end. +With argument N, reinsert the Nth most recent kill. -When this command inserts killed text into the buffer, it honors -`yank-excluded-properties' and `yank-handler' as described in the -doc string for `insert-for-yank-1', which see. +When this command inserts text into the buffer, it honors the +`yank-handled-properties' and `yank-excluded-properties' +variables, and the `yank-handler' text property. See +`insert-for-yank-1' for details. See also the command `yank-pop' (\\[yank-pop])." (interactive "*P") === modified file 'lisp/subr.el' --- lisp/subr.el 2012-08-15 16:29:11 +0000 +++ lisp/subr.el 2012-08-18 05:11:38 +0000 @@ -2805,35 +2805,24 @@ ;;;; Support for yanking and text properties. +(defvar yank-handled-properties) (defvar yank-excluded-properties) (defun remove-yank-excluded-properties (start end) - "Remove `yank-excluded-properties' between START and END positions. -Replaces `category' properties with their defined properties." + "Process text properties between START and END, inserted for a `yank'. +Perform the handling specified by `yank-handled-properties', then +remove properties specified by `yank-excluded-properties'." (let ((inhibit-read-only t)) - ;; Replace any `category' property with the properties it stands - ;; for. This is to remove `mouse-face' properties that are placed - ;; on categories in *Help* buffers' buttons. See - ;; http://lists.gnu.org/archive/html/emacs-devel/2002-04/msg00648.html - ;; for the details. - (unless (memq yank-excluded-properties '(t nil)) - (save-excursion - (goto-char start) - (while (< (point) end) - (let ((cat (get-text-property (point) 'category)) - run-end) - (setq run-end - (next-single-property-change (point) 'category nil end)) - (when cat - (let (run-end2 original) - (remove-list-of-text-properties (point) run-end '(category)) - (while (< (point) run-end) - (setq run-end2 (next-property-change (point) nil run-end)) - (setq original (text-properties-at (point))) - (set-text-properties (point) run-end2 (symbol-plist cat)) - (add-text-properties (point) run-end2 original) - (goto-char run-end2)))) - (goto-char run-end))))) + (dolist (handler yank-handled-properties) + (let ((prop (car handler)) + (fun (cdr handler)) + (run-start start)) + (while (< run-start end) + (let ((value (get-text-property run-start prop)) + (run-end (next-single-property-change + run-start prop nil end))) + (funcall fun value run-start run-end) + (setq run-start run-end))))) (if (eq yank-excluded-properties t) (set-text-properties start end nil) (remove-list-of-text-properties start end yank-excluded-properties)))) @@ -2851,29 +2840,31 @@ (insert-for-yank-1 string)) (defun insert-for-yank-1 (string) - "Insert STRING at point, stripping some text properties. - -Strip text properties from the inserted text according to -`yank-excluded-properties'. Otherwise just like (insert STRING). - -If STRING has a non-nil `yank-handler' property on the first character, -the normal insert behavior is modified in various ways. The value of -the yank-handler property must be a list with one to four elements -with the following format: (FUNCTION PARAM NOEXCLUDE UNDO). -When FUNCTION is present and non-nil, it is called instead of `insert' - to insert the string. FUNCTION takes one argument--the object to insert. -If PARAM is present and non-nil, it replaces STRING as the object - passed to FUNCTION (or `insert'); for example, if FUNCTION is - `yank-rectangle', PARAM may be a list of strings to insert as a - rectangle. -If NOEXCLUDE is present and non-nil, the normal removal of the + "Insert STRING at point for the `yank' command. +This function is like `insert', except it honors the variables +`yank-handled-properties' and `yank-excluded-properties', and the +`yank-handler' text property. + +Properties listed in `yank-handled-properties' are processed, +then those listed in `yank-excluded-properties' are discarded. + +If STRING has a non-nil `yank-handler' property on its first +character, the normal insert behavior is altered. The value of +the `yank-handler' property must be a list of one to four +elements, of the form (FUNCTION PARAM NOEXCLUDE UNDO). +FUNCTION, if non-nil, should be a function of one argument, an + object to insert; it is called instead of `insert'. +PARAM, if present and non-nil, replaces STRING as the argument to + FUNCTION or `insert'; e.g. if FUNCTION is `yank-rectangle', PARAM + may be a list of strings to insert as a rectangle. +If NOEXCLUDE is present and non-nil, the normal removal of `yank-excluded-properties' is not performed; instead FUNCTION is - responsible for removing those properties. This may be necessary - if FUNCTION adjusts point before or after inserting the object. -If UNDO is present and non-nil, it is a function that will be called + responsible for the removal. This may be necessary if FUNCTION + adjusts point before or after inserting the object. +UNDO, if present and non-nil, should be a function to be called by `yank-pop' to undo the insertion of the current object. It is - called with two arguments, the start and end of the current region. - FUNCTION may set `yank-undo-function' to override the UNDO value." + given two arguments, the start and end of the region. FUNCTION + may set `yank-undo-function' to override UNDO." (let* ((handler (and (stringp string) (get-text-property 0 'yank-handler string))) (param (or (nth 1 handler) string)) @@ -2882,7 +2873,7 @@ end) (setq yank-undo-function t) - (if (nth 0 handler) ;; FUNCTION + (if (nth 0 handler) ; FUNCTION (funcall (car handler) param) (insert param)) (setq end (point)) @@ -2891,34 +2882,17 @@ ;; following text property changes. (setq inhibit-read-only t) - ;; What should we do with `font-lock-face' properties? - (if font-lock-defaults - ;; No, just wipe them. - (remove-list-of-text-properties opoint end '(font-lock-face)) - ;; Convert them to `face'. - (save-excursion - (goto-char opoint) - (while (< (point) end) - (let ((face (get-text-property (point) 'font-lock-face)) - run-end) - (setq run-end - (next-single-property-change (point) 'font-lock-face nil end)) - (when face - (remove-text-properties (point) run-end '(font-lock-face nil)) - (put-text-property (point) run-end 'face face)) - (goto-char run-end))))) - - (unless (nth 2 handler) ;; NOEXCLUDE - (remove-yank-excluded-properties opoint (point))) + (unless (nth 2 handler) ; NOEXCLUDE + (remove-yank-excluded-properties opoint end)) ;; If last inserted char has properties, mark them as rear-nonsticky. (if (and (> end opoint) (text-properties-at (1- end))) (put-text-property (1- end) end 'rear-nonsticky t)) - (if (eq yank-undo-function t) ;; not set by FUNCTION - (setq yank-undo-function (nth 3 handler))) ;; UNDO - (if (nth 4 handler) ;; COMMAND + (if (eq yank-undo-function t) ; not set by FUNCTION + (setq yank-undo-function (nth 3 handler))) ; UNDO + (if (nth 4 handler) ; COMMAND (setq this-command (nth 4 handler))))) (defun insert-buffer-substring-no-properties (buffer &optional start end) @@ -2944,6 +2918,27 @@ (insert-buffer-substring buffer start end) (remove-yank-excluded-properties opoint (point)))) +(defun yank-handle-font-lock-face-property (face start end) + "If `font-lock-defaults' is nil, apply FACE as a `face' property. +START and END denote the start and end of the text to act on. +Do nothing if FACE is nil." + (and face + (null font-lock-defaults) + (put-text-property start end 'face face))) + +;; This removes `mouse-face' properties in *Help* buffer buttons: +;; http://lists.gnu.org/archive/html/emacs-devel/2002-04/msg00648.html +(defun yank-handle-category-property (category start end) + "Apply property category CATEGORY's properties between START and END." + (when category + (let ((start2 start)) + (while (< start2 end) + (let ((end2 (next-property-change start2 nil end)) + (original (text-properties-at start2))) + (set-text-properties start2 end2 (symbol-plist category)) + (add-text-properties start2 end2 original) + (setq start2 end2)))))) + ;;;; Synchronous shell commands. ------------------------------------------------------------ revno: 109671 fixes bug: http://debbugs.gnu.org/12215 committer: Paul Eggert branch nick: trunk timestamp: Fri 2012-08-17 19:49:24 -0700 message: * process.h (PSET): Remove. Replace all uses with calls to new setter functions. Use INLINE_HEADER_BEGIN, INLINE_HEADER_END. (PROCESS_INLINE): New macro. (pset_childp): New setter function. (pset_gnutls_cred_type) [HAVE_GNUTLS]: New setter function. * process.c (PROCESS_INLINE): Define to EXTERN_INLINE, so that the corresponding functions are compiled into code. (pset_buffer, pset_command, pset_decode_coding_system) (pset_decoding_buf, pset_encode_coding_system) (pset_encoding_buf, pset_filter, pset_log, pset_mark, pset_name) (pset_plist, pset_sentinel, pset_status, pset_tty_name) (pset_type, pset_write_queue): New setter functions. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-08-18 01:42:52 +0000 +++ src/ChangeLog 2012-08-18 02:49:24 +0000 @@ -1,5 +1,20 @@ 2012-08-18 Paul Eggert + * process.h (PSET): Remove (Bug#12215). + Replace all uses with calls to new setter functions. + Use INLINE_HEADER_BEGIN, INLINE_HEADER_END. + (PROCESS_INLINE): New macro. + (pset_childp): New setter function. + (pset_gnutls_cred_type) [HAVE_GNUTLS]: New setter function. + * process.c (PROCESS_INLINE): + Define to EXTERN_INLINE, so that the corresponding functions + are compiled into code. + (pset_buffer, pset_command, pset_decode_coding_system) + (pset_decoding_buf, pset_encode_coding_system) + (pset_encoding_buf, pset_filter, pset_log, pset_mark, pset_name) + (pset_plist, pset_sentinel, pset_status, pset_tty_name) + (pset_type, pset_write_queue): New setter functions. + * window.h (WSET): Remove (Bug#12215). Replace all uses with calls to new setter functions. Use INLINE_HEADER_BEGIN, INLINE_HEADER_END. === modified file 'src/gnutls.c' --- src/gnutls.c 2012-08-06 11:16:07 +0000 +++ src/gnutls.c 2012-08-18 02:49:24 +0000 @@ -830,7 +830,7 @@ XPROCESS (proc)->gnutls_state = NULL; XPROCESS (proc)->gnutls_x509_cred = NULL; XPROCESS (proc)->gnutls_anon_cred = NULL; - PSET (XPROCESS (proc), gnutls_cred_type, type); + pset_gnutls_cred_type (XPROCESS (proc), type); GNUTLS_INITSTAGE (proc) = GNUTLS_STAGE_EMPTY; GNUTLS_LOG (1, max_log_level, "allocating credentials"); === modified file 'src/process.c' --- src/process.c 2012-08-13 03:39:07 +0000 +++ src/process.c 2012-08-18 02:49:24 +0000 @@ -20,6 +20,9 @@ #include + +#define PROCESS_INLINE EXTERN_INLINE + #include #include #include @@ -334,6 +337,88 @@ /* Maximum number of bytes to send to a pty without an eof. */ static int pty_max_bytes; +/* These setters are used only in this file, so they can be private. */ +static inline void +pset_buffer (struct Lisp_Process *p, Lisp_Object val) +{ + p->buffer = val; +} +static inline void +pset_command (struct Lisp_Process *p, Lisp_Object val) +{ + p->command = val; +} +static inline void +pset_decode_coding_system (struct Lisp_Process *p, Lisp_Object val) +{ + p->decode_coding_system = val; +} +static inline void +pset_decoding_buf (struct Lisp_Process *p, Lisp_Object val) +{ + p->decoding_buf = val; +} +static inline void +pset_encode_coding_system (struct Lisp_Process *p, Lisp_Object val) +{ + p->encode_coding_system = val; +} +static inline void +pset_encoding_buf (struct Lisp_Process *p, Lisp_Object val) +{ + p->encoding_buf = val; +} +static inline void +pset_filter (struct Lisp_Process *p, Lisp_Object val) +{ + p->filter = val; +} +static inline void +pset_log (struct Lisp_Process *p, Lisp_Object val) +{ + p->log = val; +} +static inline void +pset_mark (struct Lisp_Process *p, Lisp_Object val) +{ + p->mark = val; +} +static inline void +pset_name (struct Lisp_Process *p, Lisp_Object val) +{ + p->name = val; +} +static inline void +pset_plist (struct Lisp_Process *p, Lisp_Object val) +{ + p->plist = val; +} +static inline void +pset_sentinel (struct Lisp_Process *p, Lisp_Object val) +{ + p->sentinel = val; +} +static inline void +pset_status (struct Lisp_Process *p, Lisp_Object val) +{ + p->status = val; +} +static inline void +pset_tty_name (struct Lisp_Process *p, Lisp_Object val) +{ + p->tty_name = val; +} +static inline void +pset_type (struct Lisp_Process *p, Lisp_Object val) +{ + p->type = val; +} +static inline void +pset_write_queue (struct Lisp_Process *p, Lisp_Object val) +{ + p->write_queue = val; +} + static struct fd_callback_data @@ -428,7 +513,7 @@ update_status (struct Lisp_Process *p) { eassert (p->raw_status_new); - PSET (p, status, status_convert (p->raw_status)); + pset_status (p, status_convert (p->raw_status)); p->raw_status_new = 0; } @@ -626,8 +711,8 @@ p = allocate_process (); /* Initialize Lisp data. Note that allocate_process initializes all Lisp data to nil, so do it only for slots which should not be nil. */ - PSET (p, status, Qrun); - PSET (p, mark, Fmake_marker ()); + pset_status (p, Qrun); + pset_mark (p, Fmake_marker ()); /* Initialize non-Lisp data. Note that allocate_process zeroes out all non-Lisp data, so do it only for slots which should not be zero. */ @@ -648,7 +733,7 @@ name1 = concat2 (name, make_formatted_string (suffix, "<%"pMd">", i)); } name = name1; - PSET (p, name, name); + pset_name (p, name); XSETPROCESS (val, p); Vprocess_alist = Fcons (Fcons (name, val), Vprocess_alist); return val; @@ -745,7 +830,7 @@ p->raw_status_new = 0; if (NETCONN1_P (p) || SERIALCONN1_P (p)) { - PSET (p, status, Fcons (Qexit, Fcons (make_number (0), Qnil))); + pset_status (p, Fcons (Qexit, Fcons (make_number (0), Qnil))); p->tick = ++process_tick; status_notify (p); redisplay_preserve_echo_area (13); @@ -774,7 +859,7 @@ { Fkill_process (process, Qnil); /* Do this now, since remove_process will make sigchld_handler do nothing. */ - PSET (p, status, Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil))); + pset_status (p, Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil))); p->tick = ++process_tick; status_notify (p); redisplay_preserve_echo_area (13); @@ -901,9 +986,9 @@ if (!NILP (buffer)) CHECK_BUFFER (buffer); p = XPROCESS (process); - PSET (p, buffer, buffer); + pset_buffer (p, buffer); if (NETCONN1_P (p) || SERIALCONN1_P (p)) - PSET (p, childp, Fplist_put (p->childp, QCbuffer, buffer)); + pset_childp (p, Fplist_put (p->childp, QCbuffer, buffer)); setup_process_coding_systems (process); return buffer; } @@ -974,9 +1059,9 @@ } } - PSET (p, filter, filter); + pset_filter (p, filter); if (NETCONN1_P (p) || SERIALCONN1_P (p)) - PSET (p, childp, Fplist_put (p->childp, QCfilter, filter)); + pset_childp (p, Fplist_put (p->childp, QCfilter, filter)); setup_process_coding_systems (process); return filter; } @@ -1003,9 +1088,9 @@ CHECK_PROCESS (process); p = XPROCESS (process); - PSET (p, sentinel, sentinel); + pset_sentinel (p, sentinel); if (NETCONN1_P (p) || SERIALCONN1_P (p)) - PSET (p, childp, Fplist_put (p->childp, QCsentinel, sentinel)); + pset_childp (p, Fplist_put (p->childp, QCsentinel, sentinel)); return sentinel; } @@ -1138,7 +1223,7 @@ CHECK_PROCESS (process); CHECK_LIST (plist); - PSET (XPROCESS (process), plist, plist); + pset_plist (XPROCESS (process), plist); return plist; } @@ -1324,18 +1409,18 @@ itself; it's all taken care of here. */ record_unwind_protect (start_process_unwind, proc); - PSET (XPROCESS (proc), childp, Qt); - PSET (XPROCESS (proc), plist, Qnil); - PSET (XPROCESS (proc), type, Qreal); - PSET (XPROCESS (proc), buffer, buffer); - PSET (XPROCESS (proc), sentinel, Qnil); - PSET (XPROCESS (proc), filter, Qnil); - PSET (XPROCESS (proc), command, Flist (nargs - 2, args + 2)); + pset_childp (XPROCESS (proc), Qt); + pset_plist (XPROCESS (proc), Qnil); + pset_type (XPROCESS (proc), Qreal); + pset_buffer (XPROCESS (proc), buffer); + pset_sentinel (XPROCESS (proc), Qnil); + pset_filter (XPROCESS (proc), Qnil); + pset_command (XPROCESS (proc), Flist (nargs - 2, args + 2)); #ifdef HAVE_GNUTLS /* AKA GNUTLS_INITSTAGE(proc). */ XPROCESS (proc)->gnutls_initstage = GNUTLS_STAGE_EMPTY; - PSET (XPROCESS (proc), gnutls_cred_type, Qnil); + pset_gnutls_cred_type (XPROCESS (proc), Qnil); #endif #ifdef ADAPTIVE_READ_BUFFERING @@ -1375,7 +1460,7 @@ else if (CONSP (Vdefault_process_coding_system)) val = XCAR (Vdefault_process_coding_system); } - PSET (XPROCESS (proc), decode_coding_system, val); + pset_decode_coding_system (XPROCESS (proc), val); val = Vcoding_system_for_write; if (NILP (val)) @@ -1395,7 +1480,7 @@ else if (CONSP (Vdefault_process_coding_system)) val = XCDR (Vdefault_process_coding_system); } - PSET (XPROCESS (proc), encode_coding_system, val); + pset_encode_coding_system (XPROCESS (proc), val); /* Note: At this moment, the above coding system may leave text-conversion or eol-conversion unspecified. They will be decided after we read output from the process and decode it by @@ -1404,9 +1489,9 @@ } - PSET (XPROCESS (proc), decoding_buf, empty_unibyte_string); + pset_decoding_buf (XPROCESS (proc), empty_unibyte_string); XPROCESS (proc)->decoding_carryover = 0; - PSET (XPROCESS (proc), encoding_buf, empty_unibyte_string); + pset_encoding_buf (XPROCESS (proc), empty_unibyte_string); XPROCESS (proc)->inherit_coding_system_flag = !(NILP (buffer) || !inherit_process_coding_system); @@ -1628,7 +1713,7 @@ more portable (see USG_SUBTTY_WORKS above). */ XPROCESS (process)->pty_flag = pty_flag; - PSET (XPROCESS (process), status, Qrun); + pset_status (XPROCESS (process), Qrun); /* Delay interrupts until we have a chance to store the new fork's pid in its process structure */ @@ -1867,10 +1952,10 @@ #ifdef HAVE_PTYS if (pty_flag) - PSET (XPROCESS (process), tty_name, build_string (pty_name)); + pset_tty_name (XPROCESS (process), build_string (pty_name)); else #endif - PSET (XPROCESS (process), tty_name, Qnil); + pset_tty_name (XPROCESS (process), Qnil); #if !defined (WINDOWSNT) && defined (FD_CLOEXEC) /* Wait for child_setup to complete in case that vfork is @@ -1965,7 +2050,7 @@ more portable (see USG_SUBTTY_WORKS above). */ XPROCESS (process)->pty_flag = pty_flag; - PSET (XPROCESS (process), status, Qrun); + pset_status (XPROCESS (process), Qrun); setup_process_coding_systems (process); FD_SET (inchannel, &input_wait_mask); @@ -1976,10 +2061,10 @@ XPROCESS (process)->pid = -2; #ifdef HAVE_PTYS if (pty_flag) - PSET (XPROCESS (process), tty_name, build_string (pty_name)); + pset_tty_name (XPROCESS (process), build_string (pty_name)); else #endif - PSET (XPROCESS (process), tty_name, Qnil); + pset_tty_name (XPROCESS (process), Qnil); } @@ -2368,7 +2453,7 @@ if (set_socket_option (s, option, value)) { - PSET (p, childp, Fplist_put (p->childp, option, value)); + pset_childp (p, Fplist_put (p->childp, option, value)); return Qt; } @@ -2601,18 +2686,18 @@ if (NILP (buffer)) buffer = name; buffer = Fget_buffer_create (buffer); - PSET (p, buffer, buffer); + pset_buffer (p, buffer); - PSET (p, childp, contact); - PSET (p, plist, Fcopy_sequence (Fplist_get (contact, QCplist))); - PSET (p, type, Qserial); - PSET (p, sentinel, Fplist_get (contact, QCsentinel)); - PSET (p, filter, Fplist_get (contact, QCfilter)); - PSET (p, log, Qnil); + pset_childp (p, contact); + pset_plist (p, Fcopy_sequence (Fplist_get (contact, QCplist))); + pset_type (p, Qserial); + pset_sentinel (p, Fplist_get (contact, QCsentinel)); + pset_filter (p, Fplist_get (contact, QCfilter)); + pset_log (p, Qnil); if (tem = Fplist_get (contact, QCnoquery), !NILP (tem)) p->kill_without_query = 1; if (tem = Fplist_get (contact, QCstop), !NILP (tem)) - PSET (p, command, Qt); + pset_command (p, Qt); p->pty_flag = 0; if (!EQ (p->command, Qt)) @@ -2644,7 +2729,7 @@ else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters))) || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters)))) val = Qnil; - PSET (p, decode_coding_system, val); + pset_decode_coding_system (p, val); val = Qnil; if (!NILP (tem)) @@ -2658,12 +2743,12 @@ else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters))) || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters)))) val = Qnil; - PSET (p, encode_coding_system, val); + pset_encode_coding_system (p, val); setup_process_coding_systems (proc); - PSET (p, decoding_buf, empty_unibyte_string); + pset_decoding_buf (p, empty_unibyte_string); p->decoding_carryover = 0; - PSET (p, encoding_buf, empty_unibyte_string); + pset_encoding_buf (p, empty_unibyte_string); p->inherit_coding_system_flag = !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system); @@ -3400,23 +3485,23 @@ p = XPROCESS (proc); - PSET (p, childp, contact); - PSET (p, plist, Fcopy_sequence (Fplist_get (contact, QCplist))); - PSET (p, type, Qnetwork); + pset_childp (p, contact); + pset_plist (p, Fcopy_sequence (Fplist_get (contact, QCplist))); + pset_type (p, Qnetwork); - PSET (p, buffer, buffer); - PSET (p, sentinel, sentinel); - PSET (p, filter, filter); - PSET (p, log, Fplist_get (contact, QClog)); + pset_buffer (p, buffer); + pset_sentinel (p, sentinel); + pset_filter (p, filter); + pset_log (p, Fplist_get (contact, QClog)); if (tem = Fplist_get (contact, QCnoquery), !NILP (tem)) p->kill_without_query = 1; if ((tem = Fplist_get (contact, QCstop), !NILP (tem))) - PSET (p, command, Qt); + pset_command (p, Qt); p->pid = 0; p->infd = inch; p->outfd = outch; if (is_server && socktype != SOCK_DGRAM) - PSET (p, status, Qlisten); + pset_status (p, Qlisten); /* Make the process marker point into the process buffer (if any). */ if (BUFFERP (buffer)) @@ -3430,7 +3515,7 @@ /* We may get here if connect did succeed immediately. However, in that case, we still need to signal this like a non-blocking connection. */ - PSET (p, status, Qconnect); + pset_status (p, Qconnect); if (!FD_ISSET (inch, &connect_wait_mask)) { FD_SET (inch, &connect_wait_mask); @@ -3497,7 +3582,7 @@ else val = Qnil; } - PSET (p, decode_coding_system, val); + pset_decode_coding_system (p, val); if (!NILP (tem)) { @@ -3531,13 +3616,13 @@ else val = Qnil; } - PSET (p, encode_coding_system, val); + pset_encode_coding_system (p, val); } setup_process_coding_systems (proc); - PSET (p, decoding_buf, empty_unibyte_string); + pset_decoding_buf (p, empty_unibyte_string); p->decoding_carryover = 0; - PSET (p, encoding_buf, empty_unibyte_string); + pset_encoding_buf (p, empty_unibyte_string); p->inherit_coding_system_flag = !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system); @@ -4150,18 +4235,18 @@ conv_sockaddr_to_lisp (&saddr.sa, len)); #endif - PSET (p, childp, contact); - PSET (p, plist, Fcopy_sequence (ps->plist)); - PSET (p, type, Qnetwork); + pset_childp (p, contact); + pset_plist (p, Fcopy_sequence (ps->plist)); + pset_type (p, Qnetwork); - PSET (p, buffer, buffer); - PSET (p, sentinel, ps->sentinel); - PSET (p, filter, ps->filter); - PSET (p, command, Qnil); + pset_buffer (p, buffer); + pset_sentinel (p, ps->sentinel); + pset_filter (p, ps->filter); + pset_command (p, Qnil); p->pid = 0; p->infd = s; p->outfd = s; - PSET (p, status, Qrun); + pset_status (p, Qrun); /* Client processes for accepted connections are not stopped initially. */ if (!EQ (p->filter, Qt)) @@ -4178,13 +4263,13 @@ of the new process should reflect the settings at the time the server socket was opened; not the current settings. */ - PSET (p, decode_coding_system, ps->decode_coding_system); - PSET (p, encode_coding_system, ps->encode_coding_system); + pset_decode_coding_system (p, ps->decode_coding_system); + pset_encode_coding_system (p, ps->encode_coding_system); setup_process_coding_systems (proc); - PSET (p, decoding_buf, empty_unibyte_string); + pset_decoding_buf (p, empty_unibyte_string); p->decoding_carryover = 0; - PSET (p, encoding_buf, empty_unibyte_string); + pset_encoding_buf (p, empty_unibyte_string); p->inherit_coding_system_flag = (NILP (buffer) ? 0 : ps->inherit_coding_system_flag); @@ -4889,7 +4974,7 @@ waitpid() will not find the process object to delete. Do it here. */ p->tick = ++process_tick; - PSET (p, status, Qfailed); + pset_status (p, Qfailed); } else kill (getpid (), SIGCHLD); @@ -4909,8 +4994,8 @@ if (XPROCESS (proc)->raw_status_new) update_status (XPROCESS (proc)); if (EQ (XPROCESS (proc)->status, Qrun)) - PSET (XPROCESS (proc), status, - Fcons (Qexit, Fcons (make_number (256), Qnil))); + pset_status (XPROCESS (proc), + list2 (Qexit, make_number (256))); } } #ifdef NON_BLOCKING_CONNECT @@ -4958,13 +5043,12 @@ if (xerrno) { p->tick = ++process_tick; - PSET (p, status, - Fcons (Qfailed, Fcons (make_number (xerrno), Qnil))); + pset_status (p, list2 (Qfailed, make_number (xerrno))); deactivate_process (proc); } else { - PSET (p, status, Qrun); + pset_status (p, Qrun); /* Execute the sentinel here. If we had relied on status_notify to do it later, it will read input from the process before calling the sentinel. */ @@ -5164,7 +5248,7 @@ /* A new coding system might be found. */ if (!EQ (p->decode_coding_system, Vlast_coding_system_used)) { - PSET (p, decode_coding_system, Vlast_coding_system_used); + pset_decode_coding_system (p, Vlast_coding_system_used); /* Don't call setup_coding_system for proc_decode_coding_system[channel] here. It is done in @@ -5180,8 +5264,8 @@ if (NILP (p->encode_coding_system) && proc_encode_coding_system[p->outfd]) { - PSET (p, encode_coding_system, - coding_inherit_eol_type (Vlast_coding_system_used, Qnil)); + pset_encode_coding_system + (p, coding_inherit_eol_type (Vlast_coding_system_used, Qnil)); setup_coding_system (p->encode_coding_system, proc_encode_coding_system[p->outfd]); } @@ -5190,7 +5274,7 @@ if (coding->carryover_bytes > 0) { if (SCHARS (p->decoding_buf) < coding->carryover_bytes) - PSET (p, decoding_buf, make_uninit_string (coding->carryover_bytes)); + pset_decoding_buf (p, make_uninit_string (coding->carryover_bytes)); memcpy (SDATA (p->decoding_buf), coding->carryover, coding->carryover_bytes); p->decoding_carryover = coding->carryover_bytes; @@ -5274,12 +5358,12 @@ similar code in the previous `if' block. */ if (!EQ (p->decode_coding_system, Vlast_coding_system_used)) { - PSET (p, decode_coding_system, Vlast_coding_system_used); + pset_decode_coding_system (p, Vlast_coding_system_used); if (NILP (p->encode_coding_system) && proc_encode_coding_system[p->outfd]) { - PSET (p, encode_coding_system, - coding_inherit_eol_type (Vlast_coding_system_used, Qnil)); + pset_encode_coding_system + (p, coding_inherit_eol_type (Vlast_coding_system_used, Qnil)); setup_coding_system (p->encode_coding_system, proc_encode_coding_system[p->outfd]); } @@ -5287,7 +5371,7 @@ if (coding->carryover_bytes > 0) { if (SCHARS (p->decoding_buf) < coding->carryover_bytes) - PSET (p, decoding_buf, make_uninit_string (coding->carryover_bytes)); + pset_decoding_buf (p, make_uninit_string (coding->carryover_bytes)); memcpy (SDATA (p->decoding_buf), coding->carryover, coding->carryover_bytes); p->decoding_carryover = coding->carryover_bytes; @@ -5404,9 +5488,9 @@ entry = Fcons (obj, Fcons (make_number (offset), make_number (len))); if (front) - PSET (p, write_queue, Fcons (entry, p->write_queue)); + pset_write_queue (p, Fcons (entry, p->write_queue)); else - PSET (p, write_queue, nconc2 (p->write_queue, Fcons (entry, Qnil))); + pset_write_queue (p, nconc2 (p->write_queue, Fcons (entry, Qnil))); } /* Remove the first element in the write_queue of process P, put its @@ -5424,7 +5508,7 @@ return 0; entry = XCAR (p->write_queue); - PSET (p, write_queue, XCDR (p->write_queue)); + pset_write_queue (p, XCDR (p->write_queue)); *obj = XCAR (entry); offset_length = XCDR (entry); @@ -5471,8 +5555,8 @@ && !NILP (BVAR (XBUFFER (object), enable_multibyte_characters))) || EQ (object, Qt)) { - PSET (p, encode_coding_system, - complement_process_encoding_system (p->encode_coding_system)); + pset_encode_coding_system + (p, complement_process_encoding_system (p->encode_coding_system)); if (!EQ (Vlast_coding_system_used, p->encode_coding_system)) { /* The coding system for encoding was changed to raw-text @@ -5693,7 +5777,7 @@ proc = process_sent_to; p = XPROCESS (proc); p->raw_status_new = 0; - PSET (p, status, Fcons (Qexit, Fcons (make_number (256), Qnil))); + pset_status (p, Fcons (Qexit, Fcons (make_number (256), Qnil))); p->tick = ++process_tick; deactivate_process (proc); error ("SIGPIPE raised on process %s; closed it", SDATA (p->name)); @@ -5922,7 +6006,7 @@ #ifdef SIGCONT case SIGCONT: p->raw_status_new = 0; - PSET (p, status, Qrun); + pset_status (p, Qrun); p->tick = ++process_tick; if (!nomsg) { @@ -6018,7 +6102,7 @@ FD_CLR (p->infd, &input_wait_mask); FD_CLR (p->infd, &non_keyboard_wait_mask); } - PSET (p, command, Qt); + pset_command (p, Qt); return process; } #ifndef SIGTSTP @@ -6054,7 +6138,7 @@ tcflush (p->infd, TCIFLUSH); #endif /* not WINDOWSNT */ } - PSET (p, command, Qnil); + pset_command (p, Qnil); return process; } #ifdef SIGCONT @@ -6470,7 +6554,7 @@ static Lisp_Object exec_sentinel_unwind (Lisp_Object data) { - PSET (XPROCESS (XCAR (data)), sentinel, XCDR (data)); + pset_sentinel (XPROCESS (XCAR (data)), XCDR (data)); return Qnil; } @@ -6516,7 +6600,7 @@ /* Zilch the sentinel while it's running, to avoid recursive invocations; assure that it gets restored no matter how the sentinel exits. */ - PSET (p, sentinel, Qnil); + pset_sentinel (p, Qnil); record_unwind_protect (exec_sentinel_unwind, Fcons (proc, sentinel)); /* Inhibit quit so that random quits don't screw up a running filter. */ specbind (Qinhibit_quit, Qt); @@ -6714,8 +6798,8 @@ Fcheck_coding_system (decoding); Fcheck_coding_system (encoding); encoding = coding_inherit_eol_type (encoding, Qnil); - PSET (p, decode_coding_system, decoding); - PSET (p, encode_coding_system, encoding); + pset_decode_coding_system (p, decoding); + pset_encode_coding_system (p, encoding); setup_process_coding_systems (process); return Qnil; @@ -6745,8 +6829,8 @@ CHECK_PROCESS (process); p = XPROCESS (process); if (NILP (flag)) - PSET (p, decode_coding_system, - raw_text_coding_system (p->decode_coding_system)); + pset_decode_coding_system + (p, raw_text_coding_system (p->decode_coding_system)); setup_process_coding_systems (process); return Qnil; === modified file 'src/process.h' --- src/process.h 2012-08-07 07:42:34 +0000 +++ src/process.h 2012-08-18 02:49:24 +0000 @@ -26,10 +26,10 @@ #include "gnutls.h" #endif -/* Most code should use these macros to set - Lisp fields in struct Lisp_Process. */ - -#define PSET(p, field, value) ((p)->field = (value)) +INLINE_HEADER_BEGIN +#ifndef PROCESS_INLINE +# define PROCESS_INLINE INLINE +#endif /* This structure records information about a subprocess or network connection. */ @@ -165,6 +165,23 @@ #define ChannelMask(n) (1 << (n)) +/* Most code should use these functions to set Lisp fields in struct + process. */ + +PROCESS_INLINE void +pset_childp (struct Lisp_Process *p, Lisp_Object val) +{ + p->childp = val; +} + +#ifdef HAVE_GNUTLS +PROCESS_INLINE void +pset_gnutls_cred_type (struct Lisp_Process *p, Lisp_Object val) +{ + p->gnutls_cred_type = val; +} +#endif + /* True if we are about to fork off a synchronous process or if we are waiting for it. */ extern int synch_process_alive; @@ -208,3 +225,5 @@ extern void delete_read_fd (int fd); extern void add_write_fd (int fd, fd_callback func, void *data); extern void delete_write_fd (int fd); + +INLINE_HEADER_END === modified file 'src/sysdep.c' --- src/sysdep.c 2012-08-16 21:58:44 +0000 +++ src/sysdep.c 2012-08-18 02:49:24 +0000 @@ -2307,8 +2307,7 @@ error ("tcsetattr() failed: %s", emacs_strerror (errno)); childp2 = Fplist_put (childp2, QCsummary, build_string (summary)); - PSET (p, childp, childp2); - + pset_childp (p, childp2); } #endif /* not DOS_NT */ === modified file 'src/w32.c' --- src/w32.c 2012-08-07 07:42:34 +0000 +++ src/w32.c 2012-08-18 02:49:24 +0000 @@ -7023,7 +7023,7 @@ error ("SetCommState() failed"); childp2 = Fplist_put (childp2, QCsummary, build_string (summary)); - PSET (p, childp, childp2); + pset_childp (p, childp2); } #ifdef HAVE_GNUTLS ------------------------------------------------------------ revno: 109670 fixes bug: http://debbugs.gnu.org/12215 committer: Paul Eggert branch nick: trunk timestamp: Fri 2012-08-17 18:42:52 -0700 message: * window.h (WSET): Remove. Replace all uses with calls to new setter functions. Use INLINE_HEADER_BEGIN, INLINE_HEADER_END. (WINDOW_INLINE): New macro. (wset_buffer, wset_frame, wset_left_col, wset_next, wset_prev) (wset_redisplay_end_trigger, wset_top_line, wset_total_cols) (wset_total_lines, wset_vertical_scroll_bar) (wset_window_end_pos, wset_window_end_valid) (wset_window_end_vpos): New setter functions. * window.c (WINDOW_INLINE): Define to EXTERN_INLINE, so that the corresponding functions are compiled into code. (wset_combination_limit, wset_dedicated, wset_display_table) (wset_hchild, wset_left_fringe_width, wset_left_margin_cols) (wset_new_normal, wset_new_total, wset_next_buffers) (wset_normal_cols, wset_normal_lines, wset_parent, wset_pointm) (wset_prev_buffers, wset_right_fringe_width) (wset_right_margin_cols, wset_scroll_bar_width, wset_start) (wset_temslot, wset_vchild, wset_vertical_scroll_bar_type) (wset_window_parameters): * xdisp.c (wset_base_line_number, wset_base_line_pos) (wset_column_number_displayed, wset_region_showing): New setter functions. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-08-18 00:07:52 +0000 +++ src/ChangeLog 2012-08-18 01:42:52 +0000 @@ -1,5 +1,29 @@ 2012-08-18 Paul Eggert + * window.h (WSET): Remove (Bug#12215). + Replace all uses with calls to new setter functions. + Use INLINE_HEADER_BEGIN, INLINE_HEADER_END. + (WINDOW_INLINE): New macro. + (wset_buffer, wset_frame, wset_left_col, wset_next, wset_prev) + (wset_redisplay_end_trigger, wset_top_line, wset_total_cols) + (wset_total_lines, wset_vertical_scroll_bar) + (wset_window_end_pos, wset_window_end_valid) + (wset_window_end_vpos): New setter functions. + * window.c (WINDOW_INLINE): + Define to EXTERN_INLINE, so that the corresponding functions + are compiled into code. + (wset_combination_limit, wset_dedicated, wset_display_table) + (wset_hchild, wset_left_fringe_width, wset_left_margin_cols) + (wset_new_normal, wset_new_total, wset_next_buffers) + (wset_normal_cols, wset_normal_lines, wset_parent, wset_pointm) + (wset_prev_buffers, wset_right_fringe_width) + (wset_right_margin_cols, wset_scroll_bar_width, wset_start) + (wset_temslot, wset_vchild, wset_vertical_scroll_bar_type) + (wset_window_parameters): + * xdisp.c (wset_base_line_number, wset_base_line_pos) + (wset_column_number_displayed, wset_region_showing): + New setter functions. + * termhooks.h (TSET): Remove (Bug#12215). Replace all uses with calls to new setter functions. Use INLINE_HEADER_BEGIN, INLINE_HEADER_END. === modified file 'src/dispnew.c' --- src/dispnew.c 2012-08-17 21:52:15 +0000 +++ src/dispnew.c 2012-08-18 01:42:52 +0000 @@ -621,7 +621,7 @@ are invalidated below. */ if (INTEGERP (w->window_end_vpos) && XFASTINT (w->window_end_vpos) >= i) - WSET (w, window_end_valid, Qnil); + wset_window_end_valid (w, Qnil); while (i < matrix->nrows) matrix->rows[i++].enabled_p = 0; @@ -878,7 +878,7 @@ else { clear_glyph_matrix (w->current_matrix); - WSET (w, window_end_valid, Qnil); + wset_window_end_valid (w, Qnil); } } @@ -1887,14 +1887,14 @@ int top_margin = FRAME_TOP_MARGIN (sf); /* Do it for the root window. */ - WSET (root, top_line, make_number (top_margin)); - WSET (root, total_lines, make_number (frame_lines - 1 - top_margin)); - WSET (root, total_cols, make_number (frame_cols)); + wset_top_line (root, make_number (top_margin)); + wset_total_lines (root, make_number (frame_lines - 1 - top_margin)); + wset_total_cols (root, make_number (frame_cols)); /* Do it for the mini-buffer window. */ - WSET (mini, top_line, make_number (frame_lines - 1)); - WSET (mini, total_lines, make_number (1)); - WSET (mini, total_cols, make_number (frame_cols)); + wset_top_line (mini, make_number (frame_lines - 1)); + wset_total_lines (mini, make_number (1)); + wset_total_cols (mini, make_number (frame_cols)); adjust_frame_glyphs (sf); glyphs_initialized_initially_p = 1; @@ -2169,7 +2169,7 @@ fset_menu_bar_window (f, make_window ()); w = XWINDOW (f->menu_bar_window); XSETFRAME (frame, f); - WSET (w, frame, frame); + wset_frame (w, frame); w->pseudo_window_p = 1; } else @@ -2177,10 +2177,10 @@ /* Set window dimensions to frame dimensions and allocate or adjust glyph matrices of W. */ - WSET (w, top_line, make_number (0)); - WSET (w, left_col, make_number (0)); - WSET (w, total_lines, make_number (FRAME_MENU_BAR_LINES (f))); - WSET (w, total_cols, make_number (FRAME_TOTAL_COLS (f))); + wset_top_line (w, make_number (0)); + wset_left_col (w, make_number (0)); + wset_total_lines (w, make_number (FRAME_MENU_BAR_LINES (f))); + wset_total_cols (w, make_number (FRAME_TOTAL_COLS (f))); allocate_matrices_for_window_redisplay (w); } #endif /* not USE_X_TOOLKIT && not USE_GTK */ @@ -2197,16 +2197,16 @@ fset_tool_bar_window (f, make_window ()); w = XWINDOW (f->tool_bar_window); XSETFRAME (frame, f); - WSET (w, frame, frame); + wset_frame (w, frame); w->pseudo_window_p = 1; } else w = XWINDOW (f->tool_bar_window); - WSET (w, top_line, make_number (FRAME_MENU_BAR_LINES (f))); - WSET (w, left_col, make_number (0)); - WSET (w, total_lines, make_number (FRAME_TOOL_BAR_LINES (f))); - WSET (w, total_cols, make_number (FRAME_TOTAL_COLS (f))); + wset_top_line (w, make_number (FRAME_MENU_BAR_LINES (f))); + wset_left_col (w, make_number (0)); + wset_total_lines (w, make_number (FRAME_TOOL_BAR_LINES (f))); + wset_total_cols (w, make_number (FRAME_TOTAL_COLS (f))); allocate_matrices_for_window_redisplay (w); } #endif @@ -5744,7 +5744,7 @@ FrameCols (FRAME_TTY (f)) = newwidth; if (WINDOWP (f->tool_bar_window)) - WSET (XWINDOW (f->tool_bar_window), total_cols, make_number (newwidth)); + wset_total_cols (XWINDOW (f->tool_bar_window), make_number (newwidth)); } FRAME_LINES (f) = newheight; === modified file 'src/frame.c' --- src/frame.c 2012-08-17 23:38:43 +0000 +++ src/frame.c 2012-08-18 01:42:52 +0000 @@ -148,8 +148,8 @@ struct window *w = XWINDOW (window); w->last_modified = 0; - WSET (w, top_line, make_number (XFASTINT (w->top_line) + n)); - WSET (w, total_lines, make_number (XFASTINT (w->total_lines) - n)); + wset_top_line (w, make_number (XFASTINT (w->top_line) + n)); + wset_total_lines (w, make_number (XFASTINT (w->total_lines) - n)); /* Handle just the top child in a vertical split. */ if (!NILP (w->vchild)) @@ -305,20 +305,20 @@ if (mini_p) { mini_window = make_window (); - WSET (XWINDOW (root_window), next, mini_window); - WSET (XWINDOW (mini_window), prev, root_window); + wset_next (XWINDOW (root_window), mini_window); + wset_prev (XWINDOW (mini_window), root_window); XWINDOW (mini_window)->mini = 1; - WSET (XWINDOW (mini_window), frame, frame); + wset_frame (XWINDOW (mini_window), frame); fset_minibuffer_window (f, mini_window); } else { mini_window = Qnil; - WSET (XWINDOW (root_window), next, Qnil); + wset_next (XWINDOW (root_window), Qnil); fset_minibuffer_window (f, Qnil); } - WSET (XWINDOW (root_window), frame, frame); + wset_frame (XWINDOW (root_window), frame); /* 10 is arbitrary, just so that there is "something there." @@ -327,21 +327,21 @@ SET_FRAME_COLS (f, 10); FRAME_LINES (f) = 10; - WSET (XWINDOW (root_window), total_cols, make_number (10)); - WSET (XWINDOW (root_window), total_lines, make_number (mini_p ? 9 : 10)); + wset_total_cols (XWINDOW (root_window), make_number (10)); + wset_total_lines (XWINDOW (root_window), make_number (mini_p ? 9 : 10)); if (mini_p) { - WSET (XWINDOW (mini_window), total_cols, make_number (10)); - WSET (XWINDOW (mini_window), top_line, make_number (9)); - WSET (XWINDOW (mini_window), total_lines, make_number (1)); + wset_total_cols (XWINDOW (mini_window), make_number (10)); + wset_top_line (XWINDOW (mini_window), make_number (9)); + wset_total_lines (XWINDOW (mini_window), make_number (1)); } /* Choose a buffer for the frame's root window. */ { Lisp_Object buf; - WSET (XWINDOW (root_window), buffer, Qt); + wset_buffer (XWINDOW (root_window), Qt); buf = Fcurrent_buffer (); /* If buf is a 'hidden' buffer (i.e. one whose name starts with a space), try to find another one. */ @@ -360,7 +360,7 @@ if (mini_p) { - WSET (XWINDOW (mini_window), buffer, Qt); + wset_buffer (XWINDOW (mini_window), Qt); set_window_buffer (mini_window, (NILP (Vminibuffer_list) ? get_minibuffer (0) @@ -458,9 +458,9 @@ mini_window = f->root_window; fset_minibuffer_window (f, mini_window); XWINDOW (mini_window)->mini = 1; - WSET (XWINDOW (mini_window), next, Qnil); - WSET (XWINDOW (mini_window), prev, Qnil); - WSET (XWINDOW (mini_window), frame, frame); + wset_next (XWINDOW (mini_window), Qnil); + wset_prev (XWINDOW (mini_window), Qnil); + wset_frame (XWINDOW (mini_window), frame); /* Put the proper buffer in that window. */ === modified file 'src/indent.c' --- src/indent.c 2012-08-17 21:12:11 +0000 +++ src/indent.c 2012-08-18 01:42:52 +0000 @@ -2003,7 +2003,7 @@ old_buffer = w->buffer; old_charpos = XMARKER (w->pointm)->charpos; old_bytepos = XMARKER (w->pointm)->bytepos; - WSET (w, buffer, Fcurrent_buffer ()); + wset_buffer (w, Fcurrent_buffer ()); set_marker_both (w->pointm, w->buffer, BUF_PT (current_buffer), BUF_PT_BYTE (current_buffer)); } @@ -2146,7 +2146,7 @@ if (BUFFERP (old_buffer)) { - WSET (w, buffer, old_buffer); + wset_buffer (w, old_buffer); set_marker_both (w->pointm, w->buffer, old_charpos, old_bytepos); } === modified file 'src/nsterm.m' --- src/nsterm.m 2012-08-17 23:38:43 +0000 +++ src/nsterm.m 2012-08-18 01:42:52 +0000 @@ -3698,7 +3698,7 @@ { bar = XNS_SCROLL_BAR (window->vertical_scroll_bar); [bar removeFromSuperview]; - WSET (window, vertical_scroll_bar, Qnil); + wset_vertical_scroll_bar (window, Qnil); } ns_clear_frame_area (f, sb_left, top, width, height); UNBLOCK_INPUT; @@ -3709,7 +3709,7 @@ { ns_clear_frame_area (f, sb_left, top, width, height); bar = [[EmacsScroller alloc] initFrame: r window: win]; - WSET (window, vertical_scroll_bar, make_save_value (bar, 0)); + wset_vertical_scroll_bar (window, make_save_value (bar, 0)); } else { @@ -6388,7 +6388,7 @@ { NSTRACE (EmacsScroller_dealloc); if (!NILP (win)) - WSET (XWINDOW (win), vertical_scroll_bar, Qnil); + wset_vertical_scroll_bar (XWINDOW (win), Qnil); [super dealloc]; } === modified file 'src/w32fns.c' --- src/w32fns.c 2012-08-17 23:38:43 +0000 +++ src/w32fns.c 2012-08-18 01:42:52 +0000 @@ -5647,8 +5647,8 @@ /* Set up the frame's root window. */ w = XWINDOW (FRAME_ROOT_WINDOW (f)); - WSET (w, left_col, make_number (0)); - WSET (w, top_line, make_number (0)); + wset_left_col (w, make_number (0)); + wset_top_line (w, make_number (0)); if (CONSP (Vx_max_tooltip_size) && INTEGERP (XCAR (Vx_max_tooltip_size)) @@ -5656,13 +5656,13 @@ && INTEGERP (XCDR (Vx_max_tooltip_size)) && XINT (XCDR (Vx_max_tooltip_size)) > 0) { - WSET (w, total_cols, XCAR (Vx_max_tooltip_size)); - WSET (w, total_lines, XCDR (Vx_max_tooltip_size)); + wset_total_cols (w, XCAR (Vx_max_tooltip_size)); + wset_total_lines (w, XCDR (Vx_max_tooltip_size)); } else { - WSET (w, total_cols, make_number (80)); - WSET (w, total_lines, make_number (40)); + wset_total_cols (w, make_number (80)); + wset_total_lines (w, make_number (40)); } FRAME_TOTAL_COLS (f) = XINT (w->total_cols); @@ -5733,7 +5733,7 @@ /* w->total_cols and FRAME_TOTAL_COLS want the width in columns, not in pixels. */ width /= WINDOW_FRAME_COLUMN_WIDTH (w); - WSET (w, total_cols, make_number (width)); + wset_total_cols (w, make_number (width)); FRAME_TOTAL_COLS (f) = width; adjust_glyphs (f); w->pseudo_window_p = 1; === modified file 'src/w32term.c' --- src/w32term.c 2012-08-17 23:38:43 +0000 +++ src/w32term.c 2012-08-18 01:42:52 +0000 @@ -3670,7 +3670,7 @@ my_destroy_window (f, SCROLL_BAR_W32_WINDOW (bar)); /* Dissociate this scroll bar from its window. */ - WSET (XWINDOW (bar->window), vertical_scroll_bar, Qnil); + wset_vertical_scroll_bar (XWINDOW (bar->window), Qnil); UNBLOCK_INPUT; } @@ -3808,7 +3808,7 @@ w32_set_scroll_bar_thumb (bar, portion, position, whole); XSETVECTOR (barobj, bar); - WSET (w, vertical_scroll_bar, barobj); + wset_vertical_scroll_bar (w, barobj); } === modified file 'src/window.c' --- src/window.c 2012-08-17 21:52:15 +0000 +++ src/window.c 2012-08-18 01:42:52 +0000 @@ -19,6 +19,9 @@ along with GNU Emacs. If not, see . */ #include + +#define WINDOW_INLINE EXTERN_INLINE + #include #include @@ -130,6 +133,118 @@ static EMACS_INT window_scroll_preserve_hpos; static EMACS_INT window_scroll_preserve_vpos; +/* These setters are used only in this file, so they can be private. */ +static inline void +wset_combination_limit (struct window *w, Lisp_Object val) +{ + w->combination_limit = val; +} +static inline void +wset_dedicated (struct window *w, Lisp_Object val) +{ + w->dedicated = val; +} +static inline void +wset_display_table (struct window *w, Lisp_Object val) +{ + w->display_table = val; +} +static inline void +wset_hchild (struct window *w, Lisp_Object val) +{ + w->hchild = val; +} +static inline void +wset_left_fringe_width (struct window *w, Lisp_Object val) +{ + w->left_fringe_width = val; +} +static inline void +wset_left_margin_cols (struct window *w, Lisp_Object val) +{ + w->left_margin_cols = val; +} +static inline void +wset_new_normal (struct window *w, Lisp_Object val) +{ + w->new_normal = val; +} +static inline void +wset_new_total (struct window *w, Lisp_Object val) +{ + w->new_total = val; +} +static inline void +wset_next_buffers (struct window *w, Lisp_Object val) +{ + w->next_buffers = val; +} +static inline void +wset_normal_cols (struct window *w, Lisp_Object val) +{ + w->normal_cols = val; +} +static inline void +wset_normal_lines (struct window *w, Lisp_Object val) +{ + w->normal_lines = val; +} +static inline void +wset_parent (struct window *w, Lisp_Object val) +{ + w->parent = val; +} +static inline void +wset_pointm (struct window *w, Lisp_Object val) +{ + w->pointm = val; +} +static inline void +wset_prev_buffers (struct window *w, Lisp_Object val) +{ + w->prev_buffers = val; +} +static inline void +wset_right_fringe_width (struct window *w, Lisp_Object val) +{ + w->right_fringe_width = val; +} +static inline void +wset_right_margin_cols (struct window *w, Lisp_Object val) +{ + w->right_margin_cols = val; +} +static inline void +wset_scroll_bar_width (struct window *w, Lisp_Object val) +{ + w->scroll_bar_width = val; +} +static inline void +wset_start (struct window *w, Lisp_Object val) +{ + w->start = val; +} +static inline void +wset_temslot (struct window *w, Lisp_Object val) +{ + w->temslot = val; +} +static inline void +wset_vchild (struct window *w, Lisp_Object val) +{ + w->vchild = val; +} +static inline void +wset_vertical_scroll_bar_type (struct window *w, Lisp_Object val) +{ + w->vertical_scroll_bar_type = val; +} +static inline void +wset_window_parameters (struct window *w, Lisp_Object val) +{ + w->window_parameters = val; +} + struct window * decode_live_window (register Lisp_Object window) { @@ -514,7 +629,8 @@ for future use. */) (Lisp_Object window, Lisp_Object limit) { - return WSET (decode_valid_window (window), combination_limit, limit); + wset_combination_limit (decode_valid_window (window), limit); + return limit; } DEFUN ("window-use-time", Fwindow_use_time, Swindow_use_time, 0, 1, 0, @@ -753,7 +869,8 @@ end-trigger value is reset to nil. */) (register Lisp_Object window, Lisp_Object value) { - return WSET (decode_live_window (window), redisplay_end_trigger, value); + wset_redisplay_end_trigger (decode_live_window (window), value); + return value; } DEFUN ("window-edges", Fwindow_edges, Swindow_edges, 0, 1, 0, @@ -1674,7 +1791,8 @@ window, it also makes sure that the window is no more dedicated. */) (Lisp_Object window, Lisp_Object flag) { - return WSET (decode_live_window (window), dedicated, flag); + wset_dedicated (decode_live_window (window), flag); + return flag; } DEFUN ("window-prev-buffers", Fwindow_prev_buffers, Swindow_prev_buffers, @@ -1700,7 +1818,8 @@ window for that buffer, and POS is a window-specific point value. */) (Lisp_Object window, Lisp_Object prev_buffers) { - return WSET (decode_live_window (window), prev_buffers, prev_buffers); + wset_prev_buffers (decode_live_window (window), prev_buffers); + return prev_buffers; } DEFUN ("window-next-buffers", Fwindow_next_buffers, Swindow_next_buffers, @@ -1719,7 +1838,8 @@ NEXT-BUFFERS should be a list of buffers. */) (Lisp_Object window, Lisp_Object next_buffers) { - return WSET (decode_live_window (window), next_buffers, next_buffers); + wset_next_buffers (decode_live_window (window), next_buffers); + return next_buffers; } DEFUN ("window-parameters", Fwindow_parameters, Swindow_parameters, @@ -1756,8 +1876,8 @@ old_alist_elt = Fassq (parameter, w->window_parameters); if (NILP (old_alist_elt)) - WSET (w, window_parameters, - Fcons (Fcons (parameter, value), w->window_parameters)); + wset_window_parameters + (w, Fcons (Fcons (parameter, value), w->window_parameters)); else Fsetcdr (old_alist_elt, value); return value; @@ -1802,7 +1922,8 @@ WINDOW must be a live window and defaults to the selected one. */) (register Lisp_Object window, Lisp_Object table) { - return WSET (decode_live_window (window), display_table, table); + wset_display_table (decode_live_window (window), table); + return table; } /* Record info on buffer window W is displaying @@ -1870,14 +1991,14 @@ if (setflag) { - WSET (n, left_col, o->left_col); - WSET (n, top_line, o->top_line); - WSET (n, total_cols, o->total_cols); - WSET (n, total_lines, o->total_lines); - WSET (n, normal_cols, o->normal_cols); - WSET (o, normal_cols, make_float (1.0)); - WSET (n, normal_lines, o->normal_lines); - WSET (o, normal_lines, make_float (1.0)); + wset_left_col (n, o->left_col); + wset_top_line (n, o->top_line); + wset_total_cols (n, o->total_cols); + wset_total_lines (n, o->total_lines); + wset_normal_cols (n, o->normal_cols); + wset_normal_cols (o, make_float (1.0)); + wset_normal_lines (n, o->normal_lines); + wset_normal_lines (o, make_float (1.0)); n->desired_matrix = n->current_matrix = 0; n->vscroll = 0; memset (&n->cursor, 0, sizeof (n->cursor)); @@ -1887,30 +2008,30 @@ n->phys_cursor_width = -1; n->must_be_updated_p = 0; n->pseudo_window_p = 0; - WSET (n, window_end_vpos, make_number (0)); - WSET (n, window_end_pos, make_number (0)); - WSET (n, window_end_valid, Qnil); + wset_window_end_vpos (n, make_number (0)); + wset_window_end_pos (n, make_number (0)); + wset_window_end_valid (n, Qnil); n->frozen_window_start_p = 0; } tem = o->next; - WSET (n, next, tem); + wset_next (n, tem); if (!NILP (tem)) - WSET (XWINDOW (tem), prev, new); + wset_prev (XWINDOW (tem), new); tem = o->prev; - WSET (n, prev, tem); + wset_prev (n, tem); if (!NILP (tem)) - WSET (XWINDOW (tem), next, new); + wset_next (XWINDOW (tem), new); tem = o->parent; - WSET (n, parent, tem); + wset_parent (n, tem); if (!NILP (tem)) { if (EQ (XWINDOW (tem)->vchild, old)) - WSET (XWINDOW (tem), vchild, new); + wset_vchild (XWINDOW (tem), new); if (EQ (XWINDOW (tem)->hchild, old)) - WSET (XWINDOW (tem), hchild, new); + wset_hchild (XWINDOW (tem), new); } } @@ -1943,34 +2064,34 @@ assign new normal sizes. */ if (NILP (w->prev)) if (horflag) - WSET (p, hchild, child); + wset_hchild (p, child); else - WSET (p, vchild, child); + wset_vchild (p, child); else { - WSET (c, prev, w->prev); - WSET (XWINDOW (w->prev), next, child); + wset_prev (c, w->prev); + wset_next (XWINDOW (w->prev), child); } while (c) { - WSET (c, parent, parent); + wset_parent (c, parent); if (horflag) - WSET (c, normal_cols, - make_float (XFLOATINT (c->total_cols) - / XFLOATINT (p->total_cols))); + wset_normal_cols (c, + make_float (XFLOATINT (c->total_cols) + / XFLOATINT (p->total_cols))); else - WSET (c, normal_lines, - make_float (XFLOATINT (c->total_lines) - / XFLOATINT (p->total_lines))); + wset_normal_lines (c, + make_float (XFLOATINT (c->total_lines) + / XFLOATINT (p->total_lines))); if (NILP (c->next)) { if (!NILP (w->next)) { - WSET (c, next, w->next); - WSET (XWINDOW (c->next), prev, child); + wset_next (c, w->next); + wset_prev (XWINDOW (c->next), child); } c = 0; @@ -1983,8 +2104,8 @@ } /* WINDOW can be deleted now. */ - WSET (w, vchild, Qnil); - WSET (w, hchild, Qnil); + wset_vchild (w, Qnil); + wset_hchild (w, Qnil); } } } @@ -2505,7 +2626,7 @@ if (EQ (w->buffer, obj)) { /* Undedicate WINDOW. */ - WSET (w, dedicated, Qnil); + wset_dedicated (w, Qnil); /* Make WINDOW show the buffer returned by other_buffer_safely, don't run any hooks. */ set_window_buffer @@ -2727,7 +2848,7 @@ /* Resize child windows vertically. */ XSETINT (delta, XINT (r->total_lines) - XINT (w->total_lines)); - WSET (w, top_line, r->top_line); + wset_top_line (w, r->top_line); resize_root_window (window, delta, Qnil, Qnil); if (window_resize_check (w, 0)) window_resize_apply (w, 0); @@ -2743,10 +2864,10 @@ /* Resize child windows horizontally. */ if (!resize_failed) { - WSET (w, left_col, r->left_col); + wset_left_col (w, r->left_col); XSETINT (delta, XINT (r->total_cols) - XINT (w->total_cols)); - WSET (w, left_col, r->left_col); + wset_left_col (w, r->left_col); resize_root_window (window, delta, Qt, Qnil); if (window_resize_check (w, 1)) window_resize_apply (w, 1); @@ -2774,32 +2895,32 @@ { sibling = w->prev; s = XWINDOW (sibling); - WSET (s, next, w->next); + wset_next (s, w->next); if (!NILP (s->next)) - WSET (XWINDOW (s->next), prev, sibling); + wset_prev (XWINDOW (s->next), sibling); } else /* Get SIBLING below (on the right of) WINDOW. */ { sibling = w->next; s = XWINDOW (sibling); - WSET (s, prev, Qnil); + wset_prev (s, Qnil); if (!NILP (XWINDOW (w->parent)->vchild)) - WSET (XWINDOW (w->parent), vchild, sibling); + wset_vchild (XWINDOW (w->parent), sibling); else - WSET (XWINDOW (w->parent), hchild, sibling); + wset_hchild (XWINDOW (w->parent), sibling); } /* Delete ROOT and all child windows of ROOT. */ if (!NILP (r->vchild)) { delete_all_child_windows (r->vchild); - WSET (r, vchild, Qnil); + wset_vchild (r, Qnil); } else if (!NILP (r->hchild)) { delete_all_child_windows (r->hchild); - WSET (r, hchild, Qnil); + wset_hchild (r, Qnil); } replace_window (root, window, 1); @@ -2826,7 +2947,7 @@ pos = *vmotion (startpos, -top, w); set_marker_both (w->start, w->buffer, pos.bufpos, pos.bytepos); - WSET (w, window_end_valid, Qnil); + wset_window_end_valid (w, Qnil); w->start_at_line_beg = (pos.bytepos == BEGV_BYTE || FETCH_BYTE (pos.bytepos - 1) == '\n'); /* We need to do this, so that the window-scroll-functions @@ -2917,14 +3038,14 @@ { if (WINDOW_LEFT_MARGIN_COLS (w) > 0) { - WSET (w, left_margin_cols, make_number (margin_cols / 2)); - WSET (w, right_margin_cols, make_number (margin_cols / 2)); + wset_left_margin_cols (w, make_number (margin_cols / 2)); + wset_right_margin_cols (w, make_number (margin_cols / 2)); } else - WSET (w, right_margin_cols, make_number (margin_cols)); + wset_right_margin_cols (w, make_number (margin_cols)); } else - WSET (w, left_margin_cols, make_number (margin_cols)); + wset_left_margin_cols (w, make_number (margin_cols)); return 1; } @@ -3024,7 +3145,7 @@ ptrdiff_t count = SPECPDL_INDEX (); int samebuf = EQ (buffer, w->buffer); - WSET (w, buffer, buffer); + wset_buffer (w, buffer); if (EQ (window, selected_window)) BSET (b, last_selected_window, window); @@ -3037,10 +3158,10 @@ BSET (b, display_count, make_number (XINT (BVAR (b, display_count)) + 1)); BSET (b, display_time, Fcurrent_time ()); - WSET (w, window_end_pos, make_number (0)); - WSET (w, window_end_vpos, make_number (0)); + wset_window_end_pos (w, make_number (0)); + wset_window_end_vpos (w, make_number (0)); memset (&w->last_cursor, 0, sizeof w->last_cursor); - WSET (w, window_end_valid, Qnil); + wset_window_end_valid (w, Qnil); if (!(keep_margins_p && samebuf)) { /* If we're not actually changing the buffer, don't reset hscroll and vscroll. This case happens for example when called from @@ -3085,8 +3206,8 @@ Lisp_Object save_left = w->left_margin_cols; Lisp_Object save_right = w->right_margin_cols; - WSET (w, left_margin_cols, Qnil); - WSET (w, right_margin_cols, Qnil); + wset_left_margin_cols (w, Qnil); + wset_right_margin_cols (w, Qnil); Fset_window_fringes (window, BVAR (b, left_fringe_width), BVAR (b, right_fringe_width), @@ -3096,8 +3217,8 @@ BVAR (b, scroll_bar_width), BVAR (b, vertical_scroll_bar_type), Qnil); - WSET (w, left_margin_cols, save_left); - WSET (w, right_margin_cols, save_right); + wset_left_margin_cols (w, save_left); + wset_right_margin_cols (w, save_right); Fset_window_margins (window, BVAR (b, left_margin_cols), BVAR (b, right_margin_cols)); @@ -3156,7 +3277,7 @@ else /* WINDOW is weakly dedicated to its buffer, reset dedication. */ - WSET (w, dedicated, Qnil); + wset_dedicated (w, Qnil); call1 (Qrecord_window_buffer, window); } @@ -3302,17 +3423,17 @@ replace_window (window, parent, 1); - WSET (o, next, Qnil); - WSET (o, prev, Qnil); - WSET (o, parent, parent); + wset_next (o, Qnil); + wset_prev (o, Qnil); + wset_parent (o, parent); - WSET (p, hchild, horflag ? window : Qnil); - WSET (p, vchild, horflag ? Qnil : window); - WSET (p, start, Qnil); - WSET (p, pointm, Qnil); - WSET (p, buffer, Qnil); - WSET (p, combination_limit, Qnil); - WSET (p, window_parameters, Qnil); + wset_hchild (p, horflag ? window : Qnil); + wset_vchild (p, horflag ? Qnil : window); + wset_start (p, Qnil); + wset_pointm (p, Qnil); + wset_buffer (p, Qnil); + wset_combination_limit (p, Qnil); + wset_window_parameters (p, Qnil); } /* Make new window from scratch. */ @@ -3325,19 +3446,19 @@ w = allocate_window (); /* Initialize Lisp data. Note that allocate_window initializes all Lisp data to nil, so do it only for slots which should not be nil. */ - WSET (w, left_col, make_number (0)); - WSET (w, top_line, make_number (0)); - WSET (w, total_lines, make_number (0)); - WSET (w, total_cols, make_number (0)); - WSET (w, normal_lines, make_float (1.0)); - WSET (w, normal_cols, make_float (1.0)); - WSET (w, new_total, make_number (0)); - WSET (w, new_normal, make_number (0)); - WSET (w, start, Fmake_marker ()); - WSET (w, pointm, Fmake_marker ()); - WSET (w, vertical_scroll_bar_type, Qt); - WSET (w, window_end_pos, make_number (0)); - WSET (w, window_end_vpos, make_number (0)); + wset_left_col (w, make_number (0)); + wset_top_line (w, make_number (0)); + wset_total_lines (w, make_number (0)); + wset_total_cols (w, make_number (0)); + wset_normal_lines (w, make_float (1.0)); + wset_normal_cols (w, make_float (1.0)); + wset_new_total (w, make_number (0)); + wset_new_normal (w, make_number (0)); + wset_start (w, Fmake_marker ()); + wset_pointm (w, Fmake_marker ()); + wset_vertical_scroll_bar_type (w, Qt); + wset_window_end_pos (w, make_number (0)); + wset_window_end_vpos (w, make_number (0)); /* Initialize non-Lisp data. Note that allocate_window zeroes out all non-Lisp data, so do it only for slots which should not be zero. */ @@ -3368,9 +3489,9 @@ CHECK_NUMBER (size); if (NILP (add)) - WSET (w, new_total, size); + wset_new_total (w, size); else - WSET (w, new_total, make_number (XINT (w->new_total) + XINT (size))); + wset_new_total (w, make_number (XINT (w->new_total) + XINT (size))); return w->new_total; } @@ -3383,7 +3504,8 @@ Note: This function does not operate on any child windows of WINDOW. */) (Lisp_Object window, Lisp_Object size) { - return WSET (decode_valid_window (window), new_normal, size); + wset_new_normal (decode_valid_window (window), size); + return size; } /* Return 1 if setting w->total_lines (w->total_cols if HORFLAG is @@ -3484,17 +3606,17 @@ parent window has been set *before*. */ if (horflag) { - WSET (w, total_cols, w->new_total); + wset_total_cols (w, w->new_total); if (NUMBERP (w->new_normal)) - WSET (w, normal_cols, w->new_normal); + wset_normal_cols (w, w->new_normal); pos = XINT (w->left_col); } else { - WSET (w, total_lines, w->new_total); + wset_total_lines (w, w->new_total); if (NUMBERP (w->new_normal)) - WSET (w, normal_lines, w->new_normal); + wset_normal_lines (w, w->new_normal); pos = XINT (w->top_line); } @@ -3506,9 +3628,9 @@ while (c) { if (horflag) - WSET (c, left_col, make_number (pos)); + wset_left_col (c, make_number (pos)); else - WSET (c, top_line, make_number (pos)); + wset_top_line (c, make_number (pos)); window_resize_apply (c, horflag); if (!horflag) pos = pos + XINT (c->total_lines); @@ -3522,9 +3644,9 @@ while (c) { if (horflag) - WSET (c, left_col, make_number (pos)); + wset_left_col (c, make_number (pos)); else - WSET (c, top_line, make_number (pos)); + wset_top_line (c, make_number (pos)); window_resize_apply (c, horflag); if (horflag) pos = pos + XINT (c->total_cols); @@ -3605,13 +3727,13 @@ - ((FRAME_HAS_MINIBUF_P (f) && !FRAME_MINIBUF_ONLY_P (f)) ? 1 : 0))); - WSET (r, top_line, make_number (FRAME_TOP_MARGIN (f))); + wset_top_line (r, make_number (FRAME_TOP_MARGIN (f))); if (NILP (r->vchild) && NILP (r->hchild)) /* For a leaf root window just set the size. */ if (horflag) - WSET (r, total_cols, make_number (new_size)); + wset_total_cols (r, make_number (new_size)); else - WSET (r, total_lines, make_number (new_size)); + wset_total_lines (r, make_number (new_size)); else { /* old_size is the old size of the frame's root window. */ @@ -3646,9 +3768,9 @@ root = f->selected_window; Fdelete_other_windows_internal (root, Qnil); if (horflag) - WSET (XWINDOW (root), total_cols, make_number (new_size)); + wset_total_cols (XWINDOW (root), make_number (new_size)); else - WSET (XWINDOW (root), total_lines, make_number (new_size)); + wset_total_lines (XWINDOW (root), make_number (new_size)); } } } @@ -3658,13 +3780,13 @@ { m = XWINDOW (mini); if (horflag) - WSET (m, total_cols, make_number (size)); + wset_total_cols (m, make_number (size)); else { /* Are we sure we always want 1 line here? */ - WSET (m, total_lines, make_number (1)); - WSET (m, top_line, - make_number (XINT (r->top_line) + XINT (r->total_lines))); + wset_total_lines (m, make_number (1)); + wset_top_line + (m, make_number (XINT (r->top_line) + XINT (r->total_lines))); } } } @@ -3745,15 +3867,14 @@ { p = XWINDOW (o->parent); /* Temporarily pretend we split the parent window. */ - WSET (p, new_total, - make_number (XINT (horflag ? p->total_cols : p->total_lines) + wset_new_total + (p, make_number (XINT (horflag ? p->total_cols : p->total_lines) - XINT (total_size))); if (!window_resize_check (p, horflag)) error ("Window sizes don't fit"); else /* Undo the temporary pretension. */ - WSET (p, new_total, - horflag ? p->total_cols : p->total_lines); + wset_new_total (p, horflag ? p->total_cols : p->total_lines); } else { @@ -3777,10 +3898,10 @@ p = XWINDOW (o->parent); /* Store value of `window-combination-limit' in new parent's combination_limit slot. */ - WSET (p, combination_limit, Vwindow_combination_limit); + wset_combination_limit (p, Vwindow_combination_limit); /* These get applied below. */ - WSET (p, new_total, horflag ? o->total_cols : o->total_lines); - WSET (p, new_normal, new_normal); + wset_new_total (p, horflag ? o->total_cols : o->total_lines); + wset_new_normal (p, new_normal); } else p = XWINDOW (o->parent); @@ -3789,62 +3910,62 @@ FRAME_WINDOW_SIZES_CHANGED (f) = 1; new = make_window (); n = XWINDOW (new); - WSET (n, frame, frame); - WSET (n, parent, o->parent); - WSET (n, vchild, Qnil); - WSET (n, hchild, Qnil); + wset_frame (n, frame); + wset_parent (n, o->parent); + wset_vchild (n, Qnil); + wset_hchild (n, Qnil); if (EQ (side, Qabove) || EQ (side, Qleft)) { - WSET (n, prev, o->prev); + wset_prev (n, o->prev); if (NILP (n->prev)) if (horflag) - WSET (p, hchild, new); + wset_hchild (p, new); else - WSET (p, vchild, new); + wset_vchild (p, new); else - WSET (XWINDOW (n->prev), next, new); - WSET (n, next, old); - WSET (o, prev, new); + wset_next (XWINDOW (n->prev), new); + wset_next (n, old); + wset_prev (o, new); } else { - WSET (n, next, o->next); + wset_next (n, o->next); if (!NILP (n->next)) - WSET (XWINDOW (n->next), prev, new); - WSET (n, prev, old); - WSET (o, next, new); + wset_prev (XWINDOW (n->next), new); + wset_prev (n, old); + wset_next (o, new); } - WSET (n, buffer, Qt); - WSET (n, window_end_valid, Qnil); + wset_buffer (n, Qt); + wset_window_end_valid (n, Qnil); memset (&n->last_cursor, 0, sizeof n->last_cursor); /* Get special geometry settings from reference window. */ - WSET (n, left_margin_cols, r->left_margin_cols); - WSET (n, right_margin_cols, r->right_margin_cols); - WSET (n, left_fringe_width, r->left_fringe_width); - WSET (n, right_fringe_width, r->right_fringe_width); + wset_left_margin_cols (n, r->left_margin_cols); + wset_right_margin_cols (n, r->right_margin_cols); + wset_left_fringe_width (n, r->left_fringe_width); + wset_right_fringe_width (n, r->right_fringe_width); n->fringes_outside_margins = r->fringes_outside_margins; - WSET (n, scroll_bar_width, r->scroll_bar_width); - WSET (n, vertical_scroll_bar_type, r->vertical_scroll_bar_type); + wset_scroll_bar_width (n, r->scroll_bar_width); + wset_vertical_scroll_bar_type (n, r->vertical_scroll_bar_type); /* Directly assign orthogonal coordinates and sizes. */ if (horflag) { - WSET (n, top_line, o->top_line); - WSET (n, total_lines, o->total_lines); + wset_top_line (n, o->top_line); + wset_total_lines (n, o->total_lines); } else { - WSET (n, left_col, o->left_col); - WSET (n, total_cols, o->total_cols); + wset_left_col (n, o->left_col); + wset_total_cols (n, o->total_cols); } /* Iso-coordinates and sizes are assigned by window_resize_apply, get them ready here. */ - WSET (n, new_total, total_size); - WSET (n, new_normal, normal_size); + wset_new_total (n, total_size); + wset_new_normal (n, normal_size); BLOCK_INPUT; window_resize_apply (p, horflag); @@ -3910,20 +4031,20 @@ before_sibling = 1; sibling = w->next; s = XWINDOW (sibling); - WSET (s, prev, Qnil); + wset_prev (s, Qnil); if (horflag) - WSET (p, hchild, sibling); + wset_hchild (p, sibling); else - WSET (p, vchild, sibling); + wset_vchild (p, sibling); } else /* Get SIBLING above (on the left of) WINDOW. */ { sibling = w->prev; s = XWINDOW (sibling); - WSET (s, next, w->next); + wset_next (s, w->next); if (!NILP (s->next)) - WSET (XWINDOW (s->next), prev, sibling); + wset_prev (XWINDOW (s->next), sibling); } if (window_resize_check (r, horflag) @@ -3950,25 +4071,25 @@ Vwindow_list = Qnil; FRAME_WINDOW_SIZES_CHANGED (f) = 1; - WSET (w, next, Qnil); /* Don't delete w->next too. */ + wset_next (w, Qnil); /* Don't delete w->next too. */ free_window_matrices (w); if (!NILP (w->vchild)) { delete_all_child_windows (w->vchild); - WSET (w, vchild, Qnil); + wset_vchild (w, Qnil); } else if (!NILP (w->hchild)) { delete_all_child_windows (w->hchild); - WSET (w, hchild, Qnil); + wset_hchild (w, Qnil); } else if (!NILP (w->buffer)) { unshow_buffer (w); unchain_marker (XMARKER (w->pointm)); unchain_marker (XMARKER (w->start)); - WSET (w, buffer, Qnil); + wset_buffer (w, Qnil); } if (NILP (s->prev) && NILP (s->next)) @@ -3979,11 +4100,11 @@ replace_window (parent, sibling, 0); /* Have SIBLING inherit the following three slot values from PARENT (the combination_limit slot is not inherited). */ - WSET (s, normal_cols, p->normal_cols); - WSET (s, normal_lines, p->normal_lines); + wset_normal_cols (s, p->normal_cols); + wset_normal_lines (s, p->normal_lines); /* Mark PARENT as deleted. */ - WSET (p, vchild, Qnil); - WSET (p, hchild, Qnil); + wset_vchild (p, Qnil); + wset_hchild (p, Qnil); /* Try to merge SIBLING into its new parent. */ recombine_windows (sibling); } @@ -4030,17 +4151,17 @@ { if (before_sibling) { - WSET (s, prev, window); + wset_prev (s, window); if (horflag) - WSET (p, hchild, window); + wset_hchild (p, window); else - WSET (p, vchild, window); + wset_vchild (p, window); } else { - WSET (s, next, window); + wset_next (s, window); if (!NILP (w->next)) - WSET (XWINDOW (w->next), prev, window); + wset_prev (XWINDOW (w->next), window); } error ("Deletion failed"); } @@ -4074,10 +4195,10 @@ window_resize_apply (r, 0); /* Grow the mini-window. */ - WSET (w, top_line, - make_number (XFASTINT (r->top_line) + XFASTINT (r->total_lines))); - WSET (w, total_lines, - make_number (XFASTINT (w->total_lines) - XINT (value))); + wset_top_line + (w, make_number (XFASTINT (r->top_line) + XFASTINT (r->total_lines))); + wset_total_lines + (w, make_number (XFASTINT (w->total_lines) - XINT (value))); w->last_modified = 0; w->last_overlay_modified = 0; @@ -4111,9 +4232,9 @@ window_resize_apply (r, 0); /* Shrink the mini-window. */ - WSET (w, top_line, - make_number (XFASTINT (r->top_line) + XFASTINT (r->total_lines))); - WSET (w, total_lines, make_number (1)); + wset_top_line (w, make_number (XFASTINT (r->top_line) + + XFASTINT (r->total_lines))); + wset_total_lines (w, make_number (1)); w->last_modified = 0; w->last_overlay_modified = 0; @@ -4154,9 +4275,9 @@ BLOCK_INPUT; window_resize_apply (r, 0); - WSET (w, total_lines, w->new_total); - WSET (w, top_line, - make_number (XINT (r->top_line) + XINT (r->total_lines))); + wset_total_lines (w, w->new_total); + wset_top_line (w, make_number (XINT (r->top_line) + + XINT (r->total_lines))); windows_or_buffers_changed++; FRAME_WINDOW_SIZES_CHANGED (f) = 1; @@ -5224,7 +5345,7 @@ /* Set the new window start. */ set_marker_both (w->start, w->buffer, charpos, bytepos); - WSET (w, window_end_valid, Qnil); + wset_window_end_valid (w, Qnil); w->optional_new_start = 1; @@ -5542,34 +5663,34 @@ p = SAVED_WINDOW_N (saved_windows, k); window = p->window; w = XWINDOW (window); - WSET (w, next, Qnil); + wset_next (w, Qnil); if (!NILP (p->parent)) - WSET (w, parent, SAVED_WINDOW_N - (saved_windows, XFASTINT (p->parent))->window); + wset_parent + (w, SAVED_WINDOW_N (saved_windows, XFASTINT (p->parent))->window); else - WSET (w, parent, Qnil); + wset_parent (w, Qnil); if (!NILP (p->prev)) { - WSET (w, prev, SAVED_WINDOW_N - (saved_windows, XFASTINT (p->prev))->window); - WSET (XWINDOW (w->prev), next, p->window); + wset_prev + (w, SAVED_WINDOW_N (saved_windows, XFASTINT (p->prev))->window); + wset_next (XWINDOW (w->prev), p->window); } else { - WSET (w, prev, Qnil); + wset_prev (w, Qnil); if (!NILP (w->parent)) { if (EQ (p->total_cols, XWINDOW (w->parent)->total_cols)) { - WSET (XWINDOW (w->parent), vchild, p->window); - WSET (XWINDOW (w->parent), hchild, Qnil); + wset_vchild (XWINDOW (w->parent), p->window); + wset_hchild (XWINDOW (w->parent), Qnil); } else { - WSET (XWINDOW (w->parent), hchild, p->window); - WSET (XWINDOW (w->parent), vchild, Qnil); + wset_hchild (XWINDOW (w->parent), p->window); + wset_vchild (XWINDOW (w->parent), Qnil); } } } @@ -5577,25 +5698,25 @@ /* If we squirreled away the buffer in the window's height, restore it now. */ if (BUFFERP (w->total_lines)) - WSET (w, buffer, w->total_lines); - WSET (w, left_col, p->left_col); - WSET (w, top_line, p->top_line); - WSET (w, total_cols, p->total_cols); - WSET (w, total_lines, p->total_lines); - WSET (w, normal_cols, p->normal_cols); - WSET (w, normal_lines, p->normal_lines); + wset_buffer (w, w->total_lines); + wset_left_col (w, p->left_col); + wset_top_line (w, p->top_line); + wset_total_cols (w, p->total_cols); + wset_total_lines (w, p->total_lines); + wset_normal_cols (w, p->normal_cols); + wset_normal_lines (w, p->normal_lines); w->hscroll = XFASTINT (p->hscroll); w->min_hscroll = XFASTINT (p->min_hscroll); - WSET (w, display_table, p->display_table); - WSET (w, left_margin_cols, p->left_margin_cols); - WSET (w, right_margin_cols, p->right_margin_cols); - WSET (w, left_fringe_width, p->left_fringe_width); - WSET (w, right_fringe_width, p->right_fringe_width); + wset_display_table (w, p->display_table); + wset_left_margin_cols (w, p->left_margin_cols); + wset_right_margin_cols (w, p->right_margin_cols); + wset_left_fringe_width (w, p->left_fringe_width); + wset_right_fringe_width (w, p->right_fringe_width); w->fringes_outside_margins = !NILP (p->fringes_outside_margins); - WSET (w, scroll_bar_width, p->scroll_bar_width); - WSET (w, vertical_scroll_bar_type, p->vertical_scroll_bar_type); - WSET (w, dedicated, p->dedicated); - WSET (w, combination_limit, p->combination_limit); + wset_scroll_bar_width (w, p->scroll_bar_width); + wset_vertical_scroll_bar_type (w, p->vertical_scroll_bar_type); + wset_dedicated (w, p->dedicated); + wset_combination_limit (w, p->combination_limit); /* Restore any window parameters that have been saved. Parameters that have not been saved are left alone. */ for (tem = p->window_parameters; CONSP (tem); tem = XCDR (tem)) @@ -5624,24 +5745,24 @@ /* Reinstall the saved buffer and pointers into it. */ if (NILP (p->buffer)) /* An internal window. */ - WSET (w, buffer, p->buffer); + wset_buffer (w, p->buffer); else if (!NILP (BVAR (XBUFFER (p->buffer), name))) /* If saved buffer is alive, install it. */ { - WSET (w, buffer, p->buffer); - w->start_at_line_beg = !NILP (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 (BVAR (XBUFFER (w->buffer), mark), - p->mark, w->buffer); + wset_buffer (w, p->buffer); + w->start_at_line_beg = !NILP (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 (BVAR (XBUFFER (w->buffer), mark), + p->mark, w->buffer); - /* As documented in Fcurrent_window_configuration, don't - restore the location of point in the buffer which was - current when the window configuration was recorded. */ - if (!EQ (p->buffer, new_current_buffer) - && XBUFFER (p->buffer) == current_buffer) - Fgoto_char (w->pointm); + /* As documented in Fcurrent_window_configuration, don't + restore the location of point in the buffer which was + current when the window configuration was recorded. */ + if (!EQ (p->buffer, new_current_buffer) + && XBUFFER (p->buffer) == current_buffer) + Fgoto_char (w->pointm); } else if (!NILP (w->buffer) && !NILP (BVAR (XBUFFER (w->buffer), name))) @@ -5662,7 +5783,8 @@ else if (STRINGP (auto_buffer_name = Fwindow_parameter (window, Qauto_buffer_name)) && SCHARS (auto_buffer_name) != 0 - && !NILP (WSET (w, buffer, Fget_buffer_create (auto_buffer_name)))) + && (wset_buffer (w, Fget_buffer_create (auto_buffer_name)), + !NILP (w->buffer))) { set_marker_restricted (w->start, make_number (0), w->buffer); @@ -5677,7 +5799,7 @@ avoid showing an unimportant buffer and, if necessary, to recreate *scratch* in the course (part of Juanma's bs-show scenario from March 2011). */ - WSET (w, buffer, other_buffer_safely (Fcurrent_buffer ())); + wset_buffer (w, other_buffer_safely (Fcurrent_buffer ())); /* This will set the markers to beginning of visible range. */ set_marker_restricted (w->start, @@ -5689,7 +5811,7 @@ /* Record this window as dead. */ dead_windows = Fcons (window, dead_windows); /* Make sure window is no more dedicated. */ - WSET (w, dedicated, Qnil); + wset_dedicated (w, Qnil); } } @@ -5789,24 +5911,25 @@ /* Delete WINDOW's siblings (we traverse postorderly). */ delete_all_child_windows (w->next); - WSET (w, total_lines, w->buffer); /* See Fset_window_configuration for excuse. */ + /* See Fset_window_configuration for excuse. */ + wset_total_lines (w, w->buffer); if (!NILP (w->vchild)) { delete_all_child_windows (w->vchild); - WSET (w, vchild, Qnil); + wset_vchild (w, Qnil); } else if (!NILP (w->hchild)) { delete_all_child_windows (w->hchild); - WSET (w, hchild, Qnil); + wset_hchild (w, Qnil); } else if (!NILP (w->buffer)) { unshow_buffer (w); unchain_marker (XMARKER (w->pointm)); unchain_marker (XMARKER (w->start)); - WSET (w, buffer, Qnil); + wset_buffer (w, Qnil); } Vwindow_list = Qnil; @@ -5898,7 +6021,7 @@ p = SAVED_WINDOW_N (vector, i); w = XWINDOW (window); - WSET (w, temslot, make_number (i)); i++; + wset_temslot (w, make_number (i)); i++; p->window = window; p->buffer = w->buffer; p->left_col = w->left_col; @@ -6101,8 +6224,8 @@ if (!EQ (w->left_margin_cols, left_width) || !EQ (w->right_margin_cols, right_width)) { - WSET (w, left_margin_cols, left_width); - WSET (w, right_margin_cols, right_width); + wset_left_margin_cols (w, left_width); + wset_right_margin_cols (w, right_width); adjust_window_margins (w); @@ -6163,14 +6286,14 @@ || !EQ (w->right_fringe_width, right_width) || w->fringes_outside_margins != outside)) { - WSET (w, left_fringe_width, left_width); - WSET (w, right_fringe_width, right_width); + wset_left_fringe_width (w, left_width); + wset_right_fringe_width (w, right_width); w->fringes_outside_margins = outside; adjust_window_margins (w); clear_glyph_matrix (w->current_matrix); - WSET (w, window_end_valid, Qnil); + wset_window_end_valid (w, Qnil); ++windows_or_buffers_changed; adjust_glyphs (XFRAME (WINDOW_FRAME (w))); @@ -6235,13 +6358,13 @@ if (!EQ (w->scroll_bar_width, width) || !EQ (w->vertical_scroll_bar_type, vertical_type)) { - WSET (w, scroll_bar_width, width); - WSET (w, vertical_scroll_bar_type, vertical_type); + wset_scroll_bar_width (w, width); + wset_vertical_scroll_bar_type (w, vertical_type); adjust_window_margins (w); clear_glyph_matrix (w->current_matrix); - WSET (w, window_end_valid, Qnil); + wset_window_end_valid (w, Qnil); ++windows_or_buffers_changed; adjust_glyphs (XFRAME (WINDOW_FRAME (w))); === modified file 'src/window.h' --- src/window.h 2012-08-16 07:58:24 +0000 +++ src/window.h 2012-08-18 01:42:52 +0000 @@ -22,6 +22,11 @@ #include "dispextern.h" +INLINE_HEADER_BEGIN +#ifndef WINDOW_INLINE +# define WINDOW_INLINE INLINE +#endif + extern Lisp_Object Qleft, Qright; /* Windows are allocated as if they were vectors, but then the @@ -86,10 +91,6 @@ int hpos, vpos; }; -/* Most code should use this macro to set Lisp fields in struct window. */ - -#define WSET(w, field, value) ((w)->field = (value)) - struct window { /* This is for Lisp; the terminal code does not refer to it. */ @@ -348,6 +349,75 @@ ptrdiff_t window_end_bytepos; }; +/* Most code should use these functions to set Lisp fields in struct + window. */ +WINDOW_INLINE void +wset_buffer (struct window *w, Lisp_Object val) +{ + w->buffer = val; +} +WINDOW_INLINE void +wset_frame (struct window *w, Lisp_Object val) +{ + w->frame = val; +} +WINDOW_INLINE void +wset_left_col (struct window *w, Lisp_Object val) +{ + w->left_col = val; +} +WINDOW_INLINE void +wset_next (struct window *w, Lisp_Object val) +{ + w->next = val; +} +WINDOW_INLINE void +wset_prev (struct window *w, Lisp_Object val) +{ + w->prev = val; +} +WINDOW_INLINE void +wset_redisplay_end_trigger (struct window *w, Lisp_Object val) +{ + w->redisplay_end_trigger = val; +} +WINDOW_INLINE void +wset_top_line (struct window *w, Lisp_Object val) +{ + w->top_line = val; +} +WINDOW_INLINE void +wset_total_cols (struct window *w, Lisp_Object val) +{ + w->total_cols = val; +} +WINDOW_INLINE void +wset_total_lines (struct window *w, Lisp_Object val) +{ + w->total_lines = val; +} +WINDOW_INLINE void +wset_vertical_scroll_bar (struct window *w, Lisp_Object val) +{ + w->vertical_scroll_bar = val; +} +WINDOW_INLINE void +wset_window_end_pos (struct window *w, Lisp_Object val) +{ + w->window_end_pos = val; +} +WINDOW_INLINE void +wset_window_end_valid (struct window *w, Lisp_Object val) +{ + w->window_end_valid = val; +} +WINDOW_INLINE void +wset_window_end_vpos (struct window *w, Lisp_Object val) +{ + w->window_end_vpos = val; +} + + /* 1 if W is a minibuffer window. */ #define MINI_WINDOW_P(W) ((W)->mini) @@ -916,4 +986,6 @@ extern void syms_of_window (void); extern void keys_of_window (void); +INLINE_HEADER_END + #endif /* not WINDOW_H_INCLUDED */ === modified file 'src/xdisp.c' --- src/xdisp.c 2012-08-17 21:52:15 +0000 +++ src/xdisp.c 2012-08-18 01:42:52 +0000 @@ -365,6 +365,28 @@ static Lisp_Object Qmargin, Qpointer; static Lisp_Object Qline_height; +/* These setters are used only in this file, so they can be private. */ +static inline void +wset_base_line_number (struct window *w, Lisp_Object val) +{ + w->base_line_number = val; +} +static inline void +wset_base_line_pos (struct window *w, Lisp_Object val) +{ + w->base_line_pos = val; +} +static inline void +wset_column_number_displayed (struct window *w, Lisp_Object val) +{ + w->column_number_displayed = val; +} +static inline void +wset_region_showing (struct window *w, Lisp_Object val) +{ + w->region_showing = val; +} + #ifdef HAVE_WINDOW_SYSTEM /* Test if overflow newline into fringe. Called with iterator IT @@ -7981,7 +8003,7 @@ /* Since we are *trying* to run these functions, don't try to run them again, even if they get an error. */ - WSET (it->w, redisplay_end_trigger, Qnil); + wset_redisplay_end_trigger (it->w, Qnil); Frun_hook_with_args (3, args); /* Notice if it changed the face of the character we are on. */ @@ -9969,7 +9991,7 @@ set_buffer_internal_1 (XBUFFER (buffer)); if (w) { - WSET (w, buffer, buffer); + wset_buffer (w, buffer); set_marker_both (w->pointm, buffer, BEG, BEG_BYTE); } @@ -10054,7 +10076,7 @@ charpos = AREF (vector, 5); bytepos = AREF (vector, 6); - WSET (w, buffer, buffer); + wset_buffer (w, buffer); set_marker_both (w->pointm, buffer, XFASTINT (charpos), XFASTINT (bytepos)); } @@ -13266,12 +13288,12 @@ if ((it.glyph_row - 1)->displays_text_p) { if (XFASTINT (w->window_end_vpos) < this_line_vpos) - WSET (w, window_end_vpos, make_number (this_line_vpos)); + wset_window_end_vpos (w, make_number (this_line_vpos)); } else if (XFASTINT (w->window_end_vpos) == this_line_vpos && this_line_vpos > 0) - WSET (w, window_end_vpos, make_number (this_line_vpos - 1)); - WSET (w, window_end_valid, Qnil); + wset_window_end_vpos (w, make_number (this_line_vpos - 1)); + wset_window_end_valid (w, Qnil); /* Update hint: No need to try to scroll in update_window. */ w->desired_matrix->no_scrolling_p = 1; @@ -13737,7 +13759,7 @@ if (accurate_p) { - WSET (w, window_end_valid, w->buffer); + wset_window_end_valid (w, w->buffer); w->update_mode_line = 0; } } @@ -14845,7 +14867,7 @@ if (!just_this_one_p || current_buffer->clip_changed || BEG_UNCHANGED < CHARPOS (startp)) - WSET (w, base_line_number, Qnil); + wset_base_line_number (w, Qnil); /* If cursor ends up on a partially visible line, treat that as being off the bottom of the screen. */ @@ -15470,7 +15492,7 @@ if (XMARKER (w->start)->buffer == current_buffer) compute_window_start_on_continuation_line (w); - WSET (w, window_end_valid, Qnil); + wset_window_end_valid (w, Qnil); } /* Some sanity checks. */ @@ -15581,11 +15603,11 @@ w->force_start = 0; w->vscroll = 0; - WSET (w, window_end_valid, Qnil); + wset_window_end_valid (w, Qnil); /* Forget any recorded base line for line number display. */ if (!buffer_unchanged_p) - WSET (w, base_line_number, Qnil); + wset_base_line_number (w, Qnil); /* Redisplay the mode line. Select the buffer properly for that. Also, run the hook window-scroll-functions @@ -15799,7 +15821,7 @@ || current_buffer->clip_changed || BEG_UNCHANGED < CHARPOS (startp)) /* Forget any recorded base line for line number display. */ - WSET (w, base_line_number, Qnil); + wset_base_line_number (w, Qnil); if (!cursor_row_fully_visible_p (w, 1, 0)) { @@ -15870,7 +15892,7 @@ /* Forget any previously recorded base line for line number display. */ if (!buffer_unchanged_p) - WSET (w, base_line_number, Qnil); + wset_base_line_number (w, Qnil); /* Determine the window start relative to point. */ init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID); @@ -16128,8 +16150,8 @@ if (!line_number_displayed && !BUFFERP (w->base_line_pos)) { - WSET (w, base_line_pos, Qnil); - WSET (w, base_line_number, Qnil); + wset_base_line_pos (w, Qnil); + wset_base_line_number (w, Qnil); } finish_menu_bars: @@ -16306,10 +16328,10 @@ eassert (MATRIX_ROW_DISPLAYS_TEXT_P (last_text_row)); w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row); - WSET (w, window_end_pos, - make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row))); - WSET (w, window_end_vpos, - make_number (MATRIX_ROW_VPOS (last_text_row, w->desired_matrix))); + wset_window_end_pos + (w, make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row))); + wset_window_end_vpos + (w, make_number (MATRIX_ROW_VPOS (last_text_row, w->desired_matrix))); eassert (MATRIX_ROW (w->desired_matrix, XFASTINT (w->window_end_vpos))->displays_text_p); @@ -16317,12 +16339,12 @@ else { w->window_end_bytepos = Z_BYTE - ZV_BYTE; - WSET (w, window_end_pos, make_number (Z - ZV)); - WSET (w, window_end_vpos, make_number (0)); + wset_window_end_pos (w, make_number (Z - ZV)); + wset_window_end_vpos (w, make_number (0)); } /* But that is not valid info until redisplay finishes. */ - WSET (w, window_end_valid, Qnil); + wset_window_end_valid (w, Qnil); return 1; } @@ -16546,28 +16568,31 @@ { w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_reused_text_row); - WSET (w, window_end_pos, - make_number (Z - MATRIX_ROW_END_CHARPOS (last_reused_text_row))); - WSET (w, window_end_vpos, - make_number (MATRIX_ROW_VPOS (last_reused_text_row, w->current_matrix))); + wset_window_end_pos + (w, make_number (Z + - MATRIX_ROW_END_CHARPOS (last_reused_text_row))); + wset_window_end_vpos + (w, make_number (MATRIX_ROW_VPOS (last_reused_text_row, + w->current_matrix))); } else if (last_text_row) { w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row); - WSET (w, window_end_pos, - make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row))); - WSET (w, window_end_vpos, - make_number (MATRIX_ROW_VPOS (last_text_row, w->desired_matrix))); + wset_window_end_pos + (w, make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row))); + wset_window_end_vpos + (w, make_number (MATRIX_ROW_VPOS (last_text_row, + w->desired_matrix))); } else { /* This window must be completely empty. */ w->window_end_bytepos = Z_BYTE - ZV_BYTE; - WSET (w, window_end_pos, make_number (Z - ZV)); - WSET (w, window_end_vpos, make_number (0)); + wset_window_end_pos (w, make_number (Z - ZV)); + wset_window_end_vpos (w, make_number (0)); } - WSET (w, window_end_valid, Qnil); + wset_window_end_valid (w, Qnil); /* Update hint: don't try scrolling again in update_window. */ w->desired_matrix->no_scrolling_p = 1; @@ -16748,18 +16773,19 @@ { w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row); - WSET (w, window_end_pos, - make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row))); - WSET (w, window_end_vpos, - make_number (MATRIX_ROW_VPOS (last_text_row, w->desired_matrix))); + wset_window_end_pos + (w, make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row))); + wset_window_end_vpos + (w, make_number (MATRIX_ROW_VPOS (last_text_row, + w->desired_matrix))); } else { - WSET (w, window_end_vpos, - make_number (XFASTINT (w->window_end_vpos) - nrows_scrolled)); + wset_window_end_vpos + (w, make_number (XFASTINT (w->window_end_vpos) - nrows_scrolled)); } - WSET (w, window_end_valid, Qnil); + wset_window_end_valid (w, Qnil); w->desired_matrix->no_scrolling_p = 1; #ifdef GLYPH_DEBUG @@ -17331,8 +17357,8 @@ { /* We have to compute the window end anew since text could have been added/removed after it. */ - WSET (w, window_end_pos, - make_number (Z - MATRIX_ROW_END_CHARPOS (row))); + wset_window_end_pos + (w, make_number (Z - MATRIX_ROW_END_CHARPOS (row))); w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row); @@ -17766,21 +17792,22 @@ first_unchanged_at_end_row); eassert (row && MATRIX_ROW_DISPLAYS_TEXT_P (row)); - WSET (w, window_end_pos, make_number (Z - MATRIX_ROW_END_CHARPOS (row))); + wset_window_end_pos (w, make_number (Z - MATRIX_ROW_END_CHARPOS (row))); w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row); - WSET (w, window_end_vpos, - make_number (MATRIX_ROW_VPOS (row, w->current_matrix))); + wset_window_end_vpos + (w, make_number (MATRIX_ROW_VPOS (row, w->current_matrix))); eassert (w->window_end_bytepos >= 0); IF_DEBUG (debug_method_add (w, "A")); } else if (last_text_row_at_end) { - WSET (w, window_end_pos, - make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row_at_end))); + wset_window_end_pos + (w, make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row_at_end))); w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row_at_end); - WSET (w, window_end_vpos, - make_number (MATRIX_ROW_VPOS (last_text_row_at_end, desired_matrix))); + wset_window_end_vpos + (w, make_number (MATRIX_ROW_VPOS (last_text_row_at_end, + desired_matrix))); eassert (w->window_end_bytepos >= 0); IF_DEBUG (debug_method_add (w, "B")); } @@ -17789,12 +17816,12 @@ /* We have displayed either to the end of the window or at the end of the window, i.e. the last row with text is to be found in the desired matrix. */ - WSET (w, window_end_pos, - make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row))); + wset_window_end_pos + (w, make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row))); w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row); - WSET (w, window_end_vpos, - make_number (MATRIX_ROW_VPOS (last_text_row, desired_matrix))); + wset_window_end_vpos + (w, make_number (MATRIX_ROW_VPOS (last_text_row, desired_matrix))); eassert (w->window_end_bytepos >= 0); } else if (first_unchanged_at_end_row == NULL @@ -17822,8 +17849,8 @@ } eassert (row != NULL); - WSET (w, window_end_vpos, make_number (vpos + 1)); - WSET (w, window_end_pos, make_number (Z - MATRIX_ROW_END_CHARPOS (row))); + wset_window_end_vpos (w, make_number (vpos + 1)); + wset_window_end_pos (w, make_number (Z - MATRIX_ROW_END_CHARPOS (row))); w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row); eassert (w->window_end_bytepos >= 0); IF_DEBUG (debug_method_add (w, "C")); @@ -17835,7 +17862,7 @@ debug_end_vpos = XFASTINT (w->window_end_vpos)); /* Record that display has not been completed. */ - WSET (w, window_end_valid, Qnil); + wset_window_end_valid (w, Qnil); w->desired_matrix->no_scrolling_p = 1; return 3; @@ -19248,7 +19275,7 @@ } /* Is IT->w showing the region? */ - WSET (it->w, region_showing, it->region_beg_charpos > 0 ? Qt : Qnil); + wset_region_showing (it->w, it->region_beg_charpos > 0 ? Qt : Qnil); /* Clear the result glyph row and enable it. */ prepare_desired_row (row); @@ -20252,7 +20279,7 @@ /* These will be set while the mode line specs are processed. */ line_number_displayed = 0; - WSET (w, column_number_displayed, Qnil); + wset_column_number_displayed (w, Qnil); if (WINDOW_WANTS_MODELINE_P (w)) { @@ -21388,7 +21415,7 @@ else { ptrdiff_t col = current_column (); - WSET (w, column_number_displayed, make_number (col)); + wset_column_number_displayed (w, make_number (col)); pint2str (decode_mode_spec_buf, field_width, col); return decode_mode_spec_buf; } @@ -21451,14 +21478,14 @@ goto no_value; /* But do forget it, if the window shows a different buffer now. */ else if (BUFFERP (w->base_line_pos)) - WSET (w, base_line_pos, Qnil); + wset_base_line_pos (w, Qnil); /* If the buffer is very big, don't waste time. */ if (INTEGERP (Vline_number_display_limit) && BUF_ZV (b) - BUF_BEGV (b) > XINT (Vline_number_display_limit)) { - WSET (w, base_line_pos, Qnil); - WSET (w, base_line_number, Qnil); + wset_base_line_pos (w, Qnil); + wset_base_line_number (w, Qnil); goto no_value; } @@ -21490,8 +21517,8 @@ go back past it. */ if (startpos == BUF_BEGV (b)) { - WSET (w, base_line_number, make_number (topline)); - WSET (w, base_line_pos, make_number (BUF_BEGV (b))); + wset_base_line_number (w, make_number (topline)); + wset_base_line_pos (w, make_number (BUF_BEGV (b))); } else if (nlines < height + 25 || nlines > height * 3 + 50 || linepos == BUF_BEGV (b)) @@ -21517,13 +21544,13 @@ give up on line numbers for this window. */ if (position == limit_byte && limit == startpos - distance) { - WSET (w, base_line_pos, w->buffer); - WSET (w, base_line_number, Qnil); + wset_base_line_pos (w, w->buffer); + wset_base_line_number (w, Qnil); goto no_value; } - WSET (w, base_line_number, make_number (topline - nlines)); - WSET (w, base_line_pos, make_number (BYTE_TO_CHAR (position))); + wset_base_line_number (w, make_number (topline - nlines)); + wset_base_line_pos (w, make_number (BYTE_TO_CHAR (position))); } /* Now count lines from the start pos to point. */ @@ -29288,12 +29315,13 @@ echo_area_window = minibuf_window; - WSET (r, top_line, make_number (FRAME_TOP_MARGIN (f))); - WSET (r, total_lines, make_number (FRAME_LINES (f) - 1 - FRAME_TOP_MARGIN (f))); - WSET (r, total_cols, make_number (FRAME_COLS (f))); - WSET (m, top_line, make_number (FRAME_LINES (f) - 1)); - WSET (m, total_lines, make_number (1)); - WSET (m, total_cols, make_number (FRAME_COLS (f))); + wset_top_line (r, make_number (FRAME_TOP_MARGIN (f))); + wset_total_lines + (r, make_number (FRAME_LINES (f) - 1 - FRAME_TOP_MARGIN (f))); + wset_total_cols (r, make_number (FRAME_COLS (f))); + wset_top_line (m, make_number (FRAME_LINES (f) - 1)); + wset_total_lines (m, make_number (1)); + wset_total_cols (m, make_number (FRAME_COLS (f))); scratch_glyph_row.glyphs[TEXT_AREA] = scratch_glyphs; scratch_glyph_row.glyphs[TEXT_AREA + 1] === modified file 'src/xfns.c' --- src/xfns.c 2012-08-17 23:38:43 +0000 +++ src/xfns.c 2012-08-18 01:42:52 +0000 @@ -5064,20 +5064,20 @@ /* Set up the frame's root window. */ w = XWINDOW (FRAME_ROOT_WINDOW (f)); - WSET (w, left_col, make_number (0)); - WSET (w, top_line, make_number (0)); + wset_left_col (w, make_number (0)); + wset_top_line (w, make_number (0)); if (CONSP (Vx_max_tooltip_size) && RANGED_INTEGERP (1, XCAR (Vx_max_tooltip_size), INT_MAX) && RANGED_INTEGERP (1, XCDR (Vx_max_tooltip_size), INT_MAX)) { - WSET (w, total_cols, XCAR (Vx_max_tooltip_size)); - WSET (w, total_lines, XCDR (Vx_max_tooltip_size)); + wset_total_cols (w, XCAR (Vx_max_tooltip_size)); + wset_total_lines (w, XCDR (Vx_max_tooltip_size)); } else { - WSET (w, total_cols, make_number (80)); - WSET (w, total_lines, make_number (40)); + wset_total_cols (w, make_number (80)); + wset_total_lines (w, make_number (40)); } FRAME_TOTAL_COLS (f) = XINT (w->total_cols); @@ -5147,7 +5147,7 @@ /* w->total_cols and FRAME_TOTAL_COLS want the width in columns, not in pixels. */ width /= WINDOW_FRAME_COLUMN_WIDTH (w); - WSET (w, total_cols, make_number (width)); + wset_total_cols (w, make_number (width)); FRAME_TOTAL_COLS (f) = width; adjust_glyphs (f); clear_glyph_matrix (w->desired_matrix); === modified file 'src/xterm.c' --- src/xterm.c 2012-08-17 23:38:43 +0000 +++ src/xterm.c 2012-08-18 01:42:52 +0000 @@ -5181,7 +5181,7 @@ #endif /* Dissociate this scroll bar from its window. */ - WSET (XWINDOW (bar->window), vertical_scroll_bar, Qnil); + wset_vertical_scroll_bar (XWINDOW (bar->window), Qnil); UNBLOCK_INPUT; } @@ -5395,7 +5395,7 @@ #endif /* not USE_TOOLKIT_SCROLL_BARS */ XSETVECTOR (barobj, bar); - WSET (w, vertical_scroll_bar, barobj); + wset_vertical_scroll_bar (w, barobj); } ------------------------------------------------------------ revno: 109669 fixes bug: http://debbugs.gnu.org/12215 committer: Paul Eggert branch nick: trunk timestamp: Fri 2012-08-17 17:07:52 -0700 message: * termhooks.h (TSET): Remove. Replace all uses with calls to new setter functions. Use INLINE_HEADER_BEGIN, INLINE_HEADER_END. (TERMHOOKS_INLINE): New macro. (tset_charset_list, tset_selection_alist): New setter functions. * terminal.c (TERMHOOKS_INLINE): Define to EXTERN_INLINE, so that the corresponding functions are compiled into code. (tset_param_alist): New setter function. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-08-17 23:38:43 +0000 +++ src/ChangeLog 2012-08-18 00:07:52 +0000 @@ -1,3 +1,15 @@ +2012-08-18 Paul Eggert + + * termhooks.h (TSET): Remove (Bug#12215). + Replace all uses with calls to new setter functions. + Use INLINE_HEADER_BEGIN, INLINE_HEADER_END. + (TERMHOOKS_INLINE): New macro. + (tset_charset_list, tset_selection_alist): New setter functions. + * terminal.c (TERMHOOKS_INLINE): + Define to EXTERN_INLINE, so that the corresponding functions + are compiled into code. + (tset_param_alist): New setter function. + 2012-08-17 Paul Eggert * keyboard.h (KSET): Remove (Bug#12215). === modified file 'src/coding.c' --- src/coding.c 2012-08-14 05:09:35 +0000 +++ src/coding.c 2012-08-18 00:07:52 +0000 @@ -9302,10 +9302,10 @@ terminal_coding->common_flags &= ~CODING_ANNOTATE_COMPOSITION_MASK; terminal_coding->src_multibyte = 1; terminal_coding->dst_multibyte = 0; - if (terminal_coding->common_flags & CODING_REQUIRE_ENCODING_MASK) - TSET (term, charset_list, coding_charset_list (terminal_coding)); - else - TSET (term, charset_list, Fcons (make_number (charset_ascii), Qnil)); + tset_charset_list + (term, (terminal_coding->common_flags & CODING_REQUIRE_ENCODING_MASK + ? coding_charset_list (terminal_coding) + : Fcons (make_number (charset_ascii), Qnil))); return Qnil; } === modified file 'src/termhooks.h' --- src/termhooks.h 2012-08-09 05:14:23 +0000 +++ src/termhooks.h 2012-08-18 00:07:52 +0000 @@ -22,6 +22,11 @@ #include "systime.h" /* for Time */ +INLINE_HEADER_BEGIN +#ifndef TERMHOOKS_INLINE +# define TERMHOOKS_INLINE INLINE +#endif + struct glyph; struct frame; @@ -321,10 +326,6 @@ struct x_display_info; struct w32_display_info; -/* Most code should use this macro to set Lisp field in struct terminal. */ - -#define TSET(f, field, value) ((f)->field = (value)) - /* Terminal-local parameters. */ struct terminal { @@ -631,6 +632,18 @@ void (*delete_terminal_hook) (struct terminal *); }; +/* Most code should use these functions to set Lisp fields in struct + terminal. */ +TERMHOOKS_INLINE void +tset_charset_list (struct terminal *t, Lisp_Object val) +{ + t->charset_list = val; +} +TERMHOOKS_INLINE void +tset_selection_alist (struct terminal *t, Lisp_Object val) +{ + t->Vselection_alist = val; +} /* Chain of all terminal devices currently in use. */ extern struct terminal *terminal_list; @@ -669,3 +682,5 @@ #ifdef HAVE_GPM extern void close_gpm (int gpm_fd); #endif + +INLINE_HEADER_END === modified file 'src/terminal.c' --- src/terminal.c 2012-08-09 05:14:23 +0000 +++ src/terminal.c 2012-08-18 00:07:52 +0000 @@ -17,6 +17,9 @@ along with GNU Emacs. If not, see . */ #include + +#define TERMHOOKS_INLINE EXTERN_INLINE + #include #include @@ -39,6 +42,13 @@ static void delete_initial_terminal (struct terminal *); +/* This setter is used only in this file, so it can be private. */ +static inline void +tset_param_alist (struct terminal *t, Lisp_Object val) +{ + t->param_alist = val; +} + void @@ -446,7 +456,7 @@ Lisp_Object old_alist_elt = Fassq (parameter, t->param_alist); if (EQ (old_alist_elt, Qnil)) { - TSET (t, param_alist, Fcons (Fcons (parameter, value), t->param_alist)); + tset_param_alist (t, Fcons (Fcons (parameter, value), t->param_alist)); return Qnil; } else === modified file 'src/xselect.c' --- src/xselect.c 2012-08-09 05:14:23 +0000 +++ src/xselect.c 2012-08-18 00:07:52 +0000 @@ -353,8 +353,9 @@ INTEGER_TO_CONS (timestamp), frame); prev_value = LOCAL_SELECTION (selection_name, dpyinfo); - TSET (dpyinfo->terminal, Vselection_alist, - Fcons (selection_data, dpyinfo->terminal->Vselection_alist)); + tset_selection_alist + (dpyinfo->terminal, + Fcons (selection_data, dpyinfo->terminal->Vselection_alist)); /* If we already owned the selection, remove the old selection data. Don't use Fdelq as that may QUIT. */ @@ -989,7 +990,7 @@ break; } } - TSET (dpyinfo->terminal, Vselection_alist, Vselection_alist); + tset_selection_alist (dpyinfo->terminal, Vselection_alist); /* Run the `x-lost-selection-functions' abnormal hook. */ { @@ -1039,7 +1040,7 @@ args[1] = Fcar (Fcar (t->Vselection_alist)); Frun_hook_with_args (2, args); - TSET (t, Vselection_alist, XCDR (t->Vselection_alist)); + tset_selection_alist (t, XCDR (t->Vselection_alist)); } /* Delete elements after the beginning of Vselection_alist. */ ------------------------------------------------------------ revno: 109668 fixes bug: http://debbugs.gnu.org/12215 committer: Paul Eggert branch nick: trunk timestamp: Fri 2012-08-17 16:38:43 -0700 message: * keyboard.h (KSET): Remove. Replace all uses with calls to new setter functions. Use INLINE_HEADER_BEGIN, INLINE_HEADER_END. (KEYBOARD_INLINE): New macro. (kset_default_minibuffer_frame, kset_defining_kbd_macro) (kset_input_decode_map, kset_last_command, kset_last_kbd_macro) (kset_prefix_arg, kset_system_key_alist, kset_window_system): New setter functions. * keyboard.c (KEYBOARD_INLINE): Define to EXTERN_INLINE, so that the corresponding functions are compiled into code. (kset_echo_string, kset_kbd_queue) (kset_keyboard_translate_table, kset_last_prefix_arg) (kset_last_repeatable_command, kset_local_function_key_map) (kset_overriding_terminal_local_map, kset_real_last_command) (kset_system_key_syms): New setter functions. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-08-17 21:52:15 +0000 +++ src/ChangeLog 2012-08-17 23:38:43 +0000 @@ -1,5 +1,22 @@ 2012-08-17 Paul Eggert + * keyboard.h (KSET): Remove (Bug#12215). + Replace all uses with calls to new setter functions. + Use INLINE_HEADER_BEGIN, INLINE_HEADER_END. + (KEYBOARD_INLINE): New macro. + (kset_default_minibuffer_frame, kset_defining_kbd_macro) + (kset_input_decode_map, kset_last_command, kset_last_kbd_macro) + (kset_prefix_arg, kset_system_key_alist, kset_window_system): + New setter functions. + * keyboard.c (KEYBOARD_INLINE): + Define to EXTERN_INLINE, so that the corresponding functions + are compiled into code. + (kset_echo_string, kset_kbd_queue) + (kset_keyboard_translate_table, kset_last_prefix_arg) + (kset_last_repeatable_command, kset_local_function_key_map) + (kset_overriding_terminal_local_map, kset_real_last_command) + (kset_system_key_syms): New setter functions. + * frame.h (FSET): Remove (Bug#12215). Replace all uses with calls to new setter functions. Use INLINE_HEADER_BEGIN, INLINE_HEADER_END. === modified file 'src/callint.c' --- src/callint.c 2012-08-13 03:44:27 +0000 +++ src/callint.c 2012-08-17 23:38:43 +0000 @@ -372,7 +372,7 @@ Vthis_command = save_this_command; Vthis_original_command = save_this_original_command; Vreal_this_command = save_real_this_command; - KSET (current_kboard, Vlast_command, save_last_command); + kset_last_command (current_kboard, save_last_command); temporarily_switch_to_single_kboard (NULL); return unbind_to (speccount, apply1 (function, specs)); @@ -843,7 +843,7 @@ Vthis_command = save_this_command; Vthis_original_command = save_this_original_command; Vreal_this_command = save_real_this_command; - KSET (current_kboard, Vlast_command, save_last_command); + kset_last_command (current_kboard, save_last_command); { Lisp_Object val; === modified file 'src/frame.c' --- src/frame.c 2012-08-17 21:52:15 +0000 +++ src/frame.c 2012-08-17 23:38:43 +0000 @@ -409,8 +409,8 @@ XSETFRAME (frame_dummy, f); GCPRO1 (frame_dummy); /* If there's no minibuffer frame to use, create one. */ - KSET (kb, Vdefault_minibuffer_frame, - call1 (intern ("make-initial-minibuffer-frame"), display)); + kset_default_minibuffer_frame + (kb, call1 (intern ("make-initial-minibuffer-frame"), display)); UNGCPRO; } @@ -864,7 +864,7 @@ (Lisp_Object event) { /* Preserve prefix arg that the command loop just cleared. */ - KSET (current_kboard, Vprefix_arg, Vcurrent_prefix_arg); + kset_prefix_arg (current_kboard, Vcurrent_prefix_arg); Frun_hooks (1, &Qmouse_leave_buffer_hook); return do_switch_frame (event, 0, 0, Qnil); } @@ -1458,11 +1458,11 @@ if (NILP (frame_with_minibuf)) abort (); - KSET (kb, Vdefault_minibuffer_frame, frame_with_minibuf); + kset_default_minibuffer_frame (kb, frame_with_minibuf); } else /* No frames left on this kboard--say no minibuffer either. */ - KSET (kb, Vdefault_minibuffer_frame, Qnil); + kset_default_minibuffer_frame (kb, Qnil); } /* Cause frame titles to update--necessary if we now have just one frame. */ === modified file 'src/keyboard.c' --- src/keyboard.c 2012-08-16 07:58:24 +0000 +++ src/keyboard.c 2012-08-17 23:38:43 +0000 @@ -18,6 +18,9 @@ along with GNU Emacs. If not, see . */ #include + +#define KEYBOARD_INLINE EXTERN_INLINE + #include #include #include @@ -469,6 +472,53 @@ static char *find_user_signal_name (int); static int store_user_signal_events (void); +/* These setters are used only in this file, so they can be private. */ +static inline void +kset_echo_string (struct kboard *kb, Lisp_Object val) +{ + kb->INTERNAL_FIELD (echo_string) = val; +} +static inline void +kset_kbd_queue (struct kboard *kb, Lisp_Object val) +{ + kb->INTERNAL_FIELD (kbd_queue) = val; +} +static inline void +kset_keyboard_translate_table (struct kboard *kb, Lisp_Object val) +{ + kb->INTERNAL_FIELD (Vkeyboard_translate_table) = val; +} +static inline void +kset_last_prefix_arg (struct kboard *kb, Lisp_Object val) +{ + kb->INTERNAL_FIELD (Vlast_prefix_arg) = val; +} +static inline void +kset_last_repeatable_command (struct kboard *kb, Lisp_Object val) +{ + kb->INTERNAL_FIELD (Vlast_repeatable_command) = val; +} +static inline void +kset_local_function_key_map (struct kboard *kb, Lisp_Object val) +{ + kb->INTERNAL_FIELD (Vlocal_function_key_map) = val; +} +static inline void +kset_overriding_terminal_local_map (struct kboard *kb, Lisp_Object val) +{ + kb->INTERNAL_FIELD (Voverriding_terminal_local_map) = val; +} +static inline void +kset_real_last_command (struct kboard *kb, Lisp_Object val) +{ + kb->INTERNAL_FIELD (Vreal_last_command) = val; +} +static inline void +kset_system_key_syms (struct kboard *kb, Lisp_Object val) +{ + kb->INTERNAL_FIELD (system_key_syms) = val; +} + /* Add C to the echo string, if echoing is going on. C can be a character, which is printed prettily ("M-C-x" and all that @@ -551,8 +601,9 @@ else if (STRINGP (echo_string)) echo_string = concat2 (echo_string, build_string (" ")); - KSET (current_kboard, echo_string, - concat2 (echo_string, make_string (buffer, ptr - buffer))); + kset_echo_string + (current_kboard, + concat2 (echo_string, make_string (buffer, ptr - buffer))); echo_now (); } @@ -597,8 +648,9 @@ /* Put a dash at the end of the buffer temporarily, but make it go away when the next character is added. */ - KSET (current_kboard, echo_string, - concat2 (KVAR (current_kboard, echo_string), build_string ("-"))); + kset_echo_string + (current_kboard, + concat2 (KVAR (current_kboard, echo_string), build_string ("-"))); echo_now (); } @@ -660,7 +712,7 @@ { current_kboard->immediate_echo = 0; current_kboard->echo_after_prompt = -1; - KSET (current_kboard, echo_string, Qnil); + kset_echo_string (current_kboard, Qnil); ok_to_echo_at_next_pause = NULL; echo_kboard = NULL; echo_message_buffer = Qnil; @@ -684,9 +736,9 @@ echo_truncate (ptrdiff_t nchars) { if (STRINGP (KVAR (current_kboard, echo_string))) - KSET (current_kboard, echo_string, - Fsubstring (KVAR (current_kboard, echo_string), - make_number (0), make_number (nchars))); + kset_echo_string (current_kboard, + Fsubstring (KVAR (current_kboard, echo_string), + make_number (0), make_number (nchars))); truncate_echo_area (nchars); } @@ -1016,8 +1068,8 @@ Vstandard_input = Qt; Vexecuting_kbd_macro = Qnil; executing_kbd_macro = Qnil; - KSET (current_kboard, Vprefix_arg, Qnil); - KSET (current_kboard, Vlast_prefix_arg, Qnil); + kset_prefix_arg (current_kboard, Qnil); + kset_last_prefix_arg (current_kboard, Qnil); cancel_echoing (); /* Avoid unquittable loop if data contains a circular list. */ @@ -1338,8 +1390,8 @@ #endif int already_adjusted = 0; - KSET (current_kboard, Vprefix_arg, Qnil); - KSET (current_kboard, Vlast_prefix_arg, Qnil); + kset_prefix_arg (current_kboard, Qnil); + kset_last_prefix_arg (current_kboard, Qnil); Vdeactivate_mark = Qnil; waiting_for_input = 0; cancel_echoing (); @@ -1371,10 +1423,10 @@ } /* Do this after running Vpost_command_hook, for consistency. */ - KSET (current_kboard, Vlast_command, Vthis_command); - KSET (current_kboard, Vreal_last_command, Vreal_this_command); + kset_last_command (current_kboard, Vthis_command); + kset_real_last_command (current_kboard, Vreal_this_command); if (!CONSP (last_command_event)) - KSET (current_kboard, Vlast_repeatable_command, Vreal_this_command); + kset_last_repeatable_command (current_kboard, Vreal_this_command); while (1) { @@ -1546,7 +1598,7 @@ keys = Fkey_description (keys, Qnil); bitch_at_user (); message_with_string ("%s is undefined", keys, 0); - KSET (current_kboard, defining_kbd_macro, Qnil); + kset_defining_kbd_macro (current_kboard, Qnil); update_mode_lines = 1; /* If this is a down-mouse event, don't reset prefix-arg; pass it to the command run by the up event. */ @@ -1556,10 +1608,10 @@ = parse_modifiers (EVENT_HEAD (last_command_event)); int modifiers = XINT (XCAR (XCDR (breakdown))); if (!(modifiers & down_modifier)) - KSET (current_kboard, Vprefix_arg, Qnil); + kset_prefix_arg (current_kboard, Qnil); } else - KSET (current_kboard, Vprefix_arg, Qnil); + kset_prefix_arg (current_kboard, Qnil); } else { @@ -1596,7 +1648,7 @@ unbind_to (scount, Qnil); #endif } - KSET (current_kboard, Vlast_prefix_arg, Vcurrent_prefix_arg); + kset_last_prefix_arg (current_kboard, Vcurrent_prefix_arg); safe_run_hooks (Qpost_command_hook); @@ -1627,10 +1679,10 @@ if (NILP (KVAR (current_kboard, Vprefix_arg)) || CONSP (last_command_event)) { - KSET (current_kboard, Vlast_command, Vthis_command); - KSET (current_kboard, Vreal_last_command, Vreal_this_command); + kset_last_command (current_kboard, Vthis_command); + kset_real_last_command (current_kboard, Vreal_this_command); if (!CONSP (last_command_event)) - KSET (current_kboard, Vlast_repeatable_command, Vreal_this_command); + kset_last_repeatable_command (current_kboard, Vreal_this_command); cancel_echoing (); this_command_key_count = 0; this_command_key_count_reset = 0; @@ -2573,7 +2625,7 @@ abort (); } if (!CONSP (last)) - KSET (kb, kbd_queue, Fcons (c, Qnil)); + kset_kbd_queue (kb, Fcons (c, Qnil)); else XSETCDR (last, Fcons (c, Qnil)); kb->kbd_queue_has_data = 1; @@ -2745,8 +2797,8 @@ if (!CONSP (KVAR (current_kboard, kbd_queue))) abort (); c = XCAR (KVAR (current_kboard, kbd_queue)); - KSET (current_kboard, kbd_queue, - XCDR (KVAR (current_kboard, kbd_queue))); + kset_kbd_queue (current_kboard, + 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); @@ -2813,7 +2865,7 @@ abort (); } if (!CONSP (last)) - KSET (kb, kbd_queue, Fcons (c, Qnil)); + kset_kbd_queue (kb, Fcons (c, Qnil)); else XSETCDR (last, Fcons (c, Qnil)); kb->kbd_queue_has_data = 1; @@ -3071,7 +3123,7 @@ cancel_echoing (); ok_to_echo_at_next_pause = saved_ok_to_echo; - KSET (current_kboard, echo_string, saved_echo_string); + kset_echo_string (current_kboard, saved_echo_string); current_kboard->echo_after_prompt = saved_echo_after_prompt; if (saved_immediate_echo) echo_now (); @@ -3542,9 +3594,9 @@ if (single_kboard && kb != current_kboard) { - KSET (kb, kbd_queue, - Fcons (make_lispy_switch_frame (event->frame_or_window), - Fcons (make_number (c), Qnil))); + kset_kbd_queue + (kb, Fcons (make_lispy_switch_frame (event->frame_or_window), + Fcons (make_number (c), Qnil))); kb->kbd_queue_has_data = 1; for (sp = kbd_fetch_ptr; sp != kbd_store_ptr; sp++) { @@ -5416,7 +5468,7 @@ /* We need to use an alist rather than a vector as the cache since we can't make a vector long enough. */ if (NILP (KVAR (current_kboard, system_key_syms))) - KSET (current_kboard, system_key_syms, Fcons (Qnil, Qnil)); + kset_system_key_syms (current_kboard, Fcons (Qnil, Qnil)); return modify_event_symbol (event->code, event->modifiers, Qfunction_key, @@ -8739,11 +8791,11 @@ is not used on replay. */ orig_defn_macro = KVAR (current_kboard, defining_kbd_macro); - KSET (current_kboard, defining_kbd_macro, Qnil); + kset_defining_kbd_macro (current_kboard, Qnil); do obj = read_char (commandflag, 0, 0, Qt, 0, NULL); while (BUFFERP (obj)); - KSET (current_kboard, defining_kbd_macro, orig_defn_macro); + kset_defining_kbd_macro (current_kboard, orig_defn_macro); if (!INTEGERP (obj)) return obj; @@ -9099,7 +9151,7 @@ /* Install the string STR as the beginning of the string of echoing, so that it serves as a prompt for the next character. */ - KSET (current_kboard, echo_string, prompt); + kset_echo_string (current_kboard, prompt); current_kboard->echo_after_prompt = SCHARS (prompt); echo_now (); } @@ -9345,15 +9397,17 @@ if (!NILP (delayed_switch_frame)) { - KSET (interrupted_kboard, kbd_queue, - Fcons (delayed_switch_frame, - KVAR (interrupted_kboard, kbd_queue))); + kset_kbd_queue + (interrupted_kboard, + Fcons (delayed_switch_frame, + KVAR (interrupted_kboard, kbd_queue))); delayed_switch_frame = Qnil; } while (t > 0) - KSET (interrupted_kboard, kbd_queue, - Fcons (keybuf[--t], KVAR (interrupted_kboard, kbd_queue))); + kset_kbd_queue + (interrupted_kboard, + 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. */ @@ -9365,9 +9419,10 @@ { Lisp_Object frame; XSETFRAME (frame, interrupted_frame); - KSET (interrupted_kboard, kbd_queue, - Fcons (make_lispy_switch_frame (frame), - KVAR (interrupted_kboard, kbd_queue))); + kset_kbd_queue + (interrupted_kboard, + Fcons (make_lispy_switch_frame (frame), + KVAR (interrupted_kboard, kbd_queue))); } mock_input = 0; orig_local_map = get_local_map (PT, current_buffer, Qlocal_map); @@ -10261,7 +10316,7 @@ { prefixarg = KVAR (current_kboard, Vprefix_arg); Vcurrent_prefix_arg = prefixarg; - KSET (current_kboard, Vprefix_arg, Qnil); + kset_prefix_arg (current_kboard, Qnil); } else prefixarg = Qnil; @@ -11256,30 +11311,30 @@ void init_kboard (KBOARD *kb) { - KSET (kb, Voverriding_terminal_local_map, Qnil); - KSET (kb, Vlast_command, Qnil); - KSET (kb, Vreal_last_command, Qnil); - KSET (kb, Vkeyboard_translate_table, Qnil); - KSET (kb, Vlast_repeatable_command, Qnil); - KSET (kb, Vprefix_arg, Qnil); - KSET (kb, Vlast_prefix_arg, Qnil); - KSET (kb, kbd_queue, Qnil); + kset_overriding_terminal_local_map (kb, Qnil); + kset_last_command (kb, Qnil); + kset_real_last_command (kb, Qnil); + kset_keyboard_translate_table (kb, Qnil); + kset_last_repeatable_command (kb, Qnil); + kset_prefix_arg (kb, Qnil); + kset_last_prefix_arg (kb, Qnil); + kset_kbd_queue (kb, Qnil); kb->kbd_queue_has_data = 0; kb->immediate_echo = 0; - KSET (kb, echo_string, Qnil); + kset_echo_string (kb, Qnil); kb->echo_after_prompt = -1; kb->kbd_macro_buffer = 0; kb->kbd_macro_bufsize = 0; - KSET (kb, defining_kbd_macro, Qnil); - KSET (kb, Vlast_kbd_macro, Qnil); + kset_defining_kbd_macro (kb, Qnil); + kset_last_kbd_macro (kb, Qnil); kb->reference_count = 0; - KSET (kb, Vsystem_key_alist, Qnil); - KSET (kb, system_key_syms, Qnil); - KSET (kb, Vwindow_system, Qt); /* Unset. */ - KSET (kb, Vinput_decode_map, Fmake_sparse_keymap (Qnil)); - KSET (kb, Vlocal_function_key_map, Fmake_sparse_keymap (Qnil)); + kset_system_key_alist (kb, Qnil); + kset_system_key_syms (kb, Qnil); + kset_window_system (kb, Qt); /* Unset. */ + kset_input_decode_map (kb, Fmake_sparse_keymap (Qnil)); + kset_local_function_key_map (kb, Fmake_sparse_keymap (Qnil)); Fset_keymap_parent (KVAR (kb, Vlocal_function_key_map), Vfunction_key_map); - KSET (kb, Vdefault_minibuffer_frame, Qnil); + kset_default_minibuffer_frame (kb, Qnil); } /* @@ -11355,7 +11410,7 @@ 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. */ - KSET (current_kboard, Vwindow_system, Qnil); + kset_window_system (current_kboard, Qnil); if (!noninteractive) { === modified file 'src/keyboard.h' --- src/keyboard.h 2012-08-13 03:44:27 +0000 +++ src/keyboard.h 2012-08-17 23:38:43 +0000 @@ -19,10 +19,14 @@ #include "systime.h" /* for EMACS_TIME, Time */ #include "coding.h" /* for ENCODE_UTF_8 and ENCODE_SYSTEM */ +INLINE_HEADER_BEGIN +#ifndef KEYBOARD_INLINE +# define KEYBOARD_INLINE INLINE +#endif + /* Most code should use this macro to access Lisp fields in struct kboard. */ #define KVAR(kboard, field) ((kboard)->INTERNAL_FIELD (field)) -#define KSET(kboard, field, value) ((kboard)->INTERNAL_FIELD (field) = (value)) /* Each KBOARD represents one logical input stream from which Emacs gets input. If we are using ordinary terminals, it has one KBOARD @@ -173,6 +177,47 @@ char echo_after_prompt; }; +KEYBOARD_INLINE void +kset_default_minibuffer_frame (struct kboard *kb, Lisp_Object val) +{ + kb->INTERNAL_FIELD (Vdefault_minibuffer_frame) = val; +} +KEYBOARD_INLINE void +kset_defining_kbd_macro (struct kboard *kb, Lisp_Object val) +{ + kb->INTERNAL_FIELD (defining_kbd_macro) = val; +} +KEYBOARD_INLINE void +kset_input_decode_map (struct kboard *kb, Lisp_Object val) +{ + kb->INTERNAL_FIELD (Vinput_decode_map) = val; +} +KEYBOARD_INLINE void +kset_last_command (struct kboard *kb, Lisp_Object val) +{ + kb->INTERNAL_FIELD (Vlast_command) = val; +} +KEYBOARD_INLINE void +kset_last_kbd_macro (struct kboard *kb, Lisp_Object val) +{ + kb->INTERNAL_FIELD (Vlast_kbd_macro) = val; +} +KEYBOARD_INLINE void +kset_prefix_arg (struct kboard *kb, Lisp_Object val) +{ + kb->INTERNAL_FIELD (Vprefix_arg) = val; +} +KEYBOARD_INLINE void +kset_system_key_alist (struct kboard *kb, Lisp_Object val) +{ + kb->INTERNAL_FIELD (Vsystem_key_alist) = val; +} +KEYBOARD_INLINE void +kset_window_system (struct kboard *kb, Lisp_Object val) +{ + kb->INTERNAL_FIELD (Vwindow_system) = val; +} + /* Temporarily used before a frame has been opened. */ extern KBOARD *initial_kboard; @@ -510,3 +555,5 @@ #ifdef WINDOWSNT extern const char *const lispy_function_keys[]; #endif + +INLINE_HEADER_END === modified file 'src/macros.c' --- src/macros.c 2012-08-13 03:44:27 +0000 +++ src/macros.c 2012-08-17 23:38:43 +0000 @@ -127,7 +127,7 @@ message ("Appending to kbd macro..."); } - KSET (current_kboard, defining_kbd_macro, Qt); + kset_defining_kbd_macro (current_kboard, Qt); return Qnil; } @@ -137,12 +137,13 @@ void end_kbd_macro (void) { - KSET (current_kboard, defining_kbd_macro, Qnil); + kset_defining_kbd_macro (current_kboard, Qnil); update_mode_lines++; - KSET (current_kboard, Vlast_kbd_macro, - make_event_array ((current_kboard->kbd_macro_end - - current_kboard->kbd_macro_buffer), - current_kboard->kbd_macro_buffer)); + kset_last_kbd_macro + (current_kboard, + make_event_array ((current_kboard->kbd_macro_end + - current_kboard->kbd_macro_buffer), + current_kboard->kbd_macro_buffer)); } DEFUN ("end-kbd-macro", Fend_kbd_macro, Send_kbd_macro, 0, 2, "p", @@ -330,7 +331,7 @@ executing_kbd_macro = final; executing_kbd_macro_index = 0; - KSET (current_kboard, Vprefix_arg, Qnil); + kset_prefix_arg (current_kboard, Qnil); if (!NILP (loopfunc)) { === modified file 'src/msdos.c' --- src/msdos.c 2012-08-13 03:44:27 +0000 +++ src/msdos.c 2012-08-17 23:38:43 +0000 @@ -520,8 +520,8 @@ /* If the user specified a special video mode for these dimensions, use that mode. */ - video_mode - = Fsymbol_value (Fintern_soft (make_formatted_string + video_mode + = Fsymbol_value (Fintern_soft (make_formatted_string (video_name, "screen-dimensions-%dx%d", *rows, *cols), Qnil)); @@ -1801,7 +1801,7 @@ } tty = FRAME_TTY (sf); - KSET (current_kboard, Vwindow_system, Qpc); + kset_window_system (current_kboard, Qpc); sf->output_method = output_msdos_raw; if (init_needed) { === modified file 'src/nsfns.m' --- src/nsfns.m 2012-08-17 21:52:15 +0000 +++ src/nsfns.m 2012-08-17 23:38:43 +0000 @@ -1391,7 +1391,7 @@ if (FRAME_HAS_MINIBUF_P (f) && (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame)) || !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame))))) - KSET (kb, Vdefault_minibuffer_frame, frame); + kset_default_minibuffer_frame (kb, 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. */ === modified file 'src/nsterm.m' --- src/nsterm.m 2012-08-17 21:52:15 +0000 +++ src/nsterm.m 2012-08-17 23:38:43 +0000 @@ -4093,7 +4093,7 @@ terminal->kboard = xmalloc (sizeof *terminal->kboard); init_kboard (terminal->kboard); - KSET (terminal->kboard, Vwindow_system, Qns); + kset_window_system (terminal->kboard, Qns); terminal->kboard->next_kboard = all_kboards; all_kboards = terminal->kboard; /* Don't let the initial kboard remain current longer than necessary. === modified file 'src/term.c' --- src/term.c 2012-08-16 21:58:44 +0000 +++ src/term.c 2012-08-17 23:38:43 +0000 @@ -1332,7 +1332,7 @@ /* This can happen if CANNOT_DUMP or with strange options. */ if (!KEYMAPP (KVAR (kboard, Vinput_decode_map))) - KSET (kboard, Vinput_decode_map, Fmake_sparse_keymap (Qnil)); + kset_input_decode_map (kboard, Fmake_sparse_keymap (Qnil)); for (i = 0; i < (sizeof (keys)/sizeof (keys[0])); i++) { @@ -3280,7 +3280,7 @@ terminal->kboard = xmalloc (sizeof *terminal->kboard); init_kboard (terminal->kboard); - KSET (terminal->kboard, Vwindow_system, Qnil); + kset_window_system (terminal->kboard, Qnil); terminal->kboard->next_kboard = all_kboards; all_kboards = terminal->kboard; terminal->kboard->reference_count++; === modified file 'src/w32fns.c' --- src/w32fns.c 2012-08-17 21:52:15 +0000 +++ src/w32fns.c 2012-08-17 23:38:43 +0000 @@ -4381,7 +4381,7 @@ if (FRAME_HAS_MINIBUF_P (f) && (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame)) || !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame))))) - KSET (kb, Vdefault_minibuffer_frame, frame); + kset_default_minibuffer_frame (kb, 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. */ === modified file 'src/w32term.c' --- src/w32term.c 2012-08-17 21:52:15 +0000 +++ src/w32term.c 2012-08-17 23:38:43 +0000 @@ -6232,7 +6232,7 @@ terminal like X does. */ terminal->kboard = xmalloc (sizeof (KBOARD)); init_kboard (terminal->kboard); - KSET (terminal->kboard, Vwindow_system, intern ("w32")); + kset_window_system (terminal->kboard, intern ("w32")); terminal->kboard->next_kboard = all_kboards; all_kboards = terminal->kboard; /* Don't let the initial kboard remain current longer than necessary. === modified file 'src/xfns.c' --- src/xfns.c 2012-08-17 21:52:15 +0000 +++ src/xfns.c 2012-08-17 23:38:43 +0000 @@ -3455,7 +3455,7 @@ if (FRAME_HAS_MINIBUF_P (f) && (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame)) || !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame))))) - KSET (kb, Vdefault_minibuffer_frame, frame); + kset_default_minibuffer_frame (kb, 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. */ === modified file 'src/xterm.c' --- src/xterm.c 2012-08-17 21:52:15 +0000 +++ src/xterm.c 2012-08-17 23:38:43 +0000 @@ -7834,7 +7834,7 @@ { /* Set this to t so that delete_frame won't get confused trying to find a replacement. */ - KSET (FRAME_KBOARD (XFRAME (frame)), Vdefault_minibuffer_frame, Qt); + kset_default_minibuffer_frame (FRAME_KBOARD (XFRAME (frame)), Qt); delete_frame (frame, Qnoelisp); } @@ -10114,7 +10114,7 @@ { terminal->kboard = xmalloc (sizeof *terminal->kboard); init_kboard (terminal->kboard); - KSET (terminal->kboard, Vwindow_system, Qx); + kset_window_system (terminal->kboard, Qx); /* Add the keyboard to the list before running Lisp code (via Qvendor_specific_keysyms below), since these are not traced @@ -10136,9 +10136,10 @@ /* Temporarily hide the partially initialized terminal. */ terminal_list = terminal->next_terminal; UNBLOCK_INPUT; - KSET (terminal->kboard, Vsystem_key_alist, - call1 (Qvendor_specific_keysyms, - vendor ? build_string (vendor) : empty_unibyte_string)); + kset_system_key_alist + (terminal->kboard, + call1 (Qvendor_specific_keysyms, + vendor ? build_string (vendor) : empty_unibyte_string)); BLOCK_INPUT; terminal->next_terminal = terminal_list; terminal_list = terminal; ------------------------------------------------------------ revno: 109667 fixes bug: http://debbugs.gnu.org/12215 committer: Paul Eggert branch nick: trunk timestamp: Fri 2012-08-17 14:52:15 -0700 message: * frame.h (FSET): Remove (Bug#12215). Replace all uses with calls to new setter functions. Use INLINE_HEADER_BEGIN, INLINE_HEADER_END. (FRAME_INLINE): New macro. (fset_buffer_list, fset_buried_buffer_list, fset_condemned_scroll_bars) (fset_current_tool_bar_string, fset_desired_tool_bar_string) (fset_face_alist, fset_focus_frame, fset_icon_name, fset_menu_bar_items) (fset_menu_bar_vector, fset_menu_bar_window, fset_name) (fset_param_alist, fset_root_window, fset_scroll_bars) (fset_selected_window, fset_title, fset_tool_bar_items) (fset_tool_bar_position, fset_tool_bar_window): New functions. * frame.c (FRAME_INLINE): Define to EXTERN_INLINE, so that the corresponding functions are compiled into code. (fset_buffer_predicate, fset_minibuffer_window): New setter functions. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-08-17 21:12:11 +0000 +++ src/ChangeLog 2012-08-17 21:52:15 +0000 @@ -1,5 +1,21 @@ 2012-08-17 Paul Eggert + * frame.h (FSET): Remove (Bug#12215). + Replace all uses with calls to new setter functions. + Use INLINE_HEADER_BEGIN, INLINE_HEADER_END. + (FRAME_INLINE): New macro. + (fset_buffer_list, fset_buried_buffer_list, fset_condemned_scroll_bars) + (fset_current_tool_bar_string, fset_desired_tool_bar_string) + (fset_face_alist, fset_focus_frame, fset_icon_name, fset_menu_bar_items) + (fset_menu_bar_vector, fset_menu_bar_window, fset_name) + (fset_param_alist, fset_root_window, fset_scroll_bars) + (fset_selected_window, fset_title, fset_tool_bar_items) + (fset_tool_bar_position, fset_tool_bar_window): New functions. + * frame.c (FRAME_INLINE): + Define to EXTERN_INLINE, so that the corresponding functions + are compiled into code. + (fset_buffer_predicate, fset_minibuffer_window): New setter functions. + A few more naming-convention fixes for getters and setters. * buffer.c (set_buffer_overlays_before): Move here from buffer.h, and rename from buffer_overlays_set_before. === modified file 'src/buffer.c' --- src/buffer.c 2012-08-17 21:12:11 +0000 +++ src/buffer.c 2012-08-17 21:52:15 +0000 @@ -1783,8 +1783,8 @@ Vinhibit_quit = tem; /* Update buffer list of selected frame. */ - FSET (f, buffer_list, Fcons (buffer, Fdelq (buffer, f->buffer_list))); - FSET (f, buried_buffer_list, Fdelq (buffer, f->buried_buffer_list)); + fset_buffer_list (f, Fcons (buffer, Fdelq (buffer, f->buffer_list))); + fset_buried_buffer_list (f, Fdelq (buffer, f->buried_buffer_list)); /* Run buffer-list-update-hook. */ if (!NILP (Vrun_hooks)) @@ -1821,9 +1821,9 @@ Vinhibit_quit = tem; /* Update buffer lists of selected frame. */ - FSET (f, buffer_list, Fdelq (buffer, f->buffer_list)); - FSET (f, buried_buffer_list, - Fcons (buffer, Fdelq (buffer, f->buried_buffer_list))); + fset_buffer_list (f, Fdelq (buffer, f->buffer_list)); + fset_buried_buffer_list + (f, Fcons (buffer, Fdelq (buffer, f->buried_buffer_list))); /* Run buffer-list-update-hook. */ if (!NILP (Vrun_hooks)) === modified file 'src/dispnew.c' --- src/dispnew.c 2012-08-16 21:58:44 +0000 +++ src/dispnew.c 2012-08-17 21:52:15 +0000 @@ -2166,7 +2166,7 @@ if (NILP (f->menu_bar_window)) { Lisp_Object frame; - FSET (f, menu_bar_window, make_window ()); + fset_menu_bar_window (f, make_window ()); w = XWINDOW (f->menu_bar_window); XSETFRAME (frame, f); WSET (w, frame, frame); @@ -2194,7 +2194,7 @@ if (NILP (f->tool_bar_window)) { Lisp_Object frame; - FSET (f, tool_bar_window, make_window ()); + fset_tool_bar_window (f, make_window ()); w = XWINDOW (f->tool_bar_window); XSETFRAME (frame, f); WSET (w, frame, frame); @@ -2272,7 +2272,7 @@ free_glyph_matrix (w->desired_matrix); free_glyph_matrix (w->current_matrix); w->desired_matrix = w->current_matrix = NULL; - FSET (f, menu_bar_window, Qnil); + fset_menu_bar_window (f, Qnil); } /* Free the tool bar window and its glyph matrices. */ @@ -2282,7 +2282,7 @@ free_glyph_matrix (w->desired_matrix); free_glyph_matrix (w->current_matrix); w->desired_matrix = w->current_matrix = NULL; - FSET (f, tool_bar_window, Qnil); + fset_tool_bar_window (f, Qnil); } /* Release frame glyph matrices. Reset fields to zero in @@ -3220,8 +3220,8 @@ /* Swap tool-bar strings. We swap because we want to reuse strings. */ tem = f->current_tool_bar_string; - FSET (f, current_tool_bar_string, f->desired_tool_bar_string); - FSET (f, desired_tool_bar_string, tem); + fset_current_tool_bar_string (f, f->desired_tool_bar_string); + fset_desired_tool_bar_string (f, tem); } } === modified file 'src/dosfns.c' --- src/dosfns.c 2012-08-07 05:29:25 +0000 +++ src/dosfns.c 2012-08-17 21:52:15 +0000 @@ -473,7 +473,7 @@ update_mode_lines = 1; - FSET (f, title, name); + fset_title (f, name); if (NILP (name)) name = f->name; === modified file 'src/frame.c' --- src/frame.c 2012-08-17 14:24:43 +0000 +++ src/frame.c 2012-08-17 21:52:15 +0000 @@ -19,6 +19,8 @@ #include +#define FRAME_INLINE EXTERN_INLINE + #include #include #include @@ -127,6 +129,18 @@ static void x_report_frame_params (struct frame *, Lisp_Object *); #endif +/* These setters are used only in this file, so they can be private. */ +static inline void +fset_buffer_predicate (struct frame *f, Lisp_Object val) +{ + f->buffer_predicate = val; +} +static inline void +fset_minibuffer_window (struct frame *f, Lisp_Object val) +{ + f->minibuffer_window = val; +} + static void set_menu_bar_lines_1 (Lisp_Object window, int n) @@ -271,7 +285,7 @@ /* Initialize Lisp data. Note that allocate_frame initializes all Lisp data to nil, so do it only for slots which should not be nil. */ - FSET (f, tool_bar_position, Qtop); + fset_tool_bar_position (f, Qtop); /* Initialize non-Lisp data. Note that allocate_frame zeroes out all non-Lisp data, so do it only for slots which should not be zero. @@ -295,13 +309,13 @@ WSET (XWINDOW (mini_window), prev, root_window); XWINDOW (mini_window)->mini = 1; WSET (XWINDOW (mini_window), frame, frame); - FSET (f, minibuffer_window, mini_window); + fset_minibuffer_window (f, mini_window); } else { mini_window = Qnil; WSET (XWINDOW (root_window), next, Qnil); - FSET (f, minibuffer_window, Qnil); + fset_minibuffer_window (f, Qnil); } WSET (XWINDOW (root_window), frame, frame); @@ -341,7 +355,7 @@ etc. Running Lisp functions at this point surely ends in a SEGV. */ set_window_buffer (root_window, buf, 0, 0); - FSET (f, buffer_list, Fcons (buf, Qnil)); + fset_buffer_list (f, Fcons (buf, Qnil)); } if (mini_p) @@ -354,8 +368,8 @@ 0, 0); } - FSET (f, root_window, root_window); - FSET (f, selected_window, root_window); + fset_root_window (f, root_window); + fset_selected_window (f, root_window); /* Make sure this window seems more recently used than a newly-created, never-selected window. */ XWINDOW (f->selected_window)->use_time = ++window_select_count; @@ -404,7 +418,7 @@ = XFRAME (KVAR (kb, Vdefault_minibuffer_frame))->minibuffer_window; } - FSET (f, minibuffer_window, mini_window); + fset_minibuffer_window (f, mini_window); /* Make the chosen minibuffer window display the proper minibuffer, unless it is already showing a minibuffer. */ @@ -441,7 +455,8 @@ Avoid infinite looping on the window chain by marking next pointer as nil. */ - mini_window = FSET (f, minibuffer_window, f->root_window); + mini_window = f->root_window; + fset_minibuffer_window (f, mini_window); XWINDOW (mini_window)->mini = 1; WSET (XWINDOW (mini_window), next, Qnil); WSET (XWINDOW (mini_window), prev, Qnil); @@ -484,7 +499,7 @@ Vframe_list = Fcons (frame, Vframe_list); tty_frame_count = 1; - FSET (f, name, build_pure_c_string ("F1")); + fset_name (f, build_pure_c_string ("F1")); f->visible = 1; f->async_visible = 1; @@ -525,7 +540,7 @@ XSETFRAME (frame, f); Vframe_list = Fcons (frame, Vframe_list); - FSET (f, name, make_formatted_string (name, "F%"pMd, ++tty_frame_count)); + fset_name (f, make_formatted_string (name, "F%"pMd, ++tty_frame_count)); f->visible = 1; /* FRAME_SET_VISIBLE wd set frame_garbaged. */ f->async_visible = 1; /* Don't let visible be cleared later. */ @@ -695,7 +710,7 @@ /* Make the frame face alist be frame-specific, so that each frame could change its face definitions independently. */ - FSET (f, face_alist, Fcopy_alist (sf->face_alist)); + fset_face_alist (f, Fcopy_alist (sf->face_alist)); /* Simple Fcopy_alist isn't enough, because we need the contents of the vectors which are the CDRs of associations in face_alist to be copied as well. */ @@ -1282,7 +1297,7 @@ /* Mark all the windows that used to be on FRAME as deleted, and then remove the reference to them. */ delete_all_child_windows (f->root_window); - FSET (f, root_window, Qnil); + fset_root_window (f, Qnil); Vframe_list = Fdelq (frame, Vframe_list); FRAME_SET_VISIBLE (f, 0); @@ -1291,7 +1306,7 @@ garbage collection. The frame object itself may not be garbage collected until much later, because recent_keys and other data structures can still refer to it. */ - FSET (f, menu_bar_vector, Qnil); + fset_menu_bar_vector (f, Qnil); free_font_driver_list (f); xfree (f->namebuf); @@ -1919,7 +1934,7 @@ f = XFRAME (frame); - FSET (f, focus_frame, focus_frame); + fset_focus_frame (f, focus_frame); if (FRAME_TERMINAL (f)->frame_rehighlight_hook) (*FRAME_TERMINAL (f)->frame_rehighlight_hook) (f); @@ -1984,10 +1999,10 @@ FOR_EACH_FRAME (tail, frame) { - FSET (XFRAME (frame), buffer_list, - Fdelq (buffer, XFRAME (frame)->buffer_list)); - FSET (XFRAME (frame), buried_buffer_list, - Fdelq (buffer, XFRAME (frame)->buried_buffer_list)); + fset_buffer_list + (XFRAME (frame), Fdelq (buffer, XFRAME (frame)->buffer_list)); + fset_buried_buffer_list + (XFRAME (frame), Fdelq (buffer, XFRAME (frame)->buried_buffer_list)); } } @@ -2054,7 +2069,7 @@ error ("Frame names of the form F are usurped by Emacs"); } - FSET (f, name, name); + fset_name (f, name); update_mode_lines = 1; } @@ -2071,7 +2086,7 @@ for (; CONSP (val); val = XCDR (val)) if (!NILP (Fbuffer_live_p (XCAR (val)))) list = Fcons (XCAR (val), list); - FSET (f, buffer_list, Fnreverse (list)); + fset_buffer_list (f, Fnreverse (list)); return; } if (EQ (prop, Qburied_buffer_list)) @@ -2080,7 +2095,7 @@ for (; CONSP (val); val = XCDR (val)) if (!NILP (Fbuffer_live_p (XCAR (val)))) list = Fcons (XCAR (val), list); - FSET (f, buried_buffer_list, Fnreverse (list)); + fset_buried_buffer_list (f, Fnreverse (list)); return; } @@ -2117,7 +2132,7 @@ /* Update the frame parameter alist. */ old_alist_elt = Fassq (prop, f->param_alist); if (EQ (old_alist_elt, Qnil)) - FSET (f, param_alist, Fcons (Fcons (prop, val), f->param_alist)); + fset_param_alist (f, Fcons (Fcons (prop, val), f->param_alist)); else Fsetcdr (old_alist_elt, val); @@ -2125,7 +2140,7 @@ in addition to the alist. */ if (EQ (prop, Qbuffer_predicate)) - FSET (f, buffer_predicate, val); + fset_buffer_predicate (f, val); if (! FRAME_WINDOW_P (f)) { @@ -2145,7 +2160,7 @@ error ("Can't change the surrogate minibuffer of a frame with its own minibuffer"); /* Install the chosen minibuffer window, with proper buffer. */ - FSET (f, minibuffer_window, val); + fset_minibuffer_window (f, val); } } === modified file 'src/frame.h' --- src/frame.h 2012-08-07 07:33:18 +0000 +++ src/frame.h 2012-08-17 21:52:15 +0000 @@ -25,6 +25,11 @@ #include "dispextern.h" +INLINE_HEADER_BEGIN +#ifndef FRAME_INLINE +# define FRAME_INLINE INLINE +#endif + /* Miscellanea. */ @@ -80,10 +85,6 @@ struct font_driver_list; -/* Most code should use this macro to set Lisp field in struct frame. */ - -#define FSET(f, field, value) ((f)->field = (value)) - struct frame { struct vectorlike_header header; @@ -499,6 +500,109 @@ unsigned long foreground_pixel; }; +/* Most code should use these functions to set Lisp fields in struct frame. */ + +FRAME_INLINE void +fset_buffer_list (struct frame *f, Lisp_Object val) +{ + f->buffer_list = val; +} +FRAME_INLINE void +fset_buried_buffer_list (struct frame *f, Lisp_Object val) +{ + f->buried_buffer_list = val; +} +FRAME_INLINE void +fset_condemned_scroll_bars (struct frame *f, Lisp_Object val) +{ + f->condemned_scroll_bars = val; +} +FRAME_INLINE void +fset_current_tool_bar_string (struct frame *f, Lisp_Object val) +{ + f->current_tool_bar_string = val; +} +FRAME_INLINE void +fset_desired_tool_bar_string (struct frame *f, Lisp_Object val) +{ + f->desired_tool_bar_string = val; +} +FRAME_INLINE void +fset_face_alist (struct frame *f, Lisp_Object val) +{ + f->face_alist = val; +} +FRAME_INLINE void +fset_focus_frame (struct frame *f, Lisp_Object val) +{ + f->focus_frame = val; +} +FRAME_INLINE void +fset_icon_name (struct frame *f, Lisp_Object val) +{ + f->icon_name = val; +} +FRAME_INLINE void +fset_menu_bar_items (struct frame *f, Lisp_Object val) +{ + f->menu_bar_items = val; +} +FRAME_INLINE void +fset_menu_bar_vector (struct frame *f, Lisp_Object val) +{ + f->menu_bar_vector = val; +} +FRAME_INLINE void +fset_menu_bar_window (struct frame *f, Lisp_Object val) +{ + f->menu_bar_window = val; +} +FRAME_INLINE void +fset_name (struct frame *f, Lisp_Object val) +{ + f->name = val; +} +FRAME_INLINE void +fset_param_alist (struct frame *f, Lisp_Object val) +{ + f->param_alist = val; +} +FRAME_INLINE void +fset_root_window (struct frame *f, Lisp_Object val) +{ + f->root_window = val; +} +FRAME_INLINE void +fset_scroll_bars (struct frame *f, Lisp_Object val) +{ + f->scroll_bars = val; +} +FRAME_INLINE void +fset_selected_window (struct frame *f, Lisp_Object val) +{ + f->selected_window = val; +} +FRAME_INLINE void +fset_title (struct frame *f, Lisp_Object val) +{ + f->title = val; +} +FRAME_INLINE void +fset_tool_bar_items (struct frame *f, Lisp_Object val) +{ + f->tool_bar_items = val; +} +FRAME_INLINE void +fset_tool_bar_position (struct frame *f, Lisp_Object val) +{ + f->tool_bar_position = val; +} +FRAME_INLINE void +fset_tool_bar_window (struct frame *f, Lisp_Object val) +{ + f->tool_bar_window = val; +} + #define FRAME_KBOARD(f) ((f)->terminal->kboard) /* Return a pointer to the image cache of frame F. */ @@ -1146,4 +1250,6 @@ #endif /* HAVE_WINDOW_SYSTEM */ +INLINE_HEADER_END + #endif /* not EMACS_FRAME_H */ === modified file 'src/nsfns.m' --- src/nsfns.m 2012-08-13 03:44:27 +0000 +++ src/nsfns.m 2012-08-17 21:52:15 +0000 @@ -447,7 +447,7 @@ else if (!STRINGP (oldval) && EQ (oldval, Qnil) == EQ (arg, Qnil)) return; - FSET (f, icon_name, arg); + fset_icon_name (f, arg); if (NILP (arg)) { @@ -539,7 +539,7 @@ if (! NILP (Fstring_equal (name, f->name))) return; - FSET (f, name, name); + fset_name (f, name); /* title overrides explicit name */ if (! NILP (f->title)) @@ -590,7 +590,7 @@ update_mode_lines = 1; - FSET (f, title, name); + fset_title (f, name); if (NILP (name)) name = f->name; @@ -676,7 +676,7 @@ [[view window] setRepresentedFilename: fstr]; [[view window] setTitle: str]; - FSET (f, name, name); + fset_name (f, name); } [pool release]; @@ -1204,11 +1204,11 @@ FRAME_FONTSET (f) = -1; - FSET (f, icon_name, x_get_arg (dpyinfo, parms, Qicon_name, - "iconName", "Title", - RES_TYPE_STRING)); + fset_icon_name (f, x_get_arg (dpyinfo, parms, Qicon_name, + "iconName", "Title", + RES_TYPE_STRING)); if (! STRINGP (f->icon_name)) - FSET (f, icon_name, Qnil); + fset_icon_name (f, Qnil); FRAME_NS_DISPLAY_INFO (f) = dpyinfo; @@ -1231,12 +1231,12 @@ be set. */ if (EQ (name, Qunbound) || NILP (name) || ! STRINGP (name)) { - FSET (f, name, build_string ([ns_app_name UTF8String])); + fset_name (f, build_string ([ns_app_name UTF8String])); f->explicit_name = 0; } else { - FSET (f, name, name); + fset_name (f, name); f->explicit_name = 1; specbind (Qx_resource_name, name); } @@ -1397,7 +1397,7 @@ by x_get_arg and friends, now go in the misc. alist of the frame. */ for (tem = parms; CONSP (tem); tem = XCDR (tem)) if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem)))) - FSET (f, param_alist, Fcons (XCAR (tem), f->param_alist)); + fset_param_alist (f, Fcons (XCAR (tem), f->param_alist)); UNGCPRO; === modified file 'src/nsmenu.m' --- src/nsmenu.m 2012-08-15 18:58:19 +0000 +++ src/nsmenu.m 2012-08-17 21:52:15 +0000 @@ -214,7 +214,7 @@ if (! NILP (Vlucid_menu_bar_dirty_flag)) call0 (Qrecompute_lucid_menubar); safe_run_hooks (Qmenu_bar_update_hook); - FSET (f, menu_bar_items, menu_bar_items (FRAME_MENU_BAR_ITEMS (f))); + fset_menu_bar_items (f, menu_bar_items (FRAME_MENU_BAR_ITEMS (f))); /* Now ready to go */ items = FRAME_MENU_BAR_ITEMS (f); @@ -340,7 +340,7 @@ } /* The menu items are different, so store them in the frame */ /* FIXME: this is not correct for single-submenu case */ - FSET (f, menu_bar_vector, menu_items); + fset_menu_bar_vector (f, menu_items); f->menu_bar_items_used = menu_items_used; /* Calls restore_menu_items, etc., as they were outside */ === modified file 'src/nsterm.m' --- src/nsterm.m 2012-08-16 21:58:44 +0000 +++ src/nsterm.m 2012-08-17 21:52:15 +0000 @@ -1032,7 +1032,7 @@ : dpyinfo->x_focus_frame); if (!FRAME_LIVE_P (dpyinfo->x_highlight_frame)) { - FSET (dpyinfo->x_focus_frame, focus_frame, Qnil); + fset_focus_frame (dpyinfo->x_focus_frame, Qnil); dpyinfo->x_highlight_frame = dpyinfo->x_focus_frame; } } === modified file 'src/w32fns.c' --- src/w32fns.c 2012-08-14 08:44:24 +0000 +++ src/w32fns.c 2012-08-17 21:52:15 +0000 @@ -1490,7 +1490,7 @@ else if (!NILP (arg) || NILP (oldval)) return; - FSET (f, icon_name, arg); + fset_icon_name (f, arg); #if 0 if (f->output_data.w32->icon_bitmap != 0) @@ -1686,7 +1686,7 @@ if (! NILP (Fstring_equal (name, f->name))) return; - FSET (f, name, name); + fset_name (f, name); /* For setting the frame title, the title parameter should override the name parameter. */ @@ -1734,7 +1734,7 @@ update_mode_lines = 1; - FSET (f, title, name); + fset_title (f, name); if (NILP (name)) name = f->name; @@ -3925,7 +3925,7 @@ f->explicit_name = 0; name = f->name; - FSET (f, name, Qnil); + fset_name (f, Qnil); x_set_name (f, name, explicit); } @@ -4174,11 +4174,11 @@ f->output_data.w32 = xzalloc (sizeof (struct w32_output)); FRAME_FONTSET (f) = -1; - FSET (f, icon_name, - x_get_arg (dpyinfo, parameters, Qicon_name, "iconName", "Title", + fset_icon_name + (f, x_get_arg (dpyinfo, parameters, Qicon_name, "iconName", "Title", RES_TYPE_STRING)); if (! STRINGP (f->icon_name)) - FSET (f, icon_name, Qnil); + fset_icon_name (f, Qnil); /* FRAME_W32_DISPLAY_INFO (f) = dpyinfo; */ @@ -4207,12 +4207,12 @@ be set. */ if (EQ (name, Qunbound) || NILP (name)) { - FSET (f, name, build_string (dpyinfo->w32_id_name)); + fset_name (f, build_string (dpyinfo->w32_id_name)); f->explicit_name = 0; } else { - FSET (f, name, name); + fset_name (f, name); f->explicit_name = 1; /* use the frame's title when getting resources for this frame. */ specbind (Qx_resource_name, name); @@ -4387,7 +4387,7 @@ by x_get_arg and friends, now go in the misc. alist of the frame. */ for (tem = parameters; CONSP (tem); tem = XCDR (tem)) if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem)))) - FSET (f, param_alist, Fcons (XCAR (tem), f->param_alist)); + fset_param_alist (f, Fcons (XCAR (tem), f->param_alist)); UNGCPRO; @@ -5261,7 +5261,7 @@ f->output_data.w32 = xzalloc (sizeof (struct w32_output)); FRAME_FONTSET (f) = -1; - FSET (f, icon_name, Qnil); + fset_icon_name (f, Qnil); #ifdef GLYPH_DEBUG image_cache_refcount = @@ -5276,12 +5276,12 @@ be set. */ if (EQ (name, Qunbound) || NILP (name)) { - FSET (f, name, build_string (dpyinfo->w32_id_name)); + fset_name (f, build_string (dpyinfo->w32_id_name)); f->explicit_name = 0; } else { - FSET (f, name, name); + fset_name (f, name); f->explicit_name = 1; /* use the frame's title when getting resources for this frame. */ specbind (Qx_resource_name, name); === modified file 'src/w32menu.c' --- src/w32menu.c 2012-08-07 07:33:18 +0000 +++ src/w32menu.c 2012-08-17 21:52:15 +0000 @@ -413,7 +413,7 @@ /* Run the hooks. */ safe_run_hooks (Qactivate_menubar_hook); safe_run_hooks (Qmenu_bar_update_hook); - FSET (f, menu_bar_items, menu_bar_items (FRAME_MENU_BAR_ITEMS (f))); + fset_menu_bar_items (f, menu_bar_items (FRAME_MENU_BAR_ITEMS (f))); items = FRAME_MENU_BAR_ITEMS (f); @@ -500,7 +500,7 @@ return; } - FSET (f, menu_bar_vector, menu_items); + fset_menu_bar_vector (f, menu_items); f->menu_bar_items_used = menu_items_used; /* This undoes save_menu_items. */ @@ -615,7 +615,7 @@ { /* This function is called before the first chance to redisplay the frame. It has to be, so the frame will have the right size. */ - FSET (f, menu_bar_items, menu_bar_items (FRAME_MENU_BAR_ITEMS (f))); + fset_menu_bar_items (f, menu_bar_items (FRAME_MENU_BAR_ITEMS (f))); set_frame_menubar (f, 1, 1); } === modified file 'src/w32term.c' --- src/w32term.c 2012-08-13 03:44:27 +0000 +++ src/w32term.c 2012-08-17 21:52:15 +0000 @@ -2972,7 +2972,7 @@ : dpyinfo->w32_focus_frame); if (! FRAME_LIVE_P (dpyinfo->x_highlight_frame)) { - FSET (dpyinfo->w32_focus_frame, focus_frame, Qnil); + fset_focus_frame (dpyinfo->w32_focus_frame, Qnil); dpyinfo->x_highlight_frame = dpyinfo->w32_focus_frame; } } @@ -3646,7 +3646,7 @@ bar->next = FRAME_SCROLL_BARS (f); bar->prev = Qnil; XSETVECTOR (barobj, bar); - FSET (f, scroll_bars, barobj); + fset_scroll_bars (f, barobj); if (! NILP (bar->next)) XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar); @@ -3832,12 +3832,12 @@ { Lisp_Object bar; bar = FRAME_SCROLL_BARS (frame); - FSET (frame, scroll_bars, XSCROLL_BAR (bar)->next); + fset_scroll_bars (frame, XSCROLL_BAR (bar)->next); XSCROLL_BAR (bar)->next = FRAME_CONDEMNED_SCROLL_BARS (frame); XSCROLL_BAR (bar)->prev = Qnil; if (! NILP (FRAME_CONDEMNED_SCROLL_BARS (frame))) XSCROLL_BAR (FRAME_CONDEMNED_SCROLL_BARS (frame))->prev = bar; - FSET (frame, condemned_scroll_bars, bar); + fset_condemned_scroll_bars (frame, bar); } } @@ -3869,7 +3869,7 @@ return; else if (EQ (FRAME_CONDEMNED_SCROLL_BARS (f), window->vertical_scroll_bar)) - FSET (f, condemned_scroll_bars, bar->next); + fset_condemned_scroll_bars (f, bar->next); else /* If its prev pointer is nil, it must be at the front of one or the other! */ @@ -3884,7 +3884,7 @@ bar->next = FRAME_SCROLL_BARS (f); bar->prev = Qnil; XSETVECTOR (barobj, bar); - FSET (f, scroll_bars, barobj); + fset_scroll_bars (f, barobj); if (! NILP (bar->next)) XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar); } @@ -3901,7 +3901,7 @@ /* Clear out the condemned list now so we won't try to process any more events on the hapless scroll bars. */ - FSET (f, condemned_scroll_bars, Qnil); + fset_condemned_scroll_bars (f, Qnil); for (; ! NILP (bar); bar = next) { === modified file 'src/window.c' --- src/window.c 2012-08-16 07:58:24 +0000 +++ src/window.c 2012-08-17 21:52:15 +0000 @@ -322,7 +322,10 @@ if (EQ (frame, selected_frame)) return Fselect_window (window, norecord); else - return FSET (XFRAME (frame), selected_window, window); + { + fset_selected_window (XFRAME (frame), window); + return window; + } } DEFUN ("selected-window", Fselected_window, Sselected_window, 0, 0, 0, @@ -365,7 +368,7 @@ sf = SELECTED_FRAME (); if (XFRAME (WINDOW_FRAME (w)) != sf) { - FSET (XFRAME (WINDOW_FRAME (w)), selected_window, window); + fset_selected_window (XFRAME (WINDOW_FRAME (w)), window); /* Use this rather than Fhandle_switch_frame so that FRAME_FOCUS_FRAME is moved appropriately as we move around in the state where a minibuffer in a separate @@ -376,7 +379,7 @@ return window; } else - FSET (sf, selected_window, window); + fset_selected_window (sf, window); /* Store the current buffer's actual point into the old selected window. It belongs to that window, @@ -1863,7 +1866,7 @@ /* If OLD is its frame's root window, then NEW is the new root window for that frame. */ if (EQ (old, FRAME_ROOT_WINDOW (XFRAME (o->frame)))) - FSET (XFRAME (o->frame), root_window, new); + fset_root_window (XFRAME (o->frame), new); if (setflag) { @@ -2146,7 +2149,7 @@ /* ALL_FRAMES nil doesn't specify which frames to include. */ if (NILP (*all_frames)) - *all_frames + *all_frames = (!EQ (*minibuf, Qlambda) ? FRAME_MINIBUF_WINDOW (XFRAME (XWINDOW (*window)->frame)) : Qnil); @@ -2659,7 +2662,7 @@ if (EQ (selected_frame, w->frame)) Fselect_window (window, Qnil); else - FSET (f, selected_window, window); + fset_selected_window (f, window); } } else @@ -2689,7 +2692,7 @@ if (EQ (selected_frame, w->frame)) Fselect_window (swindow, Qnil); else - FSET (f, selected_window, swindow); + fset_selected_window (f, swindow); } } @@ -2741,8 +2744,8 @@ if (!resize_failed) { WSET (w, left_col, r->left_col); - XSETINT (delta, XINT (r->total_cols) - - XINT (w->total_cols)); + XSETINT (delta, + XINT (r->total_cols) - XINT (w->total_cols)); WSET (w, left_col, r->left_col); resize_root_window (window, delta, Qt, Qnil); if (window_resize_check (w, 1)) @@ -2915,7 +2918,7 @@ if (WINDOW_LEFT_MARGIN_COLS (w) > 0) { WSET (w, left_margin_cols, make_number (margin_cols / 2)); - WSET (w, right_margin_cols, make_number (margin_cols / 2)); + WSET (w, right_margin_cols, make_number (margin_cols / 2)); } else WSET (w, right_margin_cols, make_number (margin_cols)); @@ -3612,7 +3615,7 @@ else { /* old_size is the old size of the frame's root window. */ - int old_size = XFASTINT (horflag ? r->total_cols + int old_size = XFASTINT (horflag ? r->total_cols : r->total_lines); Lisp_Object delta; @@ -4000,7 +4003,7 @@ if (EQ (FRAME_SELECTED_WINDOW (f), selected_window)) Fselect_window (new_selected_window, Qt); else - FSET (f, selected_window, new_selected_window); + fset_selected_window (f, new_selected_window); UNBLOCK_INPUT; @@ -4014,7 +4017,7 @@ if (EQ (FRAME_SELECTED_WINDOW (f), selected_window)) Fselect_window (new_selected_window, Qnil); else - FSET (f, selected_window, new_selected_window); + fset_selected_window (f, new_selected_window); } else UNBLOCK_INPUT; @@ -5542,7 +5545,7 @@ WSET (w, next, Qnil); if (!NILP (p->parent)) - WSET (w, parent, SAVED_WINDOW_N + WSET (w, parent, SAVED_WINDOW_N (saved_windows, XFASTINT (p->parent))->window); else WSET (w, parent, Qnil); @@ -5650,7 +5653,7 @@ set_marker_restricted (w->start, make_number (0), w->buffer); if (XMARKER (w->pointm)->buffer == 0) - set_marker_restricted_both + set_marker_restricted_both (w->pointm, w->buffer, BUF_PT (XBUFFER (w->buffer)), BUF_PT_BYTE (XBUFFER (w->buffer))); @@ -5690,7 +5693,7 @@ } } - FSET (f, root_window, data->root_window); + fset_root_window (f, data->root_window); /* Arrange *not* to restore point in the buffer that was current when the window configuration was saved. */ if (EQ (XWINDOW (data->current_window)->buffer, new_current_buffer)) === modified file 'src/xdisp.c' --- src/xdisp.c 2012-08-14 04:49:18 +0000 +++ src/xdisp.c 2012-08-17 21:52:15 +0000 @@ -11274,7 +11274,7 @@ } XSETFRAME (Vmenu_updating_frame, f); - FSET (f, menu_bar_items, menu_bar_items (FRAME_MENU_BAR_ITEMS (f))); + fset_menu_bar_items (f, menu_bar_items (FRAME_MENU_BAR_ITEMS (f))); /* Redisplay the menu bar in case we changed it. */ #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \ @@ -11487,7 +11487,7 @@ may access f->tool_bar_items. Make sure we update both variables within BLOCK_INPUT so no such event interrupts. */ BLOCK_INPUT; - FSET (f, tool_bar_items, new_tool_bar); + fset_tool_bar_items (f, new_tool_bar); f->n_tool_bar_items = new_n_tool_bar; w->update_mode_line = 1; UNBLOCK_INPUT; @@ -11529,8 +11529,8 @@ /* Reuse f->desired_tool_bar_string, if possible. */ if (size < size_needed || NILP (f->desired_tool_bar_string)) - FSET (f, desired_tool_bar_string, - Fmake_string (make_number (size_needed), make_number (' '))); + fset_desired_tool_bar_string + (f, Fmake_string (make_number (size_needed), make_number (' '))); else { props = list4 (Qdisplay, Qnil, Qmenu_item, Qnil); === modified file 'src/xfaces.c' --- src/xfaces.c 2012-08-17 09:10:31 +0000 +++ src/xfaces.c 2012-08-17 21:52:15 +0000 @@ -2695,7 +2695,7 @@ lface = Fmake_vector (make_number (LFACE_VECTOR_SIZE), Qunspecified); ASET (lface, 0, Qface); - FSET (f, face_alist, Fcons (Fcons (face, lface), f->face_alist)); + fset_face_alist (f, Fcons (Fcons (face, lface), f->face_alist)); } else for (i = 1; i < LFACE_VECTOR_SIZE; ++i) === modified file 'src/xfns.c' --- src/xfns.c 2012-08-16 21:58:44 +0000 +++ src/xfns.c 2012-08-17 21:52:15 +0000 @@ -658,7 +658,7 @@ #ifdef USE_GTK if (xg_change_toolbar_position (f, new_value)) - FSET (f, tool_bar_position, new_value); + fset_tool_bar_position (f, new_value); #endif } @@ -1145,7 +1145,7 @@ else if (!NILP (arg) || NILP (oldval)) return; - FSET (f, icon_name, arg); + fset_icon_name (f, arg); if (f->output_data.x->icon_bitmap != 0) return; @@ -1636,7 +1636,7 @@ if (! NILP (Fstring_equal (name, f->name))) return; - FSET (f, name, name); + fset_name (f, name); /* For setting the frame title, the title parameter should override the name parameter. */ @@ -1676,7 +1676,7 @@ update_mode_lines = 1; - FSET (f, title, name); + fset_title (f, name); if (NILP (name)) name = f->name; @@ -2565,7 +2565,7 @@ f->explicit_name = 0; name = f->name; - FSET (f, name, Qnil); + fset_name (f, Qnil); x_set_name (f, name, explicit); } @@ -2708,7 +2708,7 @@ f->explicit_name = 0; name = f->name; - FSET (f, name, Qnil); + fset_name (f, Qnil); x_set_name (f, name, explicit); } @@ -3128,11 +3128,11 @@ f->output_data.x->scroll_bar_bottom_shadow_pixel = -1; #endif /* USE_TOOLKIT_SCROLL_BARS */ - FSET (f, icon_name, - x_get_arg (dpyinfo, parms, Qicon_name, "iconName", "Title", - RES_TYPE_STRING)); + fset_icon_name (f, + x_get_arg (dpyinfo, parms, Qicon_name, "iconName", "Title", + RES_TYPE_STRING)); if (! STRINGP (f->icon_name)) - FSET (f, icon_name, Qnil); + fset_icon_name (f, Qnil); FRAME_X_DISPLAY_INFO (f) = dpyinfo; @@ -3189,12 +3189,12 @@ be set. */ if (EQ (name, Qunbound) || NILP (name)) { - FSET (f, name, build_string (dpyinfo->x_id_name)); + fset_name (f, build_string (dpyinfo->x_id_name)); f->explicit_name = 0; } else { - FSET (f, name, name); + fset_name (f, name); f->explicit_name = 1; /* use the frame's title when getting resources for this frame. */ specbind (Qx_resource_name, name); @@ -3461,7 +3461,7 @@ by x_get_arg and friends, now go in the misc. alist of the frame. */ for (tem = parms; CONSP (tem); tem = XCDR (tem)) if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem)))) - FSET (f, param_alist, Fcons (XCAR (tem), f->param_alist)); + fset_param_alist (f, Fcons (XCAR (tem), f->param_alist)); UNGCPRO; @@ -4616,7 +4616,7 @@ f->output_data.x->scroll_bar_top_shadow_pixel = -1; f->output_data.x->scroll_bar_bottom_shadow_pixel = -1; #endif /* USE_TOOLKIT_SCROLL_BARS */ - FSET (f, icon_name, Qnil); + fset_icon_name (f, Qnil); FRAME_X_DISPLAY_INFO (f) = dpyinfo; f->output_data.x->parent_desc = FRAME_X_DISPLAY_INFO (f)->root_window; f->output_data.x->explicit_parent = 0; @@ -4658,12 +4658,12 @@ be set. */ if (EQ (name, Qunbound) || NILP (name)) { - FSET (f, name, build_string (dpyinfo->x_id_name)); + fset_name (f, build_string (dpyinfo->x_id_name)); f->explicit_name = 0; } else { - FSET (f, name, name); + fset_name (f, name); f->explicit_name = 1; /* use the frame's title when getting resources for this frame. */ specbind (Qx_resource_name, name); === modified file 'src/xmenu.c' --- src/xmenu.c 2012-08-07 07:33:18 +0000 +++ src/xmenu.c 2012-08-17 21:52:15 +0000 @@ -1008,7 +1008,7 @@ if (! NILP (Vlucid_menu_bar_dirty_flag)) call0 (Qrecompute_lucid_menubar); safe_run_hooks (Qmenu_bar_update_hook); - FSET (f, menu_bar_items, menu_bar_items (FRAME_MENU_BAR_ITEMS (f))); + fset_menu_bar_items (f, menu_bar_items (FRAME_MENU_BAR_ITEMS (f))); items = FRAME_MENU_BAR_ITEMS (f); @@ -1100,7 +1100,7 @@ } /* The menu items are different, so store them in the frame. */ - FSET (f, menu_bar_vector, menu_items); + fset_menu_bar_vector (f, menu_items); f->menu_bar_items_used = menu_items_used; /* This undoes save_menu_items. */ @@ -1283,7 +1283,7 @@ { /* This function is called before the first chance to redisplay the frame. It has to be, so the frame will have the right size. */ - FSET (f, menu_bar_items, menu_bar_items (FRAME_MENU_BAR_ITEMS (f))); + fset_menu_bar_items (f, menu_bar_items (FRAME_MENU_BAR_ITEMS (f))); set_frame_menubar (f, 1, 1); } === modified file 'src/xterm.c' --- src/xterm.c 2012-08-16 21:58:44 +0000 +++ src/xterm.c 2012-08-17 21:52:15 +0000 @@ -3584,7 +3584,7 @@ : dpyinfo->x_focus_frame); if (! FRAME_LIVE_P (dpyinfo->x_highlight_frame)) { - FSET (dpyinfo->x_focus_frame, focus_frame, Qnil); + fset_focus_frame (dpyinfo->x_focus_frame, Qnil); dpyinfo->x_highlight_frame = dpyinfo->x_focus_frame; } } @@ -5018,7 +5018,7 @@ bar->next = FRAME_SCROLL_BARS (f); bar->prev = Qnil; XSETVECTOR (barobj, bar); - FSET (f, scroll_bars, barobj); + fset_scroll_bars (f, barobj); if (!NILP (bar->next)) XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar); @@ -5419,12 +5419,12 @@ { Lisp_Object bar; bar = FRAME_SCROLL_BARS (frame); - FSET (frame, scroll_bars, XSCROLL_BAR (bar)->next); + fset_scroll_bars (frame, XSCROLL_BAR (bar)->next); XSCROLL_BAR (bar)->next = FRAME_CONDEMNED_SCROLL_BARS (frame); XSCROLL_BAR (bar)->prev = Qnil; if (! NILP (FRAME_CONDEMNED_SCROLL_BARS (frame))) XSCROLL_BAR (FRAME_CONDEMNED_SCROLL_BARS (frame))->prev = bar; - FSET (frame, condemned_scroll_bars, bar); + fset_condemned_scroll_bars (frame, bar); } } @@ -5456,7 +5456,7 @@ return; else if (EQ (FRAME_CONDEMNED_SCROLL_BARS (f), window->vertical_scroll_bar)) - FSET (f, condemned_scroll_bars, bar->next); + fset_condemned_scroll_bars (f, bar->next); else /* If its prev pointer is nil, it must be at the front of one or the other! */ @@ -5471,7 +5471,7 @@ bar->next = FRAME_SCROLL_BARS (f); bar->prev = Qnil; XSETVECTOR (barobj, bar); - FSET (f, scroll_bars, barobj); + fset_scroll_bars (f, barobj); if (! NILP (bar->next)) XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar); } @@ -5488,7 +5488,7 @@ /* Clear out the condemned list now so we won't try to process any more events on the hapless scroll bars. */ - FSET (f, condemned_scroll_bars, Qnil); + fset_condemned_scroll_bars (f, Qnil); for (; ! NILP (bar); bar = next) { ------------------------------------------------------------ revno: 109666 committer: Paul Eggert branch nick: trunk timestamp: Fri 2012-08-17 14:12:11 -0700 message: A few more naming-convention fixes for getters and setters. * buffer.c (set_buffer_overlays_before): Move here from buffer.h, and rename from buffer_overlays_set_before. (set_buffer_overlays_after): Move here from buffer.h, and rename from buffer_overlays_set_after. * buffer.h (buffer_intervals): Rename from buffer_get_intervals. All uses changed. (set_buffer_intervals): Rename from buffer_set_intervals. * intervals.c (set_interval_object): Move here from intervals.h, and rename from interval_set_object. (set_interval_left): Move here from intervals.h, and rename from interval_set_left. (set_interval_right): Move here from intervals.h, and rename from interval_set_right. (copy_interval_parent): Move here from intervals.h, and rename from interval_copy_parent. * intervals.h (set_interval_parent): Rename from interval_set_parent. (set_interval_plist): Rename from interval_set_plist. Return void, not Lisp_Object, since no caller uses the result. * lisp.h (string_intervals): Rename from string_get_intervals. (set_string_intervals): Rename from string_set_intervals. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-08-17 17:09:45 +0000 +++ src/ChangeLog 2012-08-17 21:12:11 +0000 @@ -1,5 +1,27 @@ 2012-08-17 Paul Eggert + A few more naming-convention fixes for getters and setters. + * buffer.c (set_buffer_overlays_before): Move here from buffer.h, + and rename from buffer_overlays_set_before. + (set_buffer_overlays_after): Move here from buffer.h, and rename + from buffer_overlays_set_after. + * buffer.h (buffer_intervals): Rename from buffer_get_intervals. + All uses changed. + (set_buffer_intervals): Rename from buffer_set_intervals. + * intervals.c (set_interval_object): Move here from intervals.h, + and rename from interval_set_object. + (set_interval_left): Move here from intervals.h, and rename from + interval_set_left. + (set_interval_right): Move here from intervals.h, and rename from + interval_set_right. + (copy_interval_parent): Move here from intervals.h, and rename from + interval_copy_parent. + * intervals.h (set_interval_parent): Rename from interval_set_parent. + (set_interval_plist): Rename from interval_set_plist. + Return void, not Lisp_Object, since no caller uses the result. + * lisp.h (string_intervals): Rename from string_get_intervals. + (set_string_intervals): Rename from string_set_intervals. + * lisp.h (set_char_table_extras): Rename from char_table_set_extras. (set_char_table_contents): Rename from char_table_set_contents. (set_sub_char_table_contents): Rename from sub_char_table_set_contents. === modified file 'src/alloc.c' --- src/alloc.c 2012-08-14 21:38:06 +0000 +++ src/alloc.c 2012-08-17 21:12:11 +0000 @@ -5836,7 +5836,7 @@ /* ...but there are some buffer-specific things. */ - MARK_INTERVAL_TREE (buffer_get_intervals (buffer)); + MARK_INTERVAL_TREE (buffer_intervals (buffer)); /* For now, we just don't mark the undo_list. It's done later in a special way just before the sweep phase, and after stripping @@ -6090,7 +6090,7 @@ } if (!PURE_POINTER_P (XSTRING (ptr->name))) MARK_STRING (XSTRING (ptr->name)); - MARK_INTERVAL_TREE (string_get_intervals (ptr->name)); + MARK_INTERVAL_TREE (string_intervals (ptr->name)); ptr = ptr->next; if (ptr) @@ -6405,7 +6405,7 @@ { if (!iblk->intervals[i].gcmarkbit) { - interval_set_parent (&iblk->intervals[i], interval_free_list); + set_interval_parent (&iblk->intervals[i], interval_free_list); interval_free_list = &iblk->intervals[i]; this_free++; } === modified file 'src/buffer.c' --- src/buffer.c 2012-08-14 04:49:18 +0000 +++ src/buffer.c 2012-08-17 21:12:11 +0000 @@ -360,7 +360,7 @@ BUF_CHARS_MODIFF (b) = 1; BUF_OVERLAY_MODIFF (b) = 1; BUF_SAVE_MODIFF (b) = 1; - buffer_set_intervals (b, NULL); + set_buffer_intervals (b, NULL); BUF_UNCHANGED_MODIFIED (b) = 1; BUF_OVERLAY_UNCHANGED_MODIFIED (b) = 1; BUF_END_UNCHANGED (b) = 0; @@ -384,7 +384,7 @@ BSET (b, zv_marker, Qnil); name = Fcopy_sequence (buffer_or_name); - string_set_intervals (name, NULL); + set_string_intervals (name, NULL); BSET (b, name, name); BSET (b, undo_list, (SREF (name, 0) != ' ') ? Qnil : Qt); @@ -439,6 +439,19 @@ return result; } +/* Set an appropriate overlay of B. */ + +static inline void +set_buffer_overlays_before (struct buffer *b, struct Lisp_Overlay *o) +{ + b->overlays_before = o; +} + +static inline void +set_buffer_overlays_after (struct buffer *b, struct Lisp_Overlay *o) +{ + b->overlays_after = o; +} /* Clone per-buffer values of buffer FROM. @@ -474,8 +487,8 @@ memcpy (to->local_flags, from->local_flags, sizeof to->local_flags); - buffer_set_overlays_before (to, copy_overlays (to, from->overlays_before)); - buffer_set_overlays_after (to, copy_overlays (to, from->overlays_after)); + set_buffer_overlays_before (to, copy_overlays (to, from->overlays_before)); + set_buffer_overlays_after (to, copy_overlays (to, from->overlays_after)); /* Get (a copy of) the alist of Lisp-level local variables of FROM and install that in TO. */ @@ -589,7 +602,7 @@ all_buffers = b; name = Fcopy_sequence (name); - string_set_intervals (name, NULL); + set_string_intervals (name, NULL); BSET (b, name, name); reset_buffer (b); @@ -688,8 +701,8 @@ ov->next = NULL; } - buffer_set_overlays_before (b, NULL); - buffer_set_overlays_after (b, NULL); + set_buffer_overlays_before (b, NULL); + set_buffer_overlays_after (b, NULL); } /* Reinitialize everything about a buffer except its name and contents @@ -718,8 +731,8 @@ b->auto_save_failure_time = 0; BSET (b, auto_save_file_name, Qnil); BSET (b, read_only, Qnil); - buffer_set_overlays_before (b, NULL); - buffer_set_overlays_after (b, NULL); + set_buffer_overlays_before (b, NULL); + set_buffer_overlays_after (b, NULL); b->overlay_center = BEG; BSET (b, mark_active, Qnil); BSET (b, point_before_scroll, Qnil); @@ -1691,7 +1704,7 @@ m = next; } BUF_MARKERS (b) = NULL; - buffer_set_intervals (b, NULL); + set_buffer_intervals (b, NULL); /* Perhaps we should explicitly free the interval tree here... */ } @@ -3238,7 +3251,7 @@ if (prev) prev->next = next; else - buffer_set_overlays_before (buf, next); + set_buffer_overlays_before (buf, next); /* Search thru overlays_after for where to put it. */ other_prev = NULL; @@ -3260,7 +3273,7 @@ if (other_prev) other_prev->next = tail; else - buffer_set_overlays_after (buf, tail); + set_buffer_overlays_after (buf, tail); tail = prev; } else @@ -3296,7 +3309,7 @@ if (prev) prev->next = next; else - buffer_set_overlays_after (buf, next); + set_buffer_overlays_after (buf, next); /* Search thru overlays_before for where to put it. */ other_prev = NULL; @@ -3318,7 +3331,7 @@ if (other_prev) other_prev->next = tail; else - buffer_set_overlays_before (buf, tail); + set_buffer_overlays_before (buf, tail); tail = prev; } } @@ -3423,7 +3436,7 @@ beforep = tail; } if (!parent) - buffer_set_overlays_before (current_buffer, tail->next); + set_buffer_overlays_before (current_buffer, tail->next); else parent->next = tail->next; tail = tail->next; @@ -3469,7 +3482,7 @@ beforep = tail; } if (!parent) - buffer_set_overlays_after (current_buffer, tail->next); + set_buffer_overlays_after (current_buffer, tail->next); else parent->next = tail->next; tail = tail->next; @@ -3483,14 +3496,14 @@ if (beforep) { beforep->next = current_buffer->overlays_before; - buffer_set_overlays_before (current_buffer, before_list); + set_buffer_overlays_before (current_buffer, before_list); } recenter_overlay_lists (current_buffer, current_buffer->overlay_center); if (afterp) { afterp->next = current_buffer->overlays_after; - buffer_set_overlays_after (current_buffer, after_list); + set_buffer_overlays_after (current_buffer, after_list); } recenter_overlay_lists (current_buffer, current_buffer->overlay_center); } @@ -3567,7 +3580,7 @@ if (!right_pair) { found->next = bp->overlays_before; - buffer_set_overlays_before (bp, found); + set_buffer_overlays_before (bp, found); } else { @@ -3645,13 +3658,13 @@ { if (b->overlays_after) XOVERLAY (overlay)->next = b->overlays_after; - buffer_set_overlays_after (b, XOVERLAY (overlay)); + set_buffer_overlays_after (b, XOVERLAY (overlay)); } else { if (b->overlays_before) XOVERLAY (overlay)->next = b->overlays_before; - buffer_set_overlays_before (b, XOVERLAY (overlay)); + set_buffer_overlays_before (b, XOVERLAY (overlay)); } /* This puts it in the right list, and in the right order. */ @@ -3716,8 +3729,8 @@ { struct Lisp_Overlay *ov = XOVERLAY (overlay); - buffer_set_overlays_before (b, unchain_overlay (b->overlays_before, ov)); - buffer_set_overlays_after (b, unchain_overlay (b->overlays_after, ov)); + set_buffer_overlays_before (b, unchain_overlay (b->overlays_before, ov)); + set_buffer_overlays_after (b, unchain_overlay (b->overlays_after, ov)); eassert (XOVERLAY (overlay)->next == NULL); } @@ -3812,12 +3825,12 @@ if (n_end < b->overlay_center) { XOVERLAY (overlay)->next = b->overlays_after; - buffer_set_overlays_after (b, XOVERLAY (overlay)); + set_buffer_overlays_after (b, XOVERLAY (overlay)); } else { XOVERLAY (overlay)->next = b->overlays_before; - buffer_set_overlays_before (b, XOVERLAY (overlay)); + set_buffer_overlays_before (b, XOVERLAY (overlay)); } /* This puts it in the right list, and in the right order. */ @@ -4913,8 +4926,8 @@ /* No one will share the text with these buffers, but let's play it safe. */ buffer_defaults.indirections = 0; buffer_local_symbols.indirections = 0; - buffer_set_intervals (&buffer_defaults, NULL); - buffer_set_intervals (&buffer_local_symbols, NULL); + set_buffer_intervals (&buffer_defaults, NULL); + set_buffer_intervals (&buffer_local_symbols, NULL); XSETPVECTYPESIZE (&buffer_defaults, PVEC_BUFFER, pvecsize); XSETBUFFER (Vbuffer_defaults, &buffer_defaults); XSETPVECTYPESIZE (&buffer_local_symbols, PVEC_BUFFER, pvecsize); @@ -4938,8 +4951,8 @@ BSET (&buffer_defaults, mark_active, Qnil); BSET (&buffer_defaults, file_format, Qnil); BSET (&buffer_defaults, auto_save_file_format, Qt); - buffer_set_overlays_before (&buffer_defaults, NULL); - buffer_set_overlays_after (&buffer_defaults, NULL); + set_buffer_overlays_before (&buffer_defaults, NULL); + set_buffer_overlays_after (&buffer_defaults, NULL); buffer_defaults.overlay_center = BEG; XSETFASTINT (BVAR (&buffer_defaults, tab_width), 8); === modified file 'src/buffer.h' --- src/buffer.h 2012-08-14 04:49:18 +0000 +++ src/buffer.h 2012-08-17 21:12:11 +0000 @@ -953,7 +953,7 @@ /* Get text properties of B. */ BUFFER_INLINE INTERVAL -buffer_get_intervals (struct buffer *b) +buffer_intervals (struct buffer *b) { eassert (b->text != NULL); return b->text->intervals; @@ -962,26 +962,12 @@ /* Set text properties of B to I. */ BUFFER_INLINE void -buffer_set_intervals (struct buffer *b, INTERVAL i) +set_buffer_intervals (struct buffer *b, INTERVAL i) { eassert (b->text != NULL); b->text->intervals = i; } -/* Set an appropriate overlay of B. */ - -BUFFER_INLINE void -buffer_set_overlays_before (struct buffer *b, struct Lisp_Overlay *o) -{ - b->overlays_before = o; -} - -BUFFER_INLINE void -buffer_set_overlays_after (struct buffer *b, struct Lisp_Overlay *o) -{ - b->overlays_after = o; -} - /* Non-zero if current buffer has overlays. */ BUFFER_INLINE int === modified file 'src/editfns.c' --- src/editfns.c 2012-08-16 21:58:44 +0000 +++ src/editfns.c 2012-08-17 21:12:11 +0000 @@ -3936,7 +3936,7 @@ /* If this argument has text properties, record where in the result string it appears. */ - if (string_get_intervals (args[n])) + if (string_intervals (args[n])) info[n].intervals = arg_intervals = 1; continue; @@ -4280,7 +4280,7 @@ arguments has text properties, set up text properties of the result string. */ - if (string_get_intervals (args[0]) || arg_intervals) + if (string_intervals (args[0]) || arg_intervals) { Lisp_Object len, new_len, props; struct gcpro gcpro1; @@ -4530,7 +4530,7 @@ Lisp_Object buf; XSETBUFFER (buf, current_buffer); - cur_intv = buffer_get_intervals (current_buffer); + cur_intv = buffer_intervals (current_buffer); validate_region (&startr1, &endr1); validate_region (&startr2, &endr2); === modified file 'src/fileio.c' --- src/fileio.c 2012-08-16 21:58:44 +0000 +++ src/fileio.c 2012-08-17 21:12:11 +0000 @@ -3146,7 +3146,7 @@ set_buffer_internal (XBUFFER (buffer)); adjust_markers_for_delete (BEG, BEG_BYTE, Z, Z_BYTE); adjust_overlays_for_delete (BEG, Z - BEG); - buffer_set_intervals (current_buffer, NULL); + set_buffer_intervals (current_buffer, NULL); TEMP_SET_PT_BOTH (BEG, BEG_BYTE); /* Now we are safe to change the buffer's multibyteness directly. */ === modified file 'src/fns.c' --- src/fns.c 2012-08-17 17:08:30 +0000 +++ src/fns.c 2012-08-17 21:12:11 +0000 @@ -628,7 +628,7 @@ ptrdiff_t thislen_byte = SBYTES (this); memcpy (SDATA (val) + toindex_byte, SDATA (this), SBYTES (this)); - if (string_get_intervals (this)) + if (string_intervals (this)) { textprops[num_textprops].argnum = argnum; textprops[num_textprops].from = 0; @@ -640,7 +640,7 @@ /* Copy a single-byte string to a multibyte string. */ else if (STRINGP (this) && STRINGP (val)) { - if (string_get_intervals (this)) + if (string_intervals (this)) { textprops[num_textprops].argnum = argnum; textprops[num_textprops].from = 0; @@ -1060,7 +1060,7 @@ str_as_multibyte (SDATA (new_string), nbytes, SBYTES (string), NULL); string = new_string; - string_set_intervals (string, NULL); + set_string_intervals (string, NULL); } return string; } === modified file 'src/indent.c' --- src/indent.c 2012-08-13 03:39:07 +0000 +++ src/indent.c 2012-08-17 21:12:11 +0000 @@ -336,7 +336,7 @@ /* If the buffer has overlays, text properties, or multibyte characters, use a more general algorithm. */ - if (buffer_get_intervals (current_buffer) + if (buffer_intervals (current_buffer) || buffer_has_overlays () || Z != Z_BYTE) return current_column_1 (); === modified file 'src/insdel.c' --- src/insdel.c 2012-08-13 03:39:07 +0000 +++ src/insdel.c 2012-08-17 21:12:11 +0000 @@ -844,10 +844,10 @@ PT + nchars, PT_BYTE + nbytes, before_markers); - if (buffer_get_intervals (current_buffer)) + if (buffer_intervals (current_buffer)) offset_intervals (current_buffer, PT, nchars); - if (!inherit && buffer_get_intervals (current_buffer)) + if (!inherit && buffer_intervals (current_buffer)) set_text_properties (make_number (PT), make_number (PT + nchars), Qnil, Qnil, Qnil); @@ -976,7 +976,7 @@ offset_intervals (current_buffer, PT, nchars); - intervals = string_get_intervals (string); + intervals = string_intervals (string); /* Get the intervals for the part of the string we are inserting. */ if (nbytes < SBYTES (string)) intervals = copy_intervals (intervals, pos, nchars); @@ -1017,7 +1017,7 @@ adjust_markers_for_insert (GPT - nchars, GPT_BYTE - nbytes, GPT, GPT_BYTE, 0); - if (buffer_get_intervals (current_buffer)) + if (buffer_intervals (current_buffer)) { offset_intervals (current_buffer, GPT - nchars, nchars); graft_intervals_into_buffer (NULL, GPT - nchars, nchars, @@ -1157,11 +1157,11 @@ PT_BYTE + outgoing_nbytes, 0); - if (buffer_get_intervals (current_buffer)) + if (buffer_intervals (current_buffer)) offset_intervals (current_buffer, PT, nchars); /* Get the intervals for the part of the string we are inserting. */ - intervals = buffer_get_intervals (buf); + intervals = buffer_intervals (buf); if (nchars < BUF_Z (buf) - BUF_BEG (buf)) { if (buf == current_buffer && PT <= from) @@ -1226,7 +1226,7 @@ else if (len < nchars_del) adjust_overlays_for_delete (from, nchars_del - len); - if (buffer_get_intervals (current_buffer)) + if (buffer_intervals (current_buffer)) offset_intervals (current_buffer, from, len - nchars_del); if (from < PT) @@ -1412,7 +1412,7 @@ /* Get the intervals for the part of the string we are inserting-- not including the combined-before bytes. */ - intervals = string_get_intervals (new); + intervals = string_intervals (new); /* Insert those intervals. */ graft_intervals_into_buffer (intervals, from, inschars, current_buffer, inherit); @@ -1822,7 +1822,7 @@ if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer) ++windows_or_buffers_changed; - if (buffer_get_intervals (current_buffer)) + if (buffer_intervals (current_buffer)) { if (preserve_ptr) { === modified file 'src/intervals.c' --- src/intervals.c 2012-08-17 05:35:39 +0000 +++ src/intervals.c 2012-08-17 21:12:11 +0000 @@ -62,6 +62,38 @@ /* Utility functions for intervals. */ +/* Use these functions to set Lisp_Object + or pointer slots of struct interval. */ + +static inline void +set_interval_object (INTERVAL i, Lisp_Object obj) +{ + eassert (BUFFERP (obj) || STRINGP (obj)); + i->up_obj = 1; + i->up.obj = obj; +} + +static inline void +set_interval_left (INTERVAL i, INTERVAL left) +{ + i->left = left; +} + +static inline void +set_interval_right (INTERVAL i, INTERVAL right) +{ + i->right = right; +} + +/* Make the parent of D be whatever the parent of S is, regardless + of the type. This is used when balancing an interval tree. */ + +static inline void +copy_interval_parent (INTERVAL d, INTERVAL s) +{ + d->up = s->up; + d->up_obj = s->up_obj; +} /* Create the root interval of some object, a buffer or string. */ @@ -79,18 +111,18 @@ new->total_length = (BUF_Z (XBUFFER (parent)) - BUF_BEG (XBUFFER (parent))); eassert (0 <= TOTAL_LENGTH (new)); - buffer_set_intervals (XBUFFER (parent), new); + set_buffer_intervals (XBUFFER (parent), new); new->position = BEG; } else if (STRINGP (parent)) { new->total_length = SCHARS (parent); eassert (0 <= TOTAL_LENGTH (new)); - string_set_intervals (parent, new); + set_string_intervals (parent, new); new->position = 0; } - interval_set_object (new, parent); + set_interval_object (new, parent); return new; } @@ -104,7 +136,7 @@ return; COPY_INTERVAL_CACHE (source, target); - interval_set_plist (target, Fcopy_sequence (source->plist)); + set_interval_plist (target, Fcopy_sequence (source->plist)); } /* Merge the properties of interval SOURCE into the properties @@ -140,7 +172,7 @@ if (NILP (val)) { val = XCAR (o); - interval_set_plist (target, Fcons (sym, Fcons (val, target->plist))); + set_interval_plist (target, Fcons (sym, Fcons (val, target->plist))); } o = XCDR (o); } @@ -322,21 +354,21 @@ if (! ROOT_INTERVAL_P (interval)) { if (AM_LEFT_CHILD (interval)) - interval_set_left (INTERVAL_PARENT (interval), B); + set_interval_left (INTERVAL_PARENT (interval), B); else - interval_set_right (INTERVAL_PARENT (interval), B); + set_interval_right (INTERVAL_PARENT (interval), B); } - interval_copy_parent (B, interval); + copy_interval_parent (B, interval); /* Make B the parent of A */ i = B->right; - interval_set_right (B, interval); - interval_set_parent (interval, B); + set_interval_right (B, interval); + set_interval_parent (interval, B); /* Make A point to c */ - interval_set_left (interval, i); + set_interval_left (interval, i); if (i) - interval_set_parent (i, interval); + set_interval_parent (i, interval); /* A's total length is decreased by the length of B and its left child. */ interval->total_length -= B->total_length - LEFT_TOTAL_LENGTH (interval); @@ -369,21 +401,21 @@ if (! ROOT_INTERVAL_P (interval)) { if (AM_LEFT_CHILD (interval)) - interval_set_left (INTERVAL_PARENT (interval), B); + set_interval_left (INTERVAL_PARENT (interval), B); else - interval_set_right (INTERVAL_PARENT (interval), B); + set_interval_right (INTERVAL_PARENT (interval), B); } - interval_copy_parent (B, interval); + copy_interval_parent (B, interval); /* Make B the parent of A */ i = B->left; - interval_set_left (B, interval); - interval_set_parent (interval, B); + set_interval_left (B, interval); + set_interval_parent (interval, B); /* Make A point to c */ - interval_set_right (interval, i); + set_interval_right (interval, i); if (i) - interval_set_parent (i, interval); + set_interval_parent (i, interval); /* A's total length is decreased by the length of B and its right child. */ interval->total_length -= B->total_length - RIGHT_TOTAL_LENGTH (interval); @@ -455,9 +487,9 @@ if (have_parent) { if (BUFFERP (parent)) - buffer_set_intervals (XBUFFER (parent), interval); + set_buffer_intervals (XBUFFER (parent), interval); else if (STRINGP (parent)) - string_set_intervals (parent, interval); + set_string_intervals (parent, interval); } return interval; @@ -493,9 +525,9 @@ INTERVAL i; eassert (b != NULL); - i = buffer_get_intervals (b); + i = buffer_intervals (b); if (i) - buffer_set_intervals (b, balance_an_interval (i)); + set_buffer_intervals (b, balance_an_interval (i)); } /* Split INTERVAL into two pieces, starting the second piece at @@ -519,20 +551,20 @@ ptrdiff_t new_length = LENGTH (interval) - offset; new->position = position + offset; - interval_set_parent (new, interval); + set_interval_parent (new, interval); if (NULL_RIGHT_CHILD (interval)) { - interval_set_right (interval, new); + set_interval_right (interval, new); new->total_length = new_length; eassert (0 <= TOTAL_LENGTH (new)); } else { /* Insert the new node between INTERVAL and its right child. */ - interval_set_right (new, interval->right); - interval_set_parent (interval->right, new); - interval_set_right (interval, new); + set_interval_right (new, interval->right); + set_interval_parent (interval->right, new); + set_interval_right (interval, new); new->total_length = new_length + new->right->total_length; eassert (0 <= TOTAL_LENGTH (new)); balance_an_interval (new); @@ -564,20 +596,20 @@ new->position = interval->position; interval->position = interval->position + offset; - interval_set_parent (new, interval); + set_interval_parent (new, interval); if (NULL_LEFT_CHILD (interval)) { - interval_set_left (interval, new); + set_interval_left (interval, new); new->total_length = new_length; eassert (0 <= TOTAL_LENGTH (new)); } else { /* Insert the new node between INTERVAL and its left child. */ - interval_set_left (new, interval->left); - interval_set_parent (new->left, new); - interval_set_left (interval, new); + set_interval_left (new, interval->left); + set_interval_parent (new->left, new); + set_interval_left (interval, new); new->total_length = new_length + new->left->total_length; eassert (0 <= TOTAL_LENGTH (new)); balance_an_interval (new); @@ -952,20 +984,20 @@ RESET_INTERVAL (&newi); pleft = prev ? prev->plist : Qnil; pright = i ? i->plist : Qnil; - interval_set_plist (&newi, merge_properties_sticky (pleft, pright)); + set_interval_plist (&newi, merge_properties_sticky (pleft, pright)); if (! prev) /* i.e. position == BEG */ { if (! intervals_equal (i, &newi)) { i = split_interval_left (i, length); - interval_set_plist (i, newi.plist); + set_interval_plist (i, newi.plist); } } else if (! intervals_equal (prev, &newi)) { prev = split_interval_right (prev, position - prev->position); - interval_set_plist (prev, newi.plist); + set_interval_plist (prev, newi.plist); if (i && intervals_equal (prev, i)) merge_interval_right (prev); } @@ -1190,8 +1222,8 @@ this->total_length += migrate_amt; } eassert (0 <= TOTAL_LENGTH (this)); - interval_set_left (this, migrate); - interval_set_parent (migrate, this); + set_interval_left (this, migrate); + set_interval_parent (migrate, this); return i->right; } @@ -1216,12 +1248,12 @@ GET_INTERVAL_OBJECT (owner, i); parent = delete_node (i); if (parent) - interval_set_object (parent, owner); + set_interval_object (parent, owner); if (BUFFERP (owner)) - buffer_set_intervals (XBUFFER (owner), parent); + set_buffer_intervals (XBUFFER (owner), parent); else if (STRINGP (owner)) - string_set_intervals (owner, parent); + set_string_intervals (owner, parent); else abort (); @@ -1231,15 +1263,15 @@ parent = INTERVAL_PARENT (i); if (AM_LEFT_CHILD (i)) { - interval_set_left (parent, delete_node (i)); + set_interval_left (parent, delete_node (i)); if (parent->left) - interval_set_parent (parent->left, parent); + set_interval_parent (parent->left, parent); } else { - interval_set_right (parent, delete_node (i)); + set_interval_right (parent, delete_node (i)); if (parent->right) - interval_set_parent (parent->right, parent); + set_interval_parent (parent->right, parent); } } @@ -1320,8 +1352,8 @@ adjust_intervals_for_deletion (struct buffer *buffer, ptrdiff_t start, ptrdiff_t length) { - register ptrdiff_t left_to_delete = length; - register INTERVAL tree = buffer_get_intervals (buffer); + ptrdiff_t left_to_delete = length; + INTERVAL tree = buffer_intervals (buffer); Lisp_Object parent; ptrdiff_t offset; @@ -1336,7 +1368,7 @@ if (length == TOTAL_LENGTH (tree)) { - buffer_set_intervals (buffer, NULL); + set_buffer_intervals (buffer, NULL); return; } @@ -1353,10 +1385,10 @@ { left_to_delete -= interval_deletion_adjustment (tree, start - offset, left_to_delete); - tree = buffer_get_intervals (buffer); + tree = buffer_intervals (buffer); if (left_to_delete == tree->total_length) { - buffer_set_intervals (buffer, NULL); + set_buffer_intervals (buffer, NULL); return; } } @@ -1370,11 +1402,11 @@ void offset_intervals (struct buffer *buffer, ptrdiff_t start, ptrdiff_t length) { - if (!buffer_get_intervals (buffer) || length == 0) + if (!buffer_intervals (buffer) || length == 0) return; if (length > 0) - adjust_intervals_for_insertion (buffer_get_intervals (buffer), + adjust_intervals_for_insertion (buffer_intervals (buffer), start, length); else { @@ -1510,9 +1542,9 @@ copy_properties (source, target); if (! NULL_LEFT_CHILD (source)) - interval_set_left (target, reproduce_tree (source->left, target)); + set_interval_left (target, reproduce_tree (source->left, target)); if (! NULL_RIGHT_CHILD (source)) - interval_set_right (target, reproduce_tree (source->right, target)); + set_interval_right (target, reproduce_tree (source->right, target)); return target; } @@ -1525,18 +1557,16 @@ static INTERVAL reproduce_tree (INTERVAL source, INTERVAL parent) { - register INTERVAL target = reproduce_interval (source); - - interval_set_parent (target, parent); + INTERVAL target = reproduce_interval (source); + set_interval_parent (target, parent); return target; } static INTERVAL reproduce_tree_obj (INTERVAL source, Lisp_Object parent) { - register INTERVAL target = reproduce_interval (source); - - interval_set_object (target, parent); + INTERVAL target = reproduce_interval (source); + set_interval_object (target, parent); return target; } @@ -1582,12 +1612,10 @@ ptrdiff_t length, struct buffer *buffer, int inherit) { - register INTERVAL under, over, this; - register INTERVAL tree; + INTERVAL tree = buffer_intervals (buffer); + INTERVAL under, over, this; ptrdiff_t over_used; - tree = buffer_get_intervals (buffer); - /* If the new text has no properties, then with inheritance it becomes part of whatever interval it was inserted into. To prevent inheritance, we must clear out the properties @@ -1616,9 +1644,9 @@ Lisp_Object buf; XSETBUFFER (buf, buffer); - buffer_set_intervals (buffer, reproduce_tree_obj (source, buf)); - buffer_get_intervals (buffer)->position = BUF_BEG (buffer); - eassert (buffer_get_intervals (buffer)->up_obj == 1); + set_buffer_intervals (buffer, reproduce_tree_obj (source, buf)); + buffer_intervals (buffer)->position = BUF_BEG (buffer); + eassert (buffer_intervals (buffer)->up_obj == 1); return; } else if (!tree) @@ -1876,7 +1904,7 @@ /* If we have no text properties and overlays, then we can do it quickly. */ - if (!buffer_get_intervals (current_buffer) && ! have_overlays) + if (!buffer_intervals (current_buffer) && ! have_overlays) { temp_set_point_both (current_buffer, charpos, bytepos); return; @@ -1885,7 +1913,7 @@ /* Set TO to the interval containing the char after CHARPOS, and TOPREV to the interval containing the char before CHARPOS. Either one may be null. They may be equal. */ - to = find_interval (buffer_get_intervals (current_buffer), charpos); + to = find_interval (buffer_intervals (current_buffer), charpos); if (charpos == BEGV) toprev = 0; else if (to && to->position == charpos) @@ -1899,7 +1927,7 @@ and FROMPREV to the interval containing the char before PT. Either one may be null. They may be equal. */ /* We could cache this and save time. */ - from = find_interval (buffer_get_intervals (current_buffer), buffer_point); + from = find_interval (buffer_intervals (current_buffer), buffer_point); if (buffer_point == BEGV) fromprev = 0; else if (from && from->position == PT) @@ -2005,7 +2033,7 @@ /* Set TO to the interval containing the char after CHARPOS, and TOPREV to the interval containing the char before CHARPOS. Either one may be null. They may be equal. */ - to = find_interval (buffer_get_intervals (current_buffer), charpos); + to = find_interval (buffer_intervals (current_buffer), charpos); if (charpos == BEGV) toprev = 0; else if (to && to->position == charpos) @@ -2138,11 +2166,11 @@ INTERVAL i, prev, next; if (NILP (object)) - i = find_interval (buffer_get_intervals (current_buffer), pos); + i = find_interval (buffer_intervals (current_buffer), pos); else if (BUFFERP (object)) - i = find_interval (buffer_get_intervals (XBUFFER (object)), pos); + i = find_interval (buffer_intervals (XBUFFER (object)), pos); else if (STRINGP (object)) - i = find_interval (string_get_intervals (object), pos); + i = find_interval (string_intervals (object), pos); else abort (); @@ -2269,13 +2297,13 @@ copy_intervals_to_string (Lisp_Object string, struct buffer *buffer, ptrdiff_t position, ptrdiff_t length) { - INTERVAL interval_copy = copy_intervals (buffer_get_intervals (buffer), + INTERVAL interval_copy = copy_intervals (buffer_intervals (buffer), position, length); if (!interval_copy) return; - interval_set_object (interval_copy, string); - string_set_intervals (string, interval_copy); + set_interval_object (interval_copy, string); + set_string_intervals (string, interval_copy); } /* Return 1 if strings S1 and S2 have identical properties; 0 otherwise. @@ -2288,8 +2316,8 @@ ptrdiff_t pos = 0; ptrdiff_t end = SCHARS (s1); - i1 = find_interval (string_get_intervals (s1), 0); - i2 = find_interval (string_get_intervals (s2), 0); + i1 = find_interval (string_intervals (s1), 0); + i2 = find_interval (string_intervals (s2), 0); while (pos < end) { @@ -2414,13 +2442,13 @@ { if ((i)->left) { - interval_set_plist (i, i->left->plist); + set_interval_plist (i, i->left->plist); (i)->left->total_length = 0; delete_interval ((i)->left); } else { - interval_set_plist (i, i->right->plist); + set_interval_plist (i, i->right->plist); (i)->right->total_length = 0; delete_interval ((i)->right); } @@ -2434,7 +2462,7 @@ void set_intervals_multibyte (int multi_flag) { - INTERVAL i = buffer_get_intervals (current_buffer); + INTERVAL i = buffer_intervals (current_buffer); if (i) set_intervals_multibyte_1 (i, multi_flag, BEG, BEG_BYTE, Z, Z_BYTE); === modified file 'src/intervals.h' --- src/intervals.h 2012-08-10 09:37:43 +0000 +++ src/intervals.h 2012-08-17 21:12:11 +0000 @@ -137,47 +137,16 @@ or pointer slots of struct interval. */ INTERVALS_INLINE void -interval_set_parent (INTERVAL i, INTERVAL parent) +set_interval_parent (INTERVAL i, INTERVAL parent) { i->up_obj = 0; i->up.interval = parent; } INTERVALS_INLINE void -interval_set_object (INTERVAL i, Lisp_Object obj) -{ - eassert (BUFFERP (obj) || STRINGP (obj)); - i->up_obj = 1; - i->up.obj = obj; -} - -INTERVALS_INLINE void -interval_set_left (INTERVAL i, INTERVAL left) -{ - i->left = left; -} - -INTERVALS_INLINE void -interval_set_right (INTERVAL i, INTERVAL right) -{ - i->right = right; -} - -INTERVALS_INLINE Lisp_Object -interval_set_plist (INTERVAL i, Lisp_Object plist) +set_interval_plist (INTERVAL i, Lisp_Object plist) { i->plist = plist; - return plist; -} - -/* Make the parent of D be whatever the parent of S is, regardless - of the type. This is used when balancing an interval tree. */ - -INTERVALS_INLINE void -interval_copy_parent (INTERVAL d, INTERVAL s) -{ - d->up = s->up; - d->up_obj = s->up_obj; } /* Get the parent interval, if any, otherwise a null pointer. Useful @@ -191,11 +160,11 @@ { \ (i)->total_length = (i)->position = 0; \ (i)->left = (i)->right = NULL; \ - interval_set_parent (i, NULL); \ + set_interval_parent (i, NULL); \ (i)->write_protect = 0; \ (i)->visible = 0; \ (i)->front_sticky = (i)->rear_sticky = 0; \ - interval_set_plist (i, Qnil); \ + set_interval_plist (i, Qnil); \ } /* Copy the cached property values of interval FROM to interval TO. */ === modified file 'src/lisp.h' --- src/lisp.h 2012-08-17 17:08:30 +0000 +++ src/lisp.h 2012-08-17 21:12:11 +0000 @@ -2458,7 +2458,7 @@ /* Get text properties of S. */ LISP_INLINE INTERVAL -string_get_intervals (Lisp_Object s) +string_intervals (Lisp_Object s) { return XSTRING (s)->intervals; } @@ -2466,7 +2466,7 @@ /* Set text properties of S to I. */ LISP_INLINE void -string_set_intervals (Lisp_Object s, INTERVAL i) +set_string_intervals (Lisp_Object s, INTERVAL i) { XSTRING (s)->intervals = i; } === modified file 'src/lread.c' --- src/lread.c 2012-08-16 01:18:07 +0000 +++ src/lread.c 2012-08-17 21:12:11 +0000 @@ -3189,8 +3189,8 @@ /* Check for text properties in each interval. substitute_in_interval contains part of the logic. */ - INTERVAL root_interval = string_get_intervals (subtree); - Lisp_Object arg = Fcons (object, placeholder); + INTERVAL root_interval = string_intervals (subtree); + Lisp_Object arg = Fcons (object, placeholder); traverse_intervals_noorder (root_interval, &substitute_in_interval, arg); @@ -3211,7 +3211,7 @@ Lisp_Object object = Fcar (arg); Lisp_Object placeholder = Fcdr (arg); - SUBSTITUTE (interval->plist, interval_set_plist (interval, true_value)); + SUBSTITUTE (interval->plist, set_interval_plist (interval, true_value)); } === modified file 'src/print.c' --- src/print.c 2012-08-14 04:49:18 +0000 +++ src/print.c 2012-08-17 21:12:11 +0000 @@ -1194,7 +1194,7 @@ { case Lisp_String: /* A string may have text properties, which can be circular. */ - traverse_intervals_noorder (string_get_intervals (obj), + traverse_intervals_noorder (string_intervals (obj), print_preprocess_string, Qnil); break; @@ -1297,7 +1297,7 @@ print_prune_string_charset (Lisp_Object string) { print_check_string_result = 0; - traverse_intervals (string_get_intervals (string), 0, + traverse_intervals (string_intervals (string), 0, print_check_string_charset_prop, string); if (! (print_check_string_result & PRINT_STRING_UNSAFE_CHARSET_FOUND)) { @@ -1408,7 +1408,7 @@ if (! EQ (Vprint_charset_text_property, Qt)) obj = print_prune_string_charset (obj); - if (string_get_intervals (obj)) + if (string_intervals (obj)) { PRINTCHAR ('#'); PRINTCHAR ('('); @@ -1499,9 +1499,9 @@ } PRINTCHAR ('\"'); - if (string_get_intervals (obj)) + if (string_intervals (obj)) { - traverse_intervals (string_get_intervals (obj), + traverse_intervals (string_intervals (obj), 0, print_interval, printcharfun); PRINTCHAR (')'); } === modified file 'src/textprop.c' --- src/textprop.c 2012-08-08 12:12:40 +0000 +++ src/textprop.c 2012-08-17 21:12:11 +0000 @@ -143,7 +143,7 @@ if (!(BUF_BEGV (b) <= XINT (*begin) && XINT (*begin) <= XINT (*end) && XINT (*end) <= BUF_ZV (b))) args_out_of_range (*begin, *end); - i = buffer_get_intervals (b); + i = buffer_intervals (b); /* If there's no text, there are no properties. */ if (BUF_BEGV (b) == BUF_ZV (b)) @@ -161,7 +161,7 @@ XSETFASTINT (*begin, XFASTINT (*begin)); if (begin != end) XSETFASTINT (*end, XFASTINT (*end)); - i = string_get_intervals (object); + i = string_intervals (object); if (len == 0) return NULL; @@ -338,7 +338,7 @@ } /* Store new properties. */ - interval_set_plist (interval, Fcopy_sequence (properties)); + set_interval_plist (interval, Fcopy_sequence (properties)); } /* Add the properties of PLIST to the interval I, or set @@ -411,7 +411,7 @@ record_property_change (i->position, LENGTH (i), sym1, Qnil, object); } - interval_set_plist (i, Fcons (sym1, Fcons (val1, i->plist))); + set_interval_plist (i, Fcons (sym1, Fcons (val1, i->plist))); changed++; } } @@ -484,7 +484,7 @@ } if (changed) - interval_set_plist (i, current_plist); + set_interval_plist (i, current_plist); return changed; } @@ -510,13 +510,13 @@ beg = BUF_BEGV (b); end = BUF_ZV (b); - i = buffer_get_intervals (b); + i = buffer_intervals (b); } else { beg = 0; end = SCHARS (object); - i = string_get_intervals (object); + i = string_intervals (object); } if (!(beg <= position && position <= end)) @@ -1274,10 +1274,10 @@ && XFASTINT (start) == 0 && XFASTINT (end) == SCHARS (object)) { - if (!string_get_intervals (object)) + if (!string_intervals (object)) return Qnil; - string_set_intervals (object, NULL); + set_string_intervals (object, NULL); return Qt; } @@ -1339,7 +1339,7 @@ return; if (i == NULL) - i = find_interval (buffer_get_intervals (XBUFFER (buffer)), s); + i = find_interval (buffer_intervals (XBUFFER (buffer)), s); if (i->position != s) { @@ -1993,10 +1993,10 @@ verify_interval_modification (struct buffer *buf, ptrdiff_t start, ptrdiff_t end) { - register INTERVAL intervals = buffer_get_intervals (buf); - register INTERVAL i; + INTERVAL intervals = buffer_intervals (buf); + INTERVAL i; Lisp_Object hooks; - register Lisp_Object prev_mod_hooks; + Lisp_Object prev_mod_hooks; Lisp_Object mod_hooks; struct gcpro gcpro1; ------------------------------------------------------------ revno: 109665 committer: Glenn Morris branch nick: trunk timestamp: Fri 2012-08-17 16:38:47 -0400 message: rmail-output-read-file-name fix for bug#12214 This resembles the 2001-05-07 change to rmail-output-read-rmail-file-name, which was never copied to rmail-output-read-file-name. It's more complicated now due to Rmail's buffer swapping. * lisp/mail/rmailout.el (rmail-output-read-file-name): Check rmail-output-file-alist against the full message body in the correct rmail buffer. * lisp/mail/rmail.el: Comment. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-08-17 09:18:18 +0000 +++ lisp/ChangeLog 2012-08-17 20:38:47 +0000 @@ -1,3 +1,9 @@ +2012-08-17 Glenn Morris + + * mail/rmailout.el (rmail-output-read-file-name): + Check rmail-output-file-alist against the full message body + in the correct rmail buffer. (Bug#12214) + 2012-08-17 Michael Albinus * net/tramp-sh.el (tramp-sh-handle-start-file-process): Eliminate === modified file 'lisp/mail/rmail.el' --- lisp/mail/rmail.el 2012-06-10 13:20:58 +0000 +++ lisp/mail/rmail.el 2012-08-17 20:38:47 +0000 @@ -663,6 +663,7 @@ (defvar rmail-last-regexp nil) (put 'rmail-last-regexp 'permanent-local t) +;; Note that rmail-output-read-file-name modifies this. (defcustom rmail-default-file "~/xmail" "Default file name for \\[rmail-output]." :type 'file === modified file 'lisp/mail/rmailout.el' --- lisp/mail/rmailout.el 2012-01-19 07:21:25 +0000 +++ lisp/mail/rmailout.el 2012-08-17 20:38:47 +0000 @@ -34,7 +34,6 @@ :type 'boolean :group 'rmail-output) -;; FIXME risky? (defcustom rmail-output-file-alist nil "Alist matching regexps to suggested output Rmail files. This is a list of elements of the form (REGEXP . NAME-EXP). @@ -47,6 +46,7 @@ (string :tag "File Name") sexp))) :group 'rmail-output) +;; This is risky because NAME-EXP gets evalled. ;;;###autoload(put 'rmail-output-file-alist 'risky-local-variable t) (defcustom rmail-fields-not-to-output nil @@ -58,35 +58,46 @@ (defun rmail-output-read-file-name () "Read the file name to use for `rmail-output'. -Set `rmail-default-file' to this name as well as returning it." - (let ((default-file - (let (answer tail) - (setq tail rmail-output-file-alist) - ;; Suggest a file based on a pattern match. - (while (and tail (not answer)) - (save-excursion - (goto-char (point-min)) - (if (re-search-forward (car (car tail)) nil t) - (setq answer (eval (cdr (car tail))))) - (setq tail (cdr tail)))) - ;; If no suggestion, use same file as last time. - (or answer rmail-default-file)))) - (let ((read-file - (expand-file-name - (read-file-name - (concat "Output message to mail file (default " - (file-name-nondirectory default-file) - "): ") - (file-name-directory default-file) - (abbreviate-file-name default-file)) - (file-name-directory default-file)))) - (setq rmail-default-file - (if (file-directory-p read-file) - (expand-file-name (file-name-nondirectory default-file) - read-file) - (expand-file-name - (or read-file (file-name-nondirectory default-file)) - (file-name-directory default-file))))))) +Set `rmail-default-file' to this name as well as returning it. +This uses `rmail-output-file-alist'." + (let* ((default-file + (when rmail-output-file-alist + (or rmail-buffer (error "There is no Rmail buffer")) + (save-current-buffer + (set-buffer rmail-buffer) + (let ((beg (rmail-msgbeg rmail-current-message)) + (end (rmail-msgend rmail-current-message))) + (if (rmail-buffers-swapped-p) (set-buffer rmail-view-buffer)) + (save-excursion + (save-restriction + (widen) + (narrow-to-region beg end) + (let ((tail rmail-output-file-alist) + answer) + ;; Suggest a file based on a pattern match. + (while (and tail (not answer)) + (goto-char (point-min)) + (if (re-search-forward (caar tail) nil t) + (setq answer (eval (cdar tail)))) + (setq tail (cdr tail))) + ;; If no suggestion, use same file as last time. + (or answer rmail-default-file)))))))) + (read-file + (expand-file-name + (read-file-name + (concat "Output message to mail file (default " + (file-name-nondirectory default-file) + "): ") + (file-name-directory default-file) + (abbreviate-file-name default-file)) + (file-name-directory default-file)))) + (setq rmail-default-file + (if (file-directory-p read-file) + (expand-file-name (file-name-nondirectory default-file) + read-file) + (expand-file-name + (or read-file (file-name-nondirectory default-file)) + (file-name-directory default-file)))))) (defun rmail-delete-unwanted-fields (preserve) "Delete all headers matching `rmail-fields-not-to-output'. ------------------------------------------------------------ revno: 109664 committer: Paul Eggert branch nick: trunk timestamp: Fri 2012-08-17 10:09:45 -0700 message: Fix typo in ChangeLog entry. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-08-17 17:08:30 +0000 +++ src/ChangeLog 2012-08-17 17:09:45 +0000 @@ -2,7 +2,7 @@ * lisp.h (set_char_table_extras): Rename from char_table_set_extras. (set_char_table_contents): Rename from char_table_set_contents. - (set_sub_char_table_contents): Rename from sub_char_table_sub_contents. + (set_sub_char_table_contents): Rename from sub_char_table_set_contents. All uses changed. See the end of . ------------------------------------------------------------ revno: 109663 committer: Paul Eggert branch nick: trunk timestamp: Fri 2012-08-17 10:08:30 -0700 message: * lisp.h (set_char_table_extras): Rename from char_table_set_extras. (set_char_table_contents): Rename from char_table_set_contents. (set_sub_char_table_contents): Rename from sub_char_table_sub_contents. All uses changed. See the end of . diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-08-17 16:53:03 +0000 +++ src/ChangeLog 2012-08-17 17:08:30 +0000 @@ -1,5 +1,11 @@ 2012-08-17 Paul Eggert + * lisp.h (set_char_table_extras): Rename from char_table_set_extras. + (set_char_table_contents): Rename from char_table_set_contents. + (set_sub_char_table_contents): Rename from sub_char_table_sub_contents. + All uses changed. See the end of + . + * lisp.h (CSET): Remove (Bug#12215). (set_char_table_ascii, set_char_table_defalt, set_char_table_parent) (set_char_table_purpose): New functions, === modified file 'src/casetab.c' --- src/casetab.c 2012-08-17 16:48:22 +0000 +++ src/casetab.c 2012-08-17 17:08:30 +0000 @@ -128,13 +128,13 @@ up = Fmake_char_table (Qcase_table, Qnil); map_char_table (set_identity, Qnil, table, up); map_char_table (shuffle, Qnil, table, up); - char_table_set_extras (table, 0, up); + set_char_table_extras (table, 0, up); } if (NILP (canon)) { canon = Fmake_char_table (Qcase_table, Qnil); - char_table_set_extras (table, 1, canon); + set_char_table_extras (table, 1, canon); map_char_table (set_canon, Qnil, table, table); } @@ -143,11 +143,11 @@ eqv = Fmake_char_table (Qcase_table, Qnil); map_char_table (set_identity, Qnil, canon, eqv); map_char_table (shuffle, Qnil, canon, eqv); - char_table_set_extras (table, 2, eqv); + set_char_table_extras (table, 2, eqv); } /* This is so set_image_of_range_1 in regex.c can find the EQV table. */ - char_table_set_extras (canon, 2, eqv); + set_char_table_extras (canon, 2, eqv); if (standard) { @@ -268,10 +268,10 @@ CHAR_TABLE_SET (down, i, make_number (c)); } - char_table_set_extras (down, 1, Fcopy_sequence (down)); + set_char_table_extras (down, 1, Fcopy_sequence (down)); up = Fmake_char_table (Qcase_table, Qnil); - char_table_set_extras (down, 0, up); + set_char_table_extras (down, 0, up); for (i = 0; i < 128; i++) { @@ -281,7 +281,7 @@ CHAR_TABLE_SET (up, i, make_number (c)); } - char_table_set_extras (down, 2, Fcopy_sequence (up)); + set_char_table_extras (down, 2, Fcopy_sequence (up)); /* Fill in what isn't filled in. */ set_case_table (down, 1); === modified file 'src/category.c' --- src/category.c 2012-08-17 16:48:22 +0000 +++ src/category.c 2012-08-17 17:08:30 +0000 @@ -70,7 +70,7 @@ EMACS_UINT hash; if (NILP (XCHAR_TABLE (table)->extras[1])) - char_table_set_extras + set_char_table_extras (table, 1, make_hash_table (Qequal, make_number (DEFAULT_HASH_SIZE), make_float (DEFAULT_REHASH_SIZE), @@ -240,7 +240,7 @@ if (! NILP (XCHAR_TABLE (table)->defalt)) set_char_table_defalt (table, Fcopy_sequence (XCHAR_TABLE (table)->defalt)); - char_table_set_extras + set_char_table_extras (table, 0, Fcopy_sequence (XCHAR_TABLE (table)->extras[0])); map_char_table (copy_category_entry, Qnil, table, table); @@ -272,7 +272,7 @@ val = Fmake_char_table (Qcategory_table, Qnil); set_char_table_defalt (val, MAKE_CATEGORY_SET); for (i = 0; i < (1 << CHARTAB_SIZE_BITS_0); i++) - char_table_set_contents (val, i, MAKE_CATEGORY_SET); + set_char_table_contents (val, i, MAKE_CATEGORY_SET); Fset_char_table_extra_slot (val, make_number (0), Fmake_vector (make_number (95), Qnil)); return val; === modified file 'src/chartab.c' --- src/chartab.c 2012-08-17 16:48:22 +0000 +++ src/chartab.c 2012-08-17 17:08:30 +0000 @@ -155,21 +155,17 @@ static Lisp_Object copy_sub_char_table (Lisp_Object table) { - Lisp_Object copy; int depth = XINT (XSUB_CHAR_TABLE (table)->depth); int min_char = XINT (XSUB_CHAR_TABLE (table)->min_char); - Lisp_Object val; + Lisp_Object copy = make_sub_char_table (depth, min_char, Qnil); int i; - copy = make_sub_char_table (depth, min_char, Qnil); /* Recursively copy any sub char-tables. */ for (i = 0; i < chartab_size[depth]; i++) { - val = XSUB_CHAR_TABLE (table)->contents[i]; - if (SUB_CHAR_TABLE_P (val)) - sub_char_table_set_contents (copy, i, copy_sub_char_table (val)); - else - sub_char_table_set_contents (copy, i, val); + Lisp_Object val = XSUB_CHAR_TABLE (table)->contents[i]; + set_sub_char_table_contents + (copy, i, SUB_CHAR_TABLE_P (val) ? copy_sub_char_table (val) : val); } return copy; @@ -189,7 +185,7 @@ set_char_table_parent (copy, XCHAR_TABLE (table)->parent); set_char_table_purpose (copy, XCHAR_TABLE (table)->purpose); for (i = 0; i < chartab_size[0]; i++) - char_table_set_contents + set_char_table_contents (copy, i, (SUB_CHAR_TABLE_P (XCHAR_TABLE (table)->contents[i]) ? copy_sub_char_table (XCHAR_TABLE (table)->contents[i]) @@ -197,7 +193,7 @@ set_char_table_ascii (copy, char_table_ascii (copy)); size -= VECSIZE (struct Lisp_Char_Table) - 1; for (i = 0; i < size; i++) - char_table_set_extras (copy, i, XCHAR_TABLE (table)->extras[i]); + set_char_table_extras (copy, i, XCHAR_TABLE (table)->extras[i]); XSETCHAR_TABLE (copy, XCHAR_TABLE (copy)); return copy; @@ -395,7 +391,7 @@ Lisp_Object sub; if (depth == 3) - sub_char_table_set_contents (table, i, val); + set_sub_char_table_contents (table, i, val); else { sub = tbl->contents[i]; @@ -408,7 +404,7 @@ sub = make_sub_char_table (depth + 1, min_char + i * chartab_chars[depth], sub); - sub_char_table_set_contents (table, i, sub); + set_sub_char_table_contents (table, i, sub); } } sub_char_table_set (sub, c, val, is_uniprop); @@ -422,7 +418,7 @@ if (ASCII_CHAR_P (c) && SUB_CHAR_TABLE_P (tbl->ascii)) - sub_char_table_set_contents (tbl->ascii, c, val); + set_sub_char_table_contents (tbl->ascii, c, val); else { int i = CHARTAB_IDX (c, 0, 0); @@ -432,7 +428,7 @@ if (! SUB_CHAR_TABLE_P (sub)) { sub = make_sub_char_table (1, i * chartab_chars[0], sub); - char_table_set_contents (table, i, sub); + set_char_table_contents (table, i, sub); } sub_char_table_set (sub, c, val, UNIPROP_TABLE_P (table)); if (ASCII_CHAR_P (c)) @@ -460,7 +456,7 @@ if (c > to) break; if (from <= c && c + chars_in_block - 1 <= to) - sub_char_table_set_contents (table, i, val); + set_sub_char_table_contents (table, i, val); else { Lisp_Object sub = tbl->contents[i]; @@ -471,7 +467,7 @@ else { sub = make_sub_char_table (depth + 1, c, sub); - sub_char_table_set_contents (table, i, sub); + set_sub_char_table_contents (table, i, sub); } } sub_char_table_set_range (sub, from, to, val, is_uniprop); @@ -499,14 +495,14 @@ if (c > to) break; if (from <= c && c + chartab_chars[0] - 1 <= to) - char_table_set_contents (table, i, val); + set_char_table_contents (table, i, val); else { Lisp_Object sub = tbl->contents[i]; if (! SUB_CHAR_TABLE_P (sub)) { sub = make_sub_char_table (1, i * chartab_chars[0], sub); - char_table_set_contents (table, i, sub); + set_char_table_contents (table, i, sub); } sub_char_table_set_range (sub, from, to, val, is_uniprop); } @@ -593,7 +589,7 @@ || XINT (n) >= CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (char_table))) args_out_of_range (char_table, n); - char_table_set_extras (char_table, XINT (n), value); + set_char_table_extras (char_table, XINT (n), value); return value; } @@ -642,7 +638,7 @@ set_char_table_ascii (char_table, value); for (i = 0; i < chartab_size[0]; i++) - char_table_set_contents (char_table, i, value); + set_char_table_contents (char_table, i, value); } else if (EQ (range, Qnil)) set_char_table_defalt (char_table, value); @@ -695,7 +691,7 @@ if (SUB_CHAR_TABLE_P (elt)) { elt = optimize_sub_char_table (elt, test); - sub_char_table_set_contents (table, 0, elt); + set_sub_char_table_contents (table, 0, elt); } optimizable = SUB_CHAR_TABLE_P (elt) ? 0 : 1; for (i = 1; i < chartab_size[depth]; i++) @@ -704,7 +700,7 @@ if (SUB_CHAR_TABLE_P (this)) { this = optimize_sub_char_table (this, test); - sub_char_table_set_contents (table, i, this); + set_sub_char_table_contents (table, i, this); } if (optimizable && (NILP (test) ? NILP (Fequal (this, elt)) /* defaults to `equal'. */ @@ -732,7 +728,7 @@ { elt = XCHAR_TABLE (char_table)->contents[i]; if (SUB_CHAR_TABLE_P (elt)) - char_table_set_contents + set_char_table_contents (char_table, i, optimize_sub_char_table (elt, test)); } /* Reset the `ascii' cache, in case it got optimized away. */ @@ -1149,7 +1145,7 @@ Lisp_Object sub = make_sub_char_table (3, min_char, Qnil); const unsigned char *p, *pend; - sub_char_table_set_contents (table, idx, sub); + set_sub_char_table_contents (table, idx, sub); p = SDATA (val), pend = p + SBYTES (val); if (*p == 1) { @@ -1159,7 +1155,7 @@ while (p < pend && idx < chartab_chars[2]) { int v = STRING_CHAR_ADVANCE (p); - sub_char_table_set_contents + set_sub_char_table_contents (sub, idx++, v > 0 ? make_number (v) : Qnil); } } @@ -1185,7 +1181,7 @@ } } while (count-- > 0) - sub_char_table_set_contents (sub, idx++, make_number (v)); + set_sub_char_table_contents (sub, idx++, make_number (v)); } } /* It seems that we don't need this function because C code won't need @@ -1288,7 +1284,7 @@ args[0] = XCHAR_TABLE (table)->extras[4]; args[1] = Fmake_vector (make_number (1), value); - char_table_set_extras (table, 4, Fvconcat (2, args)); + set_char_table_extras (table, 4, Fvconcat (2, args)); } return make_number (i); } === modified file 'src/fns.c' --- src/fns.c 2012-08-17 16:48:22 +0000 +++ src/fns.c 2012-08-17 17:08:30 +0000 @@ -2150,7 +2150,7 @@ int i; for (i = 0; i < (1 << CHARTAB_SIZE_BITS_0); i++) - char_table_set_contents (array, i, item); + set_char_table_contents (array, i, item); set_char_table_defalt (array, item); } else if (STRINGP (array)) === modified file 'src/fontset.c' --- src/fontset.c 2012-08-17 16:48:22 +0000 +++ src/fontset.c 2012-08-17 17:08:30 +0000 @@ -1916,7 +1916,7 @@ if (!EQ (fontset, Vdefault_fontset)) { tables[1] = Fmake_char_table (Qnil, Qnil); - char_table_set_extras (tables[0], 0, tables[1]); + set_char_table_extras (tables[0], 0, tables[1]); fontsets[1] = Vdefault_fontset; } === modified file 'src/lisp.h' --- src/lisp.h 2012-08-17 16:48:22 +0000 +++ src/lisp.h 2012-08-17 17:08:30 +0000 @@ -923,7 +923,7 @@ 8-bit European characters. Do not check validity of CT. */ #define CHAR_TABLE_SET(CT, IDX, VAL) \ (ASCII_CHAR_P (IDX) && SUB_CHAR_TABLE_P (XCHAR_TABLE (CT)->ascii) \ - ? sub_char_table_set_contents (XCHAR_TABLE (CT)->ascii, IDX, VAL) \ + ? set_sub_char_table_contents (XCHAR_TABLE (CT)->ascii, IDX, VAL) \ : char_table_set (CT, IDX, VAL)) enum CHARTAB_SIZE_BITS @@ -984,7 +984,7 @@ /* Minimum character covered by the sub char-table. */ Lisp_Object min_char; - /* Use sub_char_table_set_contents to set this. */ + /* Use set_sub_char_table_contents to set this. */ Lisp_Object contents[1]; }; @@ -2498,21 +2498,21 @@ /* Set different slots in (sub)character tables. */ LISP_INLINE void -char_table_set_extras (Lisp_Object table, ptrdiff_t idx, Lisp_Object val) +set_char_table_extras (Lisp_Object table, ptrdiff_t idx, Lisp_Object val) { eassert (0 <= idx && idx < CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (table))); XCHAR_TABLE (table)->extras[idx] = val; } LISP_INLINE void -char_table_set_contents (Lisp_Object table, ptrdiff_t idx, Lisp_Object val) +set_char_table_contents (Lisp_Object table, ptrdiff_t idx, Lisp_Object val) { eassert (0 <= idx && idx < (1 << CHARTAB_SIZE_BITS_0)); XCHAR_TABLE (table)->contents[idx] = val; } LISP_INLINE void -sub_char_table_set_contents (Lisp_Object table, ptrdiff_t idx, Lisp_Object val) +set_sub_char_table_contents (Lisp_Object table, ptrdiff_t idx, Lisp_Object val) { XSUB_CHAR_TABLE (table)->contents[idx] = val; } === modified file 'src/search.c' --- src/search.c 2012-08-16 03:13:44 +0000 +++ src/search.c 2012-08-17 17:08:30 +0000 @@ -278,7 +278,7 @@ save_search_regs (); /* This is so set_image_of_range_1 in regex.c can find the EQV table. */ - char_table_set_extras (BVAR (current_buffer, case_canon_table), 2, + set_char_table_extras (BVAR (current_buffer, case_canon_table), 2, BVAR (current_buffer, case_eqv_table)); CHECK_STRING (string); @@ -393,7 +393,7 @@ } /* This is so set_image_of_range_1 in regex.c can find the EQV table. */ - char_table_set_extras (BVAR (current_buffer, case_canon_table), 2, + set_char_table_extras (BVAR (current_buffer, case_canon_table), 2, BVAR (current_buffer, case_eqv_table)); bufp = compile_pattern (regexp, @@ -990,7 +990,7 @@ } /* This is so set_image_of_range_1 in regex.c can find the EQV table. */ - char_table_set_extras (BVAR (current_buffer, case_canon_table), 2, + set_char_table_extras (BVAR (current_buffer, case_canon_table), 2, BVAR (current_buffer, case_eqv_table)); np = search_buffer (string, PT, PT_BYTE, lim, lim_byte, n, RE, ------------------------------------------------------------ revno: 109662 committer: Paul Eggert branch nick: trunk timestamp: Fri 2012-08-17 09:53:03 -0700 message: Fix ChangeLog typo. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-08-17 16:48:22 +0000 +++ src/ChangeLog 2012-08-17 16:53:03 +0000 @@ -5,7 +5,7 @@ (set_char_table_purpose): New functions, replacing CSET. All uses changed. For example, replace "CSET (XCHAR_TABLE (char_table), parent, parent);" with - "char_table_set_parent (char_table, parent);". + "set_char_table_parent (char_table, parent);". The old version was confusing because it used the same name 'parent' for two different things. ------------------------------------------------------------ revno: 109661 fixes bug: http://debbugs.gnu.org/12215 committer: Paul Eggert branch nick: trunk timestamp: Fri 2012-08-17 09:48:22 -0700 message: * lisp.h (CSET): Remove. (set_char_table_ascii, set_char_table_defalt, set_char_table_parent) (set_char_table_purpose): New functions, replacing CSET. All uses changed. For example, replace "CSET (XCHAR_TABLE (char_table), parent, parent);" with "char_table_set_parent (char_table, parent);". The old version was confusing because it used the same name 'parent' for two different things. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-08-17 14:24:43 +0000 +++ src/ChangeLog 2012-08-17 16:48:22 +0000 @@ -1,3 +1,14 @@ +2012-08-17 Paul Eggert + + * lisp.h (CSET): Remove (Bug#12215). + (set_char_table_ascii, set_char_table_defalt, set_char_table_parent) + (set_char_table_purpose): New functions, + replacing CSET. All uses changed. For example, replace + "CSET (XCHAR_TABLE (char_table), parent, parent);" with + "char_table_set_parent (char_table, parent);". + The old version was confusing because it used the same name + 'parent' for two different things. + 2012-08-17 Dmitry Antipov Functions to get and set Lisp_Object fields of buffer-local variables. === modified file 'src/casetab.c' --- src/casetab.c 2012-08-16 03:13:44 +0000 +++ src/casetab.c 2012-08-17 16:48:22 +0000 @@ -260,7 +260,7 @@ down = Fmake_char_table (Qcase_table, Qnil); Vascii_downcase_table = down; - CSET (XCHAR_TABLE (down), purpose, Qcase_table); + set_char_table_purpose (down, Qcase_table); for (i = 0; i < 128; i++) { === modified file 'src/category.c' --- src/category.c 2012-08-16 21:58:44 +0000 +++ src/category.c 2012-08-17 16:48:22 +0000 @@ -238,8 +238,8 @@ table = copy_char_table (table); if (! NILP (XCHAR_TABLE (table)->defalt)) - CSET (XCHAR_TABLE (table), defalt, - Fcopy_sequence (XCHAR_TABLE (table)->defalt)); + set_char_table_defalt (table, + Fcopy_sequence (XCHAR_TABLE (table)->defalt)); char_table_set_extras (table, 0, Fcopy_sequence (XCHAR_TABLE (table)->extras[0])); map_char_table (copy_category_entry, Qnil, table, table); @@ -270,7 +270,7 @@ int i; val = Fmake_char_table (Qcategory_table, Qnil); - CSET (XCHAR_TABLE (val), defalt, MAKE_CATEGORY_SET); + set_char_table_defalt (val, MAKE_CATEGORY_SET); for (i = 0; i < (1 << CHARTAB_SIZE_BITS_0); i++) char_table_set_contents (val, i, MAKE_CATEGORY_SET); Fset_char_table_extra_slot (val, make_number (0), @@ -466,7 +466,7 @@ Vstandard_category_table = Fmake_char_table (Qcategory_table, Qnil); /* Set a category set which contains nothing to the default. */ - CSET (XCHAR_TABLE (Vstandard_category_table), defalt, MAKE_CATEGORY_SET); + set_char_table_defalt (Vstandard_category_table, MAKE_CATEGORY_SET); Fset_char_table_extra_slot (Vstandard_category_table, make_number (0), Fmake_vector (make_number (95), Qnil)); } === modified file 'src/chartab.c' --- src/chartab.c 2012-08-16 07:26:18 +0000 +++ src/chartab.c 2012-08-17 16:48:22 +0000 @@ -115,8 +115,8 @@ size = VECSIZE (struct Lisp_Char_Table) - 1 + n_extras; vector = Fmake_vector (make_number (size), init); XSETPVECTYPE (XVECTOR (vector), PVEC_CHAR_TABLE); - CSET (XCHAR_TABLE (vector), parent, Qnil); - CSET (XCHAR_TABLE (vector), purpose, purpose); + set_char_table_parent (vector, Qnil); + set_char_table_purpose (vector, purpose); XSETCHAR_TABLE (vector, XCHAR_TABLE (vector)); return vector; } @@ -185,16 +185,16 @@ copy = Fmake_vector (make_number (size), Qnil); XSETPVECTYPE (XVECTOR (copy), PVEC_CHAR_TABLE); - CSET (XCHAR_TABLE (copy), defalt, XCHAR_TABLE (table)->defalt); - CSET (XCHAR_TABLE (copy), parent, XCHAR_TABLE (table)->parent); - CSET (XCHAR_TABLE (copy), purpose, XCHAR_TABLE (table)->purpose); + set_char_table_defalt (copy, XCHAR_TABLE (table)->defalt); + set_char_table_parent (copy, XCHAR_TABLE (table)->parent); + set_char_table_purpose (copy, XCHAR_TABLE (table)->purpose); for (i = 0; i < chartab_size[0]; i++) char_table_set_contents - (copy, i, + (copy, i, (SUB_CHAR_TABLE_P (XCHAR_TABLE (table)->contents[i]) ? copy_sub_char_table (XCHAR_TABLE (table)->contents[i]) : XCHAR_TABLE (table)->contents[i])); - CSET (XCHAR_TABLE (copy), ascii, char_table_ascii (copy)); + set_char_table_ascii (copy, char_table_ascii (copy)); size -= VECSIZE (struct Lisp_Char_Table) - 1; for (i = 0; i < size; i++) char_table_set_extras (copy, i, XCHAR_TABLE (table)->extras[i]); @@ -436,7 +436,7 @@ } sub_char_table_set (sub, c, val, UNIPROP_TABLE_P (table)); if (ASCII_CHAR_P (c)) - CSET (tbl, ascii, char_table_ascii (table)); + set_char_table_ascii (table, char_table_ascii (table)); } return val; } @@ -512,7 +512,7 @@ } } if (ASCII_CHAR_P (from)) - CSET (tbl, ascii, char_table_ascii (table)); + set_char_table_ascii (table, char_table_ascii (table)); } return val; } @@ -562,7 +562,7 @@ error ("Attempt to make a chartable be its own parent"); } - CSET (XCHAR_TABLE (char_table), parent, parent); + set_char_table_parent (char_table, parent); return parent; } @@ -640,12 +640,12 @@ { int i; - CSET (XCHAR_TABLE (char_table), ascii, value); + set_char_table_ascii (char_table, value); for (i = 0; i < chartab_size[0]; i++) char_table_set_contents (char_table, i, value); } else if (EQ (range, Qnil)) - CSET (XCHAR_TABLE (char_table), defalt, value); + set_char_table_defalt (char_table, value); else if (CHARACTERP (range)) char_table_set (char_table, XINT (range), value); else if (CONSP (range)) @@ -736,7 +736,7 @@ (char_table, i, optimize_sub_char_table (elt, test)); } /* Reset the `ascii' cache, in case it got optimized away. */ - CSET (XCHAR_TABLE (char_table), ascii, char_table_ascii (char_table)); + set_char_table_ascii (char_table, char_table_ascii (char_table)); return Qnil; } @@ -828,9 +828,9 @@ /* This is to get a value of FROM in PARENT without checking the parent of PARENT. */ - CSET (XCHAR_TABLE (parent), parent, Qnil); + set_char_table_parent (parent, Qnil); val = CHAR_TABLE_REF (parent, from); - CSET (XCHAR_TABLE (parent), parent, temp); + set_char_table_parent (parent, temp); XSETCDR (range, make_number (c - 1)); val = map_sub_char_table (c_function, function, parent, arg, val, range, @@ -910,9 +910,9 @@ temp = XCHAR_TABLE (parent)->parent; /* This is to get a value of FROM in PARENT without checking the parent of PARENT. */ - CSET (XCHAR_TABLE (parent), parent, Qnil); + set_char_table_parent (parent, Qnil); val = CHAR_TABLE_REF (parent, from); - CSET (XCHAR_TABLE (parent), parent, temp); + set_char_table_parent (parent, temp); val = map_sub_char_table (c_function, function, parent, arg, val, range, parent); table = parent; @@ -1350,7 +1350,7 @@ : ! NILP (val)) return Qnil; /* Prepare ASCII values in advance for CHAR_TABLE_REF. */ - CSET (XCHAR_TABLE (table), ascii, char_table_ascii (table)); + set_char_table_ascii (table, char_table_ascii (table)); return table; } === modified file 'src/fns.c' --- src/fns.c 2012-08-16 03:13:44 +0000 +++ src/fns.c 2012-08-17 16:48:22 +0000 @@ -2151,7 +2151,7 @@ for (i = 0; i < (1 << CHARTAB_SIZE_BITS_0); i++) char_table_set_contents (array, i, item); - CSET (XCHAR_TABLE (array), defalt, item); + set_char_table_defalt (array, item); } else if (STRINGP (array)) { === modified file 'src/fontset.c' --- src/fontset.c 2012-08-16 03:13:44 +0000 +++ src/fontset.c 2012-08-17 16:48:22 +0000 @@ -1979,7 +1979,7 @@ if (c <= MAX_5_BYTE_CHAR) char_table_set_range (tables[k], c, to, alist); else - CSET (XCHAR_TABLE (tables[k]), defalt, alist); + set_char_table_defalt (tables[k], alist); /* At last, change each elements to font names. */ for (; CONSP (alist); alist = XCDR (alist)) === modified file 'src/lisp.h' --- src/lisp.h 2012-08-17 14:24:43 +0000 +++ src/lisp.h 2012-08-17 16:48:22 +0000 @@ -936,12 +936,6 @@ extern const int chartab_size[4]; -/* Most code should use this macro to set non-array Lisp fields in struct - Lisp_Char_Table. For CONTENTS and EXTRAS, use char_table_set_contents - and char_table_set_extras, respectively. */ - -#define CSET(c, field, value) ((c)->field = (value)) - struct Lisp_Char_Table { /* HEADER.SIZE is the vector's size field, which also holds the @@ -2477,6 +2471,30 @@ XSTRING (s)->intervals = i; } +/* Set a Lisp slot in TABLE to VAL. Most code should use this instead + of setting slots directly. */ + +LISP_INLINE void +set_char_table_ascii (Lisp_Object table, Lisp_Object val) +{ + XCHAR_TABLE (table)->ascii = val; +} +LISP_INLINE void +set_char_table_defalt (Lisp_Object table, Lisp_Object val) +{ + XCHAR_TABLE (table)->defalt = val; +} +LISP_INLINE void +set_char_table_parent (Lisp_Object table, Lisp_Object val) +{ + XCHAR_TABLE (table)->parent = val; +} +LISP_INLINE void +set_char_table_purpose (Lisp_Object table, Lisp_Object val) +{ + XCHAR_TABLE (table)->purpose = val; +} + /* Set different slots in (sub)character tables. */ LISP_INLINE void === modified file 'src/syntax.c' --- src/syntax.c 2012-08-16 21:58:44 +0000 +++ src/syntax.c 2012-08-17 16:48:22 +0000 @@ -818,7 +818,7 @@ /* Only the standard syntax table should have a default element. Other syntax tables should inherit from parents instead. */ - CSET (XCHAR_TABLE (copy), defalt, Qnil); + set_char_table_defalt (copy, Qnil); /* Copied syntax tables should all have parents. If we copied one with no parent, such as the standard syntax table, ------------------------------------------------------------ revno: 109660 committer: Dmitry Antipov branch nick: trunk timestamp: Fri 2012-08-17 18:24:43 +0400 message: Functions to get and set Lisp_Object fields of buffer-local variables. * lisp.h (blv_found, set_blv_found, blv_value, set_blv_value) (set_blv_where, set_blv_defcell, set_blv_valcell): New functions. (BLV_FOUND, SET_BLV_FOUND, BLV_VALUE, SET_BLV_VALUE): Remove. * data.c, eval.c, frame.c: Adjust users. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-08-17 09:10:31 +0000 +++ src/ChangeLog 2012-08-17 14:24:43 +0000 @@ -1,3 +1,11 @@ +2012-08-17 Dmitry Antipov + + Functions to get and set Lisp_Object fields of buffer-local variables. + * lisp.h (blv_found, set_blv_found, blv_value, set_blv_value) + (set_blv_where, set_blv_defcell, set_blv_valcell): New functions. + (BLV_FOUND, SET_BLV_FOUND, BLV_VALUE, SET_BLV_VALUE): Remove. + * data.c, eval.c, frame.c: Adjust users. + 2012-08-17 Chong Yidong * xfaces.c (merge_face_vectors): If the target font specfies a === modified file 'src/data.c' --- src/data.c 2012-08-14 17:10:38 +0000 +++ src/data.c 2012-08-17 14:24:43 +0000 @@ -543,7 +543,7 @@ else { swap_in_symval_forwarding (sym, blv); - valcontents = BLV_VALUE (blv); + valcontents = blv_value (blv); } break; } @@ -964,16 +964,16 @@ /* Unload the previously loaded binding. */ if (blv->fwd) - SET_BLV_VALUE (blv, do_symval_forwarding (blv->fwd)); + set_blv_value (blv, do_symval_forwarding (blv->fwd)); /* Select the global binding in the symbol. */ - blv->valcell = blv->defcell; + set_blv_valcell (blv, blv->defcell); if (blv->fwd) store_symval_forwarding (blv->fwd, XCDR (blv->defcell), NULL); /* Indicate that the global binding is set up now. */ - blv->where = Qnil; - SET_BLV_FOUND (blv, 0); + set_blv_where (blv, Qnil); + set_blv_found (blv, 0); } /* Set up the buffer-local symbol SYMBOL for validity in the current buffer. @@ -1001,7 +1001,7 @@ /* Unload the previously loaded binding. */ tem1 = blv->valcell; if (blv->fwd) - SET_BLV_VALUE (blv, do_symval_forwarding (blv->fwd)); + set_blv_value (blv, do_symval_forwarding (blv->fwd)); /* Choose the new binding. */ { Lisp_Object var; @@ -1009,7 +1009,7 @@ if (blv->frame_local) { tem1 = assq_no_quit (var, XFRAME (selected_frame)->param_alist); - blv->where = selected_frame; + set_blv_where (blv, selected_frame); } else { @@ -1021,9 +1021,9 @@ tem1 = blv->defcell; /* Load the new binding. */ - blv->valcell = tem1; + set_blv_valcell (blv, tem1); if (blv->fwd) - store_symval_forwarding (blv->fwd, BLV_VALUE (blv), NULL); + store_symval_forwarding (blv->fwd, blv_value (blv), NULL); } } @@ -1050,7 +1050,7 @@ { struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym); swap_in_symval_forwarding (sym, blv); - return blv->fwd ? do_symval_forwarding (blv->fwd) : BLV_VALUE (blv); + return blv->fwd ? do_symval_forwarding (blv->fwd) : blv_value (blv); } /* FALLTHROUGH */ case SYMBOL_FORWARDED: @@ -1175,7 +1175,7 @@ /* Write out `realvalue' to the old loaded binding. */ if (blv->fwd) - SET_BLV_VALUE (blv, do_symval_forwarding (blv->fwd)); + set_blv_value (blv, do_symval_forwarding (blv->fwd)); /* Find the new binding. */ XSETSYMBOL (symbol, sym); /* May have changed via aliasing. */ @@ -1183,8 +1183,8 @@ (blv->frame_local ? XFRAME (where)->param_alist : BVAR (XBUFFER (where), local_var_alist))); - blv->where = where; - blv->found = 1; + set_blv_where (blv, where); + set_blv_found (blv, 1); if (NILP (tem1)) { @@ -1199,7 +1199,7 @@ if (bindflag || !blv->local_if_set || let_shadows_buffer_binding_p (sym)) { - blv->found = 0; + set_blv_found (blv, 0); tem1 = blv->defcell; } /* If it's a local_if_set, being set not bound, @@ -1219,11 +1219,11 @@ } /* Record which binding is now loaded. */ - blv->valcell = tem1; + set_blv_valcell (blv, tem1); } /* Store the new value in the cons cell. */ - SET_BLV_VALUE (blv, newval); + set_blv_value (blv, newval); if (blv->fwd) { @@ -1479,12 +1479,12 @@ eassert (!(forwarded && BUFFER_OBJFWDP (valcontents.fwd))); eassert (!(forwarded && KBOARD_OBJFWDP (valcontents.fwd))); blv->fwd = forwarded ? valcontents.fwd : NULL; - blv->where = Qnil; + set_blv_where (blv, Qnil); blv->frame_local = 0; blv->local_if_set = 0; - blv->defcell = tem; - blv->valcell = tem; - SET_BLV_FOUND (blv, 0); + set_blv_defcell (blv, tem); + set_blv_valcell (blv, tem); + set_blv_found (blv, 0); return blv; } @@ -1660,10 +1660,8 @@ /* Make sure symbol does not think it is set up for this buffer; force it to look once again for this buffer's value. */ if (current_buffer == XBUFFER (blv->where)) - blv->where = Qnil; - /* blv->valcell = blv->defcell; - * SET_BLV_FOUND (blv, 0); */ - blv->found = 0; + set_blv_where (blv, Qnil); + set_blv_found (blv, 0); } /* If the symbol forwards into a C variable, then load the binding @@ -1733,10 +1731,8 @@ Lisp_Object buf; XSETBUFFER (buf, current_buffer); if (EQ (buf, blv->where)) { - blv->where = Qnil; - /* blv->valcell = blv->defcell; - * SET_BLV_FOUND (blv, 0); */ - blv->found = 0; + set_blv_where (blv, Qnil); + set_blv_found (blv, 0); find_symbol_value (variable); } } @@ -1857,11 +1853,11 @@ if (EQ (variable, XCAR (elt))) { eassert (!blv->frame_local); - eassert (BLV_FOUND (blv) || !EQ (blv->where, tmp)); + eassert (blv_found (blv) || !EQ (blv->where, tmp)); return Qt; } } - eassert (!BLV_FOUND (blv) || !EQ (blv->where, tmp)); + eassert (!blv_found (blv) || !EQ (blv->where, tmp)); return Qnil; } case SYMBOL_FORWARDED: @@ -1951,7 +1947,7 @@ if (!NILP (Flocal_variable_p (variable, Qnil))) return Fcurrent_buffer (); else if (sym->redirect == SYMBOL_LOCALIZED - && BLV_FOUND (SYMBOL_BLV (sym))) + && blv_found (SYMBOL_BLV (sym))) return SYMBOL_BLV (sym)->where; else return Qnil; === modified file 'src/eval.c' --- src/eval.c 2012-08-16 01:18:07 +0000 +++ src/eval.c 2012-08-17 14:24:43 +0000 @@ -3169,12 +3169,12 @@ if (!NILP (Flocal_variable_p (symbol, Qnil))) { eassert (sym->redirect != SYMBOL_LOCALIZED - || (BLV_FOUND (SYMBOL_BLV (sym)) + || (blv_found (SYMBOL_BLV (sym)) && EQ (cur_buf, SYMBOL_BLV (sym)->where))); where = cur_buf; } else if (sym->redirect == SYMBOL_LOCALIZED - && BLV_FOUND (SYMBOL_BLV (sym))) + && blv_found (SYMBOL_BLV (sym))) where = SYMBOL_BLV (sym)->where; else where = Qnil; === modified file 'src/frame.c' --- src/frame.c 2012-08-16 21:58:44 +0000 +++ src/frame.c 2012-08-17 14:24:43 +0000 @@ -2098,7 +2098,7 @@ case SYMBOL_PLAINVAL: case SYMBOL_FORWARDED: break; case SYMBOL_LOCALIZED: { struct Lisp_Buffer_Local_Value *blv = sym->val.blv; - if (blv->frame_local && BLV_FOUND (blv) && XFRAME (blv->where) == f) + if (blv->frame_local && blv_found (blv) && XFRAME (blv->where) == f) swap_in_global_binding (sym); break; } === modified file 'src/lisp.h' --- src/lisp.h 2012-08-17 05:14:06 +0000 +++ src/lisp.h 2012-08-17 14:24:43 +0000 @@ -1472,14 +1472,6 @@ Lisp_Object valcell; }; -#define BLV_FOUND(blv) \ - (eassert ((blv)->found == !EQ ((blv)->defcell, (blv)->valcell)), (blv)->found) -#define SET_BLV_FOUND(blv, v) \ - (eassert ((v) == !EQ ((blv)->defcell, (blv)->valcell)), (blv)->found = (v)) - -#define BLV_VALUE(blv) (XCDR ((blv)->valcell)) -#define SET_BLV_VALUE(blv, v) (XSETCDR ((blv)->valcell, v)) - /* Like Lisp_Objfwd except that value lives in a slot in the current kboard. */ struct Lisp_Kboard_Objfwd @@ -2415,6 +2407,52 @@ XSYMBOL (sym)->next = next; } +/* Buffer-local (also frame-local) variable access functions. */ + +LISP_INLINE int +blv_found (struct Lisp_Buffer_Local_Value *blv) +{ + eassert (blv->found == !EQ (blv->defcell, blv->valcell)); + return blv->found; +} + +LISP_INLINE void +set_blv_found (struct Lisp_Buffer_Local_Value *blv, int found) +{ + eassert (found == !EQ (blv->defcell, blv->valcell)); + blv->found = found; +} + +LISP_INLINE Lisp_Object +blv_value (struct Lisp_Buffer_Local_Value *blv) +{ + return XCDR (blv->valcell); +} + +LISP_INLINE void +set_blv_value (struct Lisp_Buffer_Local_Value *blv, Lisp_Object val) +{ + XSETCDR (blv->valcell, val); +} + +LISP_INLINE void +set_blv_where (struct Lisp_Buffer_Local_Value *blv, Lisp_Object val) +{ + blv->where = val; +} + +LISP_INLINE void +set_blv_defcell (struct Lisp_Buffer_Local_Value *blv, Lisp_Object val) +{ + blv->defcell = val; +} + +LISP_INLINE void +set_blv_valcell (struct Lisp_Buffer_Local_Value *blv, Lisp_Object val) +{ + blv->valcell = val; +} + /* Set overlay's property list. */ LISP_INLINE void ------------------------------------------------------------ revno: 109659 committer: Juanma Barranquero branch nick: trunk timestamp: Fri 2012-08-17 12:51:29 +0200 message: nt/config.nt: Sync with autogen/config.in. (HAVE_POSIX_OPENPT): New macro. diff: === modified file 'nt/ChangeLog' --- nt/ChangeLog 2012-08-14 16:15:28 +0000 +++ nt/ChangeLog 2012-08-17 10:51:29 +0000 @@ -1,3 +1,8 @@ +2012-08-17 Juanma Barranquero + + * config.nt: Sync with autogen/config.in. + (HAVE_POSIX_OPENPT): New macro. + 2012-08-14 Juanma Barranquero * config.nt: Sync with autogen/config.in. === modified file 'nt/config.nt' --- nt/config.nt 2012-08-15 13:26:30 +0000 +++ nt/config.nt 2012-08-17 10:51:29 +0000 @@ -740,6 +740,9 @@ /* Define to 1 if you have the `posix_memalign' function. */ #undef HAVE_POSIX_MEMALIGN +/* Define to 1 if you have the `posix_openpt' function. */ +#undef HAVE_POSIX_OPENPT + /* Define if you have the /proc filesystem. */ #undef HAVE_PROCFS ------------------------------------------------------------ revno: 109658 committer: Glenn Morris branch nick: trunk timestamp: Fri 2012-08-17 06:17:30 -0400 message: Auto-commit of generated files. diff: === modified file 'autogen/config.in' --- autogen/config.in 2012-08-14 10:17:30 +0000 +++ autogen/config.in 2012-08-17 10:17:30 +0000 @@ -731,6 +731,9 @@ /* Define to 1 if you have the `posix_memalign' function. */ #undef HAVE_POSIX_MEMALIGN +/* Define to 1 if you have the `posix_openpt' function. */ +#undef HAVE_POSIX_OPENPT + /* Define if you have the /proc filesystem. */ #undef HAVE_PROCFS === modified file 'autogen/configure' --- autogen/configure 2012-08-16 10:17:33 +0000 +++ autogen/configure 2012-08-17 10:17:30 +0000 @@ -13258,12 +13258,14 @@ # PTY-related GNU extensions. -for ac_func in getpt +for ac_func in getpt posix_openpt do : - ac_fn_c_check_func "$LINENO" "getpt" "ac_cv_func_getpt" -if test "x$ac_cv_func_getpt" = x""yes; then : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +eval as_val=\$$as_ac_var + if test "x$as_val" = x""yes; then : cat >>confdefs.h <<_ACEOF -#define HAVE_GETPT 1 +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi @@ -14883,7 +14885,7 @@ ;; - darwin ) + darwin ) $as_echo "#define PTY_ITERATION int i; for (i = 0; i < 1; i++)" >>confdefs.h $as_echo "#define FIRST_PTY_LETTER 'p'" >>confdefs.h @@ -14896,12 +14898,12 @@ ;; - gnu | freebsd | netbsd | openbsd ) + gnu | openbsd ) $as_echo "#define FIRST_PTY_LETTER 'p'" >>confdefs.h ;; - gnu-linux | gnu-kfreebsd ) + gnu-linux | gnu-kfreebsd | freebsd | netbsd ) if test "x$ac_cv_func_grantpt" = xyes; then $as_echo "#define UNIX98_PTYS 1" >>confdefs.h @@ -14910,7 +14912,12 @@ $as_echo "#define PTY_TTY_NAME_SPRINTF { char *ptyname; sigblock (sigmask (SIGCHLD)); if (grantpt (fd) == -1 || unlockpt (fd) == -1 || !(ptyname = ptsname(fd))) { sigunblock (sigmask (SIGCHLD)); close (fd); return -1; } snprintf (pty_name, sizeof pty_name, \"%s\", ptyname); sigunblock (sigmask (SIGCHLD)); }" >>confdefs.h - if test "x$ac_cv_func_getpt" = xyes; then + if test "x$ac_cv_func_posix_openpt" = xyes; then + $as_echo "#define PTY_OPEN fd = posix_openpt (O_RDWR | O_NOCTTY)" >>confdefs.h + + $as_echo "#define PTY_NAME_SPRINTF /**/" >>confdefs.h + + elif test "x$ac_cv_func_getpt" = xyes; then $as_echo "#define PTY_OPEN fd = getpt ()" >>confdefs.h $as_echo "#define PTY_NAME_SPRINTF /**/" >>confdefs.h ------------------------------------------------------------ revno: 109657 committer: Michael Albinus + + * net/tramp-sh.el (tramp-sh-handle-start-file-process): Eliminate + superfluous prompt. (Bug#12203) + 2012-08-17 Chong Yidong * mouse.el (mouse-appearance-menu): If x-select-font returns a === modified file 'lisp/net/tramp-sh.el' --- lisp/net/tramp-sh.el 2012-08-14 14:48:28 +0000 +++ lisp/net/tramp-sh.el 2012-08-17 09:18:18 +0000 @@ -2738,51 +2738,64 @@ (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer))) (name1 name) (i 0)) - (unwind-protect - (save-excursion - (save-restriction - (unless buffer - ;; BUFFER can be nil. We use a temporary buffer. - (setq buffer (generate-new-buffer tramp-temp-buffer-name))) - (while (get-process name1) - ;; NAME must be unique as process name. - (setq i (1+ i) - name1 (format "%s<%d>" name i))) - (setq name name1) - ;; Set the new process properties. - (tramp-set-connection-property v "process-name" name) - (tramp-set-connection-property v "process-buffer" buffer) - ;; Activate narrowing in order to save BUFFER contents. - ;; Clear also the modification time; otherwise we might - ;; be interrupted by `verify-visited-file-modtime'. - (with-current-buffer (tramp-get-connection-buffer v) - (let ((buffer-undo-list t)) + + (unless buffer + ;; BUFFER can be nil. We use a temporary buffer. + (setq buffer (generate-new-buffer tramp-temp-buffer-name))) + (while (get-process name1) + ;; NAME must be unique as process name. + (setq i (1+ i) + name1 (format "%s<%d>" name i))) + (setq name name1) + ;; Set the new process properties. + (tramp-set-connection-property v "process-name" name) + (tramp-set-connection-property v "process-buffer" buffer) + + (with-current-buffer (tramp-get-connection-buffer v) + (unwind-protect + (save-excursion + (save-restriction + ;; Activate narrowing in order to save BUFFER + ;; contents. Clear also the modification time; + ;; otherwise we might be interrupted by + ;; `verify-visited-file-modtime'. + (let ((buffer-undo-list t) + (buffer-read-only nil) + (mark (point))) (clear-visited-file-modtime) (narrow-to-region (point-max) (point-max)) + ;; We call `tramp-maybe-open-connection', in order + ;; to cleanup the prompt afterwards. + (tramp-maybe-open-connection v) + (widen) + (delete-region mark (point)) + (narrow-to-region (point-max) (point-max)) + ;; Now do it. (if command ;; Send the command. (tramp-send-command v command nil t) ; nooutput ;; Check, whether a pty is associated. - (tramp-maybe-open-connection v) (unless (tramp-compat-process-get (tramp-get-connection-process v) 'remote-tty) (tramp-error v 'file-error - "pty association is not supported for `%s'" name))))) - (let ((p (tramp-get-connection-process v))) - ;; Set query flag for this process. - (tramp-compat-set-process-query-on-exit-flag p t) - ;; Return process. - p))) - ;; Save exit. - (with-current-buffer (tramp-get-connection-buffer v) + "pty association is not supported for `%s'" name)))) + (let ((p (tramp-get-connection-process v))) + ;; Set query flag for this process. We ignore errors, + ;; because the process could have finished already. + (ignore-errors + (tramp-compat-set-process-query-on-exit-flag p t)) + ;; Return process. + p))) + + ;; Save exit. (if (string-match tramp-temp-buffer-name (buffer-name)) (progn (set-process-buffer (tramp-get-connection-process v) nil) (kill-buffer (current-buffer))) - (set-buffer-modified-p bmp))) - (tramp-set-connection-property v "process-name" nil) - (tramp-set-connection-property v "process-buffer" nil))))) + (set-buffer-modified-p bmp)) + (tramp-set-connection-property v "process-name" nil) + (tramp-set-connection-property v "process-buffer" nil)))))) (defun tramp-sh-handle-process-file (program &optional infile destination display &rest args) ------------------------------------------------------------ revno: 109656 fixes bug: http://debbugs.gnu.org/3228 committer: Chong Yidong branch nick: trunk timestamp: Fri 2012-08-17 17:10:31 +0800 message: Allow face-remapping using :font, and use it in mouse-appearance-menu. * mouse.el (mouse-appearance-menu): If x-select-font returns a font spec, set the font directly. * xfaces.c (merge_face_vectors): If the target font specfies a font spec, make the font's attributes take precedence over directly-specified attributes. (merge_face_ref): Recognize :font. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-08-17 06:01:17 +0000 +++ lisp/ChangeLog 2012-08-17 09:10:31 +0000 @@ -1,3 +1,8 @@ +2012-08-17 Chong Yidong + + * mouse.el (mouse-appearance-menu): If x-select-font returns a + font spec, set the font directly (Bug#3228). + 2012-08-17 Martin Rudalics * window.el (delete-window): Fix last fix. === modified file 'lisp/mouse.el' --- lisp/mouse.el 2012-08-10 14:47:12 +0000 +++ lisp/mouse.el 2012-08-17 09:10:31 +0000 @@ -1951,12 +1951,14 @@ (choice ;; Either choice == 'x-select-font, or choice is a ;; symbol whose name is a font. - (buffer-face-mode-invoke (font-face-attributes - (if (eq choice 'x-select-font) - (x-select-font) - (symbol-name choice))) - t - (called-interactively-p 'interactive)))))))) + (let ((font (if (eq choice 'x-select-font) + (x-select-font) + (symbol-name choice)))) + (buffer-face-mode-invoke + (if (fontp font 'font-spec) + (list :font font) + (font-face-attributes font)) + t (called-interactively-p 'interactive))))))))) ;;; Bindings for mouse commands. === modified file 'src/ChangeLog' --- src/ChangeLog 2012-08-17 05:35:39 +0000 +++ src/ChangeLog 2012-08-17 09:10:31 +0000 @@ -1,3 +1,10 @@ +2012-08-17 Chong Yidong + + * xfaces.c (merge_face_vectors): If the target font specfies a + font spec, make the font's attributes take precedence over + directly-specified attributes. + (merge_face_ref): Recognize :font. + 2012-08-17 Dmitry Antipov Do not use memcpy for copying intervals. === modified file 'src/xfaces.c' --- src/xfaces.c 2012-08-16 21:58:44 +0000 +++ src/xfaces.c 2012-08-17 09:10:31 +0000 @@ -2281,6 +2281,7 @@ struct named_merge_point *named_merge_points) { int i; + Lisp_Object font = Qnil; /* If FROM inherits from some other faces, merge their attributes into TO before merging FROM's direct attributes. Note that an :inherit @@ -2291,24 +2292,13 @@ && !NILP (from[LFACE_INHERIT_INDEX])) merge_face_ref (f, from[LFACE_INHERIT_INDEX], to, 0, named_merge_points); - i = LFACE_FONT_INDEX; - if (!UNSPECIFIEDP (from[i])) + if (FONT_SPEC_P (from[LFACE_FONT_INDEX])) { - if (!UNSPECIFIEDP (to[i])) - to[i] = merge_font_spec (from[i], to[i]); + if (!UNSPECIFIEDP (to[LFACE_FONT_INDEX])) + font = merge_font_spec (from[LFACE_FONT_INDEX], to[LFACE_FONT_INDEX]); else - to[i] = copy_font_spec (from[i]); - if (! NILP (AREF (to[i], FONT_FOUNDRY_INDEX))) - to[LFACE_FOUNDRY_INDEX] = SYMBOL_NAME (AREF (to[i], FONT_FOUNDRY_INDEX)); - if (! NILP (AREF (to[i], FONT_FAMILY_INDEX))) - to[LFACE_FAMILY_INDEX] = SYMBOL_NAME (AREF (to[i], FONT_FAMILY_INDEX)); - if (! NILP (AREF (to[i], FONT_WEIGHT_INDEX))) - to[LFACE_WEIGHT_INDEX] = FONT_WEIGHT_FOR_FACE (to[i]); - if (! NILP (AREF (to[i], FONT_SLANT_INDEX))) - to[LFACE_SLANT_INDEX] = FONT_SLANT_FOR_FACE (to[i]); - if (! NILP (AREF (to[i], FONT_WIDTH_INDEX))) - to[LFACE_SWIDTH_INDEX] = FONT_WIDTH_FOR_FACE (to[i]); - ASET (to[i], FONT_SIZE_INDEX, Qnil); + font = copy_font_spec (from[LFACE_FONT_INDEX]); + to[LFACE_FONT_INDEX] = font; } for (i = 1; i < LFACE_VECTOR_SIZE; ++i) @@ -2319,8 +2309,7 @@ to[i] = merge_face_heights (from[i], to[i], to[i]); font_clear_prop (to, FONT_SIZE_INDEX); } - else if (i != LFACE_FONT_INDEX - && ! EQ (to[i], from[i])) + else if (i != LFACE_FONT_INDEX && ! EQ (to[i], from[i])) { to[i] = from[i]; if (i >= LFACE_FAMILY_INDEX && i <=LFACE_SLANT_INDEX) @@ -2334,6 +2323,25 @@ } } + /* If FROM specifies a font spec, make its contents take precedence + over :family and other attributes. This is needed for face + remapping using :font to work. */ + + if (!NILP (font)) + { + if (! NILP (AREF (font, FONT_FOUNDRY_INDEX))) + to[LFACE_FOUNDRY_INDEX] = SYMBOL_NAME (AREF (font, FONT_FOUNDRY_INDEX)); + if (! NILP (AREF (font, FONT_FAMILY_INDEX))) + to[LFACE_FAMILY_INDEX] = SYMBOL_NAME (AREF (font, FONT_FAMILY_INDEX)); + if (! NILP (AREF (font, FONT_WEIGHT_INDEX))) + to[LFACE_WEIGHT_INDEX] = FONT_WEIGHT_FOR_FACE (font); + if (! NILP (AREF (font, FONT_SLANT_INDEX))) + to[LFACE_SLANT_INDEX] = FONT_SLANT_FOR_FACE (font); + if (! NILP (AREF (font, FONT_WIDTH_INDEX))) + to[LFACE_SWIDTH_INDEX] = FONT_WIDTH_FOR_FACE (font); + ASET (font, FONT_SIZE_INDEX, Qnil); + } + /* TO is always an absolute face, which should inherit from nothing. We blindly copy the :inherit attribute above and fix it up here. */ to[LFACE_INHERIT_INDEX] = Qnil; @@ -2575,6 +2583,13 @@ else err = 1; } + else if (EQ (keyword, QCfont)) + { + if (FONTP (value)) + to[LFACE_FONT_INDEX] = value; + else + err = 1; + } else if (EQ (keyword, QCinherit)) { /* This is not really very useful; it's just like a ------------------------------------------------------------ revno: 109655 fixes bug: http://debbugs.gnu.org/12072 author: Daniel Bergey committer: Glenn Morris branch nick: trunk timestamp: Fri 2012-08-17 00:28:23 -0700 message: quail-define-inscript-package tiny change * leim/quail/indian.el (quail-define-inscript-package): Set kbd-translate for all Inscript layouts. It's a positional layout: vowels should be on the left hand regardless of the underlying characters produced by those keys. diff: === modified file 'leim/ChangeLog' --- leim/ChangeLog 2012-08-06 07:34:35 +0000 +++ leim/ChangeLog 2012-08-17 07:28:23 +0000 @@ -1,3 +1,10 @@ +2012-08-17 Daniel Bergey (tiny change) + + * quail/indian.el (quail-define-inscript-package): + Set kbd-translate for all Inscript layouts. It's a positional + layout: vowels should be on the left hand regardless of the + underlying characters produced by those keys. (Bug#12072) + 2012-08-06 Mohsen BANAN * quail/persian.el: Add some mappings. (Bug#11812) === modified file 'leim/quail/indian.el' --- leim/quail/indian.el 2012-03-21 07:41:52 +0000 +++ leim/quail/indian.el 2012-08-17 07:28:23 +0000 @@ -309,7 +309,7 @@ (defun quail-define-inscript-package (char-tables key-tables pkgname lang title docstring) (funcall 'quail-define-package pkgname lang title nil docstring - nil nil nil nil nil nil nil nil) + nil nil nil t nil nil nil nil) (let (char-table key-table char key) (while (and char-tables key-tables) (setq char-table (car char-tables) ------------------------------------------------------------ revno: 109654 committer: Glenn Morris branch nick: trunk timestamp: Fri 2012-08-17 00:23:21 -0700 message: Whitespace diff: === modified file 'configure.ac' --- configure.ac 2012-08-17 07:20:10 +0000 +++ configure.ac 2012-08-17 07:23:21 +0000 @@ -3425,7 +3425,7 @@ dnl if HAVE_POSIX_OPENPT if test "x$ac_cv_func_posix_openpt" = xyes; then AC_DEFINE(PTY_OPEN, [fd = posix_openpt (O_RDWR | O_NOCTTY)]) - AC_DEFINE(PTY_NAME_SPRINTF, [] ) + AC_DEFINE(PTY_NAME_SPRINTF, []) dnl if HAVE_GETPT elif test "x$ac_cv_func_getpt" = xyes; then AC_DEFINE(PTY_OPEN, [fd = getpt ()]) ------------------------------------------------------------ revno: 109653 fixes bug: http://debbugs.gnu.org/12040 author: Jan Beich committer: Glenn Morris branch nick: trunk timestamp: Fri 2012-08-17 00:20:10 -0700 message: Fix pty handling on FreeBSD 8.0 (tiny change) * configure.ac (PTY_OPEN): Try posix_openpt on gnu-linux, gnu-kfreebsd, freebsd, and netbsd. diff: === modified file 'ChangeLog' --- ChangeLog 2012-08-14 03:15:52 +0000 +++ ChangeLog 2012-08-17 07:20:10 +0000 @@ -1,3 +1,8 @@ +2012-08-17 Jan Beich (tiny change) + + * configure.ac (PTY_OPEN): Try posix_openpt on gnu-linux, + gnu-kfreebsd, freebsd, and netbsd. (Bug#12040) + 2012-08-14 Paul Eggert Merge from gnulib, incorporating: === modified file 'configure.ac' --- configure.ac 2012-08-15 13:26:30 +0000 +++ configure.ac 2012-08-17 07:20:10 +0000 @@ -2773,7 +2773,7 @@ AC_CHECK_FUNCS(grantpt) # PTY-related GNU extensions. -AC_CHECK_FUNCS(getpt) +AC_CHECK_FUNCS(getpt posix_openpt) # Check this now, so that we will NOT find the above functions in ncurses. # That is because we have not set up to link ncurses in lib-src. @@ -3397,6 +3397,7 @@ AC_DEFINE(PTY_TTY_NAME_SPRINTF, []) ;; + dnl FIXME? Maybe use same as freebsd - see bug#12040. darwin ) AC_DEFINE(PTY_ITERATION, [int i; for (i = 0; i < 1; i++)]) dnl Not used, because PTY_ITERATION is defined. @@ -3409,11 +3410,11 @@ AC_DEFINE(PTY_TTY_NAME_SPRINTF, []) ;; - gnu | freebsd | netbsd | openbsd ) + gnu | openbsd ) AC_DEFINE(FIRST_PTY_LETTER, ['p']) ;; - gnu-linux | gnu-kfreebsd ) + gnu-linux | gnu-kfreebsd | freebsd | netbsd ) dnl if HAVE_GRANTPT if test "x$ac_cv_func_grantpt" = xyes; then AC_DEFINE(UNIX98_PTYS, 1, [Define if the system has Unix98 PTYs.]) @@ -3421,8 +3422,12 @@ dnl Note that grantpt and unlockpt may fork. We must block SIGCHLD dnl to prevent sigchld_handler from intercepting the child's death. AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptyname; sigblock (sigmask (SIGCHLD)); if (grantpt (fd) == -1 || unlockpt (fd) == -1 || !(ptyname = ptsname(fd))) { sigunblock (sigmask (SIGCHLD)); close (fd); return -1; } snprintf (pty_name, sizeof pty_name, "%s", ptyname); sigunblock (sigmask (SIGCHLD)); }]) + dnl if HAVE_POSIX_OPENPT + if test "x$ac_cv_func_posix_openpt" = xyes; then + AC_DEFINE(PTY_OPEN, [fd = posix_openpt (O_RDWR | O_NOCTTY)]) + AC_DEFINE(PTY_NAME_SPRINTF, [] ) dnl if HAVE_GETPT - if test "x$ac_cv_func_getpt" = xyes; then + elif test "x$ac_cv_func_getpt" = xyes; then AC_DEFINE(PTY_OPEN, [fd = getpt ()]) AC_DEFINE(PTY_NAME_SPRINTF, []) else ------------------------------------------------------------ revno: 109652 committer: martin rudalics branch nick: trunk timestamp: Fri 2012-08-17 08:01:17 +0200 message: Fix latest fix of delete-window. * window.el (delete-window): Fix last fix. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-08-16 17:22:36 +0000 +++ lisp/ChangeLog 2012-08-17 06:01:17 +0000 @@ -1,3 +1,7 @@ +2012-08-17 Martin Rudalics + + * window.el (delete-window): Fix last fix. + 2012-08-16 Martin Rudalics * window.el (window-valid-p): Move to window.c. === modified file 'lisp/window.el' --- lisp/window.el 2012-08-16 17:22:36 +0000 +++ lisp/window.el 2012-08-17 06:01:17 +0000 @@ -2459,9 +2459,7 @@ (not (eq (window-parameter parent 'window-side) 'none)))) (error "Attempt to delete last non-side window")) ((not parent) - (error "Attempt to delete minibuffer or sole ordinary window")) - ((eq window (window--major-non-side-window frame)) - (error "Attempt to delete last non-side window"))) + (error "Attempt to delete minibuffer or sole ordinary window"))) (let* ((horizontal (window-left-child parent)) (size (window-total-size window horizontal))