aboutsummaryrefslogtreecommitdiffstats
path: root/src/textprop.c
diff options
context:
space:
mode:
authorMiles Bader2000-10-25 05:14:01 +0000
committerMiles Bader2000-10-25 05:14:01 +0000
commit8d41abc445741cb74d059e78f56f999f5215c4e1 (patch)
treea51837ff6c3430871df1f778246d454c96c114bf /src/textprop.c
parentbeed66fe1867101fff9f71c5130678011291e6aa (diff)
downloademacs-8d41abc445741cb74d059e78f56f999f5215c4e1.tar.gz
emacs-8d41abc445741cb74d059e78f56f999f5215c4e1.zip
(get_char_property_and_overlay): New function.
(Fget_char_property): Use it.
Diffstat (limited to 'src/textprop.c')
-rw-r--r--src/textprop.c52
1 files changed, 41 insertions, 11 deletions
diff --git a/src/textprop.c b/src/textprop.c
index bf4e5efc2b3..03e4b477b35 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -557,17 +557,22 @@ If POSITION is at the end of OBJECT, the value is nil.")
557 return textget (Ftext_properties_at (position, object), prop); 557 return textget (Ftext_properties_at (position, object), prop);
558} 558}
559 559
560DEFUN ("get-char-property", Fget_char_property, Sget_char_property, 2, 3, 0, 560/* Return the value of POSITION's property PROP, in OBJECT.
561 "Return the value of POSITION's property PROP, in OBJECT.\n\ 561 OBJECT is optional and defaults to the current buffer.
562OBJECT is optional and defaults to the current buffer.\n\ 562 If OVERLAY is non-0, then in the case that the returned property is from
563If POSITION is at the end of OBJECT, the value is nil.\n\ 563 an overlay, the overlay found is returned in *OVERLAY, otherwise nil is
564If OBJECT is a buffer, then overlay properties are considered as well as\n\ 564 returned in *OVERLAY.
565text properties.\n\ 565 If POSITION is at the end of OBJECT, the value is nil.
566If OBJECT is a window, then that window's buffer is used, but window-specific\n\ 566 If OBJECT is a buffer, then overlay properties are considered as well as
567overlays are considered only if they are associated with OBJECT.") 567 text properties.
568 (position, prop, object) 568 If OBJECT is a window, then that window's buffer is used, but
569 window-specific overlays are considered only if they are associated
570 with OBJECT. */
571Lisp_Object
572get_char_property_and_overlay (position, prop, object, overlay)
569 Lisp_Object position, object; 573 Lisp_Object position, object;
570 register Lisp_Object prop; 574 register Lisp_Object prop;
575 Lisp_Object *overlay;
571{ 576{
572 struct window *w = 0; 577 struct window *w = 0;
573 578
@@ -617,12 +622,37 @@ overlays are considered only if they are associated with OBJECT.")
617 { 622 {
618 tem = Foverlay_get (overlay_vec[noverlays], prop); 623 tem = Foverlay_get (overlay_vec[noverlays], prop);
619 if (!NILP (tem)) 624 if (!NILP (tem))
620 return (tem); 625 {
626 if (overlay)
627 /* Return the overlay we got the property from. */
628 *overlay = overlay_vec[noverlays];
629 return tem;
630 }
621 } 631 }
622 } 632 }
633
634 if (overlay)
635 /* Indicate that the return value is not from an overlay. */
636 *overlay = Qnil;
637
623 /* Not a buffer, or no appropriate overlay, so fall through to the 638 /* Not a buffer, or no appropriate overlay, so fall through to the
624 simpler case. */ 639 simpler case. */
625 return (Fget_text_property (position, prop, object)); 640 return Fget_text_property (position, prop, object);
641}
642
643DEFUN ("get-char-property", Fget_char_property, Sget_char_property, 2, 3, 0,
644 "Return the value of POSITION's property PROP, in OBJECT.\n\
645OBJECT is optional and defaults to the current buffer.\n\
646If POSITION is at the end of OBJECT, the value is nil.\n\
647If OBJECT is a buffer, then overlay properties are considered as well as\n\
648text properties.\n\
649If OBJECT is a window, then that window's buffer is used, but window-specific\n\
650overlays are considered only if they are associated with OBJECT.")
651 (position, prop, object)
652 Lisp_Object position, object;
653 register Lisp_Object prop;
654{
655 return get_char_property_and_overlay (position, prop, object, 0);
626} 656}
627 657
628DEFUN ("next-char-property-change", Fnext_char_property_change, 658DEFUN ("next-char-property-change", Fnext_char_property_change,