unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: "Lennart Borgman \(gmail\)" <lennart.borgman@gmail.com>
Cc: Emacs Devel <emacs-devel@gnu.org>
Subject: Re: Is this a bug in overlay property list handling?
Date: Tue, 03 Jun 2008 10:37:06 -0400	[thread overview]
Message-ID: <jwv4p8ar3nl.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <484272B3.3020004@gmail.com> (Lennart Borgman's message of "Sun,  01 Jun 2008 11:58:11 +0200")

> 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.

> 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.


        Stefan


PS: BTW, please avoid using `1' instead of (point-min), or else add
a comment explaining why (point-min) is not right.  Also the
`(parse-partial-sexp (point-min) last-pos) looks odd: you probably
forgot a comma before `last-pos'.
Maybe mumamo-with-major-mode-fontification should be a macro rather than
a function.




  reply	other threads:[~2008-06-03 14:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-01  9:58 Is this a bug in overlay property list handling? Lennart Borgman (gmail)
2008-06-03 14:37 ` Stefan Monnier [this message]
2008-06-03 19:46   ` Lennart Borgman (gmail)
2008-06-03 20:50     ` Lennart Borgman (gmail)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv4p8ar3nl.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=lennart.borgman@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).