X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/5725bd2cc0e691dadc31bd958f210b1bbcf17c49..6d12ff8b3344d4284f78e0be56cda076f9a3d6e7:/src/xdisp.c?ds=sidebyside diff --git a/src/xdisp.c b/src/xdisp.c index 3f1c97e601..c1e05d6df1 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -364,6 +364,29 @@ static Lisp_Object Qslice; Lisp_Object Qcenter; static Lisp_Object Qmargin, Qpointer; static Lisp_Object Qline_height; +static Lisp_Object Qinhibit_debug_on_message; + +/* 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 @@ -746,9 +769,9 @@ static int clear_image_cache_count; static struct glyph_slice null_glyph_slice = { 0, 0, 0, 0 }; #endif -/* Non-zero while redisplay_internal is in progress. */ +/* True while redisplay_internal is in progress. */ -int redisplaying_p; +bool redisplaying_p; static Lisp_Object Qinhibit_free_realized_faces; static Lisp_Object Qmode_line_default_help_echo; @@ -2398,7 +2421,7 @@ remember_mouse_glyph (struct frame *f, int gx, int gy, NativeRectangle *rect) static Lisp_Object safe_eval_handler (Lisp_Object arg, ptrdiff_t nargs, Lisp_Object *args) { - add_to_log ("Error during redisplay: %S signalled %S", + add_to_log ("Error during redisplay: %S signaled %S", Flist (nargs, args), arg); return Qnil; } @@ -3644,7 +3667,7 @@ handle_fontified_prop (struct it *it) } /* There isn't much we can reasonably do to protect against misbehaving fontification, but here's a fig leaf. */ - else if (!NILP (BVAR (obuf, name))) + else if (BUFFER_LIVE_P (obuf)) set_buffer_internal_1 (obuf); /* The fontification code may have added/removed text. @@ -4047,38 +4070,54 @@ static enum prop_handled handle_invisible_prop (struct it *it) { enum prop_handled handled = HANDLED_NORMALLY; + int invis_p; + Lisp_Object prop; if (STRINGP (it->string)) { - Lisp_Object prop, end_charpos, limit, charpos; + Lisp_Object end_charpos, limit, charpos; /* Get the value of the invisible text property at the current position. Value will be nil if there is no such property. */ charpos = make_number (IT_STRING_CHARPOS (*it)); prop = Fget_text_property (charpos, Qinvisible, it->string); + invis_p = TEXT_PROP_MEANS_INVISIBLE (prop); - if (!NILP (prop) - && IT_STRING_CHARPOS (*it) < it->end_charpos) + if (invis_p && IT_STRING_CHARPOS (*it) < it->end_charpos) { - ptrdiff_t endpos; + /* Record whether we have to display an ellipsis for the + invisible text. */ + int display_ellipsis_p = (invis_p == 2); + ptrdiff_t len, endpos; handled = HANDLED_RECOMPUTE_PROPS; - /* Get the position at which the next change of the - invisible text property can be found in IT->string. - Value will be nil if the property value is the same for - all the rest of IT->string. */ - XSETINT (limit, SCHARS (it->string)); - end_charpos = Fnext_single_property_change (charpos, Qinvisible, - it->string, limit); - - /* Text at current position is invisible. The next - change in the property is at position end_charpos. - Move IT's current position to that position. */ - if (INTEGERP (end_charpos) - && (endpos = XFASTINT (end_charpos)) < XFASTINT (limit)) + /* Get the position at which the next visible text can be + found in IT->string, if any. */ + endpos = len = SCHARS (it->string); + XSETINT (limit, len); + do + { + end_charpos = Fnext_single_property_change (charpos, Qinvisible, + it->string, limit); + if (INTEGERP (end_charpos)) + { + endpos = XFASTINT (end_charpos); + prop = Fget_text_property (end_charpos, Qinvisible, it->string); + invis_p = TEXT_PROP_MEANS_INVISIBLE (prop); + if (invis_p == 2) + display_ellipsis_p = 1; + } + } + while (invis_p && endpos < len); + + if (display_ellipsis_p) + it->ellipsis_p = 1; + + if (endpos < len) { + /* Text at END_CHARPOS is visible. Move IT there. */ struct text_pos old; ptrdiff_t oldpos; @@ -4114,7 +4153,8 @@ handle_invisible_prop (struct it *it) /* The rest of the string is invisible. If this is an overlay string, proceed with the next overlay string or whatever comes and return a character from there. */ - if (it->current.overlay_string_index >= 0) + if (it->current.overlay_string_index >= 0 + && !display_ellipsis_p) { next_overlay_string (it); /* Don't check for overlay strings when we just @@ -4131,9 +4171,8 @@ handle_invisible_prop (struct it *it) } else { - int invis_p; ptrdiff_t newpos, next_stop, start_charpos, tem; - Lisp_Object pos, prop, overlay; + Lisp_Object pos, overlay; /* First of all, is there invisible text at this position? */ tem = start_charpos = IT_CHARPOS (*it); @@ -5445,7 +5484,7 @@ load_overlay_strings (struct it *it, ptrdiff_t charpos) while (0) /* Process overlay before the overlay center. */ - for (ov = buffer_get_overlays (NULL, OV_BEFORE); ov; ov = ov->next) + for (ov = current_buffer->overlays_before; ov; ov = ov->next) { XSETMISC (overlay, ov); eassert (OVERLAYP (overlay)); @@ -5485,7 +5524,7 @@ load_overlay_strings (struct it *it, ptrdiff_t charpos) } /* Process overlays after the overlay center. */ - for (ov = buffer_get_overlays (NULL, OV_AFTER); ov; ov = ov->next) + for (ov = current_buffer->overlays_after; ov; ov = ov->next) { XSETMISC (overlay, ov); eassert (OVERLAYP (overlay)); @@ -6010,7 +6049,7 @@ back_to_previous_visible_line_start (struct it *it) { Lisp_Object prop; prop = Fget_char_property (make_number (IT_CHARPOS (*it) - 1), - Qinvisible, it->window); + Qinvisible, it->window); if (TEXT_PROP_MEANS_INVISIBLE (prop)) continue; } @@ -7268,7 +7307,7 @@ set_iterator_to_next (struct it *it, int reseat_p) default: /* There are no other methods defined, so this should be a bug. */ - abort (); + emacs_abort (); } eassert (it->method != GET_FROM_STRING @@ -7723,7 +7762,7 @@ compute_stop_pos_backwards (struct it *it) compute_stop_pos (it); /* We must advance forward, right? */ if (it->stop_charpos <= charpos) - abort (); + emacs_abort (); } while (charpos > BEGV && it->stop_charpos >= it->end_charpos); @@ -7772,7 +7811,7 @@ handle_stop_backwards (struct it *it, ptrdiff_t charpos) compute_stop_pos (it); /* We must advance forward, right? */ if (it->stop_charpos <= it->prev_stop) - abort (); + emacs_abort (); charpos = it->stop_charpos; } while (charpos <= where_we_are); @@ -7981,7 +8020,7 @@ run_redisplay_end_trigger_hook (struct it *it) /* 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. */ @@ -8860,7 +8899,7 @@ move_it_to (struct it *it, ptrdiff_t to_charpos, int to_x, int to_y, int to_vpos break; default: - abort (); + emacs_abort (); } /* Reset/increment for the next run. */ @@ -9318,7 +9357,7 @@ message_dolog (const char *m, ptrdiff_t nbytes, int nlflag, int multibyte) old_deactivate_mark = Vdeactivate_mark; oldbuf = current_buffer; Fset_buffer (Fget_buffer_create (Vmessages_buffer_name)); - BVAR (current_buffer, undo_list) = Qt; + bset_undo_list (current_buffer, Qt); oldpoint = message_dolog_marker1; set_marker_restricted (oldpoint, make_number (PT), Qnil); @@ -9871,7 +9910,7 @@ ensure_echo_area_buffers (void) for (i = 0; i < 2; ++i) if (!BUFFERP (echo_buffer[i]) - || NILP (BVAR (XBUFFER (echo_buffer[i]), name))) + || !BUFFER_LIVE_P (XBUFFER (echo_buffer[i]))) { char name[30]; Lisp_Object old_buffer; @@ -9880,7 +9919,7 @@ ensure_echo_area_buffers (void) old_buffer = echo_buffer[i]; echo_buffer[i] = Fget_buffer_create (make_formatted_string (name, " *Echo Area %d*", i)); - BVAR (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; */ @@ -9969,12 +10008,12 @@ with_echo_area_buffer (struct window *w, int which, 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); } - BVAR (current_buffer, undo_list) = Qt; - BVAR (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); @@ -10054,7 +10093,7 @@ unwind_with_echo_area_buffer (Lisp_Object vector) 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)); } @@ -10087,7 +10126,7 @@ setup_echo_area_for_printing (int multibyte_p) /* Switch to that buffer and clear it. */ set_buffer_internal (XBUFFER (echo_area_buffer[0])); - BVAR (current_buffer, truncate_lines) = Qnil; + bset_truncate_lines (current_buffer, Qnil); if (Z > BEG) { @@ -10130,7 +10169,7 @@ setup_echo_area_for_printing (int multibyte_p) { /* Someone switched buffers between print requests. */ set_buffer_internal (XBUFFER (echo_area_buffer[0])); - BVAR (current_buffer, truncate_lines) = Qnil; + bset_truncate_lines (current_buffer, Qnil); } } } @@ -10442,11 +10481,10 @@ current_message_1 (ptrdiff_t a1, Lisp_Object a2, ptrdiff_t a3, ptrdiff_t a4) empty. This is a relatively infrequent operation, so it's not worth optimizing. */ -int +bool push_message (void) { - Lisp_Object msg; - msg = current_message (); + Lisp_Object msg = current_message (); Vmessage_stack = Fcons (msg, Vmessage_stack); return STRINGP (msg); } @@ -10495,7 +10533,7 @@ void check_message_stack (void) { if (!NILP (Vmessage_stack)) - abort (); + emacs_abort (); } @@ -10534,7 +10572,6 @@ truncate_message_1 (ptrdiff_t nchars, Lisp_Object a2, ptrdiff_t a3, ptrdiff_t a4 return 0; } - /* Set the current message to a substring of S or STRING. If STRING is a Lisp string, set the message to the first NBYTES @@ -10553,6 +10590,8 @@ static void set_message (const char *s, Lisp_Object string, ptrdiff_t nbytes, int multibyte_p) { + ptrdiff_t count = SPECPDL_INDEX (); + message_enable_multibyte = ((s && multibyte_p) || (STRINGP (string) && STRING_MULTIBYTE (string))); @@ -10561,6 +10600,15 @@ set_message (const char *s, Lisp_Object string, (intptr_t) s, string, nbytes, multibyte_p); message_buf_print = 0; help_echo_showing_p = 0; + + if (NILP (Vinhibit_debug_on_message) && STRINGP (Vdebug_on_message) + && fast_string_match (Vdebug_on_message, string) >= 0) + { + specbind (Qinhibit_debug_on_message, Qt); + call_debugger (list2 (Qerror, string)); + } + + unbind_to (count, Qnil); } @@ -10582,9 +10630,9 @@ set_message_1 (ptrdiff_t a1, Lisp_Object a2, ptrdiff_t nbytes, ptrdiff_t multiby != !NILP (BVAR (current_buffer, enable_multibyte_characters))) Fset_buffer_multibyte (message_enable_multibyte ? Qt : Qnil); - BVAR (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))) - BVAR (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); @@ -11274,7 +11322,7 @@ update_menu_bar (struct frame *f, int save_match_data, int hooks_run) } 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 +11535,7 @@ update_tool_bar (struct frame *f, int save_match_data) 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 +11577,8 @@ build_desired_tool_bar_string (struct frame *f) /* 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); @@ -12929,12 +12977,11 @@ redisplay_internal (void) if (redisplaying_p) return; - /* Record a function that resets redisplaying_p to its old value + /* Record a function that clears redisplaying_p when we leave this function. */ count = SPECPDL_INDEX (); - record_unwind_protect (unwind_redisplay, - Fcons (make_number (redisplaying_p), selected_frame)); - ++redisplaying_p; + record_unwind_protect (unwind_redisplay, selected_frame); + redisplaying_p = 1; specbind (Qinhibit_free_realized_faces, Qnil); { @@ -13266,12 +13313,12 @@ redisplay_internal (void) 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; @@ -13672,21 +13719,15 @@ redisplay_preserve_echo_area (int from_where) } -/* Function registered with record_unwind_protect in - redisplay_internal. Reset redisplaying_p to the value it had - before redisplay_internal was called, and clear - prevent_freeing_realized_faces_p. It also selects the previously +/* Function registered with record_unwind_protect in redisplay_internal. + Clear redisplaying_p. Also, select the previously selected frame, unless it has been deleted (by an X connection failure during redisplay, for example). */ static Lisp_Object -unwind_redisplay (Lisp_Object val) +unwind_redisplay (Lisp_Object old_frame) { - Lisp_Object old_redisplaying_p, old_frame; - - old_redisplaying_p = XCAR (val); - redisplaying_p = XFASTINT (old_redisplaying_p); - old_frame = XCDR (val); + redisplaying_p = 0; if (! EQ (old_frame, selected_frame) && FRAME_LIVE_P (XFRAME (old_frame))) select_frame_for_redisplay (old_frame); @@ -13737,7 +13778,7 @@ mark_window_display_accurate_1 (struct window *w, int accurate_p) if (accurate_p) { - WSET (w, window_end_valid, w->buffer); + wset_window_end_valid (w, w->buffer); w->update_mode_line = 0; } } @@ -14385,7 +14426,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, for (g = row->glyphs[TEXT_AREA], x = row->x; g < glyph; g++) { if (g >= row->glyphs[TEXT_AREA] + row->used[TEXT_AREA]) - abort (); + emacs_abort (); x += g->pixel_width; } } @@ -14506,7 +14547,7 @@ run_window_scroll_functions (Lisp_Object window, struct text_pos startp) SET_MARKER_FROM_TEXT_POS (w->start, startp); if (current_buffer != XBUFFER (w->buffer)) - abort (); + emacs_abort (); if (!NILP (Vwindow_scroll_functions)) { @@ -14514,8 +14555,7 @@ run_window_scroll_functions (Lisp_Object window, struct text_pos startp) make_number (CHARPOS (startp))); SET_TEXT_POS_FROM_MARKER (startp, w->start); /* In case the hook functions switch buffers. */ - if (current_buffer != XBUFFER (w->buffer)) - set_buffer_internal_1 (XBUFFER (w->buffer)); + set_buffer_internal (XBUFFER (w->buffer)); } return startp; @@ -14845,7 +14885,7 @@ try_scrolling (Lisp_Object window, int just_this_one_p, 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. */ @@ -15343,7 +15383,7 @@ set_vertical_scroll_bar (struct window *w) selected_window is redisplayed. We can return without actually redisplaying the window if - fonts_changed_p is nonzero. In that case, redisplay_internal will + fonts_changed_p. In that case, redisplay_internal will retry. */ static void @@ -15470,15 +15510,15 @@ redisplay_window (Lisp_Object window, int just_this_one_p) 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. */ CHECK_WINDOW_END (w); if (Z == Z_BYTE && CHARPOS (opoint) != BYTEPOS (opoint)) - abort (); + emacs_abort (); if (BYTEPOS (opoint) < CHARPOS (opoint)) - abort (); + emacs_abort (); /* If %c is in mode line, update it if needed. */ if (!NILP (w->column_number_displayed) @@ -15581,11 +15621,11 @@ redisplay_window (Lisp_Object window, int just_this_one_p) 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 @@ -15690,7 +15730,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) goto try_to_scroll; default: - abort (); + emacs_abort (); } } /* If current starting point was originally the beginning of a line @@ -15799,7 +15839,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) || 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)) { @@ -15853,7 +15893,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) break; default: - abort (); + emacs_abort (); } } @@ -15870,7 +15910,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) /* 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 +16168,8 @@ redisplay_window (Lisp_Object window, int just_this_one_p) 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: @@ -16187,7 +16227,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) } #endif /* HAVE_WINDOW_SYSTEM */ - /* We go to this label, with fonts_changed_p nonzero, + /* We go to this label, with fonts_changed_p set, if it is necessary to try again using larger glyph matrices. We have to redeem the scroll bar even in this case, because the loop in redisplay_internal expects that. */ @@ -16306,10 +16346,10 @@ try_window (Lisp_Object window, struct text_pos pos, int flags) 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 +16357,12 @@ try_window (Lisp_Object window, struct text_pos pos, int flags) 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 +16586,31 @@ try_window_reusing_current_matrix (struct window *w) { 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 +16791,19 @@ try_window_reusing_current_matrix (struct window *w) { 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 @@ -17297,7 +17341,7 @@ try_window_id (struct window *w) if (row) set_cursor_from_row (w, row, current_matrix, 0, 0, 0, 0); else - abort (); + emacs_abort (); return 1; } } @@ -17331,8 +17375,8 @@ try_window_id (struct window *w) { /* 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); @@ -17341,7 +17385,7 @@ try_window_id (struct window *w) if (row) set_cursor_from_row (w, row, current_matrix, 0, 0, 0, 0); else - abort (); + emacs_abort (); return 2; } } @@ -17664,15 +17708,15 @@ try_window_id (struct window *w) { rotate_matrix (current_matrix, first_unchanged_at_end_vpos + dvpos, bottom_vpos, dvpos); - enable_glyph_matrix_rows (current_matrix, bottom_vpos + dvpos, - bottom_vpos, 0); + clear_glyph_matrix_rows (current_matrix, bottom_vpos + dvpos, + bottom_vpos); } else if (dvpos > 0) { rotate_matrix (current_matrix, first_unchanged_at_end_vpos, bottom_vpos, dvpos); - enable_glyph_matrix_rows (current_matrix, first_unchanged_at_end_vpos, - first_unchanged_at_end_vpos + dvpos, 0); + clear_glyph_matrix_rows (current_matrix, first_unchanged_at_end_vpos, + first_unchanged_at_end_vpos + dvpos); } /* For frame-based redisplay, make sure that current frame and window @@ -17766,21 +17810,22 @@ try_window_id (struct window *w) 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 +17834,12 @@ try_window_id (struct window *w) /* 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,20 +17867,20 @@ try_window_id (struct window *w) } 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")); } else - abort (); + emacs_abort (); IF_DEBUG (debug_end_pos = XFASTINT (w->window_end_pos); 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; @@ -19206,7 +19251,7 @@ find_row_edges (struct it *it, struct glyph_row *row, /* A line that is entirely from a string/image/stretch... */ row->maxpos = row->minpos; else - abort (); + emacs_abort (); } else row->maxpos = it->current.pos; @@ -19248,7 +19293,7 @@ display_line (struct it *it) } /* 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); @@ -20047,7 +20092,7 @@ See also `bidi-paragraph-direction'. */) return Qright_to_left; break; default: - abort (); + emacs_abort (); } } } @@ -20252,7 +20297,7 @@ display_mode_lines (struct window *w) /* 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 +21433,7 @@ decode_mode_spec (struct window *w, register int c, int field_width, 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 +21496,14 @@ decode_mode_spec (struct window *w, register int c, int field_width, 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 +21535,8 @@ decode_mode_spec (struct window *w, register int c, int field_width, 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 +21562,13 @@ decode_mode_spec (struct window *w, register int c, int field_width, 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. */ @@ -21960,7 +22005,7 @@ display_string (const char *string, Lisp_Object lisp_string, Lisp_Object face_st { /* Glyph is off the left margin of the display area. Should not happen. */ - abort (); + emacs_abort (); } row->ascent = max (row->ascent, it->max_ascent); @@ -23005,7 +23050,8 @@ right_overwritten (struct glyph_string *s) { int x = 0, i; struct glyph *glyphs = s->row->glyphs[s->area]; - int first = (s->first_glyph - glyphs) + (s->cmp ? 1 : s->nchars); + int first = (s->first_glyph - glyphs + + (s->first_glyph->type == COMPOSITE_GLYPH ? 1 : s->nchars)); int end = s->row->used[s->area]; for (i = first; i < end && s->right_overhang > x; ++i) @@ -23028,7 +23074,8 @@ right_overwriting (struct glyph_string *s) int i, k, x; int end = s->row->used[s->area]; struct glyph *glyphs = s->row->glyphs[s->area]; - int first = (s->first_glyph - glyphs) + (s->cmp ? 1 : s->nchars); + int first = (s->first_glyph - glyphs + + (s->first_glyph->type == COMPOSITE_GLYPH ? 1 : s->nchars)); k = -1; x = 0; @@ -23325,7 +23372,7 @@ compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p) break; \ \ default: \ - abort (); \ + emacs_abort (); \ } \ \ if (s) \ @@ -23666,7 +23713,7 @@ append_glyph (struct it *it) { glyph->resolved_level = it->bidi_it.resolved_level; if ((it->bidi_it.type & 7) != it->bidi_it.type) - abort (); + emacs_abort (); glyph->bidi_type = it->bidi_it.type; } else @@ -23740,7 +23787,7 @@ append_composite_glyph (struct it *it) { glyph->resolved_level = it->bidi_it.resolved_level; if ((it->bidi_it.type & 7) != it->bidi_it.type) - abort (); + emacs_abort (); glyph->bidi_type = it->bidi_it.type; } ++it->glyph_row->used[area]; @@ -23919,7 +23966,7 @@ produce_image_glyph (struct it *it) { glyph->resolved_level = it->bidi_it.resolved_level; if ((it->bidi_it.type & 7) != it->bidi_it.type) - abort (); + emacs_abort (); glyph->bidi_type = it->bidi_it.type; } ++it->glyph_row->used[area]; @@ -23980,7 +24027,7 @@ append_stretch_glyph (struct it *it, Lisp_Object object, { glyph->resolved_level = it->bidi_it.resolved_level; if ((it->bidi_it.type & 7) != it->bidi_it.type) - abort (); + emacs_abort (); glyph->bidi_type = it->bidi_it.type; } else @@ -24235,7 +24282,7 @@ produce_special_glyphs (struct it *it, enum display_element_type what) } } else - abort (); + emacs_abort (); #ifdef HAVE_WINDOW_SYSTEM /* On a GUI frame, when the right fringe (left fringe for R2L rows) @@ -24432,7 +24479,7 @@ append_glyphless_glyph (struct it *it, int face_id, int for_no_font, int len, { glyph->resolved_level = it->bidi_it.resolved_level; if ((it->bidi_it.type & 7) != it->bidi_it.type) - abort (); + emacs_abort (); glyph->bidi_type = it->bidi_it.type; } ++it->glyph_row->used[area]; @@ -29265,6 +29312,15 @@ Its value should be an ASCII acronym string, `hex-code', `empty-box', or Vglyphless_char_display = Fmake_char_table (Qglyphless_char_display, Qnil); Fset_char_table_extra_slot (Vglyphless_char_display, make_number (0), Qempty_box); + + DEFVAR_LISP ("debug-on-message", Vdebug_on_message, + doc: /* If non-nil, debug if a message matching this regexp is displayed. */); + Vdebug_on_message = Qnil; + + DEFVAR_LISP ("inhibit-debug-on-message", Vinhibit_debug_on_message, + doc: /* If non-nil, inhibit `debug-on-message' from entering the debugger. */); + Vinhibit_debug_on_message = Qnil; + DEFSYM(Qinhibit_debug_on_message, "inhibit-debug-on-message"); } @@ -29288,12 +29344,13 @@ init_xdisp (void) 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]