From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Barzilay Newsgroups: gmane.emacs.bugs Subject: bug#17507: Documentation for `add-text-property' and relatives Date: Sat, 17 Aug 2019 02:49:54 +0300 Message-ID: References: <21365.44878.936634.958813@home.barzilay.org> <87a7cbti4n.fsf@mouse.gnus.org> <83k1beqz6f.fsf@gnu.org> <837e7dpkfj.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="29283"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 17507@debbugs.gnu.org, Lars Ingebrigtsen To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Aug 17 01:51:18 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 1hym05-0007Ug-LL for geb-bug-gnu-emacs@m.gmane.org; Sat, 17 Aug 2019 01:51:17 +0200 Original-Received: from localhost ([::1]:33616 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hym04-0004lu-KN for geb-bug-gnu-emacs@m.gmane.org; Fri, 16 Aug 2019 19:51:16 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53523) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylzr-0004gr-R8 for bug-gnu-emacs@gnu.org; Fri, 16 Aug 2019 19:51:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hylzq-0004iq-Gv for bug-gnu-emacs@gnu.org; Fri, 16 Aug 2019 19:51:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46356) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hylzq-0004il-Du for bug-gnu-emacs@gnu.org; Fri, 16 Aug 2019 19:51:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hylzq-0002kt-A2 for bug-gnu-emacs@gnu.org; Fri, 16 Aug 2019 19:51:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Barzilay Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 16 Aug 2019 23:51:02 +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.156599941510529 (code B ref 17507); Fri, 16 Aug 2019 23:51:02 +0000 Original-Received: (at 17507) by debbugs.gnu.org; 16 Aug 2019 23:50:15 +0000 Original-Received: from localhost ([127.0.0.1]:55177 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hylz4-0002jk-Mz for submit@debbugs.gnu.org; Fri, 16 Aug 2019 19:50:14 -0400 Original-Received: from mail-ua1-f41.google.com ([209.85.222.41]:35944) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hylz2-0002jT-75 for 17507@debbugs.gnu.org; Fri, 16 Aug 2019 19:50:12 -0400 Original-Received: by mail-ua1-f41.google.com with SMTP id v20so2668697uao.3 for <17507@debbugs.gnu.org>; Fri, 16 Aug 2019 16:50:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=barzilay-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=g2rF919KI/5m/mM+YVh9C8tf/4LSu+ZcBM3daakrC94=; b=Yojas9ye5BU++occyK+vMmK3mct6BZS43KCRIgDMYKgOUljzqSt8qq0TvaoAma8F/G A1thGvoOEHRrRXLiEf2JZmZRb3lSj6v0E16WWsublZ5hmctYuscqpakipQcikLSq3vFL ntBrZ4EudRxccTEWa4XNTL5M10RCg9nPrvkV6ksFRmFINU+gu1xHG+kO2XW9YrXs2C6c mC23Unrd+Jtro/gbM78yBTfeH7LF3vpRdjjsZ2BCahvHkr8CNTzpgmBCb/Iv8giueoT3 hSGUZPNq9TVeUBISXxGiu+K9McDbv2kgKc5tuWjZmXF5xu70/FTtoTSY4vsE9lK80eVL hfNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=g2rF919KI/5m/mM+YVh9C8tf/4LSu+ZcBM3daakrC94=; b=Sgp1cWA7zLsO3hLeh1/OKOF4AlO8V6slatIT3ClXQGn63/mZyPU3r+lPnVi7K7vD27 Q/NLW8JMmoyWSYvpWnd+M5CkSZwMJJEobLWm65q2RqtypqTh/7/1kNayfLUylDkNqBnu HQS0J6CVTTUIqWnPHd0tSLfM8ni1xmdpTcuGH/tuoXGIoOytlk4ZzrdazB7+/PqS6JAG 1u+NNArvHgN4c7oO86FleBwpE1mQcJSLXa55O6DpYqhWqgUMmiavJ2SXwISEEQ6kP0Ud W7tyqwofk489FDD46JmbrQRzxsbExFfu4lXbhKx5jIw3a8Q5qq8Snr8S8wsRrPpZWrVf zwKg== X-Gm-Message-State: APjAAAXCdWjtgCC6TKZcsrxyJWETSkAgTF4jKQY2CiAL9TDujZ4mgsBK Fz3D28K8mC/Yuxq2BKvXlwln1lVzQnGI4gKpY6TWJg== X-Google-Smtp-Source: APXvYqwnzA3D8ThK9cCGBK/BzmYq4v5d7rFN05/pttcuxfyADtHv5FXkKpjxbY0XfmwC8PZzrinpcZbrLEiLLujYPQc= X-Received: by 2002:ab0:6656:: with SMTP id b22mr1456776uaq.112.1565999406050; Fri, 16 Aug 2019 16:50:06 -0700 (PDT) In-Reply-To: <837e7dpkfj.fsf@gnu.org> 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:165238 Archived-At: To clarify what I said, it sounds like a string is a tuple of the actual string *and* its properties, so it's always #("xyz" ...) where the quotes denote the raw string contents, except that when there's no properties, then you see just the "xyz" part -- but that's *not* a raw string, it just doesn't show the (empty) properties. Yet another way to show this is the fact that if you evaluate #("xyz"), the result is *displayed* as "xyz". Maybe adding some note to that effect (perhaps rephrased, to point at the fact that all strings have properties, there are no raw strings) would have resolved my original confusion. On Fri, Aug 16, 2019 at 11:46 AM Eli Zaretskii wrote: > > > 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? -- ((x=>x(x))(x=>x(x))) Eli Barzilay: http://barzilay.org/ Maze is Life!