[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Difficulties with `purecopy' discarding text properties from strings

From: Alan Mackenzie
Subject: Difficulties with `purecopy' discarding text properties from strings
Date: Fri, 19 May 2017 18:55:09 +0000
User-agent: Mutt/1.5.24 (2015-08-30)

Hello, Emacs.

The context is my implementing of new mode-line %-constructs.  I want a
customisable user option whose values will be things like ("%o"), with
text properties on the string (for things like help strings and mouse
action key bindings).

I naively constructed such a defcustom, with text properties on the
value option strings.  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').

(Yes, the variable I'm trying to declare is in bindings.el along with
all the other mode-line stuff, and this is preloaded stuff.)

So, I'm a little bit stuck.

Presumably there are good reasons for discarding text properties when
purecopying strings.  Or, maybe, there was just no particular reason to
amend the workings of `purecopy' when text properties came into

How does this sound for a solution to the problem?  In `defcustom',
introduce a new keyword `impure:' which, when placed early enough in the
defcustom would inhibit the `purecopy' action.

Or should I work at amending `purecopy' also to copy text properties?

Alan Mackenzie (Nuremberg, Germany).

reply via email to

[Prev in Thread] Current Thread [Next in Thread]