all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Eli Barzilay <eli@barzilay.org>
Cc: 17507@debbugs.gnu.org, larsi@gnus.org
Subject: bug#17507: Documentation for `add-text-property' and relatives
Date: Fri, 16 Aug 2019 11:46:08 +0300	[thread overview]
Message-ID: <837e7dpkfj.fsf@gnu.org> (raw)
In-Reply-To: <CALO-gutogOwo1V9_CgJVFRoyCnC9O=5_eOZbM0Sr2v2nrLUyUQ@mail.gmail.com> (message from Eli Barzilay on Fri, 16 Aug 2019 04:35:35 +0300)

> From: Eli Barzilay <eli@barzilay.org>
> Date: Fri, 16 Aug 2019 04:35:35 +0300
> Cc: Lars Ingebrigtsen <larsi@gnus.org>, 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?





  reply	other threads:[~2019-08-16  8:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-16  6:25 bug#17507: Documentation for `add-text-property' and relatives Eli Barzilay
2019-08-14 23:57 ` Lars Ingebrigtsen
2019-08-15  3:41   ` Eli Barzilay
2019-08-15 14:30     ` Eli Zaretskii
2019-08-16  1:35       ` Eli Barzilay
2019-08-16  8:46         ` Eli Zaretskii [this message]
2019-08-16 20:04           ` Lars Ingebrigtsen
2019-08-17  6:47             ` Eli Zaretskii
2019-08-17 22:22             ` Richard Stallman
2019-08-16 23:49           ` Eli Barzilay
2019-08-17  6:41             ` Eli Zaretskii
2019-08-17 12:40               ` Eli Barzilay
2019-08-17 12:46                 ` Eli Zaretskii
2019-08-16  1:20     ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=837e7dpkfj.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=17507@debbugs.gnu.org \
    --cc=eli@barzilay.org \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.