/[emacs]/emacs/src/editfns.c
ViewVC logotype

Diff of /emacs/src/editfns.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.327 by lektu, Tue Mar 12 17:24:10 2002 UTC revision 1.328 by miles, Thu Mar 14 08:11:03 2002 UTC
# Line 1  Line 1 
1  /* Lisp functions pertaining to editing.  /* Lisp functions pertaining to editing.
2     Copyright (C) 1985,86,87,89,93,94,95,96,97,98, 1999, 2000, 2001     Copyright (C) 1985,86,87,89,93,94,95,96,97,98, 1999, 2000, 2001, 2002
3          Free Software Foundation, Inc.          Free Software Foundation, Inc.
4    
5  This file is part of GNU Emacs.  This file is part of GNU Emacs.
# Line 324  If you set the marker not to point anywh Line 324  If you set the marker not to point anywh
324  }  }
325    
326    
 #if 0 /* Not used.  */  
   
 /* Return nonzero if POS1 and POS2 have the same value  
    for the text property PROP.  */  
   
 static int  
 char_property_eq (prop, pos1, pos2)  
      Lisp_Object prop;  
      Lisp_Object pos1, pos2;  
 {  
   Lisp_Object pval1, pval2;  
   
   pval1 = Fget_char_property (pos1, prop, Qnil);  
   pval2 = Fget_char_property (pos2, prop, Qnil);  
   
   return EQ (pval1, pval2);  
 }  
   
 #endif /* 0 */  
   
 /* Return the direction from which the text-property PROP would be  
    inherited by any new text inserted at POS: 1 if it would be  
    inherited from the char after POS, -1 if it would be inherited from  
    the char before POS, and 0 if from neither.  */  
   
 static int  
 text_property_stickiness (prop, pos)  
      Lisp_Object prop;  
      Lisp_Object pos;  
 {  
   Lisp_Object prev_pos, front_sticky;  
   int is_rear_sticky = 1, is_front_sticky = 0; /* defaults */  
   
   if (XINT (pos) > BEGV)  
     /* Consider previous character.  */  
     {  
       Lisp_Object rear_non_sticky;  
   
       prev_pos = make_number (XINT (pos) - 1);  
       rear_non_sticky = Fget_text_property (prev_pos, Qrear_nonsticky, Qnil);  
   
       if (!NILP (CONSP (rear_non_sticky)  
                  ? Fmemq (prop, rear_non_sticky)  
                  : rear_non_sticky))  
         /* PROP is rear-non-sticky.  */  
         is_rear_sticky = 0;  
     }  
   
   /* Consider following character.  */  
   front_sticky = Fget_text_property (pos, Qfront_sticky, Qnil);  
   
   if (EQ (front_sticky, Qt)  
       || (CONSP (front_sticky)  
           && !NILP (Fmemq (prop, front_sticky))))  
     /* PROP is inherited from after.  */  
     is_front_sticky = 1;  
   
   /* Simple cases, where the properties are consistent.  */  
   if (is_rear_sticky && !is_front_sticky)  
     return -1;  
   else if (!is_rear_sticky && is_front_sticky)  
     return 1;  
   else if (!is_rear_sticky && !is_front_sticky)  
     return 0;  
   
   /* The stickiness properties are inconsistent, so we have to  
      disambiguate.  Basically, rear-sticky wins, _except_ if the  
      property that would be inherited has a value of nil, in which case  
      front-sticky wins.  */  
   if (XINT (pos) == BEGV || NILP (Fget_text_property (prev_pos, prop, Qnil)))  
     return 1;  
   else  
     return -1;  
 }  
   
   
327  /* Find the field surrounding POS in *BEG and *END.  If POS is nil,  /* Find the field surrounding POS in *BEG and *END.  If POS is nil,
328     the value of point is used instead.  If BEG or END null,     the value of point is used instead.  If BEG or END null,
329     means don't store the beginning or end of the field.     means don't store the beginning or end of the field.

Legend:
Removed from v.1.327  
changed lines
  Added in v.1.328

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26