From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Lennart Borgman (gmail)" Newsgroups: gmane.emacs.devel Subject: Re: Is this a bug in overlay property list handling? Date: Tue, 03 Jun 2008 21:46:18 +0200 Message-ID: <48459F8A.8070705@gmail.com> References: <484272B3.3020004@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1212522412 14638 80.91.229.12 (3 Jun 2008 19:46:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 3 Jun 2008 19:46:52 +0000 (UTC) Cc: Emacs Devel To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jun 03 21:47:31 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1K3cTh-0002Kd-Pn for ged-emacs-devel@m.gmane.org; Tue, 03 Jun 2008 21:47:30 +0200 Original-Received: from localhost ([127.0.0.1]:43002 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K3cSv-0002pU-BU for ged-emacs-devel@m.gmane.org; Tue, 03 Jun 2008 15:46:41 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K3cSp-0002pC-Hk for emacs-devel@gnu.org; Tue, 03 Jun 2008 15:46:35 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K3cSn-0002o7-B9 for emacs-devel@gnu.org; Tue, 03 Jun 2008 15:46:34 -0400 Original-Received: from [199.232.76.173] (port=50834 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K3cSm-0002nb-Rw for emacs-devel@gnu.org; Tue, 03 Jun 2008 15:46:33 -0400 Original-Received: from ch-smtp02.sth.basefarm.net ([80.76.149.213]:49960) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1K3cSl-0006os-Lb for emacs-devel@gnu.org; Tue, 03 Jun 2008 15:46:32 -0400 Original-Received: from c83-254-145-59.bredband.comhem.se ([83.254.145.59]:63623 helo=[127.0.0.1]) by ch-smtp02.sth.basefarm.net with esmtp (Exim 4.68) (envelope-from ) id 1K3cSi-0007To-6w; Tue, 03 Jun 2008 21:46:28 +0200 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666 In-Reply-To: X-Antivirus: avast! (VPS 080603-0, 2008-06-03), Outbound message X-Antivirus-Status: Clean X-Originating-IP: 83.254.145.59 X-Scan-Result: No virus found in message 1K3cSi-0007To-6w. X-Scan-Signature: ch-smtp02.sth.basefarm.net 1K3cSi-0007To-6w d6bdeb452cb50818b60c501f1a1bc73b X-detected-kernel: by monty-python.gnu.org: Linux 2.6? (barebone, rare!) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:98328 Archived-At: Stefan Monnier wrote: >> I am not sure if I have hit a bug or if I am doing something wrong. I do >> something like this in my code: > >> (setq syntax-ppss-last-min >> (copy-tree >> (cons (1- last-pos) >> (if is-main-mode-chunk >> (mumamo-with-major-mode-fontification main-major >> `(parse-partial-sexp (point-min) last-pos)) >> (parse-partial-sexp 1 1))) >> )) >> (overlay-put chunk-at-pos 'syntax-ppss-last-min syntax-ppss-last-min) > >> If I test this immediately after with `overlay-get' the value looks ok. > >> However, later when I read these values with `overlay-get' it seems like the >> property list has got corrupted. The car of the value stored in property >> syntax-ppss-last-min is nil. > >> I use copy-tree to try to avoid surprices like this one. > > The `cons' already makes sure you have the only reference to the object > and parse-partial-sexp also returns a fresh value, so the `copy-tree' is > not needed. Thanks for the explanation. >> Maybe I should do something different? Maybe this is a bug in overlay >> property list handling? > > I'd be very surprised if it's a bug in overlay property handling. > My guess is that it's a bug elsewhere in your code. Ok, this should make it easier to find this bug. > Stefan > > > PS: BTW, please avoid using `1' instead of (point-min), or else add > a comment explaining why (point-min) is not right. I will add a comment. > Also the > `(parse-partial-sexp (point-min) last-pos) looks odd: you probably > forgot a comma before `last-pos'. Yes, I did. Thanks. > Maybe mumamo-with-major-mode-fontification should be a macro rather than > a function. I am not sure now. I will have a look again.