emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/buffer.c


From: Stefan Monnier
Subject: [Emacs-diffs] Changes to emacs/src/buffer.c
Date: Tue, 08 Jul 2003 17:47:56 -0400

Index: emacs/src/buffer.c
diff -c emacs/src/buffer.c:1.428 emacs/src/buffer.c:1.429
*** emacs/src/buffer.c:1.428    Sun Jul  6 21:45:49 2003
--- emacs/src/buffer.c  Tue Jul  8 17:47:55 2003
***************
*** 32,38 ****
  #endif
  
  #ifndef MAXPATHLEN
! /* in 4.1, param.h fails to define this. */
  #define MAXPATHLEN 1024
  #endif /* not MAXPATHLEN */
  
--- 32,38 ----
  #endif
  
  #ifndef MAXPATHLEN
! /* in 4.1 [probably SunOS? -stef] , param.h fails to define this. */
  #define MAXPATHLEN 1024
  #endif /* not MAXPATHLEN */
  
***************
*** 648,654 ****
    b->read_only = Qnil;
    b->overlays_before = Qnil;
    b->overlays_after = Qnil;
!   XSETFASTINT (b->overlay_center, 1);
    b->mark_active = Qnil;
    b->point_before_scroll = Qnil;
    b->file_format = Qnil;
--- 648,654 ----
    b->read_only = Qnil;
    b->overlays_before = Qnil;
    b->overlays_after = Qnil;
!   b->overlay_center = BEG;
    b->mark_active = Qnil;
    b->point_before_scroll = Qnil;
    b->file_format = Qnil;
***************
*** 2420,2426 ****
  
  int
  overlays_at (pos, extend, vec_ptr, len_ptr, next_ptr, prev_ptr, change_req)
!      int pos;
       int extend;
       Lisp_Object **vec_ptr;
       int *len_ptr;
--- 2420,2426 ----
  
  int
  overlays_at (pos, extend, vec_ptr, len_ptr, next_ptr, prev_ptr, change_req)
!      EMACS_INT pos;
       int extend;
       Lisp_Object **vec_ptr;
       int *len_ptr;
***************
*** 2942,2948 ****
  
  int
  overlay_strings (pos, w, pstr)
