[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Difficulties with `purecopy' discarding text properties from strings
From: |
Stefan Monnier |
Subject: |
Re: Difficulties with `purecopy' discarding text properties from strings |
Date: |
Fri, 19 May 2017 15:22:50 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) |
> Presumably there are good reasons for discarding text properties when
> purecopying strings.
I don't think so.
> Or, maybe, there was just no particular reason to amend the workings
> of `purecopy' when text properties came into existence.
I think that's what happens.
But wait a minute:
> I naively constructed such a defcustom, with text properties on the
> value option strings.
How exactly did you do that? Using #("..." ...)
or using (propertize "..." ...)?
> After some debugging, I discover that defcustom strips those text
> properties off the strings. It does this by using `purecopy' on these
> strings (in the function `custom-declare-variable').
But AFAICT custom-declare-variable only applies purecopy to its
`default` argument which is supposed to be an expression (which
evaluates to the intended value) rather than a value. So if you use the
(propertize "..." ...) form, the properties should not be stripped.
Or am I missing something?
Stefan