From: Drew Adams <drew.adams@oracle.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>, emacs-devel@gnu.org
Subject: RE: Idea: Be able to use text properties as face attributes
Date: Tue, 28 Mar 2017 14:40:28 -0700 (PDT) [thread overview]
Message-ID: <4f28c64b-400a-4902-8d8d-84bab71a7c2a@default> (raw)
In-Reply-To: <jwvy3vpl9qm.fsf-monnier+gmane.emacs.devel@gnu.org>
> > for the 'keymap' property. There's nothing we could do with these
> > attributes during processing of faces by the display engine, except
> > record those attributes somewhere, for future use by their respective
> > features.
>
> It's worse: the rest of the code can't assume that the display rendering
> has propagated the info from the fact attributes to that
> "to-be-defined-other-place" since redisplay may not have happened yet or
> may not have looked at that part of the buffer yet.
Please reread what I wrote. I think there has been a
misunderstanding. This feature has nothing to do with
the display engine per se. It is only about leveraging
a face's spec to manipulate other text properties at
locations where the face is used.
For that, we would extend face specs to tolerate (ignore)
unknown face attributes (call them pseudo face attributes,
if you like). And we would support one or more such
attributes that are text-property symbols and their values.
The code that does the supporting (interpreting) of such a
(pseudo) face attribute-that-is-a-text-property is, it is
clear by now (but it was not clear to me initially),
typically _not_ in the display engine. I think we can
remove "display engine" from the discussion. I'm sorry
that I (naively) mentioned it when trying to make clear
that _some C code_ would be implicated.
Wherever that code is, it would check for the text
property that it handles (1) first, by looking for a
face property and checking for the text property as one
of the face property's (pseudo) attributes, and (2)
second, IF #1 did not yield the text property, looking
for it directly on the text, as it does today.
The only thing new would be #1: trying to get the text
property first from a face property. That lets a face
spec override text properties that might already be
applied to the text directly, and it lets a face spec
provide text props that are not yet applied (the general
effect would be as if they had been applied directly).
> This said, Drew's feature doesn't have to require changes all over
> the place. It might be possible to limit those changes to a few core
> place like Fget_text_property.
I can't speak to where or what code changes would be needed.
I do think, however, that the behavior of `get-text-property'
(and perhaps other functions) should _not_ be changed.
Instead we should add another function that gives Lisp code
a way to do the checking described above: first, try to get
the text property from within a face property, and then, if
not obtained, use `get-text-property' to try to get it
(directly) - as is the case now.
> This said, I think using face attributes is a bad idea.
Reason? I can be convinced, but only by reasons.
> Instead, we should consider adding some more general system of
> indirection. Drew suggests using `face` as a special meta-property.
Yes, I suggest using `face', `font-lock-face', and
`mouse-face' text properties to indirectly specify
other text properties.
I chose face properties not by accident, but because the
feature would let you leverage both (1) existing face
locations (occurrences), and (2) existing commands and
other functions that let users and Lisp easily put a face
property on text in various ways, or change it.
Faces are special in those senses - they constitute
especially handy affordances for manipulating text at
locations that are common or significant for users.
> Current code already supports such a feature but using the name
> `category` and only for overlays (and with some problems linked to the
> fact that modifying that meta-property is done via `get` and `put` which
> are very generic operations used for many other things, so it's
> hard/impossible to detect when those meta-properties are changed, which
> is a fairly serious problem. The only reason why we don't suffer too
> much from that problem is because those `category` properties aren't
> used very often).
>
> My proposal for "property planes" is somewhat related to Drew's
> proposal: my "property planes" allow merging various properties into one
> (font-lock can place the (font-lock face) property, and some other
> package can add the (mypkg face) property and they then get merged into
> the one-and-only `face` property), i.e. many-to-one. Drew wants the
> reverse: adding a single meta-property which then affects several
> other properties, i.e. one-to-many.
>
> From a more general point of view, the shared desire is to have
> "abstract text properties" from which "actual text properties"
> get computed.
I'd be more interested in your proposal if I had a
better idea of it. But I suspect that it might be
independent of what I am getting at.
It's true that I'm asking for a way to handle one
or more text properties as a package at different
locations. But my proposal is purposely aimed at
FACES and where they are applied, for the reasons
given above. It's not _only_ about packaging text
props together to act on them in an abstract way.
I fear I'm not getting the point across well, but
I'm willing to keep trying if there is a real desire
to understand.
I fear that combining discussion of your proposal
and mine in the same thread will not be helpful -
unless it is a later thread, which can take advantage
of conclusions already drawn about my proposal (e.g.
yay or nay; specific challenges identified, whatever).
next prev parent reply other threads:[~2017-03-28 21:40 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-26 19:14 Idea: Be able to use text properties as face attributes Drew Adams
2017-03-26 20:01 ` Clément Pit-Claudel
2017-03-26 21:42 ` Drew Adams
2017-03-26 22:14 ` Clément Pit-Claudel
2017-03-26 23:26 ` Drew Adams
2017-03-27 1:23 ` Clément Pit-Claudel
2017-03-27 14:54 ` Eli Zaretskii
2017-03-27 4:51 ` Drew Adams
2017-03-27 14:01 ` Drew Adams
2017-03-27 14:57 ` Eli Zaretskii
[not found] ` <<30eb5a49-2d98-4f37-8f8c-32a88cd76827@default>
[not found] ` <<83bmsm938f.fsf@gnu.org>
2017-03-27 15:49 ` Drew Adams
2017-03-27 18:59 ` Eli Zaretskii
[not found] ` <<<30eb5a49-2d98-4f37-8f8c-32a88cd76827@default>
[not found] ` <<<83bmsm938f.fsf@gnu.org>
[not found] ` <<7f98847c-9b5e-47cf-85f2-247c2045d0af@default>
[not found] ` <<834lye8s1k.fsf@gnu.org>
2017-03-27 20:01 ` Drew Adams
2017-03-28 15:06 ` Eli Zaretskii
2017-03-28 15:26 ` Stefan Monnier
2017-03-28 21:40 ` Drew Adams [this message]
2017-03-28 22:45 ` Stefan Monnier
2017-03-28 23:10 ` Drew Adams
2017-03-29 1:36 ` Stefan Monnier
2017-03-29 5:32 ` Drew Adams
[not found] ` <<<<30eb5a49-2d98-4f37-8f8c-32a88cd76827@default>
[not found] ` <<<<83bmsm938f.fsf@gnu.org>
[not found] ` <<<7f98847c-9b5e-47cf-85f2-247c2045d0af@default>
[not found] ` <<<834lye8s1k.fsf@gnu.org>
[not found] ` <<93aa220a-35c8-4be1-bfb5-299c46c9eba9@default>
[not found] ` <<83tw6d785i.fsf@gnu.org>
2017-03-28 21:39 ` Drew Adams
2017-03-27 7:56 ` Yuri Khan
2017-03-27 14:01 ` Drew Adams
2017-03-27 14:55 ` Eli Zaretskii
2017-03-27 14:51 ` Eli Zaretskii
[not found] <<7a902f7b-d808-4d0f-8ff9-b8f07eaddf83@default>
[not found] ` <<83h92e93ip.fsf@gnu.org>
2017-03-27 16:22 ` Drew Adams
2017-03-27 18:52 ` Eli Zaretskii
[not found] <<<7a902f7b-d808-4d0f-8ff9-b8f07eaddf83@default>
[not found] ` <<<83h92e93ip.fsf@gnu.org>
[not found] ` <<8080a162-700f-42cc-aec9-5fdd7c646297@default>
[not found] ` <<8360iu8sdm.fsf@gnu.org>
2017-03-27 20:01 ` Drew Adams
2017-03-28 15:08 ` Eli Zaretskii
[not found] <<<<7a902f7b-d808-4d0f-8ff9-b8f07eaddf83@default>
[not found] ` <<<<83h92e93ip.fsf@gnu.org>
[not found] ` <<<8080a162-700f-42cc-aec9-5fdd7c646297@default>
[not found] ` <<<8360iu8sdm.fsf@gnu.org>
[not found] ` <<19e94d18-656f-4a8f-8843-4d46ffdd037b@default>
[not found] ` <<83shlx782i.fsf@gnu.org>
2017-03-28 21:39 ` Drew Adams
2017-03-29 14:51 ` Eli Zaretskii
2017-03-29 15:21 ` Lars Ingebrigtsen
2017-03-29 15:36 ` Clément Pit-Claudel
2017-03-29 17:08 ` Drew Adams
2017-03-29 15:41 ` Andreas Politz
2017-03-29 17:08 ` Drew Adams
[not found] <<<<<7a902f7b-d808-4d0f-8ff9-b8f07eaddf83@default>
[not found] ` <<<<<83h92e93ip.fsf@gnu.org>
[not found] ` <<<<8080a162-700f-42cc-aec9-5fdd7c646297@default>
[not found] ` <<<<8360iu8sdm.fsf@gnu.org>
[not found] ` <<<19e94d18-656f-4a8f-8843-4d46ffdd037b@default>
[not found] ` <<<83shlx782i.fsf@gnu.org>
[not found] ` <<403a3ff2-464f-4eb5-9843-60592e786955@default>
[not found] ` <<83a8846srr.fsf@gnu.org>
2017-03-29 17:06 ` Drew Adams
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4f28c64b-400a-4902-8d8d-84bab71a7c2a@default \
--to=drew.adams@oracle.com \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).