!      int pos;
       struct window *w;
       unsigned char **pstr;
  {
--- 2942,2948 ----
  
  int
  overlay_strings (pos, w, pstr)
!      EMACS_INT pos;
       struct window *w;
       unsigned char **pstr;
  {
***************
*** 2955,2962 ****
    for (ov = current_buffer->overlays_before; CONSP (ov); ov = XCDR (ov))
      {
        overlay = XCAR (ov);
!       if (!OVERLAYP (overlay))
!       abort ();
  
        startpos = OVERLAY_POSITION (OVERLAY_START (overlay));
        endpos = OVERLAY_POSITION (OVERLAY_END (overlay));
--- 2955,2961 ----
    for (ov = current_buffer->overlays_before; CONSP (ov); ov = XCDR (ov))
      {
        overlay = XCAR (ov);
!       eassert (OVERLAYP (overlay));
  
        startpos = OVERLAY_POSITION (OVERLAY_START (overlay));
        endpos = OVERLAY_POSITION (OVERLAY_END (overlay));
***************
*** 2984,2991 ****
    for (ov = current_buffer->overlays_after; CONSP (ov); ov = XCDR (ov))
      {
        overlay = XCAR (ov);
!       if (!OVERLAYP (overlay))
!       abort ();
  
        startpos = OVERLAY_POSITION (OVERLAY_START (overlay));
        endpos = OVERLAY_POSITION (OVERLAY_END (overlay));
--- 2983,2989 ----
    for (ov = current_buffer->overlays_after; CONSP (ov); ov = XCDR (ov))
      {
        overlay = XCAR (ov);
!       eassert (!OVERLAYP (overlay));
  
        startpos = OVERLAY_POSITION (OVERLAY_START (overlay));
        endpos = OVERLAY_POSITION (OVERLAY_END (overlay));
***************
*** 3070,3076 ****
  void
  recenter_overlay_lists (buf, pos)
       struct buffer *buf;
!      int pos;
  {
    Lisp_Object overlay, tail, next, prev, beg, end;
  
--- 3068,3074 ----
  void
  recenter_overlay_lists (buf, pos)
       struct buffer *buf;
!      EMACS_INT pos;
  {
    Lisp_Object overlay, tail, next, prev, beg, end;
  
***************
*** 3127,3134 ****
              Lisp_Object otherbeg, otheroverlay;
  
              otheroverlay = XCAR (other);
!             if (! OVERLAY_VALID (otheroverlay))
!               abort ();
  
              otherbeg = OVERLAY_START (otheroverlay);
              if (OVERLAY_POSITION (otherbeg) >= where)
--- 3125,3131 ----
              Lisp_Object otherbeg, otheroverlay;
  
              otheroverlay = XCAR (other);
!             eassert (! OVERLAY_VALID (otheroverlay));
  
              otherbeg = OVERLAY_START (otheroverlay);
              if (OVERLAY_POSITION (otherbeg) >= where)
***************
*** 3204,3211 ****
              Lisp_Object otherend, otheroverlay;
  
              otheroverlay = XCAR (other);
!             if (! OVERLAY_VALID (otheroverlay))
!               abort ();
  
              otherend = OVERLAY_END (otheroverlay);
              if (OVERLAY_POSITION (otherend) <= where)
--- 3201,3207 ----
              Lisp_Object otherend, otheroverlay;
  
              otheroverlay = XCAR (other);
!             eassert (! OVERLAY_VALID (otheroverlay));
  
              otherend = OVERLAY_END (otheroverlay);
              if (OVERLAY_POSITION (otherend) <= where)
***************
*** 3222,3257 ****
        }
      }
  
!   XSETFASTINT (buf->overlay_center, pos);
  }
  
  void
  adjust_overlays_for_insert (pos, length)
!      int pos;
!      int length;
  {
    /* After an insertion, the lists are still sorted properly,
       but we may need to update the value of the overlay center.  */
!   if (XFASTINT (current_buffer->overlay_center) >= pos)
!     XSETFASTINT (current_buffer->overlay_center,
!                XFASTINT (current_buffer->overlay_center) + length);
  }
  
  void
  adjust_overlays_for_delete (pos, length)
!      int pos;
!      int length;
  {
!   if (XFASTINT (current_buffer->overlay_center) < pos)
      /* The deletion was to our right.  No change needed; the before- and
         after-lists are still consistent.  */
      ;
!   else if (XFASTINT (current_buffer->overlay_center) > pos + length)
      /* The deletion was to our left.  We need to adjust the center value
         to account for the change in position, but the lists are consistent
         given the new value.  */
!     XSETFASTINT (current_buffer->overlay_center,
!                XFASTINT (current_buffer->overlay_center) - length);
    else
      /* We're right in the middle.  There might be things on the after-list
         that now belong on the before-list.  Recentering will move them,
--- 3218,3251 ----
        }
      }
  
!   buf->overlay_center = pos;
  }
  
  void
  adjust_overlays_for_insert (pos, length)
!      EMACS_INT pos;
!      EMACS_INT length;
  {
    /* After an insertion, the lists are still sorted properly,
       but we may need to update the value of the overlay center.  */
!   if (current_buffer->overlay_center >= pos)
!     current_buffer->overlay_center += length;
  }
  
  void
  adjust_overlays_for_delete (pos, length)
!      EMACS_INT pos;
!      EMACS_INT length;
  {
!   if (current_buffer->overlay_center < pos)
      /* The deletion was to our right.  No change needed; the before- and
         after-lists are still consistent.  */
      ;
!   else if (current_buffer->overlay_center > pos + length)
      /* The deletion was to our left.  We need to adjust the center value
         to account for the change in position, but the lists are consistent
         given the new value.  */
!     current_buffer->overlay_center -= length;
    else
      /* We're right in the middle.  There might be things on the after-list
         that now belong on the before-list.  Recentering will move them,
***************
*** 3311,3317 ****
            }
          /* Add it to the end of the wrong list.  Later on,
             recenter_overlay_lists will move it to the right place.  */
!         if (endpos < XINT (current_buffer->overlay_center))
            {
              if (NILP (afterp))
                after_list = tail;
--- 3305,3311 ----
            }
          /* Add it to the end of the wrong list.  Later on,
             recenter_overlay_lists will move it to the right place.  */
!         if (endpos < current_buffer->overlay_center)
            {
              if (NILP (afterp))
                after_list = tail;
***************
*** 3355,3361 ****
                           Qnil);
              tem = startpos; startpos = endpos; endpos = tem;
            }
!         if (endpos < XINT (current_buffer->overlay_center))
            {
              if (NILP (afterp))
                after_list = tail;
--- 3349,3355 ----
                           Qnil);
              tem = startpos; startpos = endpos; endpos = tem;
            }
!         if (endpos < current_buffer->overlay_center)
            {
              if (NILP (afterp))
                after_list = tail;
***************
*** 3388,3403 ****
        XSETCDR (beforep, current_buffer->overlays_before);
        current_buffer->overlays_before = before_list;
      }
!   recenter_overlay_lists (current_buffer,
!                         XINT (current_buffer->overlay_center));
  
    if (!NILP (afterp))
      {
        XSETCDR (afterp, current_buffer->overlays_after);
        current_buffer->overlays_after = after_list;
      }
!   recenter_overlay_lists (current_buffer,
!                         XINT (current_buffer->overlay_center));
  }
  
  /* We have two types of overlay: the one whose ending marker is
--- 3382,3395 ----
        XSETCDR (beforep, current_buffer->overlays_before);
        current_buffer->overlays_before = before_list;
      }
!   recenter_overlay_lists (current_buffer, current_buffer->overlay_center);
  
    if (!NILP (afterp))
      {
        XSETCDR (afterp, current_buffer->overlays_after);
        current_buffer->overlays_after = after_list;
      }
!   recenter_overlay_lists (current_buffer, current_buffer->overlay_center);
  }
  
  /* We have two types of overlay: the one whose ending marker is
***************
*** 3415,3426 ****
  void
  fix_overlays_before (bp, prev, pos)
       struct buffer *bp;
!      int prev, pos;
  {
    /* If parent is nil, replace overlays_before; otherwise, XCDR(parent).  */
    Lisp_Object tail = bp->overlays_before, parent = Qnil;
    Lisp_Object right_pair;
!   int end;
  
    /* After the insertion, the several overlays may be in incorrect
       order.  The possibility is that, in the list `overlays_before',
--- 3407,3418 ----
  void
  fix_overlays_before (bp, prev, pos)
       struct buffer *bp;
!      EMACS_INT prev, pos;
  {
    /* If parent is nil, replace overlays_before; otherwise, XCDR(parent).  */
    Lisp_Object tail = bp->overlays_before, parent = Qnil;
    Lisp_Object right_pair;
!   EMACS_INT end;
  
    /* After the insertion, the several overlays may be in incorrect
       order.  The possibility is that, in the list `overlays_before',
***************
*** 3554,3566 ****
  
    /* Put the new overlay on the wrong list.  */
    end = OVERLAY_END (overlay);
!   if (OVERLAY_POSITION (end) < XINT (b->overlay_center))
      b->overlays_after = Fcons (overlay, b->overlays_after);
    else
      b->overlays_before = Fcons (overlay, b->overlays_before);
  
    /* This puts it in the right list, and in the right order.  */
!   recenter_overlay_lists (b, XINT (b->overlay_center));
  
    /* We don't need to redisplay the region covered by the overlay, because
       the overlay has no properties at the moment.  */
--- 3546,3558 ----
  
    /* Put the new overlay on the wrong list.  */
    end = OVERLAY_END (overlay);
!   if (OVERLAY_POSITION (end) < b->overlay_center)
      b->overlays_after = Fcons (overlay, b->overlays_after);
    else
      b->overlays_before = Fcons (overlay, b->overlays_before);
  
    /* This puts it in the right list, and in the right order.  */
!   recenter_overlay_lists (b, b->overlay_center);
  
    /* We don't need to redisplay the region covered by the overlay, because
       the overlay has no properties at the moment.  */
***************
*** 3573,3579 ****
  static void
  modify_overlay (buf, start, end)
       struct buffer *buf;
!      int start, end;
  {
    if (start > end)
      {
--- 3565,3571 ----
  static void
  modify_overlay (buf, start, end)
       struct buffer *buf;
!      EMACS_INT start, end;
  {
    if (start > end)
      {
***************
*** 3691,3703 ****
  
    /* Put the overlay on the wrong list.  */
    end = OVERLAY_END (overlay);
!   if (OVERLAY_POSITION (end) < XINT (b->overlay_center))
      b->overlays_after = Fcons (overlay, b->overlays_after);
    else
      b->overlays_before = Fcons (overlay, b->overlays_before);
  
    /* This puts it in the right list, and in the right order.  */
!   recenter_overlay_lists (b, XINT (b->overlay_center));
  
    return unbind_to (count, overlay);
  }
--- 3683,3695 ----
  
    /* Put the overlay on the wrong list.  */
    end = OVERLAY_END (overlay);
!   if (OVERLAY_POSITION (end) < b->overlay_center)
      b->overlays_after = Fcons (overlay, b->overlays_after);
    else
      b->overlays_before = Fcons (overlay, b->overlays_before);
  
    /* This puts it in the right list, and in the right order.  */
!   recenter_overlay_lists (b, b->overlay_center);
  
    return unbind_to (count, overlay);
  }
***************
*** 4241,4252 ****
     property is set.  */
  void
  evaporate_overlays (pos)
!      int pos;
  {
    Lisp_Object tail, overlay, hit_list;
  
    hit_list = Qnil;
!   if (pos <= XFASTINT (current_buffer->overlay_center))
      for (tail = current_buffer->overlays_before; CONSP (tail);
         tail = XCDR (tail))
        {
--- 4233,4244 ----
     property is set.  */
  void
  evaporate_overlays (pos)
!      EMACS_INT pos;
  {
    Lisp_Object tail, overlay, hit_list;
  
    hit_list = Qnil;
!   if (pos <= current_buffer->overlay_center)
      for (tail = current_buffer->overlays_before; CONSP (tail);
         tail = XCDR (tail))
        {
***************
*** 4906,4912 ****
    buffer_defaults.file_format = Qnil;
    buffer_defaults.overlays_before = Qnil;
    buffer_defaults.overlays_after = Qnil;
!   XSETFASTINT (buffer_defaults.overlay_center, BEG);
  
    XSETFASTINT (buffer_defaults.tab_width, 8);
    buffer_defaults.truncate_lines = Qnil;
--- 4898,4904 ----
    buffer_defaults.file_format = Qnil;
    buffer_defaults.overlays_before = Qnil;
    buffer_defaults.overlays_after = Qnil;
!   buffer_defaults.overlay_center = BEG;
  
    XSETFASTINT (buffer_defaults.tab_width, 8);
    buffer_defaults.truncate_lines = Qnil;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]