/[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.322 by rms, Thu Nov 15 00:34:42 2001 UTC revision 1.323 by miles, Thu Nov 15 08:05:45 2001 UTC
# Line 64  extern Lisp_Object make_time P_ ((time_t Line 64  extern Lisp_Object make_time P_ ((time_t
64  extern size_t emacs_strftimeu P_ ((char *, size_t, const char *,  extern size_t emacs_strftimeu P_ ((char *, size_t, const char *,
65                                     const struct tm *, int));                                     const struct tm *, int));
66  static int tm_diff P_ ((struct tm *, struct tm *));  static int tm_diff P_ ((struct tm *, struct tm *));
67  static void find_field P_ ((Lisp_Object, Lisp_Object, int *, int *));  static void find_field P_ ((Lisp_Object, Lisp_Object, Lisp_Object, int *, Lisp_Object, int *));
68  static void update_buffer_properties P_ ((int, int));  static void update_buffer_properties P_ ((int, int));
69  static Lisp_Object region_limit P_ ((int));  static Lisp_Object region_limit P_ ((int));
70  static int lisp_time_argument P_ ((Lisp_Object, time_t *, int *));  static int lisp_time_argument P_ ((Lisp_Object, time_t *, int *));
# Line 404  text_property_stickiness (prop, pos) Line 404  text_property_stickiness (prop, pos)
404     the value of point is used instead.  If BEG or END null,     the value of point is used instead.  If BEG or END null,
405     means don't store the beginning or end of the field.     means don't store the beginning or end of the field.
406    
407       BEG_LIMIT and END_LIMIT serve to limit the ranged of the returned
408       results; they do not effect boundary behavior.
409    
410     If MERGE_AT_BOUNDARY is nonzero, then if POS is at the very first     If MERGE_AT_BOUNDARY is nonzero, then if POS is at the very first
411     position of a field, then the beginning of the previous field is     position of a field, then the beginning of the previous field is
412     returned instead of the beginning of POS's field (since the end of a     returned instead of the beginning of POS's field (since the end of a
# Line 418  text_property_stickiness (prop, pos) Line 421  text_property_stickiness (prop, pos)
421     is not stored.  */     is not stored.  */
422    
423  static void  static void
424  find_field (pos, merge_at_boundary, beg, end)  find_field (pos, merge_at_boundary, beg_limit, beg, end_limit, end)
425       Lisp_Object pos;       Lisp_Object pos;
426       Lisp_Object merge_at_boundary;       Lisp_Object merge_at_boundary;
427         Lisp_Object beg_limit, end_limit;
428       int *beg, *end;       int *beg, *end;
429  {  {
430    /* Fields right before and after the point.  */    /* Fields right before and after the point.  */
# Line 544  find_field (pos, merge_at_boundary, beg, Line 548  find_field (pos, merge_at_boundary, beg,
548          {          {
549            if (!NILP (merge_at_boundary) && EQ (before_field, Qboundary))            if (!NILP (merge_at_boundary) && EQ (before_field, Qboundary))
550              /* Skip a `boundary' field.  */              /* Skip a `boundary' field.  */
551              pos = Fprevious_single_char_property_change (pos, Qfield, Qnil,Qnil);              pos = Fprevious_single_char_property_change (pos, Qfield, Qnil,
552                                                             beg_limit);
553    
554            pos = Fprevious_single_char_property_change (pos, Qfield, Qnil, Qnil);            pos = Fprevious_single_char_property_change (pos, Qfield, Qnil,
555                                                           beg_limit);
556            *beg = NILP (pos) ? BEGV : XFASTINT (pos);            *beg = NILP (pos) ? BEGV : XFASTINT (pos);
557          }          }
558      }      }
# Line 562  find_field (pos, merge_at_boundary, beg, Line 568  find_field (pos, merge_at_boundary, beg,
568          {          {
569            if (!NILP (merge_at_boundary) && EQ (after_field, Qboundary))            if (!NILP (merge_at_boundary) && EQ (after_field, Qboundary))
570              /* Skip a `boundary' field.  */              /* Skip a `boundary' field.  */
571              pos = Fnext_single_char_property_change (pos, Qfield, Qnil, Qnil);              pos = Fnext_single_char_property_change (pos, Qfield, Qnil,
572                                                         end_limit);
573    
574            pos = Fnext_single_char_property_change (pos, Qfield, Qnil, Qnil);            pos = Fnext_single_char_property_change (pos, Qfield, Qnil,
575                                                       end_limit);
576            *end = NILP (pos) ? ZV : XFASTINT (pos);            *end = NILP (pos) ? ZV : XFASTINT (pos);
577          }          }
578      }      }
# Line 579  If POS is nil, the value of point is use Line 587  If POS is nil, the value of point is use
587       Lisp_Object pos;       Lisp_Object pos;
588  {  {
589    int beg, end;    int beg, end;
590    find_field (pos, Qnil, &beg, &end);    find_field (pos, Qnil, Qnil, &beg, Qnil, &end);
591    if (beg != end)    if (beg != end)
592      del_range (beg, end);      del_range (beg, end);
593    return Qnil;    return Qnil;
# Line 593  If POS is nil, the value of point is use Line 601  If POS is nil, the value of point is use
601       Lisp_Object pos;       Lisp_Object pos;
602  {  {
603    int beg, end;    int beg, end;
604    find_field (pos, Qnil, &beg, &end);    find_field (pos, Qnil, Qnil, &beg, Qnil, &end);
605    return make_buffer_string (beg, end, 1);    return make_buffer_string (beg, end, 1);
606  }  }
607    
# Line 605  If POS is nil, the value of point is use Line 613  If POS is nil, the value of point is use
613       Lisp_Object pos;       Lisp_Object pos;
614  {  {
615    int beg, end;    int beg, end;
616    find_field (pos, Qnil, &beg, &end);    find_field (pos, Qnil, Qnil, &beg, Qnil, &end);
617    return make_buffer_string (beg, end, 0);    return make_buffer_string (beg, end, 0);
618  }  }
619    
620  DEFUN ("field-beginning", Ffield_beginning, Sfield_beginning, 0, 2, 0,  DEFUN ("field-beginning", Ffield_beginning, Sfield_beginning, 0, 3, 0,
621         doc: /* Return the beginning of the field surrounding POS.         doc: /* Return the beginning of the field surrounding POS.
622  A field is a region of text with the same `field' property.  A field is a region of text with the same `field' property.
623  If POS is nil, the value of point is used for POS.  If POS is nil, the value of point is used for POS.
624  If ESCAPE-FROM-EDGE is non-nil and POS is at the beginning of its  If ESCAPE-FROM-EDGE is non-nil and POS is at the beginning of its
625  field, then the beginning of the *previous* field is returned.  */)  field, then the beginning of the *previous* field is returned.
626       (pos, escape_from_edge)  If LIMIT is non-nil, it is a buffer position; if the beginning of the field
627       Lisp_Object pos, escape_from_edge;  is before LIMIT, then LIMIT will be returned instead.  */)
628         (pos, escape_from_edge, limit)
629         Lisp_Object pos, escape_from_edge, limit;
630  {  {
631    int beg;    int beg;
632    find_field (pos, escape_from_edge, &beg, 0);    find_field (pos, escape_from_edge, limit, &beg, Qnil, 0);
633    return make_number (beg);    return make_number (beg);
634  }  }
635    
636  DEFUN ("field-end", Ffield_end, Sfield_end, 0, 2, 0,  DEFUN ("field-end", Ffield_end, Sfield_end, 0, 3, 0,
637         doc: /* Return the end of the field surrounding POS.         doc: /* Return the end of the field surrounding POS.
638  A field is a region of text with the same `field' property.  A field is a region of text with the same `field' property.
639  If POS is nil, the value of point is used for POS.  If POS is nil, the value of point is used for POS.
640  If ESCAPE-FROM-EDGE is non-nil and POS is at the end of its field,  If ESCAPE-FROM-EDGE is non-nil and POS is at the end of its field,
641  then the end of the *following* field is returned.  */)  then the end of the *following* field is returned.
642       (pos, escape_from_edge)  If LIMIT is non-nil, it is a buffer position; if the end of the field
643       Lisp_Object pos, escape_from_edge;  is after LIMIT, then LIMIT will be returned instead.  */)
644         (pos, escape_from_edge, limit)
645         Lisp_Object pos, escape_from_edge, limit;
646  {  {
647    int end;    int end;
648    find_field (pos, escape_from_edge, 0, &end);    find_field (pos, escape_from_edge, Qnil, 0, limit, &end);
649    return make_number (end);    return make_number (end);
650  }  }
651    
# Line 696  Field boundaries are not noticed if `inh Line 708  Field boundaries are not noticed if `inh
708        fwd = (XFASTINT (new_pos) > XFASTINT (old_pos));        fwd = (XFASTINT (new_pos) > XFASTINT (old_pos));
709    
710        if (fwd)        if (fwd)
711          field_bound = Ffield_end (old_pos, escape_from_edge);          field_bound = Ffield_end (old_pos, escape_from_edge, new_pos);
712        else        else
713          field_bound = Ffield_beginning (old_pos, escape_from_edge);          field_bound = Ffield_beginning (old_pos, escape_from_edge, new_pos);
714    
715        if (/* See if ESCAPE_FROM_EDGE caused FIELD_BOUND to jump to the        if (/* See if ESCAPE_FROM_EDGE caused FIELD_BOUND to jump to the
716               other side of NEW_POS, which would mean that NEW_POS is               other side of NEW_POS, which would mean that NEW_POS is

Legend:
Removed from v.1.322  
changed lines
  Added in v.1.323

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