diff -pr emacs-20.2/src/syntax.c emacs-20.2.my/src/syntax.c
*** emacs-20.2/src/syntax.c	Thu Jul 24 03:01:31 1997
--- emacs-20.2.my/src/syntax.c	Sat Jan 17 17:01:56 1998
*************** update_syntax_table (pos, count, init, o
*** 122,129 ****
        invalidate = 0;
        if (NULL_INTERVAL_P (i))
  	return;
!       gl_state.b_property = i->position - 1;
!       gl_state.e_property = INTERVAL_LAST_POS (i);
        goto update;
      }
    oldi = i = count > 0 ? gl_state.forward_i : gl_state.backward_i;
--- 122,129 ----
        invalidate = 0;
        if (NULL_INTERVAL_P (i))
  	return;
!       gl_state.b_property = i->position - 1 - gl_state.offset;
!       gl_state.e_property = INTERVAL_LAST_POS (i) - gl_state.offset;
        goto update;
      }
    oldi = i = count > 0 ? gl_state.forward_i : gl_state.backward_i;
*************** update_syntax_table (pos, count, init, o
*** 142,148 ****
  	  invalidate = 0;
  	  gl_state.right_ok = 1;	/* Invalidate the other end.  */
  	  gl_state.forward_i = i;
! 	  gl_state.e_property = INTERVAL_LAST_POS (i);
  	}
      } 
    else if (pos >= INTERVAL_LAST_POS (i)) /* Move right.  */
--- 142,148 ----
  	  invalidate = 0;
  	  gl_state.right_ok = 1;	/* Invalidate the other end.  */
  	  gl_state.forward_i = i;
! 	  gl_state.e_property = INTERVAL_LAST_POS (i) - gl_state.offset;
  	}
      } 
    else if (pos >= INTERVAL_LAST_POS (i)) /* Move right.  */
*************** update_syntax_table (pos, count, init, o
*** 156,162 ****
  	  invalidate = 0;
  	  gl_state.left_ok = 1;		/* Invalidate the other end.  */
  	  gl_state.backward_i = i;
! 	  gl_state.b_property = i->position - 1;
  	}
      }
    else if (count > 0 ? gl_state.right_ok : gl_state.left_ok)
--- 156,162 ----
  	  invalidate = 0;
  	  gl_state.left_ok = 1;		/* Invalidate the other end.  */
  	  gl_state.backward_i = i;
! 	  gl_state.b_property = i->position - 1 - gl_state.offset;
  	}
      }
    else if (count > 0 ? gl_state.right_ok : gl_state.left_ok)
*************** update_syntax_table (pos, count, init, o
*** 178,190 ****
  	{
  	  gl_state.backward_i = i;
  	  gl_state.left_ok = 1;		/* Invalidate the other end.  */
! 	  gl_state.b_property = i->position - 1;
  	} 
        else 
  	{
  	  gl_state.forward_i = i;	
  	  gl_state.right_ok = 1;	/* Invalidate the other end.  */
! 	  gl_state.e_property = INTERVAL_LAST_POS (i);
  	}
      }
  
--- 178,190 ----
  	{
  	  gl_state.backward_i = i;
  	  gl_state.left_ok = 1;		/* Invalidate the other end.  */
! 	  gl_state.b_property = i->position - 1 - gl_state.offset;
  	} 
        else 
  	{
  	  gl_state.forward_i = i;	
  	  gl_state.right_ok = 1;	/* Invalidate the other end.  */
! 	  gl_state.e_property = INTERVAL_LAST_POS (i) - gl_state.offset;
  	}
      }
  
