From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.devel Subject: How is text properties stored? Date: Wed, 8 May 2019 17:08:06 -0400 Message-ID: <25202F5C-FE09-49D9-8782-5E9D013E0262@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) Content-Type: multipart/alternative; boundary="Apple-Mail=_4B03EDF9-6098-4D73-AF98-708BF1F08A80" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="5564"; mail-complaints-to="usenet@blaine.gmane.org" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed May 08 23:09:04 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hOToG-0001IR-0I for ged-emacs-devel@m.gmane.org; Wed, 08 May 2019 23:09:04 +0200 Original-Received: from localhost ([127.0.0.1]:43794 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOToE-0001Ls-TS for ged-emacs-devel@m.gmane.org; Wed, 08 May 2019 17:09:02 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:54906) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOTnZ-0001Lb-O8 for emacs-devel@gnu.org; Wed, 08 May 2019 17:08:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hOTnY-0000LS-OI for emacs-devel@gnu.org; Wed, 08 May 2019 17:08:21 -0400 Original-Received: from mail-qt1-x82e.google.com ([2607:f8b0:4864:20::82e]:45287) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hOTnY-0000Kf-JK for emacs-devel@gnu.org; Wed, 08 May 2019 17:08:20 -0400 Original-Received: by mail-qt1-x82e.google.com with SMTP id t1so78053qtc.12 for ; Wed, 08 May 2019 14:08:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:mime-version:subject:message-id:date:to; bh=uSQ4oHQ7kj1yxmlYIG1mbxouy1nM/EeXnNWI/5m33pQ=; b=dyPeirSXPJaay8sZao3IkRKRmgDMwSKh3wxtc2hCQfFRFZuujiVOYOF5xIoeH8rI13 x/BoATUQC0DZKWJptH4Hu/hJEtGtq9+gRcdKk0dIbdcXsnx4gBSFU4fjqLucs66i2I18 XI2rq1/XxDAHGkylTac9T0w+igR2jXJX2I66k5Od3CvPj6FncRFVpl9WxEcOMpnA0bv2 8hGmCDwzSdCWO2bk4zdx66DaGRDUkni6lXJUlzdDy++2ShFKt59dtEnJEJoMSXoaTc0Z rsREWYJN/+yPKrU0yFgCOBssIJSrBbNyjmfvmCC2BIu4jPYxGEdxYswCF1rzBG6r7hW5 VJpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:mime-version:subject:message-id:date:to; bh=uSQ4oHQ7kj1yxmlYIG1mbxouy1nM/EeXnNWI/5m33pQ=; b=ukSwBErqVyEGZvKKC2FuMwFePNEFrOetwESxy/dAzatpf218cX0cTgcxcJZCroihPO a+tv/2J3Qcv90gVo9cMR6v0ihpBz3lDU7sfdyKUPF36PaE31s+0oiHT5RaWN7LpUhITt 9cKrK85Xb3PNlcy5lc0H73bXBbS2lRzLpdR3UXG1qIqYZ5HMHOEP9oUUycy4843+AMHq 7cMwwwUkmmgsHWj4rXHtDAP/UiOkwci5qoF97zWxhW8J6Tf6iWKQEaBfG0q88APOA8Sk y2zCwGiwD+oWB3FrFyv0kD8MfXO+ZHwGS7NCRyLUXlc0VzX4WkAxdBADX9AP4o2Fack0 r3fg== X-Gm-Message-State: APjAAAWxa2etm4t8kv4UYT0oyCTKPBOZsRWD04NZQPHFA0lrKYOTTmft lpCujR37EhpG+rCFSMsD5oWTmbdVlQc= X-Google-Smtp-Source: APXvYqwW4RssWxTI301w+C5bzv49cdwLMuAekrLTLZAZRax6BTy6BR0eAwwJE0cxd7ar+NFKL5UqZg== X-Received: by 2002:aed:3bc3:: with SMTP id s3mr121643qte.313.1557349697977; Wed, 08 May 2019 14:08:17 -0700 (PDT) Original-Received: from [192.168.1.11] (c-71-207-8-160.hsd1.pa.comcast.net. [71.207.8.160]) by smtp.gmail.com with ESMTPSA id w58sm12384648qtw.93.2019.05.08.14.08.16 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 May 2019 14:08:17 -0700 (PDT) X-Mailer: Apple Mail (2.3445.102.3) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::82e 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:236315 Archived-At: --Apple-Mail=_4B03EDF9-6098-4D73-AF98-708BF1F08A80 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hi, I=E2=80=99m interested in how is text properties stored in a = string/buffer. =46rom what I see (printing propertzied string and try = reading textprop.c), it seems that they are stored in ranges. Is that = true? If that=E2=80=99s the case, I have two more questions: 1. How is it implemented? I.e., is it like (very roughly): struct string { char* string; property* properties; }; struct property { int beg; int end; Lisp_Object* plist; } ? 2. In my naive minds, if the text properties are implemented like this, = every time when the user insert something in to a buffer/string, all the = properties after the point of insert has to adjust their position (like = overlays). That=E2=80=99s probably not the case since text property is = supposed to be more efficient than overlays. So how does it work? Sincerely, Yuan --Apple-Mail=_4B03EDF9-6098-4D73-AF98-708BF1F08A80 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Hi,

I=E2=80= =99m interested in how is text properties stored in a string/buffer. = =46rom what I see (printing propertzied string and try reading = textprop.c), it seems that they are stored in ranges. Is that = true?

If = that=E2=80=99s the case, I have two more questions:

1. How is it = implemented? I.e., is it like (very roughly):

struct string = {
  char* string;
  = property* properties;
};

struct property {
  int beg;
  int = end;
  Lisp_Object* plist;
}

?

2. = In my naive minds, if the text properties are implemented like this, = every time when the user insert something in to a buffer/string, all the = properties after the point of insert has to adjust their position (like = overlays). That=E2=80=99s probably not the case since text property is = supposed to be more efficient than overlays. So how does it = work?

Sincerely, Yuan

= --Apple-Mail=_4B03EDF9-6098-4D73-AF98-708BF1F08A80--