From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Masatake YAMATO Newsgroups: gmane.emacs.devel Subject: overlay-start > overlay-end Date: Mon, 22 Mar 2004 17:00:35 +0900 (JST) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <20040322.170035.233401763.jet@gyve.org> References: <20040321.230322.85700391.jet@gyve.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1079942664 3063 80.91.224.253 (22 Mar 2004 08:04:24 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 22 Mar 2004 08:04:24 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Mon Mar 22 09:04:04 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1B5KPk-0006pd-00 for ; Mon, 22 Mar 2004 09:04:04 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1B5KPk-00079j-00 for ; Mon, 22 Mar 2004 09:04:04 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1B5KPk-0003Nj-L5 for emacs-devel@quimby.gnus.org; Mon, 22 Mar 2004 03:04:04 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1B5KNC-0002rr-7l for emacs-devel@gnu.org; Mon, 22 Mar 2004 03:01:26 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1B5KMc-0002g7-EV for emacs-devel@gnu.org; Mon, 22 Mar 2004 03:01:22 -0500 Original-Received: from [210.130.136.40] (helo=r-maa.spacetown.ne.jp) by monty-python.gnu.org with esmtp (Exim 4.30) id 1B5KMa-0002dG-OH for emacs-devel@gnu.org; Mon, 22 Mar 2004 03:00:48 -0500 Original-Received: from localhost ([219.120.63.249]) by r-maa.spacetown.ne.jp (8.11.6) with ESMTP id i2M80bw28546 for ; Mon, 22 Mar 2004 17:00:37 +0900 (JST) Original-To: emacs-devel@gnu.org In-Reply-To: X-Mailer: Mew version 4.0.62 on Emacs 21.3.50 / Mule 5.0 (SAKAKI) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:20716 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:20716 > 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))) => ((#)) 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,