From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#17507: Documentation for `add-text-property' and relatives Date: Fri, 16 Aug 2019 11:46:08 +0300 Message-ID: <837e7dpkfj.fsf@gnu.org> References: <21365.44878.936634.958813@home.barzilay.org> <87a7cbti4n.fsf@mouse.gnus.org> <83k1beqz6f.fsf@gnu.org> Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="13029"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 17507@debbugs.gnu.org, larsi@gnus.org To: Eli Barzilay Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Aug 16 10:47:12 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hyXt9-0003Fy-1l for geb-bug-gnu-emacs@m.gmane.org; Fri, 16 Aug 2019 10:47:11 +0200 Original-Received: from localhost ([::1]:51794 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyXt7-0006qq-O9 for geb-bug-gnu-emacs@m.gmane.org; Fri, 16 Aug 2019 04:47:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51930) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyXt1-0006qh-5G for bug-gnu-emacs@gnu.org; Fri, 16 Aug 2019 04:47:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyXt0-0003gy-4b for bug-gnu-emacs@gnu.org; Fri, 16 Aug 2019 04:47:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44224) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hyXt0-0003gs-1O for bug-gnu-emacs@gnu.org; Fri, 16 Aug 2019 04:47:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hyXsz-00054w-Ty for bug-gnu-emacs@gnu.org; Fri, 16 Aug 2019 04:47:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 16 Aug 2019 08:47:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17507 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: notabug Original-Received: via spool by 17507-submit@debbugs.gnu.org id=B17507.156594518319463 (code B ref 17507); Fri, 16 Aug 2019 08:47:01 +0000 Original-Received: (at 17507) by debbugs.gnu.org; 16 Aug 2019 08:46:23 +0000 Original-Received: from localhost ([127.0.0.1]:53045 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hyXsM-00053q-Ig for submit@debbugs.gnu.org; Fri, 16 Aug 2019 04:46:23 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:39514) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hyXsK-00053e-OS for 17507@debbugs.gnu.org; Fri, 16 Aug 2019 04:46:21 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:34741) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hyXsF-0003Fz-Em; Fri, 16 Aug 2019 04:46:15 -0400 Original-Received: from [176.228.60.248] (port=4739 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hyXsE-0001Wo-Nd; Fri, 16 Aug 2019 04:46:15 -0400 In-reply-to: (message from Eli Barzilay on Fri, 16 Aug 2019 04:35:35 +0300) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.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" Xref: news.gmane.org gmane.emacs.bugs:165196 Archived-At: > From: Eli Barzilay > Date: Fri, 16 Aug 2019 04:35:35 +0300 > Cc: Lars Ingebrigtsen , 17507@debbugs.gnu.org > > In lisps you can mutate properties of an object, but you cannot change > the pointer itself. I think that another way to clarify it would be > to say that "foo" is actually shorthand for #("foo") but the #() is > omitted for brevity. But at this point this is subjective enough to > be ignorable... Sorry for prolonging this discussion, but I still don't think I understand the difficulty. Allow me to step back a notch and look at this from a higher-level perspective. In Emacs, text properties are stored separately from the text itself. In particular, text properties of a string are not part of the string text, they live in a separate structure, and a string only maintains a reference to that structure. When Emacs needs to display the string, it consults that structure and renders the string characters accordingly. When the Lisp interpreter needs to print the string, it prints the properties as well, to make them visible. It sounds like your mental model of a string was that it included the properties, and therefore you were surprised that add-text-property etc. appeared to modify the string by side effect. Is that what surprised you? If so, would saying that these functions modify the properties of a string without mutating the string itself resolve the difficulty?