emacs-devel
[Top][All Lists]
Advanced

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

Idea: Be able to use text properties as face attributes


From: Drew Adams
Subject: Idea: Be able to use text properties as face attributes
Date: Sun, 26 Mar 2017 12:14:38 -0700 (PDT)

Proposal for discussion.  I think it could be a useful
feature.

(It would no doubt involve Emacs C code, which I wouldn't be
helping with.  I could help with updating the doc, though.)

The idea is to allow the use of text properties as
attributes for the text (and overlay) properties `face',
`font-lock-face', and `mouse-face'.  This would apply to
faces used in strings (e.g., `propertize') as well as in
buffers.

It would let you, for example, use a property such as
`invisible', `keymap', or `read-only' (even `display'?) as
part of a face definition.

Any properties that either cannot be implemented or do not
make sense for faces would be excluded (i.e., ignored).  But
I'm guessing that most could be accommodated.

Setting such a face attribute would have the effect that all
occurrences of text with that face, when redisplayed, would
appear as if the text property were applied directly to the
text that has that face.

For example, this would make all doc strings invisible:

  (set-face-attribute 'font-lock-doc-face nil 'invisible t)

Face merging is already well defined, in particular for
cases where there is a conflict between the values of the
same attribute, so I don't expect any problem there.

One open question would be whether to allow the text
properties `face', `font-lock-face', and `mouse-face' as
properties for themselves and each other.  E.g., be able
to do this:

  (set-face-attribute 'face-1 nil 'face 'face-2)

or this:

  (set-face-attribute 'face-1 nil 'font-lock-face 'face-1)

These properties could be excluded (ignored), but allowing
them might prove useful.  It would provide a simple way to
(e.g. temporarily) substitute one face for another or to
give control over a face to font-lock (change `face' to
`font-lock-face') or vice versa.

WDOT?  Is this something that would be useful?  If so, would
someone like to work on implementing it?



reply via email to

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