emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Idea: Be able to use text properties as face attributes


From: Eli Zaretskii
Subject: Re: Idea: Be able to use text properties as face attributes
Date: Wed, 29 Mar 2017 17:51:04 +0300

> Date: Tue, 28 Mar 2017 14:39:36 -0700 (PDT)
> From: Drew Adams <address@hidden>
> Cc: address@hidden
> 
> That's the point.  The text-property fiddling is confined
> to a particular face.  It affects all occurrences of the
> face (or all on a given frame, optionally).
> 
> That's one advantage.  Another is that we have commands
> that let users easily apply faces to text in various ways
> (match regexps,... whatever).  Another is that users
> already have lots of locations where faces are applied -
> common and significant locations, for users.  So this
> feature has plenty of terrain of immediate application.

Why would I want to make all stretches of text that have, say,
font-lock-constant-face have a particular 'keymap' attribute?  And how
is that more convenient than simply scanning the text for the same
regexp/syntax as the one which used to place the face and actually
putting a 'keymap' property there?  And why do you only ask this for
the 'face' properties, but not for others?

IOW, I'm still struggling to understand why you attach this feature to
faces, and to faces only.

Please also note that at least font-lock faces are by default placed
lazily, on and around the portions of the buffer that are going to be
displayed.  So Lisp programs looking for your special attributes might
not find them if JIT font-lock didn't yet fontify them.

> > > I can't speak to the cost.
> > 
> > I didn't ask you to.  What I did ask is what are the user-level
> > advantages which would justify those costs, whatever they are.  I
> > don't think you answered that question.
> 
> I've described the point of the feature - the advantages.

Am I correct concluding that the advantages, from your POV, are that
users of this feature will be able to avoid the need of specifying the
text to receive this special treatment with regexps, syntax classes,
and other similar means, and instead will be able to use the
definitions already provided for faces?  Is this the only advantage,
or are there others?

> You've hinted at the cost.  Do the advantages outweigh
> the cost?  I have no idea, because I don't know the costs.

I didn't ask you to weigh the costs against the advantages, I asked
only about the advantages.

> So users will be able to:
> 
> 1. Put a face wherever they want (they can do that now).
> 
> 2. Manipulate any text properties (that are supported)
>    at those locations.

Why is it better than just put any property you need, such as
'read-only', directly on that same text?  What non-trivial parts of
the job would be saved by using face attributes instead?

> Faces are special in those senses - they constitute
> especially handy affordances for manipulating text at
> locations that are common or significant for users.

If this is the answer to my question above, then I'm not sure I agree
with you.  E.g., Text mode has no faces by default, but that doesn't
mean Lisp programs working in Text mode won't want to manipulate text
at significant locations.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]