* Is this a bug in overlay property list handling?
@ 2008-06-01 9:58 Lennart Borgman (gmail)
2008-06-03 14:37 ` Stefan Monnier
0 siblings, 1 reply; 4+ messages in thread
From: Lennart Borgman (gmail) @ 2008-06-01 9:58 UTC (permalink / raw)
To: Emacs Devel
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. Maybe I should
do something different? Maybe this is a bug in overlay property list
handling?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Is this a bug in overlay property list handling?
2008-06-01 9:58 Is this a bug in overlay property list handling? Lennart Borgman (gmail)
@ 2008-06-03 14:37 ` Stefan Monnier
2008-06-03 19:46 ` Lennart Borgman (gmail)
0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2008-06-03 14:37 UTC (permalink / raw)
To: Lennart Borgman (gmail); +Cc: Emacs Devel
> 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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Is this a bug in overlay property list handling?
2008-06-03 14:37 ` Stefan Monnier
@ 2008-06-03 19:46 ` Lennart Borgman (gmail)
2008-06-03 20:50 ` Lennart Borgman (gmail)
0 siblings, 1 reply; 4+ messages in thread
From: Lennart Borgman (gmail) @ 2008-06-03 19:46 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Emacs Devel
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-06-03 20:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-01 9:58 Is this a bug in overlay property list handling? Lennart Borgman (gmail)
2008-06-03 14:37 ` Stefan Monnier
2008-06-03 19:46 ` Lennart Borgman (gmail)
2008-06-03 20:50 ` Lennart Borgman (gmail)
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.