Mercurial > emacs
comparison src/xdisp.c @ 28464:cad4cc0508a0
Fix Lisp_Object/int type confusion revealed by making Lisp_Object a union type:
* xdisp.c (compute_string_pos): Fix order of arguments to
string_pos_nchars_ahead.
(handle_fontified_prop, add_to_log): Pass int, not Lisp_Object, as
count arg to variable-arg routines like Frun_hook_with_args and Fformat.
(back_to_previous_visible_line_start, build_desired_tool_bar_string):
Pass Lisp_Object, not int, to fixed-arg routines like
Fget_char_property and Fmake_string.
(reconsider_clip_changes): Use XINT when comparing integer lisp
objects, or passing them as int arguments.
(mark_window_display_accurate, insert_left_trunc_glyphs, append_space,
extend_face_to_end_of_line): Use make_number when storing or passing
integer values as lisp objects.
(set_cursor_from_row, highlight_trailing_whitespace): Use INTEGERP,
not implicit test against zero, for glyph object.
(try_window_id): Don't use make_number when we want an int value.
* xfaces.c (xlfd_symbolic_value): Make last argument a Lisp_Object, to
be consistent with callers.
(Fbitmap_spec_p): Use XINT to get numeric value of height.
(lface_hash): Apply XFASTINT to lisp values before folding in.
* xfns.c (Fx_show_tip): Use make_number to get lisp objects to fill in window
width and height. Pass an int, not a lisp object, as first arg to Finsert.
author | Ken Raeburn <raeburn@raeburn.org> |
---|---|
date | Sat, 01 Apr 2000 12:59:53 +0000 |
parents | a568b23317fe |
children | 918f12c5c8e3 |
comparison
equal
deleted
inserted
replaced
28463:4591d285fb65 | 28464:cad4cc0508a0 |
---|---|
1019 { | 1019 { |
1020 xassert (STRINGP (string)); | 1020 xassert (STRINGP (string)); |
1021 xassert (CHARPOS (*newpos) >= CHARPOS (pos)); | 1021 xassert (CHARPOS (*newpos) >= CHARPOS (pos)); |
1022 | 1022 |
1023 if (STRING_MULTIBYTE (string)) | 1023 if (STRING_MULTIBYTE (string)) |
1024 *newpos = string_pos_nchars_ahead (pos, CHARPOS (*newpos) - CHARPOS (pos), | 1024 *newpos = string_pos_nchars_ahead (pos, string, |
1025 string); | 1025 CHARPOS (*newpos) - CHARPOS (pos)); |
1026 else | 1026 else |
1027 BYTEPOS (*newpos) = CHARPOS (*newpos); | 1027 BYTEPOS (*newpos) = CHARPOS (*newpos); |
1028 } | 1028 } |
1029 | 1029 |
1030 | 1030 |
1784 | 1784 |
1785 GCPRO1 (pos); | 1785 GCPRO1 (pos); |
1786 /* Run the hook functions. */ | 1786 /* Run the hook functions. */ |
1787 args[0] = Qfontification_functions; | 1787 args[0] = Qfontification_functions; |
1788 args[1] = pos; | 1788 args[1] = pos; |
1789 Frun_hook_with_args (make_number (2), args); | 1789 Frun_hook_with_args (2, args); |
1790 | 1790 |
1791 /* Return HANDLED_RECOMPUTE_PROPS only if function fontified | 1791 /* Return HANDLED_RECOMPUTE_PROPS only if function fontified |
1792 something. This avoids an endless loop if they failed to | 1792 something. This avoids an endless loop if they failed to |
1793 fontify the text for which reason ever. */ | 1793 fontify the text for which reason ever. */ |
1794 if (!NILP (Fget_char_property (pos, Qfontified, Qnil))) | 1794 if (!NILP (Fget_char_property (pos, Qfontified, Qnil))) |
3031 visible_p = 0; | 3031 visible_p = 0; |
3032 else | 3032 else |
3033 { | 3033 { |
3034 Lisp_Object prop; | 3034 Lisp_Object prop; |
3035 | 3035 |
3036 prop = Fget_char_property (IT_CHARPOS (*it), Qinvisible, it->window); | 3036 prop = Fget_char_property (make_number (IT_CHARPOS (*it)), |
3037 Qinvisible, it->window); | |
3037 if (TEXT_PROP_MEANS_INVISIBLE (prop)) | 3038 if (TEXT_PROP_MEANS_INVISIBLE (prop)) |
3038 visible_p = 0; | 3039 visible_p = 0; |
3039 } | 3040 } |
3040 | 3041 |
3041 /* Back one more newline if the current one is invisible. */ | 3042 /* Back one more newline if the current one is invisible. */ |
4667 GCPRO4 (fmt, msg, arg1, arg2); | 4668 GCPRO4 (fmt, msg, arg1, arg2); |
4668 | 4669 |
4669 args[0] = fmt = build_string (format); | 4670 args[0] = fmt = build_string (format); |
4670 args[1] = arg1; | 4671 args[1] = arg1; |
4671 args[2] = arg2; | 4672 args[2] = arg2; |
4672 msg = Fformat (make_number (3), args); | 4673 msg = Fformat (3, args); |
4673 | 4674 |
4674 len = STRING_BYTES (XSTRING (msg)) + 1; | 4675 len = STRING_BYTES (XSTRING (msg)) + 1; |
4675 buffer = (char *) alloca (len); | 4676 buffer = (char *) alloca (len); |
4676 strcpy (buffer, XSTRING (msg)->data); | 4677 strcpy (buffer, XSTRING (msg)->data); |
4677 | 4678 |
6461 and there is a space at the end. */ | 6462 and there is a space at the end. */ |
6462 size_needed = f->n_desired_tool_bar_items + 1; | 6463 size_needed = f->n_desired_tool_bar_items + 1; |
6463 | 6464 |
6464 /* Reuse f->desired_tool_bar_string, if possible. */ | 6465 /* Reuse f->desired_tool_bar_string, if possible. */ |
6465 if (size < size_needed) | 6466 if (size < size_needed) |
6466 f->desired_tool_bar_string = Fmake_string (make_number (size_needed), ' '); | 6467 f->desired_tool_bar_string = Fmake_string (make_number (size_needed), |
6468 make_number (' ')); | |
6467 else | 6469 else |
6468 { | 6470 { |
6469 props = list4 (Qdisplay, Qnil, Qmenu_item, Qnil); | 6471 props = list4 (Qdisplay, Qnil, Qmenu_item, Qnil); |
6470 Fremove_text_properties (make_number (0), make_number (size), | 6472 Fremove_text_properties (make_number (0), make_number (size), |
6471 props, f->desired_tool_bar_string); | 6473 props, f->desired_tool_bar_string); |
7113 pt = BUF_PT (current_buffer); | 7115 pt = BUF_PT (current_buffer); |
7114 else | 7116 else |
7115 pt = marker_position (w->pointm); | 7117 pt = marker_position (w->pointm); |
7116 | 7118 |
7117 if ((w->current_matrix->buffer != XBUFFER (w->buffer) | 7119 if ((w->current_matrix->buffer != XBUFFER (w->buffer) |
7118 || pt != w->last_point) | 7120 || pt != XINT (w->last_point)) |
7119 && check_point_in_composition (w->current_matrix->buffer, | 7121 && check_point_in_composition (w->current_matrix->buffer, |
7120 w->last_point, | 7122 XINT (w->last_point), |
7121 XBUFFER (w->buffer), pt)) | 7123 XBUFFER (w->buffer), pt)) |
7122 b->clip_changed = 1; | 7124 b->clip_changed = 1; |
7123 } | 7125 } |
7124 } | 7126 } |
7125 | 7127 |
7891 w->current_matrix->begv = BUF_BEGV (b); | 7893 w->current_matrix->begv = BUF_BEGV (b); |
7892 w->current_matrix->zv = BUF_ZV (b); | 7894 w->current_matrix->zv = BUF_ZV (b); |
7893 w->last_cursor = w->cursor; | 7895 w->last_cursor = w->cursor; |
7894 w->last_cursor_off_p = w->cursor_off_p; | 7896 w->last_cursor_off_p = w->cursor_off_p; |
7895 if (w == XWINDOW (selected_window)) | 7897 if (w == XWINDOW (selected_window)) |
7896 w->last_point = BUF_PT (b); | 7898 w->last_point = make_number (BUF_PT (b)); |
7897 else | 7899 else |
7898 w->last_point = XMARKER (w->pointm)->charpos; | 7900 w->last_point = make_number (XMARKER (w->pointm)->charpos); |
7899 } | 7901 } |
7900 } | 7902 } |
7901 | 7903 |
7902 w->window_end_valid = w->buffer; | 7904 w->window_end_valid = w->buffer; |
7903 w->update_mode_line = Qnil; | 7905 w->update_mode_line = Qnil; |
8012 /* Skip over glyphs not having an object at the start of the row. | 8014 /* Skip over glyphs not having an object at the start of the row. |
8013 These are special glyphs like truncation marks on terminal | 8015 These are special glyphs like truncation marks on terminal |
8014 frames. */ | 8016 frames. */ |
8015 if (row->displays_text_p) | 8017 if (row->displays_text_p) |
8016 while (glyph < end | 8018 while (glyph < end |
8017 && !glyph->object | 8019 && INTEGERP (glyph->object) |
8018 && glyph->charpos < 0) | 8020 && glyph->charpos < 0) |
8019 { | 8021 { |
8020 x += glyph->pixel_width; | 8022 x += glyph->pixel_width; |
8021 ++glyph; | 8023 ++glyph; |
8022 } | 8024 } |
8023 | 8025 |
8024 while (glyph < end | 8026 while (glyph < end |
8025 && glyph->object | 8027 && !INTEGERP (glyph->object) |
8026 && (!BUFFERP (glyph->object) | 8028 && (!BUFFERP (glyph->object) |
8027 || glyph->charpos < pt_old)) | 8029 || glyph->charpos < pt_old)) |
8028 { | 8030 { |
8029 x += glyph->pixel_width; | 8031 x += glyph->pixel_width; |
8030 ++glyph; | 8032 ++glyph; |
10031 /* We have to update window end positions because the buffer's | 10033 /* We have to update window end positions because the buffer's |
10032 size has changed. */ | 10034 size has changed. */ |
10033 w->window_end_pos | 10035 w->window_end_pos |
10034 = make_number (Z - MATRIX_ROW_END_CHARPOS (row)); | 10036 = make_number (Z - MATRIX_ROW_END_CHARPOS (row)); |
10035 w->window_end_bytepos | 10037 w->window_end_bytepos |
10036 = make_number (Z_BYTE - MATRIX_ROW_END_BYTEPOS (row)); | 10038 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row); |
10037 return 1; | 10039 return 1; |
10038 } | 10040 } |
10039 | 10041 |
10040 /* Return quickly if changes are all below what is displayed in the | 10042 /* Return quickly if changes are all below what is displayed in the |
10041 window, and if PT is in the window. */ | 10043 window, and if PT is in the window. */ |
10045 /* We have to update window end positions because the buffer's | 10047 /* We have to update window end positions because the buffer's |
10046 size has changed. */ | 10048 size has changed. */ |
10047 w->window_end_pos | 10049 w->window_end_pos |
10048 = make_number (Z - MATRIX_ROW_END_CHARPOS (row)); | 10050 = make_number (Z - MATRIX_ROW_END_CHARPOS (row)); |
10049 w->window_end_bytepos | 10051 w->window_end_bytepos |
10050 = make_number (Z_BYTE - MATRIX_ROW_END_BYTEPOS (row)); | 10052 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row); |
10051 return 1; | 10053 return 1; |
10052 } | 10054 } |
10053 | 10055 |
10054 /* Check that window start agrees with the start of the first glyph | 10056 /* Check that window start agrees with the start of the first glyph |
10055 row in its current matrix. Check this after we know the window | 10057 row in its current matrix. Check this after we know the window |
10776 truncate_it.current_x = 0; | 10778 truncate_it.current_x = 0; |
10777 truncate_it.face_id = DEFAULT_FACE_ID; | 10779 truncate_it.face_id = DEFAULT_FACE_ID; |
10778 truncate_it.glyph_row = &scratch_glyph_row; | 10780 truncate_it.glyph_row = &scratch_glyph_row; |
10779 truncate_it.glyph_row->used[TEXT_AREA] = 0; | 10781 truncate_it.glyph_row->used[TEXT_AREA] = 0; |
10780 CHARPOS (truncate_it.position) = BYTEPOS (truncate_it.position) = -1; | 10782 CHARPOS (truncate_it.position) = BYTEPOS (truncate_it.position) = -1; |
10781 truncate_it.object = 0; | 10783 truncate_it.object = make_number (0); |
10782 produce_special_glyphs (&truncate_it, IT_TRUNCATION); | 10784 produce_special_glyphs (&truncate_it, IT_TRUNCATION); |
10783 | 10785 |
10784 /* Overwrite glyphs from IT with truncation glyphs. */ | 10786 /* Overwrite glyphs from IT with truncation glyphs. */ |
10785 from = truncate_it.glyph_row->glyphs[TEXT_AREA]; | 10787 from = truncate_it.glyph_row->glyphs[TEXT_AREA]; |
10786 end = from + truncate_it.glyph_row->used[TEXT_AREA]; | 10788 end = from + truncate_it.glyph_row->used[TEXT_AREA]; |
10934 saved_object = it->object; | 10936 saved_object = it->object; |
10935 saved_pos = it->position; | 10937 saved_pos = it->position; |
10936 | 10938 |
10937 it->what = IT_CHARACTER; | 10939 it->what = IT_CHARACTER; |
10938 bzero (&it->position, sizeof it->position); | 10940 bzero (&it->position, sizeof it->position); |
10939 it->object = 0; | 10941 it->object = make_number (0); |
10940 it->c = ' '; | 10942 it->c = ' '; |
10941 it->len = 1; | 10943 it->len = 1; |
10942 | 10944 |
10943 if (default_face_p) | 10945 if (default_face_p) |
10944 it->face_id = DEFAULT_FACE_ID; | 10946 it->face_id = DEFAULT_FACE_ID; |
11021 saved_object = it->object; | 11023 saved_object = it->object; |
11022 saved_pos = it->position; | 11024 saved_pos = it->position; |
11023 | 11025 |
11024 it->what = IT_CHARACTER; | 11026 it->what = IT_CHARACTER; |
11025 bzero (&it->position, sizeof it->position); | 11027 bzero (&it->position, sizeof it->position); |
11026 it->object = 0; | 11028 it->object = make_number (0); |
11027 it->c = ' '; | 11029 it->c = ' '; |
11028 it->len = 1; | 11030 it->len = 1; |
11029 | 11031 |
11030 PRODUCE_GLYPHS (it); | 11032 PRODUCE_GLYPHS (it); |
11031 | 11033 |
11082 | 11084 |
11083 /* Skip over the space glyph inserted to display the | 11085 /* Skip over the space glyph inserted to display the |
11084 cursor at the end of a line. */ | 11086 cursor at the end of a line. */ |
11085 if (glyph->type == CHAR_GLYPH | 11087 if (glyph->type == CHAR_GLYPH |
11086 && glyph->u.ch == ' ' | 11088 && glyph->u.ch == ' ' |
11087 && glyph->object == 0) | 11089 && INTEGERP (glyph->object)) |
11088 --glyph; | 11090 --glyph; |
11089 | 11091 |
11090 /* If last glyph is a space or stretch, and it's trailing | 11092 /* If last glyph is a space or stretch, and it's trailing |
11091 whitespace, set the face of all trailing whitespace glyphs in | 11093 whitespace, set the face of all trailing whitespace glyphs in |
11092 IT->glyph_row to `trailing-whitespace'. */ | 11094 IT->glyph_row to `trailing-whitespace'. */ |