[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Strange problem with latest CVS
From: |
Masatake YAMATO |
Subject: |
Re: Strange problem with latest CVS |
Date: |
Thu, 08 Apr 2004 20:45:37 +0900 (JST) |
> How do you think make evaporate overlay's property t by default(when
> make-overlay)?
>
> That would break many programs. It is the wrong solution.
>
> I think the right fix is in fix_start_end_in_overlays. When an
> insertion occurs next to an overlay whose beginning-marker is the
> advancing kind and whose end-marker is not, the overlay should stay
> empty.
I've tried. I have done in two things in the attached patch.
1) I could still find the situation that Emacs returned an overlay
whose start is greater than its end. I have fixed in the patch.
2) As you wrote, I made overlays empty in fix_start_end_in_overlays.
The biggest question is that whether I should use overlay-start or
overlay-end to make an overlay empty. I'm using following code
in the patch.
// for overlay_before
int pivot = (startpos >= start)? endpos: startpos;
// for overlay_after
int pivot = (endpos < end)? startpos: endpos;
Fset_marker (OVERLAY_START (overlay), make_number (pivot),
Qnil);
Fset_marker (OVERLAY_END (overlay), make_number (pivot),
Qnil);
Masatake YAMATO
2004-04-08 Masatake YAMATO <address@hidden>
* buffer.c (fix_start_end_in_overlays): Normalize
the order of start and end in overlays before comparing
the edited range and overlay.
Introduce `make_empty' local variable. Make it true if
an overlay is upside-down.
Make overlay empty if it is upside-down.
cvs diff: warning: unrecognized response `access control disabled, clients can
connect from any host' from cvs server
Index: src/buffer.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/buffer.c,v
retrieving revision 1.446
diff -u -r1.446 buffer.c
*** src/buffer.c 25 Mar 2004 18:05:29 -0000 1.446
--- src/buffer.c 8 Apr 2004 10:53:03 -0000
***************
*** 3290,3297 ****
endpoint in this range will need to be unlinked from the overlay
list and reinserted in its proper place.
Such an overlay might even have negative size at this point.
! If so, we'll reverse the endpoints. Can you think of anything
! better to do in this situation? */
void
fix_start_end_in_overlays (start, end)
register int start, end;
--- 3290,3296 ----
endpoint in this range will need to be unlinked from the overlay
list and reinserted in its proper place.
Such an overlay might even have negative size at this point.
! If so, we'll make the overlay empty. */
void
fix_start_end_in_overlays (start, end)
register int start, end;
***************
*** 3308,3313 ****
--- 3307,3313 ----
struct Lisp_Overlay *tail, *parent;
int startpos, endpos;
+ int make_empty;
/* This algorithm shifts links around instead of consing and GCing.
The loop invariant is that before_list (resp. after_list) is a
well-formed list except that its last element, the CDR of beforep
***************
*** 3318,3339 ****
for (parent = NULL, tail = current_buffer->overlays_before; tail;)
{
XSETMISC (overlay, tail);
endpos = OVERLAY_POSITION (OVERLAY_END (overlay));
if (endpos < start)
break;
! startpos = OVERLAY_POSITION (OVERLAY_START (overlay));
if (endpos < end
|| (startpos >= start && startpos < end))
{
! /* If the overlay is backwards, fix that now. */
! if (startpos > endpos)
{
! int tem;
! Fset_marker (OVERLAY_START (overlay), make_number (endpos),
Qnil);
! Fset_marker (OVERLAY_END (overlay), make_number (startpos),
Qnil);
- tem = startpos; startpos = endpos; endpos = tem;
}
/* Add it to the end of the wrong list. Later on,
recenter_overlay_lists will move it to the right place. */
--- 3318,3354 ----
for (parent = NULL, tail = current_buffer->overlays_before; tail;)
{
XSETMISC (overlay, tail);
+
+ /* Normalize the order of startpos and endpos. */
endpos = OVERLAY_POSITION (OVERLAY_END (overlay));
+ startpos = OVERLAY_POSITION (OVERLAY_START (overlay));
+ if (endpos < startpos)
+ {
+ int tem;
+ make_empty = 1;
+ tem = startpos;
+ startpos = endpos;
+ endpos = tem;
+ }
+ else
+ make_empty = 0;
+
+ /* The order of startpos and endpos is normalized.
+ So we can use endpos to be comapred with start. */
if (endpos < start)
break;
!
if (endpos < end
|| (startpos >= start && startpos < end))
{
! /* If the overlay is backwards, make it empty. */
! if (make_empty)
{
! int pivot = (startpos >= start)? endpos: startpos;
! Fset_marker (OVERLAY_START (overlay), make_number (pivot),
Qnil);
! Fset_marker (OVERLAY_END (overlay), make_number (pivot),
Qnil);
}
/* Add it to the end of the wrong list. Later on,
recenter_overlay_lists will move it to the right place. */
***************
*** 3362,3385 ****
else
parent = tail, tail = parent->next;
}
for (parent = NULL, tail = current_buffer->overlays_after; tail;)
{
XSETMISC (overlay, tail);
startpos = OVERLAY_POSITION (OVERLAY_START (overlay));
if (startpos >= end)
break;
! endpos = OVERLAY_POSITION (OVERLAY_END (overlay));
if (startpos >= start
|| (endpos >= start && endpos < end))
{
! if (startpos > endpos)
{
! int tem;
! Fset_marker (OVERLAY_START (overlay), make_number (endpos),
Qnil);
! Fset_marker (OVERLAY_END (overlay), make_number (startpos),
Qnil);
- tem = startpos; startpos = endpos; endpos = tem;
}
if (endpos < current_buffer->overlay_center)
{
--- 3377,3417 ----
else
parent = tail, tail = parent->next;
}
+
+ make_empty = 0;
for (parent = NULL, tail = current_buffer->overlays_after; tail;)
{
XSETMISC (overlay, tail);
startpos = OVERLAY_POSITION (OVERLAY_START (overlay));
+ endpos = OVERLAY_POSITION (OVERLAY_END (overlay));
+
+ /* Normalize the order of startpos and endpos. */
+ if (endpos < startpos)
+ {
+ int tem;
+ make_empty = 1;
+ tem = startpos;
+ startpos = endpos;
+ endpos = tem;
+ }
+ else
+ make_empty = 0;
+
+ /* The order of startpos and endpos is normalized.
+ So we can use endpos to be comapred with start. */
if (startpos >= end)
break;
!
if (startpos >= start
|| (endpos >= start && endpos < end))
{
! if (make_empty)
{
! int pivot = (endpos < end)? startpos: endpos;
! Fset_marker (OVERLAY_START (overlay), make_number (pivot),
Qnil);
! Fset_marker (OVERLAY_END (overlay), make_number (pivot),
Qnil);
}
if (endpos < current_buffer->overlay_center)
{
- Re: Strange problem with latest CVS, (continued)
- Re: Strange problem with latest CVS, Richard Stallman, 2004/04/14
- Re: Strange problem with latest CVS, Masatake YAMATO, 2004/04/19
- Re: Strange problem with latest CVS, Richard Stallman, 2004/04/19
- Re: Strange problem with latest CVS, Masatake YAMATO, 2004/04/20
- Re: Strange problem with latest CVS, Richard Stallman, 2004/04/20
- Re: Strange problem with latest CVS, Masatake YAMATO, 2004/04/21
Re: Strange problem with latest CVS, Richard Stallman, 2004/04/07
- Re: Strange problem with latest CVS, Masatake YAMATO, 2004/04/08
- Re: Strange problem with latest CVS,
Masatake YAMATO <=
- Re: Strange problem with latest CVS, Richard Stallman, 2004/04/09
- Re: Strange problem with latest CVS, Masatake YAMATO, 2004/04/10
- Re: Strange problem with latest CVS, Kim F. Storm, 2004/04/10
- Re: Strange problem with latest CVS, Masatake YAMATO, 2004/04/10