From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Oleh Krehel Newsgroups: gmane.emacs.bugs Subject: bug#20153: 24.4.91; destructive add-face-text-property and string deep copying Date: Fri, 20 Mar 2015 13:28:00 +0100 Message-ID: <87bnjnyhtb.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1426854813 21892 80.91.229.3 (20 Mar 2015 12:33:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 20 Mar 2015 12:33:33 +0000 (UTC) To: 20153@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Mar 20 13:33:22 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YYw6y-0007YY-N9 for geb-bug-gnu-emacs@m.gmane.org; Fri, 20 Mar 2015 13:33:12 +0100 Original-Received: from localhost ([::1]:43607 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYw6y-00083x-01 for geb-bug-gnu-emacs@m.gmane.org; Fri, 20 Mar 2015 08:33:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39257) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYw6v-00083p-2E for bug-gnu-emacs@gnu.org; Fri, 20 Mar 2015 08:33:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YYw6p-00073h-0S for bug-gnu-emacs@gnu.org; Fri, 20 Mar 2015 08:33:08 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:40850) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYw6o-00073c-TD for bug-gnu-emacs@gnu.org; Fri, 20 Mar 2015 08:33:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YYw6o-0004c3-Kq for bug-gnu-emacs@gnu.org; Fri, 20 Mar 2015 08:33:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Oleh Krehel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 20 Mar 2015 12:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 20153 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.142685477217714 (code B ref -1); Fri, 20 Mar 2015 12:33:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 20 Mar 2015 12:32:52 +0000 Original-Received: from localhost ([127.0.0.1]:58859 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YYw6e-0004bd-9e for submit@debbugs.gnu.org; Fri, 20 Mar 2015 08:32:52 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:37467) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YYw6b-0004bN-Gs for submit@debbugs.gnu.org; Fri, 20 Mar 2015 08:32:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YYw6V-00072M-9m for submit@debbugs.gnu.org; Fri, 20 Mar 2015 08:32:44 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:36938) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYw6V-00072I-6i for submit@debbugs.gnu.org; Fri, 20 Mar 2015 08:32:43 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39186) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYw6U-0007yI-5q for bug-gnu-emacs@gnu.org; Fri, 20 Mar 2015 08:32:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YYw6R-000711-Bn for bug-gnu-emacs@gnu.org; Fri, 20 Mar 2015 08:32:42 -0400 Original-Received: from mail-wi0-x22b.google.com ([2a00:1450:400c:c05::22b]:37609) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYw6R-00070u-5n for bug-gnu-emacs@gnu.org; Fri, 20 Mar 2015 08:32:39 -0400 Original-Received: by wixw10 with SMTP id w10so19086068wix.0 for ; Fri, 20 Mar 2015 05:32:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:mime-version:content-type; bh=KFi0siMjo6bwfl5YMc00DhmKQL9fO3X2YirA5dwYSa0=; b=F8lq/walk5cntbT6yem4PSmQ4fysPsSyJgPLDDiX7uDYmMAl2ekYamUzxmN9sKbi9r sgcM4WXzkkBasDUo3YbzpJsQEI+E6LfG61QuWVROOstVKDBS4/8iNw0SB1QxXu+leb4A uacEXiOgsTQ6bFBW1mICWte6rcfQLOCLmIy751GF0vLoz73eTcO5eDt9aF+a+v51qZeb KMc6FouiHOtCyOptGrX5XVse8DB09w0UnSXZEQ/a7TTGXYUIt/+QlkthZ34sJyCCSDec TYaRe087oVafnveP1V3rUFk3dSQ9x/BWgmLGxl3Ex3RVcewXtVo4MIbsfThf1Yjoz199 gTgw== X-Received: by 10.180.90.166 with SMTP id bx6mr4842510wib.65.1426854758475; Fri, 20 Mar 2015 05:32:38 -0700 (PDT) Original-Received: from firefly (dyn069045.nbw.tue.nl. [131.155.69.45]) by mx.google.com with ESMTPSA id ax10sm6179222wjc.26.2015.03.20.05.32.37 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 20 Mar 2015 05:32:37 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:100691 Archived-At: Here's an example of what I'm trying to do: (setq test-str-1 #(";; This `is' a test" 0 3 (fontified nil face font-lock-comment-delimiter-face) 3 9 (fontified nil face font-lock-comment-face) 9 11 (fontified nil face (font-lock-constant-face font-lock-comment-face)) 11 19 (fontified nil face font-lock-comment-face))) (setq test-str-2 (concat test-str-1)) (add-face-text-property 0 (length test-str-2) 'foobar t test-str-2) I would like to modify `test-str-2' without touching `test-str-1'. For that, I either need `add-face-text-property' to be non-destructive, either w.r.t. the string or at least w.r.t. the properties of the string, or a way to deep-copy a string. Here's the result of evaling the code above: test-str-2 ;; => #(";; This `is' a test" 0 3 (fontified nil face (font-lock-comment-delimiter-face foobar)) 3 9 (fontified nil face (font-lock-comment-face foobar)) 9 11 (fontified nil face (font-lock-constant-face font-lock-comment-face foobar)) 11 19 (fontified nil face (font-lock-comment-face foobar))) test-str-1 ;; => #(";; This `is' a test" 0 3 (face font-lock-comment-delimiter-face fontified nil) 3 9 (face font-lock-comment-face fontified nil) 9 11 (face (font-lock-constant-face font-lock-comment-face foobar) ; <= foobar is here fontified nil) 11 19 (face font-lock-comment-face fontified nil)) As you see, `test-str-1' was modified. I'd like to know a straightforward solution to the problem itself, I'm fine with either way of implementation. Oleh