emacs-devel
[Top][All Lists]
Advanced

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

overlay-start > overlay-end


From: Masatake YAMATO
Subject: overlay-start > overlay-end
Date: Mon, 22 Mar 2004 17:00:35 +0900 (JST)

>     I have seen emacs's strange behaviors twice; Emacs returned an overlay 
> whose start is
>     greater than its end. I cannot find the way to reproduce it.
> 
> That is a bug.  It should never happen.
> 

I've just found the way to reproduce this:

(save-excursion
  (let (o)
    (goto-char (point-min))
    (delete-region (line-beginning-position) (line-end-position))
    (make-overlay (point) (point) (current-buffer) t)
    (insert ?x)
    (overlay-lists)))
=> ((#<overlay from 2 to 1 in *scratch*>))

I've tried to fix the problem. See the patch attached to this mail.
However, I have no confidence. 

Regards,
Masatake YAMATO

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.445
diff -u -r1.445 buffer.c
--- src/buffer.c        4 Mar 2004 17:15:13 -0000       1.445
+++ src/buffer.c        22 Mar 2004 07:59:04 -0000
@@ -3465,6 +3465,19 @@
       tail = tail->next;
     }
 
+  /* Canonicalize the order of start and end. */
+  if (tail)
+    {
+      EMACS_INT   start = OVERLAY_POSITION (OVERLAY_START (tem));
+      Lisp_Object start_lobj;
+      if (start > end)
+       {
+         start_lobj  = tail->start;
+         tail->start = tail->end;
+         tail->end   = start_lobj;
+       }
+    }
+         
   /* If we don't find such an overlay,
      or the found one ends before PREV,
      or the found one is the last one in the list,




reply via email to

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