aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKarl Heuer1994-02-24 19:18:32 +0000
committerKarl Heuer1994-02-24 19:18:32 +0000
commitf5957179cf453ec442470003a3c5532b0fcf4f74 (patch)
treeedbdde25fc1defda108d6afe979763629896a224 /src
parent42db5687794d86add3a4b5966fa2d0157b5db060 (diff)
downloademacs-f5957179cf453ec442470003a3c5532b0fcf4f74.tar.gz
emacs-f5957179cf453ec442470003a3c5532b0fcf4f74.zip
(Fget_char_property): New function.
Diffstat (limited to 'src')
-rw-r--r--src/textprop.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/textprop.c b/src/textprop.c
index 8251c83d2d8..b749ffe91ad 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -21,6 +21,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
21#include "lisp.h" 21#include "lisp.h"
22#include "intervals.h" 22#include "intervals.h"
23#include "buffer.h" 23#include "buffer.h"
24#include "window.h"
24 25
25 26
26/* NOTES: previous- and next- property change will have to skip 27/* NOTES: previous- and next- property change will have to skip
@@ -519,6 +520,67 @@ If POSITION is at the end of OBJECT, the value is nil.")
519 return textget (i->plist, prop); 520 return textget (i->plist, prop);
520} 521}
521 522
523DEFUN ("get-char-property", Fget_char_property, Sget_char_property, 2, 3, 0,
524 "Return the value of position POS's property PROP, in OBJECT.\n\
525OBJECT is optional and defaults to the current buffer.\n\
526If POSITION is at the end of OBJECT, the value is nil.\n\
527If OBJECT is a buffer, then overlay properties are considered as well as\n\
528text properties.
529If OBJECT is a window, then that window's buffer is used, but window-specific
530overlays are considered only if they are associated with OBJECT.")
531 (pos, prop, object)
532 Lisp_Object pos, object;
533 register Lisp_Object prop;
534{
535 struct window *w = 0;
536
537 CHECK_NUMBER_COERCE_MARKER (pos, 0);
538
539 if (NILP (object))
540 XSET (object, Lisp_Buffer, current_buffer);
541
542 if (WINDOWP (object))
543 {
544 w = XWINDOW (object);
545 XSET (object, Lisp_Buffer, w->buffer);
546 }
547 if (BUFFERP (object))
548 {
549 int posn = XINT (pos);
550 int noverlays;
551 Lisp_Object *overlay_vec, tem;
552 int next_overlay;
553 int len;
554
555 /* First try with room for 40 overlays. */
556 len = 40;
557 overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
558
559 noverlays = overlays_at (posn, 0, &overlay_vec, &len, &next_overlay);
560
561 /* If there are more than 40,
562 make enough space for all, and try again. */
563 if (noverlays > len)
564 {
565 len = noverlays;
566 overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
567 noverlays = overlays_at (posn, 0, &overlay_vec, &len, &next_overlay);
568 }
569 noverlays = sort_overlays (overlay_vec, noverlays, w);
570
571 /* Now check the overlays in order of decreasing priority. */
572 while (--noverlays >= 0)
573 {
574 tem = Foverlay_get (overlay_vec[noverlays], prop);
575 if (!NILP (tem))
576 return (tem);
577 }
578 }
579 /* Not a buffer, or no appropriate overlay, so fall through to the
580 simpler case. */
581 return (Fget_text_property (pos, prop, object));
582}
583
522DEFUN ("next-property-change", Fnext_property_change, 584DEFUN ("next-property-change", Fnext_property_change,
523 Snext_property_change, 1, 3, 0, 585 Snext_property_change, 1, 3, 0,
524 "Return the position of next property change.\n\ 586 "Return the position of next property change.\n\