diff options
| author | Richard M. Stallman | 2004-12-27 15:57:53 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2004-12-27 15:57:53 +0000 |
| commit | b2683be4bcc3a34636701186006ca83c274f1e97 (patch) | |
| tree | 829a7d78bf6fd95bec278be16f83cc7c4f431440 /src | |
| parent | 186369d4acb8a92a6976ba4533020c9d91cd12f0 (diff) | |
| download | emacs-b2683be4bcc3a34636701186006ca83c274f1e97.tar.gz emacs-b2683be4bcc3a34636701186006ca83c274f1e97.zip | |
(single_display_spec_string_p): Renamed from
single_display_prop_string_p.
(single_display_spec_intangible_p): Renamed from
single_display_prop_intangible_p.
(handle_single_display_spec): Renamed from handle_single_display_prop.
Rewritten to be easier to understand.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 417 |
1 files changed, 220 insertions, 197 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 2b97866592e..8ed0adfc89e 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -814,7 +814,7 @@ static struct glyph_slice null_glyph_slice = { 0, 0, 0, 0 }; | |||
| 814 | 814 | ||
| 815 | static void setup_for_ellipsis P_ ((struct it *, int)); | 815 | static void setup_for_ellipsis P_ ((struct it *, int)); |
| 816 | static void mark_window_display_accurate_1 P_ ((struct window *, int)); | 816 | static void mark_window_display_accurate_1 P_ ((struct window *, int)); |
| 817 | static int single_display_prop_string_p P_ ((Lisp_Object, Lisp_Object)); | 817 | static int single_display_spec_string_p P_ ((Lisp_Object, Lisp_Object)); |
| 818 | static int display_prop_string_p P_ ((Lisp_Object, Lisp_Object)); | 818 | static int display_prop_string_p P_ ((Lisp_Object, Lisp_Object)); |
| 819 | static int cursor_row_p P_ ((struct window *, struct glyph_row *)); | 819 | static int cursor_row_p P_ ((struct window *, struct glyph_row *)); |
| 820 | static int redisplay_mode_lines P_ ((Lisp_Object, int)); | 820 | static int redisplay_mode_lines P_ ((Lisp_Object, int)); |
| @@ -836,7 +836,7 @@ static int store_frame_title P_ ((const unsigned char *, int, int)); | |||
| 836 | static void x_consider_frame_title P_ ((Lisp_Object)); | 836 | static void x_consider_frame_title P_ ((Lisp_Object)); |
| 837 | static void handle_stop P_ ((struct it *)); | 837 | static void handle_stop P_ ((struct it *)); |
| 838 | static int tool_bar_lines_needed P_ ((struct frame *)); | 838 | static int tool_bar_lines_needed P_ ((struct frame *)); |
| 839 | static int single_display_prop_intangible_p P_ ((Lisp_Object)); | 839 | static int single_display_spec_intangible_p P_ ((Lisp_Object)); |
| 840 | static void ensure_echo_area_buffers P_ ((void)); | 840 | static void ensure_echo_area_buffers P_ ((void)); |
| 841 | static Lisp_Object unwind_with_echo_area_buffer P_ ((Lisp_Object)); | 841 | static Lisp_Object unwind_with_echo_area_buffer P_ ((Lisp_Object)); |
| 842 | static Lisp_Object with_echo_area_buffer_unwind_data P_ ((struct window *)); | 842 | static Lisp_Object with_echo_area_buffer_unwind_data P_ ((struct window *)); |
| @@ -930,7 +930,7 @@ static void compute_string_pos P_ ((struct text_pos *, struct text_pos, | |||
| 930 | Lisp_Object)); | 930 | Lisp_Object)); |
| 931 | static int face_before_or_after_it_pos P_ ((struct it *, int)); | 931 | static int face_before_or_after_it_pos P_ ((struct it *, int)); |
| 932 | static int next_overlay_change P_ ((int)); | 932 | static int next_overlay_change P_ ((int)); |
| 933 | static int handle_single_display_prop P_ ((struct it *, Lisp_Object, | 933 | static int handle_single_display_spec P_ ((struct it *, Lisp_Object, |
| 934 | Lisp_Object, struct text_pos *, | 934 | Lisp_Object, struct text_pos *, |
| 935 | int)); | 935 | int)); |
| 936 | static int underlying_face_id P_ ((struct it *)); | 936 | static int underlying_face_id P_ ((struct it *)); |
| @@ -3279,7 +3279,10 @@ setup_for_ellipsis (it, len) | |||
| 3279 | ***********************************************************************/ | 3279 | ***********************************************************************/ |
| 3280 | 3280 | ||
| 3281 | /* Set up iterator IT from `display' property at its current position. | 3281 | /* Set up iterator IT from `display' property at its current position. |
| 3282 | Called from handle_stop. */ | 3282 | Called from handle_stop. |
| 3283 | We return HANDLED_RETURN if some part of the display property | ||
| 3284 | overrides the display of the buffer text itself. | ||
| 3285 | Otherwise we return HANDLED_NORMALLY. */ | ||
| 3283 | 3286 | ||
| 3284 | static enum prop_handled | 3287 | static enum prop_handled |
| 3285 | handle_display_prop (it) | 3288 | handle_display_prop (it) |
| @@ -3287,6 +3290,7 @@ handle_display_prop (it) | |||
| 3287 | { | 3290 | { |
| 3288 | Lisp_Object prop, object; | 3291 | Lisp_Object prop, object; |
| 3289 | struct text_pos *position; | 3292 | struct text_pos *position; |
| 3293 | /* Nonzero if some property replaces the display of the text itself. */ | ||
| 3290 | int display_replaced_p = 0; | 3294 | int display_replaced_p = 0; |
| 3291 | 3295 | ||
| 3292 | if (STRINGP (it->string)) | 3296 | if (STRINGP (it->string)) |
| @@ -3334,7 +3338,7 @@ handle_display_prop (it) | |||
| 3334 | { | 3338 | { |
| 3335 | for (; CONSP (prop); prop = XCDR (prop)) | 3339 | for (; CONSP (prop); prop = XCDR (prop)) |
| 3336 | { | 3340 | { |
| 3337 | if (handle_single_display_prop (it, XCAR (prop), object, | 3341 | if (handle_single_display_spec (it, XCAR (prop), object, |
| 3338 | position, display_replaced_p)) | 3342 | position, display_replaced_p)) |
| 3339 | display_replaced_p = 1; | 3343 | display_replaced_p = 1; |
| 3340 | } | 3344 | } |
| @@ -3343,13 +3347,13 @@ handle_display_prop (it) | |||
| 3343 | { | 3347 | { |
| 3344 | int i; | 3348 | int i; |
| 3345 | for (i = 0; i < ASIZE (prop); ++i) | 3349 | for (i = 0; i < ASIZE (prop); ++i) |
| 3346 | if (handle_single_display_prop (it, AREF (prop, i), object, | 3350 | if (handle_single_display_spec (it, AREF (prop, i), object, |
| 3347 | position, display_replaced_p)) | 3351 | position, display_replaced_p)) |
| 3348 | display_replaced_p = 1; | 3352 | display_replaced_p = 1; |
| 3349 | } | 3353 | } |
| 3350 | else | 3354 | else |
| 3351 | { | 3355 | { |
| 3352 | if (handle_single_display_prop (it, prop, object, position, 0)) | 3356 | if (handle_single_display_spec (it, prop, object, position, 0)) |
| 3353 | display_replaced_p = 1; | 3357 | display_replaced_p = 1; |
| 3354 | } | 3358 | } |
| 3355 | 3359 | ||
| @@ -3381,42 +3385,44 @@ display_prop_end (it, object, start_pos) | |||
| 3381 | } | 3385 | } |
| 3382 | 3386 | ||
| 3383 | 3387 | ||
| 3384 | /* Set up IT from a single `display' sub-property value PROP. OBJECT | 3388 | /* Set up IT from a single `display' specification PROP. OBJECT |
| 3385 | is the object in which the `display' property was found. *POSITION | 3389 | is the object in which the `display' property was found. *POSITION |
| 3386 | is the position at which it was found. DISPLAY_REPLACED_P non-zero | 3390 | is the position at which it was found. DISPLAY_REPLACED_P non-zero |
| 3387 | means that we previously saw a display sub-property which already | 3391 | means that we previously saw a display specification which already |
| 3388 | replaced text display with something else, for example an image; | 3392 | replaced text display with something else, for example an image; |
| 3389 | ignore such properties after the first one has been processed. | 3393 | we ignore such properties after the first one has been processed. |
| 3390 | 3394 | ||
| 3391 | If PROP is a `space' or `image' sub-property, set *POSITION to the | 3395 | If PROP is a `space' or `image' specification, and in some other |
| 3392 | end position of the `display' property. | 3396 | cases too, set *POSITION to the position where the `display' |
| 3397 | property ends. | ||
| 3393 | 3398 | ||
| 3394 | Value is non-zero if something was found which replaces the display | 3399 | Value is non-zero if something was found which replaces the display |
| 3395 | of buffer or string text. */ | 3400 | of buffer or string text. */ |
| 3396 | 3401 | ||
| 3397 | static int | 3402 | static int |
| 3398 | handle_single_display_prop (it, prop, object, position, | 3403 | handle_single_display_spec (it, spec, object, position, |
| 3399 | display_replaced_before_p) | 3404 | display_replaced_before_p) |
| 3400 | struct it *it; | 3405 | struct it *it; |
| 3401 | Lisp_Object prop; | 3406 | Lisp_Object spec; |
| 3402 | Lisp_Object object; | 3407 | Lisp_Object object; |
| 3403 | struct text_pos *position; | 3408 | struct text_pos *position; |
| 3404 | int display_replaced_before_p; | 3409 | int display_replaced_before_p; |
| 3405 | { | 3410 | { |
| 3406 | Lisp_Object value; | ||
| 3407 | int replaces_text_display_p = 0; | ||
| 3408 | Lisp_Object form; | 3411 | Lisp_Object form; |
| 3412 | Lisp_Object location, value; | ||
| 3413 | struct text_pos start_pos; | ||
| 3414 | int valid_p; | ||
| 3409 | 3415 | ||
| 3410 | /* If PROP is a list of the form `(when FORM . VALUE)', FORM is | 3416 | /* If SPEC is a list of the form `(when FORM . VALUE)', evaluate FORM. |
| 3411 | evaluated. If the result is nil, VALUE is ignored. */ | 3417 | If the result is non-nil, use VALUE instead of SPEC. */ |
| 3412 | form = Qt; | 3418 | form = Qt; |
| 3413 | if (CONSP (prop) && EQ (XCAR (prop), Qwhen)) | 3419 | if (CONSP (spec) && EQ (XCAR (spec), Qwhen)) |
| 3414 | { | 3420 | { |
| 3415 | prop = XCDR (prop); | 3421 | spec = XCDR (spec); |
| 3416 | if (!CONSP (prop)) | 3422 | if (!CONSP (spec)) |
| 3417 | return 0; | 3423 | return 0; |
| 3418 | form = XCAR (prop); | 3424 | form = XCAR (spec); |
| 3419 | prop = XCDR (prop); | 3425 | spec = XCDR (spec); |
| 3420 | } | 3426 | } |
| 3421 | 3427 | ||
| 3422 | if (!NILP (form) && !EQ (form, Qt)) | 3428 | if (!NILP (form) && !EQ (form, Qt)) |
| @@ -3442,15 +3448,15 @@ handle_single_display_prop (it, prop, object, position, | |||
| 3442 | if (NILP (form)) | 3448 | if (NILP (form)) |
| 3443 | return 0; | 3449 | return 0; |
| 3444 | 3450 | ||
| 3445 | if (CONSP (prop) | 3451 | /* Handle `(height HEIGHT)' specifications. */ |
| 3446 | && EQ (XCAR (prop), Qheight) | 3452 | if (CONSP (spec) |
| 3447 | && CONSP (XCDR (prop))) | 3453 | && EQ (XCAR (spec), Qheight) |
| 3454 | && CONSP (XCDR (spec))) | ||
| 3448 | { | 3455 | { |
| 3449 | if (FRAME_TERMCAP_P (it->f) || FRAME_MSDOS_P (it->f)) | 3456 | if (FRAME_TERMCAP_P (it->f) || FRAME_MSDOS_P (it->f)) |
| 3450 | return 0; | 3457 | return 0; |
| 3451 | 3458 | ||
| 3452 | /* `(height HEIGHT)'. */ | 3459 | it->font_height = XCAR (XCDR (spec)); |
| 3453 | it->font_height = XCAR (XCDR (prop)); | ||
| 3454 | if (!NILP (it->font_height)) | 3460 | if (!NILP (it->font_height)) |
| 3455 | { | 3461 | { |
| 3456 | struct face *face = FACE_FROM_ID (it->f, it->face_id); | 3462 | struct face *face = FACE_FROM_ID (it->f, it->face_id); |
| @@ -3491,7 +3497,6 @@ handle_single_display_prop (it, prop, object, position, | |||
| 3491 | { | 3497 | { |
| 3492 | /* Evaluate IT->font_height with `height' bound to the | 3498 | /* Evaluate IT->font_height with `height' bound to the |
| 3493 | current specified height to get the new height. */ | 3499 | current specified height to get the new height. */ |
| 3494 | Lisp_Object value; | ||
| 3495 | int count = SPECPDL_INDEX (); | 3500 | int count = SPECPDL_INDEX (); |
| 3496 | 3501 | ||
| 3497 | specbind (Qheight, face->lface[LFACE_HEIGHT_INDEX]); | 3502 | specbind (Qheight, face->lface[LFACE_HEIGHT_INDEX]); |
| @@ -3505,29 +3510,35 @@ handle_single_display_prop (it, prop, object, position, | |||
| 3505 | if (new_height > 0) | 3510 | if (new_height > 0) |
| 3506 | it->face_id = face_with_height (it->f, it->face_id, new_height); | 3511 | it->face_id = face_with_height (it->f, it->face_id, new_height); |
| 3507 | } | 3512 | } |
| 3513 | |||
| 3514 | return 0; | ||
| 3508 | } | 3515 | } |
| 3509 | else if (CONSP (prop) | 3516 | |
| 3510 | && EQ (XCAR (prop), Qspace_width) | 3517 | /* Handle `(space_width WIDTH)'. */ |
| 3511 | && CONSP (XCDR (prop))) | 3518 | if (CONSP (spec) |
| 3519 | && EQ (XCAR (spec), Qspace_width) | ||
| 3520 | && CONSP (XCDR (spec))) | ||
| 3512 | { | 3521 | { |
| 3513 | /* `(space_width WIDTH)'. */ | ||
| 3514 | if (FRAME_TERMCAP_P (it->f) || FRAME_MSDOS_P (it->f)) | 3522 | if (FRAME_TERMCAP_P (it->f) || FRAME_MSDOS_P (it->f)) |
| 3515 | return 0; | 3523 | return 0; |
| 3516 | 3524 | ||
| 3517 | value = XCAR (XCDR (prop)); | 3525 | value = XCAR (XCDR (spec)); |
| 3518 | if (NUMBERP (value) && XFLOATINT (value) > 0) | 3526 | if (NUMBERP (value) && XFLOATINT (value) > 0) |
| 3519 | it->space_width = value; | 3527 | it->space_width = value; |
| 3528 | |||
| 3529 | return 0; | ||
| 3520 | } | 3530 | } |
| 3521 | else if (CONSP (prop) | 3531 | |
| 3522 | && EQ (XCAR (prop), Qslice)) | 3532 | /* Handle `(slice X Y WIDTH HEIGHT)'. */ |
| 3533 | if (CONSP (spec) | ||
| 3534 | && EQ (XCAR (spec), Qslice)) | ||
| 3523 | { | 3535 | { |
| 3524 | /* `(slice X Y WIDTH HEIGHT)'. */ | ||
| 3525 | Lisp_Object tem; | 3536 | Lisp_Object tem; |
| 3526 | 3537 | ||
| 3527 | if (FRAME_TERMCAP_P (it->f) || FRAME_MSDOS_P (it->f)) | 3538 | if (FRAME_TERMCAP_P (it->f) || FRAME_MSDOS_P (it->f)) |
| 3528 | return 0; | 3539 | return 0; |
| 3529 | 3540 | ||
| 3530 | if (tem = XCDR (prop), CONSP (tem)) | 3541 | if (tem = XCDR (spec), CONSP (tem)) |
| 3531 | { | 3542 | { |
| 3532 | it->slice.x = XCAR (tem); | 3543 | it->slice.x = XCAR (tem); |
| 3533 | if (tem = XCDR (tem), CONSP (tem)) | 3544 | if (tem = XCDR (tem), CONSP (tem)) |
| @@ -3541,17 +3552,20 @@ handle_single_display_prop (it, prop, object, position, | |||
| 3541 | } | 3552 | } |
| 3542 | } | 3553 | } |
| 3543 | } | 3554 | } |
| 3555 | |||
| 3556 | return 0; | ||
| 3544 | } | 3557 | } |
| 3545 | else if (CONSP (prop) | 3558 | |
| 3546 | && EQ (XCAR (prop), Qraise) | 3559 | /* Handle `(raise FACTOR)'. */ |
| 3547 | && CONSP (XCDR (prop))) | 3560 | if (CONSP (spec) |
| 3561 | && EQ (XCAR (spec), Qraise) | ||
| 3562 | && CONSP (XCDR (spec))) | ||
| 3548 | { | 3563 | { |
| 3549 | /* `(raise FACTOR)'. */ | ||
| 3550 | if (FRAME_TERMCAP_P (it->f) || FRAME_MSDOS_P (it->f)) | 3564 | if (FRAME_TERMCAP_P (it->f) || FRAME_MSDOS_P (it->f)) |
| 3551 | return 0; | 3565 | return 0; |
| 3552 | 3566 | ||
| 3553 | #ifdef HAVE_WINDOW_SYSTEM | 3567 | #ifdef HAVE_WINDOW_SYSTEM |
| 3554 | value = XCAR (XCDR (prop)); | 3568 | value = XCAR (XCDR (spec)); |
| 3555 | if (NUMBERP (value)) | 3569 | if (NUMBERP (value)) |
| 3556 | { | 3570 | { |
| 3557 | struct face *face = FACE_FROM_ID (it->f, it->face_id); | 3571 | struct face *face = FACE_FROM_ID (it->f, it->face_id); |
| @@ -3559,185 +3573,194 @@ handle_single_display_prop (it, prop, object, position, | |||
| 3559 | * (FONT_HEIGHT (face->font))); | 3573 | * (FONT_HEIGHT (face->font))); |
| 3560 | } | 3574 | } |
| 3561 | #endif /* HAVE_WINDOW_SYSTEM */ | 3575 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 3576 | |||
| 3577 | return 0; | ||
| 3562 | } | 3578 | } |
| 3563 | else if (!it->string_from_display_prop_p) | ||
| 3564 | { | ||
| 3565 | /* `((margin left-margin) VALUE)' or `((margin right-margin) | ||
| 3566 | VALUE) or `((margin nil) VALUE)' or VALUE. */ | ||
| 3567 | Lisp_Object location, value; | ||
| 3568 | struct text_pos start_pos; | ||
| 3569 | int valid_p; | ||
| 3570 | 3579 | ||
| 3571 | /* Characters having this form of property are not displayed, so | 3580 | /* Don't handle the other kinds of display specifications |
| 3572 | we have to find the end of the property. */ | 3581 | inside a string that we got from a `display' property. */ |
| 3573 | start_pos = *position; | 3582 | if (it->string_from_display_prop_p) |
| 3574 | *position = display_prop_end (it, object, start_pos); | 3583 | return 0; |
| 3575 | value = Qnil; | ||
| 3576 | 3584 | ||
| 3577 | /* Let's stop at the new position and assume that all | 3585 | /* Characters having this form of property are not displayed, so |
| 3578 | text properties change there. */ | 3586 | we have to find the end of the property. */ |
| 3579 | it->stop_charpos = position->charpos; | 3587 | start_pos = *position; |
| 3588 | *position = display_prop_end (it, object, start_pos); | ||
| 3589 | value = Qnil; | ||
| 3580 | 3590 | ||
| 3581 | if (CONSP (prop) | 3591 | /* Stop the scan at that end position--we assume that all |
| 3582 | && (EQ (XCAR (prop), Qleft_fringe) | 3592 | text properties change there. */ |
| 3583 | || EQ (XCAR (prop), Qright_fringe)) | 3593 | it->stop_charpos = position->charpos; |
| 3584 | && CONSP (XCDR (prop))) | ||
| 3585 | { | ||
| 3586 | int face_id = DEFAULT_FACE_ID; | ||
| 3587 | int fringe_bitmap; | ||
| 3588 | 3594 | ||
| 3589 | /* Save current settings of IT so that we can restore them | 3595 | /* Handle `(left-fringe BITMAP [FACE])' |
| 3590 | when we are finished with the glyph property value. */ | 3596 | and `(right-fringe BITMAP [FACE])'. */ |
| 3597 | if (CONSP (spec) | ||
| 3598 | && (EQ (XCAR (spec), Qleft_fringe) | ||
| 3599 | || EQ (XCAR (spec), Qright_fringe)) | ||
| 3600 | && CONSP (XCDR (spec))) | ||
| 3601 | { | ||
| 3602 | int face_id = DEFAULT_FACE_ID; | ||
| 3603 | int fringe_bitmap; | ||
| 3591 | 3604 | ||
| 3592 | /* `(left-fringe BITMAP FACE)'. */ | 3605 | if (FRAME_TERMCAP_P (it->f) || FRAME_MSDOS_P (it->f)) |
| 3593 | if (FRAME_TERMCAP_P (it->f) || FRAME_MSDOS_P (it->f)) | 3606 | /* If we return here, POSITION has been advanced |
| 3594 | return 0; | 3607 | across the text with this property. */ |
| 3608 | return 0; | ||
| 3595 | 3609 | ||
| 3596 | #ifdef HAVE_WINDOW_SYSTEM | 3610 | #ifdef HAVE_WINDOW_SYSTEM |
| 3597 | value = XCAR (XCDR (prop)); | 3611 | value = XCAR (XCDR (spec)); |
| 3598 | if (!SYMBOLP (value) | 3612 | if (!SYMBOLP (value) |
| 3599 | || !(fringe_bitmap = lookup_fringe_bitmap (value))) | 3613 | || !(fringe_bitmap = lookup_fringe_bitmap (value))) |
| 3600 | return 0; | 3614 | /* If we return here, POSITION has been advanced |
| 3615 | across the text with this property. */ | ||
| 3616 | return 0; | ||
| 3601 | 3617 | ||
| 3602 | if (CONSP (XCDR (XCDR (prop)))) | 3618 | if (CONSP (XCDR (XCDR (spec)))) |
| 3603 | { | 3619 | { |
| 3604 | Lisp_Object face_name = XCAR (XCDR (XCDR (prop))); | 3620 | Lisp_Object face_name = XCAR (XCDR (XCDR (spec))); |
| 3605 | int face_id2 = lookup_named_face (it->f, face_name, 'A', 0); | 3621 | int face_id2 = lookup_named_face (it->f, face_name, 'A', 0); |
| 3606 | if (face_id2 >= 0) | 3622 | if (face_id2 >= 0) |
| 3607 | face_id = face_id2; | 3623 | face_id = face_id2; |
| 3608 | } | 3624 | } |
| 3609 | 3625 | ||
| 3610 | push_it (it); | 3626 | /* Save current settings of IT so that we can restore them |
| 3627 | when we are finished with the glyph property value. */ | ||
| 3611 | 3628 | ||
| 3612 | it->area = TEXT_AREA; | 3629 | push_it (it); |
| 3613 | it->what = IT_IMAGE; | ||
| 3614 | it->image_id = -1; /* no image */ | ||
| 3615 | it->position = start_pos; | ||
| 3616 | it->object = NILP (object) ? it->w->buffer : object; | ||
| 3617 | it->method = next_element_from_image; | ||
| 3618 | it->face_id = face_id; | ||
| 3619 | 3630 | ||
| 3620 | /* Say that we haven't consumed the characters with | 3631 | it->area = TEXT_AREA; |
| 3621 | `display' property yet. The call to pop_it in | 3632 | it->what = IT_IMAGE; |
| 3622 | set_iterator_to_next will clean this up. */ | 3633 | it->image_id = -1; /* no image */ |
| 3623 | *position = start_pos; | 3634 | it->position = start_pos; |
| 3635 | it->object = NILP (object) ? it->w->buffer : object; | ||
| 3636 | it->method = next_element_from_image; | ||
| 3637 | it->face_id = face_id; | ||
| 3624 | 3638 | ||
| 3625 | if (EQ (XCAR (prop), Qleft_fringe)) | 3639 | /* Say that we haven't consumed the characters with |
| 3626 | { | 3640 | `display' property yet. The call to pop_it in |
| 3627 | it->left_user_fringe_bitmap = fringe_bitmap; | 3641 | set_iterator_to_next will clean this up. */ |
| 3628 | it->left_user_fringe_face_id = face_id; | 3642 | *position = start_pos; |
| 3629 | } | ||
| 3630 | else | ||
| 3631 | { | ||
| 3632 | it->right_user_fringe_bitmap = fringe_bitmap; | ||
| 3633 | it->right_user_fringe_face_id = face_id; | ||
| 3634 | } | ||
| 3635 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 3636 | return 1; | ||
| 3637 | } | ||
| 3638 | 3643 | ||
| 3639 | location = Qunbound; | 3644 | if (EQ (XCAR (spec), Qleft_fringe)) |
| 3640 | if (CONSP (prop) && CONSP (XCAR (prop))) | ||
| 3641 | { | 3645 | { |
| 3642 | Lisp_Object tem; | 3646 | it->left_user_fringe_bitmap = fringe_bitmap; |
| 3643 | 3647 | it->left_user_fringe_face_id = face_id; | |
| 3644 | value = XCDR (prop); | ||
| 3645 | if (CONSP (value)) | ||
| 3646 | value = XCAR (value); | ||
| 3647 | |||
| 3648 | tem = XCAR (prop); | ||
| 3649 | if (EQ (XCAR (tem), Qmargin) | ||
| 3650 | && (tem = XCDR (tem), | ||
| 3651 | tem = CONSP (tem) ? XCAR (tem) : Qnil, | ||
| 3652 | (NILP (tem) | ||
| 3653 | || EQ (tem, Qleft_margin) | ||
| 3654 | || EQ (tem, Qright_margin)))) | ||
| 3655 | location = tem; | ||
| 3656 | } | 3648 | } |
| 3657 | 3649 | else | |
| 3658 | if (EQ (location, Qunbound)) | ||
| 3659 | { | 3650 | { |
| 3660 | location = Qnil; | 3651 | it->right_user_fringe_bitmap = fringe_bitmap; |
| 3661 | value = prop; | 3652 | it->right_user_fringe_face_id = face_id; |
| 3662 | } | 3653 | } |
| 3654 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 3655 | return 1; | ||
| 3656 | } | ||
| 3663 | 3657 | ||
| 3664 | valid_p = (STRINGP (value) | 3658 | /* Prepare to handle `((margin left-margin) ...)', |
| 3665 | #ifdef HAVE_WINDOW_SYSTEM | 3659 | `((margin right-margin) ...)' and `((margin nil) ...)' |
| 3666 | || (!FRAME_TERMCAP_P (it->f) && valid_image_p (value)) | 3660 | prefixes for display specifications. */ |
| 3667 | #endif /* not HAVE_WINDOW_SYSTEM */ | 3661 | location = Qunbound; |
| 3668 | || (CONSP (value) && EQ (XCAR (value), Qspace))); | 3662 | if (CONSP (spec) && CONSP (XCAR (spec))) |
| 3663 | { | ||
| 3664 | Lisp_Object tem; | ||
| 3669 | 3665 | ||
| 3670 | if ((EQ (location, Qleft_margin) | 3666 | value = XCDR (spec); |
| 3671 | || EQ (location, Qright_margin) | 3667 | if (CONSP (value)) |
| 3672 | || NILP (location)) | 3668 | value = XCAR (value); |
| 3673 | && valid_p | ||
| 3674 | && !display_replaced_before_p) | ||
| 3675 | { | ||
| 3676 | replaces_text_display_p = 1; | ||
| 3677 | 3669 | ||
| 3678 | /* Save current settings of IT so that we can restore them | 3670 | tem = XCAR (spec); |
| 3679 | when we are finished with the glyph property value. */ | 3671 | if (EQ (XCAR (tem), Qmargin) |
| 3680 | push_it (it); | 3672 | && (tem = XCDR (tem), |
| 3673 | tem = CONSP (tem) ? XCAR (tem) : Qnil, | ||
| 3674 | (NILP (tem) | ||
| 3675 | || EQ (tem, Qleft_margin) | ||
| 3676 | || EQ (tem, Qright_margin)))) | ||
| 3677 | location = tem; | ||
| 3678 | } | ||
| 3681 | 3679 | ||
| 3682 | if (NILP (location)) | 3680 | if (EQ (location, Qunbound)) |
| 3683 | it->area = TEXT_AREA; | 3681 | { |
| 3684 | else if (EQ (location, Qleft_margin)) | 3682 | location = Qnil; |
| 3685 | it->area = LEFT_MARGIN_AREA; | 3683 | value = spec; |
| 3686 | else | 3684 | } |
| 3687 | it->area = RIGHT_MARGIN_AREA; | ||
| 3688 | 3685 | ||
| 3689 | if (STRINGP (value)) | 3686 | /* After this point, VALUE is the property after any |
| 3690 | { | 3687 | margin prefix has been stripped. It must be a string, |
| 3691 | it->string = value; | 3688 | an image specification, or `(space ...)'. |
| 3692 | it->multibyte_p = STRING_MULTIBYTE (it->string); | 3689 | |
| 3693 | it->current.overlay_string_index = -1; | 3690 | LOCATION specifies where to display: `left-margin', |
| 3694 | IT_STRING_CHARPOS (*it) = IT_STRING_BYTEPOS (*it) = 0; | 3691 | `right-margin' or nil. */ |
| 3695 | it->end_charpos = it->string_nchars = SCHARS (it->string); | 3692 | |
| 3696 | it->method = next_element_from_string; | 3693 | valid_p = (STRINGP (value) |
| 3697 | it->stop_charpos = 0; | ||
| 3698 | it->string_from_display_prop_p = 1; | ||
| 3699 | /* Say that we haven't consumed the characters with | ||
| 3700 | `display' property yet. The call to pop_it in | ||
| 3701 | set_iterator_to_next will clean this up. */ | ||
| 3702 | *position = start_pos; | ||
| 3703 | } | ||
| 3704 | else if (CONSP (value) && EQ (XCAR (value), Qspace)) | ||
| 3705 | { | ||
| 3706 | it->method = next_element_from_stretch; | ||
| 3707 | it->object = value; | ||
| 3708 | it->current.pos = it->position = start_pos; | ||
| 3709 | } | ||
| 3710 | #ifdef HAVE_WINDOW_SYSTEM | 3694 | #ifdef HAVE_WINDOW_SYSTEM |
| 3711 | else | 3695 | || (!FRAME_TERMCAP_P (it->f) && valid_image_p (value)) |
| 3712 | { | 3696 | #endif /* not HAVE_WINDOW_SYSTEM */ |
| 3713 | it->what = IT_IMAGE; | 3697 | || (CONSP (value) && EQ (XCAR (value), Qspace))); |
| 3714 | it->image_id = lookup_image (it->f, value); | 3698 | |
| 3715 | it->position = start_pos; | 3699 | if (valid_p && !display_replaced_before_p) |
| 3716 | it->object = NILP (object) ? it->w->buffer : object; | 3700 | { |
| 3717 | it->method = next_element_from_image; | 3701 | /* Save current settings of IT so that we can restore them |
| 3718 | 3702 | when we are finished with the glyph property value. */ | |
| 3719 | /* Say that we haven't consumed the characters with | 3703 | push_it (it); |
| 3720 | `display' property yet. The call to pop_it in | 3704 | |
| 3721 | set_iterator_to_next will clean this up. */ | 3705 | if (NILP (location)) |
| 3722 | *position = start_pos; | 3706 | it->area = TEXT_AREA; |
| 3723 | } | 3707 | else if (EQ (location, Qleft_margin)) |
| 3724 | #endif /* HAVE_WINDOW_SYSTEM */ | 3708 | it->area = LEFT_MARGIN_AREA; |
| 3709 | else | ||
| 3710 | it->area = RIGHT_MARGIN_AREA; | ||
| 3711 | |||
| 3712 | if (STRINGP (value)) | ||
| 3713 | { | ||
| 3714 | it->string = value; | ||
| 3715 | it->multibyte_p = STRING_MULTIBYTE (it->string); | ||
| 3716 | it->current.overlay_string_index = -1; | ||
| 3717 | IT_STRING_CHARPOS (*it) = IT_STRING_BYTEPOS (*it) = 0; | ||
| 3718 | it->end_charpos = it->string_nchars = SCHARS (it->string); | ||
| 3719 | it->method = next_element_from_string; | ||
| 3720 | it->stop_charpos = 0; | ||
| 3721 | it->string_from_display_prop_p = 1; | ||
| 3722 | /* Say that we haven't consumed the characters with | ||
| 3723 | `display' property yet. The call to pop_it in | ||
| 3724 | set_iterator_to_next will clean this up. */ | ||
| 3725 | *position = start_pos; | ||
| 3725 | } | 3726 | } |
| 3727 | else if (CONSP (value) && EQ (XCAR (value), Qspace)) | ||
| 3728 | { | ||
| 3729 | it->method = next_element_from_stretch; | ||
| 3730 | it->object = value; | ||
| 3731 | it->current.pos = it->position = start_pos; | ||
| 3732 | } | ||
| 3733 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 3726 | else | 3734 | else |
| 3727 | /* Invalid property or property not supported. Restore | 3735 | { |
| 3728 | the position to what it was before. */ | 3736 | it->what = IT_IMAGE; |
| 3729 | *position = start_pos; | 3737 | it->image_id = lookup_image (it->f, value); |
| 3738 | it->position = start_pos; | ||
| 3739 | it->object = NILP (object) ? it->w->buffer : object; | ||
| 3740 | it->method = next_element_from_image; | ||
| 3741 | |||
| 3742 | /* Say that we haven't consumed the characters with | ||
| 3743 | `display' property yet. The call to pop_it in | ||
| 3744 | set_iterator_to_next will clean this up. */ | ||
| 3745 | *position = start_pos; | ||
| 3746 | } | ||
| 3747 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 3748 | |||
| 3749 | return 1; | ||
| 3730 | } | 3750 | } |
| 3731 | 3751 | ||
| 3732 | return replaces_text_display_p; | 3752 | /* Invalid property or property not supported. Restore |
| 3753 | POSITION to what it was before. */ | ||
| 3754 | *position = start_pos; | ||
| 3755 | return 0; | ||
| 3733 | } | 3756 | } |
| 3734 | 3757 | ||
| 3735 | 3758 | ||
| 3736 | /* Check if PROP is a display sub-property value whose text should be | 3759 | /* Check if SPEC is a display specification value whose text should be |
| 3737 | treated as intangible. */ | 3760 | treated as intangible. */ |
| 3738 | 3761 | ||
| 3739 | static int | 3762 | static int |
| 3740 | single_display_prop_intangible_p (prop) | 3763 | single_display_spec_intangible_p (prop) |
| 3741 | Lisp_Object prop; | 3764 | Lisp_Object prop; |
| 3742 | { | 3765 | { |
| 3743 | /* Skip over `when FORM'. */ | 3766 | /* Skip over `when FORM'. */ |
| @@ -3790,7 +3813,7 @@ display_prop_intangible_p (prop) | |||
| 3790 | /* A list of sub-properties. */ | 3813 | /* A list of sub-properties. */ |
| 3791 | while (CONSP (prop)) | 3814 | while (CONSP (prop)) |
| 3792 | { | 3815 | { |
| 3793 | if (single_display_prop_intangible_p (XCAR (prop))) | 3816 | if (single_display_spec_intangible_p (XCAR (prop))) |
| 3794 | return 1; | 3817 | return 1; |
| 3795 | prop = XCDR (prop); | 3818 | prop = XCDR (prop); |
| 3796 | } | 3819 | } |
| @@ -3800,11 +3823,11 @@ display_prop_intangible_p (prop) | |||
| 3800 | /* A vector of sub-properties. */ | 3823 | /* A vector of sub-properties. */ |
| 3801 | int i; | 3824 | int i; |
| 3802 | for (i = 0; i < ASIZE (prop); ++i) | 3825 | for (i = 0; i < ASIZE (prop); ++i) |
| 3803 | if (single_display_prop_intangible_p (AREF (prop, i))) | 3826 | if (single_display_spec_intangible_p (AREF (prop, i))) |
| 3804 | return 1; | 3827 | return 1; |
| 3805 | } | 3828 | } |
| 3806 | else | 3829 | else |
| 3807 | return single_display_prop_intangible_p (prop); | 3830 | return single_display_spec_intangible_p (prop); |
| 3808 | 3831 | ||
| 3809 | return 0; | 3832 | return 0; |
| 3810 | } | 3833 | } |
| @@ -3813,7 +3836,7 @@ display_prop_intangible_p (prop) | |||
| 3813 | /* Return 1 if PROP is a display sub-property value containing STRING. */ | 3836 | /* Return 1 if PROP is a display sub-property value containing STRING. */ |
| 3814 | 3837 | ||
| 3815 | static int | 3838 | static int |
| 3816 | single_display_prop_string_p (prop, string) | 3839 | single_display_spec_string_p (prop, string) |
| 3817 | Lisp_Object prop, string; | 3840 | Lisp_Object prop, string; |
| 3818 | { | 3841 | { |
| 3819 | if (EQ (string, prop)) | 3842 | if (EQ (string, prop)) |
| @@ -3858,7 +3881,7 @@ display_prop_string_p (prop, string) | |||
| 3858 | /* A list of sub-properties. */ | 3881 | /* A list of sub-properties. */ |
| 3859 | while (CONSP (prop)) | 3882 | while (CONSP (prop)) |
| 3860 | { | 3883 | { |
| 3861 | if (single_display_prop_string_p (XCAR (prop), string)) | 3884 | if (single_display_spec_string_p (XCAR (prop), string)) |
| 3862 | return 1; | 3885 | return 1; |
| 3863 | prop = XCDR (prop); | 3886 | prop = XCDR (prop); |
| 3864 | } | 3887 | } |
| @@ -3868,11 +3891,11 @@ display_prop_string_p (prop, string) | |||
| 3868 | /* A vector of sub-properties. */ | 3891 | /* A vector of sub-properties. */ |
| 3869 | int i; | 3892 | int i; |
| 3870 | for (i = 0; i < ASIZE (prop); ++i) | 3893 | for (i = 0; i < ASIZE (prop); ++i) |
| 3871 | if (single_display_prop_string_p (AREF (prop, i), string)) | 3894 | if (single_display_spec_string_p (AREF (prop, i), string)) |
| 3872 | return 1; | 3895 | return 1; |
| 3873 | } | 3896 | } |
| 3874 | else | 3897 | else |
| 3875 | return single_display_prop_string_p (prop, string); | 3898 | return single_display_spec_string_p (prop, string); |
| 3876 | 3899 | ||
| 3877 | return 0; | 3900 | return 0; |
| 3878 | } | 3901 | } |
| @@ -6625,7 +6648,7 @@ message_log_check_duplicate (prev_bol, prev_bol_byte, this_bol, this_bol_byte) | |||
| 6625 | } | 6648 | } |
| 6626 | return 0; | 6649 | return 0; |
| 6627 | } | 6650 | } |
| 6628 | 6651 | ||
| 6629 | 6652 | ||
| 6630 | /* Display an echo area message M with a specified length of NBYTES | 6653 | /* Display an echo area message M with a specified length of NBYTES |
| 6631 | bytes. The string may include null characters. If M is 0, clear | 6654 | bytes. The string may include null characters. If M is 0, clear |