From: "Drew Adams" <drew.adams@oracle.com>
To: "'Tim Cross'" <theophilusx@gmail.com>
Cc: 'Philipp Haselwarter' <philipp.haselwarter@gmx.de>, emacs-devel@gnu.org
Subject: RE: Eliminating a couple of independent face definitions
Date: Mon, 7 Feb 2011 14:12:27 -0800 [thread overview]
Message-ID: <8FB964FD62DD469C8CD10E63950ABBCA@us.oracle.com> (raw)
In-Reply-To: <AANLkTi=gwEgRz4sXxU6tUydZsTJicDTvxp56T3Pv_w=Q@mail.gmail.com>
T> I do see some possible implementation issues with
T> the copy concept though. One problem could be
T> determining when to do the copy. If I have face x
T> and then define face y using your proposed copy
T> semantics, how would you control when that copy occurs.
I have not thought about implementation, nor will I really try to. ;-) I leave
that to others more knowledgable.
I did say what I thought was called for wrt copy time, however: copy when the
`defface' with the `:copy-default' gets eval'd. Normally, that's at load time.
And I did mention that only the default-attributes spec would be copied from the
reference face - not the current values of its attributes:
d> Why not introduce a new `defface' keyword `:copy-default'?
d> It would define the new face with the same default
d> attribute values as another face. A copy of those values
d> (actually, of the attributes spec) would be made at
d> `defface' time.
d> Only the _default_ attribute values would be used; the
d> current values of the reference face would have no effect
d> at any time.
IOW, this is a relation between two face _definitions_ (two `defface's), not
between a `defface' and another face's current attribute values.
Yes, this would likely require saving the referenced face spec in some form in
the byte-compiled reference file, if that is not done already. And it would
require copying that spec to the receiver at its `defface' eval time.
[Another possibility is to allow copying when the receiver `defface' is
byte-compiled, not just when it is eval'd. Dunno whether that would be a good
idea or whether it could introduce differences (eval vs compile time).]
No, I haven't tried to think this through, and especially not in terms of
implementation. Just throwing the idea out there as food for thought by others
more qualified.
T> For example, if I customize face x, how will face y
T> know the next time emacs is started to use the old
T> values of face x and not the new customized values?
See above. It would always look to face x's _definition_ (`defface'), not to
its current attribute values. Customization of face x should have no effect.
T> Somehow the defface would need to know to only copy
T> the values from face x the first time it is defined/used
T> i.e. from the first session that the face is used and
T> to then keep those values for future sessions.
Not sure I follow you. It would _never_ copy the current values. It would copy
only the attributes spec from the reference face, that is, the part of the
definition that is called for being copied.
But yes, that spec would need to be available, in the source reference file (no
problem) and in the byte-compiled reference file. A copy chain could presumably
handled: if C copies from B which copies from A, then B's defface would be
eval'd before C's defface.
There might be some problems to work out, but I don't imagine they would be
insurmountable. (But I know nothing about face implementation or
byte-compilation.)
T> Without this, you would simply have a form of delayed
T> inheritance, which is likely going to be even more
T> confusing that using normal inheritance as the change
T> would be session dependent and time delayed.
I don't follow. Again, it is only the default-attributes spec that would be
copied, not the current attribute values. Access to that spec is all that is
needed, I think. And it should be possible to provide that access through the
byte-compiled reference file (as well as through the source reference file) -
that is, the file whose `defface' is copied from.
But again, I might well be missing a thing or two (or three...).
T> This seems like a non-trivial modification to the
T> defface mechanism as it introduces a new state/time
T> dimension i.e. copy face x attributes unless face y
T> attributes have already been copied in a previous session.
The current attribute values would never be copied. Only the default-attributes
spec would be copied - that is, the part of the reference face's definition (its
`defface') that we specified to be copied.
T> Maybe defface could have some type of 'initform'
T> exstension that is used to configure the face if it
T> has no custom setting. The result would need to be
T> written to the custom-faces section so that it is
T> only run once.
I don't follow. But maybe you just misunderstood and thought I meant that the
current attribute values would be copied?
next prev parent reply other threads:[~2011-02-07 22:12 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-02 4:05 Eliminating a couple of independent face definitions Chong Yidong
2011-02-02 4:11 ` Lennart Borgman
2011-02-02 5:02 ` Tim Cross
2011-02-02 15:15 ` Drew Adams
2011-02-02 17:17 ` Chong Yidong
2011-02-02 20:33 ` Philipp Haselwarter
2011-02-02 23:01 ` Lennart Borgman
2011-02-03 19:10 ` Drew Adams
2011-02-04 0:12 ` Tim Cross
2011-02-05 22:11 ` Drew Adams
2011-02-07 0:59 ` Drew Adams
2011-02-07 1:30 ` Tim Cross
2011-02-07 14:09 ` Drew Adams
2011-02-07 21:14 ` Tim Cross
2011-02-07 22:12 ` Drew Adams [this message]
2011-02-08 3:51 ` Tim Cross
2011-02-08 15:26 ` Drew Adams
2011-02-08 19:10 ` Philipp Haselwarter
2011-02-08 13:58 ` Davis Herring
2011-02-08 14:33 ` Drew Adams
2011-02-08 15:34 ` Davis Herring
2011-02-08 16:16 ` Drew Adams
2011-02-08 17:40 ` Lennart Borgman
2011-02-08 19:10 ` Davis Herring
2011-02-07 1:08 ` Tim Cross
2011-02-04 0:18 ` Stephen J. Turnbull
2011-02-04 3:55 ` John Yates
2011-02-04 4:56 ` Stephen J. Turnbull
2011-02-04 4:57 ` Jambunathan K
2011-02-05 22:09 ` Drew Adams
2011-02-06 7:11 ` Stephen J. Turnbull
2011-02-04 10:26 ` Julien Danjou
2011-02-04 17:57 ` color-complement for defface (was: Eliminating a couple of independent face definitions) Ted Zlatanov
2011-02-14 18:11 ` color-complement for defface Ted Zlatanov
2011-02-20 17:44 ` Julien Danjou
2011-03-10 19:09 ` Ted Zlatanov
2011-03-10 19:11 ` Ted Zlatanov
2011-02-02 21:24 ` Eliminating a couple of independent face definitions Tim Cross
2011-02-03 16:14 ` Dan Nicolaescu
2011-02-02 17:16 ` Chong Yidong
2011-02-02 9:58 ` Štěpán Němec
2011-02-02 17:05 ` Chong Yidong
2011-02-02 10:05 ` Julien Danjou
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=8FB964FD62DD469C8CD10E63950ABBCA@us.oracle.com \
--to=drew.adams@oracle.com \
--cc=emacs-devel@gnu.org \
--cc=philipp.haselwarter@gmx.de \
--cc=theophilusx@gmail.com \
/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).