Mercurial > emacs
comparison src/xdisp.c @ 61725:f0d1759ab128
(store_mode_line_string, produce_stretch_glyph)
(note_mode_line_or_margin_highlight, note_mouse_highlight):
Use Fplist_get instead of Fsafe_plist_get.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Thu, 21 Apr 2005 23:45:28 +0000 |
parents | 1f917e46c345 |
children | b3a3357502cd ad07ff6e4555 |
comparison
equal
deleted
inserted
replaced
61724:4a9b51620642 | 61725:f0d1759ab128 |
---|---|
16085 lisp_string = make_string (string, len); | 16085 lisp_string = make_string (string, len); |
16086 if (NILP (props)) | 16086 if (NILP (props)) |
16087 props = mode_line_string_face_prop; | 16087 props = mode_line_string_face_prop; |
16088 else if (!NILP (mode_line_string_face)) | 16088 else if (!NILP (mode_line_string_face)) |
16089 { | 16089 { |
16090 Lisp_Object face = Fsafe_plist_get (props, Qface); | 16090 Lisp_Object face = Fplist_get (props, Qface); |
16091 props = Fcopy_sequence (props); | 16091 props = Fcopy_sequence (props); |
16092 if (NILP (face)) | 16092 if (NILP (face)) |
16093 face = mode_line_string_face; | 16093 face = mode_line_string_face; |
16094 else | 16094 else |
16095 face = Fcons (face, Fcons (mode_line_string_face, Qnil)); | 16095 face = Fcons (face, Fcons (mode_line_string_face, Qnil)); |
16110 if (!NILP (mode_line_string_face)) | 16110 if (!NILP (mode_line_string_face)) |
16111 { | 16111 { |
16112 Lisp_Object face; | 16112 Lisp_Object face; |
16113 if (NILP (props)) | 16113 if (NILP (props)) |
16114 props = Ftext_properties_at (make_number (0), lisp_string); | 16114 props = Ftext_properties_at (make_number (0), lisp_string); |
16115 face = Fsafe_plist_get (props, Qface); | 16115 face = Fplist_get (props, Qface); |
16116 if (NILP (face)) | 16116 if (NILP (face)) |
16117 face = mode_line_string_face; | 16117 face = mode_line_string_face; |
16118 else | 16118 else |
16119 face = Fcons (face, Fcons (mode_line_string_face, Qnil)); | 16119 face = Fcons (face, Fcons (mode_line_string_face, Qnil)); |
16120 props = Fcons (Qface, Fcons (face, Qnil)); | 16120 props = Fcons (Qface, Fcons (face, Qnil)); |
18913 /* List should start with `space'. */ | 18913 /* List should start with `space'. */ |
18914 xassert (CONSP (it->object) && EQ (XCAR (it->object), Qspace)); | 18914 xassert (CONSP (it->object) && EQ (XCAR (it->object), Qspace)); |
18915 plist = XCDR (it->object); | 18915 plist = XCDR (it->object); |
18916 | 18916 |
18917 /* Compute the width of the stretch. */ | 18917 /* Compute the width of the stretch. */ |
18918 if ((prop = Fsafe_plist_get (plist, QCwidth), !NILP (prop)) | 18918 if ((prop = Fplist_get (plist, QCwidth), !NILP (prop)) |
18919 && calc_pixel_width_or_height (&tem, it, prop, font, 1, 0)) | 18919 && calc_pixel_width_or_height (&tem, it, prop, font, 1, 0)) |
18920 { | 18920 { |
18921 /* Absolute width `:width WIDTH' specified and valid. */ | 18921 /* Absolute width `:width WIDTH' specified and valid. */ |
18922 zero_width_ok_p = 1; | 18922 zero_width_ok_p = 1; |
18923 width = (int)tem; | 18923 width = (int)tem; |
18924 } | 18924 } |
18925 else if (prop = Fsafe_plist_get (plist, QCrelative_width), | 18925 else if (prop = Fplist_get (plist, QCrelative_width), |
18926 NUMVAL (prop) > 0) | 18926 NUMVAL (prop) > 0) |
18927 { | 18927 { |
18928 /* Relative width `:relative-width FACTOR' specified and valid. | 18928 /* Relative width `:relative-width FACTOR' specified and valid. |
18929 Compute the width of the characters having the `glyph' | 18929 Compute the width of the characters having the `glyph' |
18930 property. */ | 18930 property. */ |
18944 it2.glyph_row = NULL; | 18944 it2.glyph_row = NULL; |
18945 it2.what = IT_CHARACTER; | 18945 it2.what = IT_CHARACTER; |
18946 x_produce_glyphs (&it2); | 18946 x_produce_glyphs (&it2); |
18947 width = NUMVAL (prop) * it2.pixel_width; | 18947 width = NUMVAL (prop) * it2.pixel_width; |
18948 } | 18948 } |
18949 else if ((prop = Fsafe_plist_get (plist, QCalign_to), !NILP (prop)) | 18949 else if ((prop = Fplist_get (plist, QCalign_to), !NILP (prop)) |
18950 && calc_pixel_width_or_height (&tem, it, prop, font, 1, &align_to)) | 18950 && calc_pixel_width_or_height (&tem, it, prop, font, 1, &align_to)) |
18951 { | 18951 { |
18952 if (it->glyph_row == NULL || !it->glyph_row->mode_line_p) | 18952 if (it->glyph_row == NULL || !it->glyph_row->mode_line_p) |
18953 align_to = (align_to < 0 | 18953 align_to = (align_to < 0 |
18954 ? 0 | 18954 ? 0 |
18964 | 18964 |
18965 if (width <= 0 && (width < 0 || !zero_width_ok_p)) | 18965 if (width <= 0 && (width < 0 || !zero_width_ok_p)) |
18966 width = 1; | 18966 width = 1; |
18967 | 18967 |
18968 /* Compute height. */ | 18968 /* Compute height. */ |
18969 if ((prop = Fsafe_plist_get (plist, QCheight), !NILP (prop)) | 18969 if ((prop = Fplist_get (plist, QCheight), !NILP (prop)) |
18970 && calc_pixel_width_or_height (&tem, it, prop, font, 0, 0)) | 18970 && calc_pixel_width_or_height (&tem, it, prop, font, 0, 0)) |
18971 { | 18971 { |
18972 height = (int)tem; | 18972 height = (int)tem; |
18973 zero_height_ok_p = 1; | 18973 zero_height_ok_p = 1; |
18974 } | 18974 } |
18975 else if (prop = Fsafe_plist_get (plist, QCrelative_height), | 18975 else if (prop = Fplist_get (plist, QCrelative_height), |
18976 NUMVAL (prop) > 0) | 18976 NUMVAL (prop) > 0) |
18977 height = FONT_HEIGHT (font) * NUMVAL (prop); | 18977 height = FONT_HEIGHT (font) * NUMVAL (prop); |
18978 else | 18978 else |
18979 height = FONT_HEIGHT (font); | 18979 height = FONT_HEIGHT (font); |
18980 | 18980 |
18982 height = 1; | 18982 height = 1; |
18983 | 18983 |
18984 /* Compute percentage of height used for ascent. If | 18984 /* Compute percentage of height used for ascent. If |
18985 `:ascent ASCENT' is present and valid, use that. Otherwise, | 18985 `:ascent ASCENT' is present and valid, use that. Otherwise, |
18986 derive the ascent from the font in use. */ | 18986 derive the ascent from the font in use. */ |
18987 if (prop = Fsafe_plist_get (plist, QCascent), | 18987 if (prop = Fplist_get (plist, QCascent), |
18988 NUMVAL (prop) > 0 && NUMVAL (prop) <= 100) | 18988 NUMVAL (prop) > 0 && NUMVAL (prop) <= 100) |
18989 ascent = height * NUMVAL (prop) / 100.0; | 18989 ascent = height * NUMVAL (prop) / 100.0; |
18990 else if (!NILP (prop) | 18990 else if (!NILP (prop) |
18991 && calc_pixel_width_or_height (&tem, it, prop, font, 0, 0)) | 18991 && calc_pixel_width_or_height (&tem, it, prop, font, 0, 0)) |
18992 ascent = min (max (0, (int)tem), height); | 18992 ascent = min (max (0, (int)tem), height); |
21240 help = Qnil; | 21240 help = Qnil; |
21241 | 21241 |
21242 if (IMAGEP (object)) | 21242 if (IMAGEP (object)) |
21243 { | 21243 { |
21244 Lisp_Object image_map, hotspot; | 21244 Lisp_Object image_map, hotspot; |
21245 if ((image_map = Fsafe_plist_get (XCDR (object), QCmap), | 21245 if ((image_map = Fplist_get (XCDR (object), QCmap), |
21246 !NILP (image_map)) | 21246 !NILP (image_map)) |
21247 && (hotspot = find_hot_spot (image_map, dx, dy), | 21247 && (hotspot = find_hot_spot (image_map, dx, dy), |
21248 CONSP (hotspot)) | 21248 CONSP (hotspot)) |
21249 && (hotspot = XCDR (hotspot), CONSP (hotspot))) | 21249 && (hotspot = XCDR (hotspot), CONSP (hotspot))) |
21250 { | 21250 { |
21256 properties in PLIST (and do something...). */ | 21256 properties in PLIST (and do something...). */ |
21257 hotspot = XCDR (hotspot); | 21257 hotspot = XCDR (hotspot); |
21258 if (CONSP (hotspot) | 21258 if (CONSP (hotspot) |
21259 && (plist = XCAR (hotspot), CONSP (plist))) | 21259 && (plist = XCAR (hotspot), CONSP (plist))) |
21260 { | 21260 { |
21261 pointer = Fsafe_plist_get (plist, Qpointer); | 21261 pointer = Fplist_get (plist, Qpointer); |
21262 if (NILP (pointer)) | 21262 if (NILP (pointer)) |
21263 pointer = Qhand; | 21263 pointer = Qhand; |
21264 help = Fsafe_plist_get (plist, Qhelp_echo); | 21264 help = Fplist_get (plist, Qhelp_echo); |
21265 if (!NILP (help)) | 21265 if (!NILP (help)) |
21266 { | 21266 { |
21267 help_echo_string = help; | 21267 help_echo_string = help; |
21268 /* Is this correct? ++kfs */ | 21268 /* Is this correct? ++kfs */ |
21269 XSETWINDOW (help_echo_window, w); | 21269 XSETWINDOW (help_echo_window, w); |
21271 help_echo_pos = charpos; | 21271 help_echo_pos = charpos; |
21272 } | 21272 } |
21273 } | 21273 } |
21274 } | 21274 } |
21275 if (NILP (pointer)) | 21275 if (NILP (pointer)) |
21276 pointer = Fsafe_plist_get (XCDR (object), QCpointer); | 21276 pointer = Fplist_get (XCDR (object), QCpointer); |
21277 } | 21277 } |
21278 | 21278 |
21279 if (STRINGP (string)) | 21279 if (STRINGP (string)) |
21280 { | 21280 { |
21281 pos = make_number (charpos); | 21281 pos = make_number (charpos); |
21424 { | 21424 { |
21425 struct image *img = IMAGE_FROM_ID (f, glyph->u.img_id); | 21425 struct image *img = IMAGE_FROM_ID (f, glyph->u.img_id); |
21426 if (img != NULL && IMAGEP (img->spec)) | 21426 if (img != NULL && IMAGEP (img->spec)) |
21427 { | 21427 { |
21428 Lisp_Object image_map, hotspot; | 21428 Lisp_Object image_map, hotspot; |
21429 if ((image_map = Fsafe_plist_get (XCDR (img->spec), QCmap), | 21429 if ((image_map = Fplist_get (XCDR (img->spec), QCmap), |
21430 !NILP (image_map)) | 21430 !NILP (image_map)) |
21431 && (hotspot = find_hot_spot (image_map, | 21431 && (hotspot = find_hot_spot (image_map, |
21432 glyph->slice.x + dx, | 21432 glyph->slice.x + dx, |
21433 glyph->slice.y + dy), | 21433 glyph->slice.y + dy), |
21434 CONSP (hotspot)) | 21434 CONSP (hotspot)) |
21442 properties in PLIST (and do something...). */ | 21442 properties in PLIST (and do something...). */ |
21443 hotspot = XCDR (hotspot); | 21443 hotspot = XCDR (hotspot); |
21444 if (CONSP (hotspot) | 21444 if (CONSP (hotspot) |
21445 && (plist = XCAR (hotspot), CONSP (plist))) | 21445 && (plist = XCAR (hotspot), CONSP (plist))) |
21446 { | 21446 { |
21447 pointer = Fsafe_plist_get (plist, Qpointer); | 21447 pointer = Fplist_get (plist, Qpointer); |
21448 if (NILP (pointer)) | 21448 if (NILP (pointer)) |
21449 pointer = Qhand; | 21449 pointer = Qhand; |
21450 help_echo_string = Fsafe_plist_get (plist, Qhelp_echo); | 21450 help_echo_string = Fplist_get (plist, Qhelp_echo); |
21451 if (!NILP (help_echo_string)) | 21451 if (!NILP (help_echo_string)) |
21452 { | 21452 { |
21453 help_echo_window = window; | 21453 help_echo_window = window; |
21454 help_echo_object = glyph->object; | 21454 help_echo_object = glyph->object; |
21455 help_echo_pos = glyph->charpos; | 21455 help_echo_pos = glyph->charpos; |
21456 } | 21456 } |
21457 } | 21457 } |
21458 } | 21458 } |
21459 if (NILP (pointer)) | 21459 if (NILP (pointer)) |
21460 pointer = Fsafe_plist_get (XCDR (img->spec), QCpointer); | 21460 pointer = Fplist_get (XCDR (img->spec), QCpointer); |
21461 } | 21461 } |
21462 } | 21462 } |
21463 | 21463 |
21464 /* Clear mouse face if X/Y not over text. */ | 21464 /* Clear mouse face if X/Y not over text. */ |
21465 if (glyph == NULL | 21465 if (glyph == NULL |