From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Difficulties with `purecopy' discarding text properties from strings Date: Fri, 19 May 2017 18:55:09 +0000 Message-ID: <20170519185508.GA5330@acm.fritz.box> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1495220216 25042 195.159.176.226 (19 May 2017 18:56:56 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 19 May 2017 18:56:56 +0000 (UTC) User-Agent: Mutt/1.5.24 (2015-08-30) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri May 19 20:56:50 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dBn50-0006Pc-7X for ged-emacs-devel@m.gmane.org; Fri, 19 May 2017 20:56:50 +0200 Original-Received: from localhost ([::1]:59935 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dBn55-0005Is-L7 for ged-emacs-devel@m.gmane.org; Fri, 19 May 2017 14:56:55 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52241) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dBn4P-0005Ib-OH for emacs-devel@gnu.org; Fri, 19 May 2017 14:56:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dBn4L-0007jO-Sz for emacs-devel@gnu.org; Fri, 19 May 2017 14:56:13 -0400 Original-Received: from ocolin.muc.de ([193.149.48.4]:20387 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1dBn4L-0007fX-Gi for emacs-devel@gnu.org; Fri, 19 May 2017 14:56:09 -0400 Original-Received: (qmail 56396 invoked by uid 3782); 19 May 2017 18:56:04 -0000 Original-Received: from acm.muc.de (p548C713C.dip0.t-ipconnect.de [84.140.113.60]) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 19 May 2017 20:56:04 +0200 Original-Received: (qmail 5439 invoked by uid 1000); 19 May 2017 18:55:09 -0000 Content-Disposition: inline X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 193.149.48.4 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:214998 Archived-At: 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 existence. 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).