*************** update_syntax_table (pos, count, init, o
*** 237,248 ****
      {
        if (count > 0) 
  	{
! 	  gl_state.e_property = i->position;
  	  gl_state.forward_i = i;
  	}
        else 
  	{
! 	  gl_state.b_property = i->position + LENGTH (i) - 1;
  	  gl_state.backward_i = i;
  	}
      }    
--- 237,248 ----
      {
        if (count > 0) 
  	{
! 	  gl_state.e_property = i->position - gl_state.offset;
  	  gl_state.forward_i = i;
  	}
        else 
  	{
! 	  gl_state.b_property = i->position + LENGTH (i) - 1 - gl_state.offset;
  	  gl_state.backward_i = i;
  	}
      }    
*************** scan_lists (from, count, depth, sexpflag
*** 1854,1860 ****
  		    /* we have encountered a comment end of the same style
  		       as the comment sequence which began this comment
  		       section */
! 		    break;
  		  INC_POS (from);
  		  if (from < stop && SYNTAX_COMEND_FIRST (c)
  		      && SYNTAX_COMEND_SECOND (FETCH_CHAR (from))
--- 1854,1860 ----
  		    /* we have encountered a comment end of the same style
  		       as the comment sequence which began this comment
  		       section */
! 		    { INC_POS (from); break; }
  		  INC_POS (from);
  		  if (from < stop && SYNTAX_COMEND_FIRST (c)
  		      && SYNTAX_COMEND_SECOND (FETCH_CHAR (from))
diff -pr emacs-20.2/src/syntax.h emacs-20.2.my/src/syntax.h
*** emacs-20.2/src/syntax.h	Mon Sep  8 20:42:16 1997
--- emacs-20.2.my/src/syntax.h	Sat Jan 17 17:06:34 1998
*************** extern char syntax_code_spec[16];
*** 199,220 ****
     currently good for a position before POS.  */
  
  #define UPDATE_SYNTAX_TABLE_FORWARD(pos)		\
!   ((pos) >= gl_state.e_property - gl_state.offset	\
     ? (update_syntax_table ((pos) + gl_state.offset, 1, 0, Qnil), 1) : 0)
  
  /* Make syntax table state (gl_state) good for POS, assuming it is
     currently good for a position after POS.  */
  
  #define UPDATE_SYNTAX_TABLE_BACKWARD(pos)		\
!   ((pos) <= gl_state.b_property - gl_state.offset	\
     ? (update_syntax_table ((pos) + gl_state.offset, -1, 0, Qnil), 1) : 0)
  
  /* Make syntax table good for POS.  */
  
  #define UPDATE_SYNTAX_TABLE(pos)					\
!   ((pos) <= gl_state.b_property - gl_state.offset			\
     ? (update_syntax_table ((pos) + gl_state.offset, -1, 0, Qnil), 1)	\
!    : ((pos) >= gl_state.e_property - gl_state.offset			\
        ? (update_syntax_table ((pos) + gl_state.offset, 1, 0, Qnil), 1) : 0))
  
  /* This macro should be called with FROM at the start of forward
--- 199,220 ----
     currently good for a position before POS.  */
  
  #define UPDATE_SYNTAX_TABLE_FORWARD(pos)		\
!   ((pos) >= gl_state.e_property				\
     ? (update_syntax_table ((pos) + gl_state.offset, 1, 0, Qnil), 1) : 0)
  
  /* Make syntax table state (gl_state) good for POS, assuming it is
     currently good for a position after POS.  */
  
  #define UPDATE_SYNTAX_TABLE_BACKWARD(pos)		\
!   ((pos) <= gl_state.b_property				\
     ? (update_syntax_table ((pos) + gl_state.offset, -1, 0, Qnil), 1) : 0)
  
  /* Make syntax table good for POS.  */
  
  #define UPDATE_SYNTAX_TABLE(pos)					\
!   ((pos) <= gl_state.b_property						\
     ? (update_syntax_table ((pos) + gl_state.offset, -1, 0, Qnil), 1)	\
!    : ((pos) >= gl_state.e_property					\
        ? (update_syntax_table ((pos) + gl_state.offset, 1, 0, Qnil), 1) : 0))
  
  /* This macro should be called with FROM at the start of forward
*************** extern char syntax_code_spec[16];
*** 245,252 ****
  #define SETUP_SYNTAX_TABLE_FOR_OBJECT(object, from, count)		\
    if (BUFFERP (object) || NILP (object))				\
      {									\
!       gl_state.b_property = BEGV - 1;					\
!       gl_state.e_property = ZV;						\
        gl_state.offset = BEGV - 1;					\
      }									\
    else if (EQ (object, Qt))						\
--- 245,252 ----
  #define SETUP_SYNTAX_TABLE_FOR_OBJECT(object, from, count)		\
    if (BUFFERP (object) || NILP (object))				\
      {									\
!       gl_state.b_property = 0;						\
!       gl_state.e_property = ZV - BEGV + 1;				\
        gl_state.offset = BEGV - 1;					\
      }									\
    else if (EQ (object, Qt))						\
*************** extern char syntax_code_spec[16];
*** 264,270 ****
    gl_state.use_global = 0;						\
    gl_state.current_syntax_table = current_buffer->syntax_table;		\
    if (parse_sexp_lookup_properties) 					\
!       update_syntax_table (count > 0 ? (from) : (from) - 1, count, 1, object);
  
  struct gl_state_s
  {
--- 264,272 ----
    gl_state.use_global = 0;						\
    gl_state.current_syntax_table = current_buffer->syntax_table;		\
    if (parse_sexp_lookup_properties) 					\
!       update_syntax_table (((from) + gl_state.offset			\
! 			    + (count > 0 ? 0 :  -1)),			\
! 			   count, 1, object);
  
  struct gl_state_s
  {
diff -pr emacs-20.2/src/textprop.c emacs-20.2.my/src/textprop.c
*** emacs-20.2/src/textprop.c	Sat Jul 12 02:30:26 1997
--- emacs-20.2.my/src/textprop.c	Sat Jan 17 17:14:43 1998
*************** interval_of (position, object)
*** 492,497 ****
--- 492,499 ----
  
    if (NILP (object))
      XSETBUFFER (object, current_buffer);
+   else if (EQ (object, Qt))
+     return NULL_INTERVAL;
  
    CHECK_STRING_OR_BUFFER (object, 0);
  
*************** interval_of (position, object)
*** 513,519 ****
        i = s->intervals;
      }
  
!   if (!(beg <= position && position <= end))
      args_out_of_range (make_number (position), make_number (position));
    if (beg == end || NULL_INTERVAL_P (i))
      return NULL_INTERVAL;
--- 515,522 ----
        i = s->intervals;
      }
  
!   if (!(beg <= position && position <= end)
!        && !(BUFFERP (object) && (position == beg - 1 && beg > 1))) /* lookbehind */
      args_out_of_range (make_number (position), make_number (position));
    if (beg == end || NULL_INTERVAL_P (i))
      return NULL_INTERVAL;