unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Simplification of faces
@ 2007-09-30 12:54 Richard Stallman
  2007-09-30 15:25 ` Jason Rumney
  2007-09-30 23:53 ` Drew Adams
  0 siblings, 2 replies; 14+ messages in thread
From: Richard Stallman @ 2007-09-30 12:54 UTC (permalink / raw)
  To: emacs-devel

I am thinking of essentially eliminating the face attributes as a way
to control what a face looks like.  Programs would use only `defface'
and `face-spec-set'.

In addition, a spec given in `face-spec-set' would totally replace
whatever spec was previously given for the same face using the
`defface' or `face-spec-set'.  Thus, the appearance information for a
face would consist of a single Lisp datum, plus X resources.
(Inheritance from other faces would still occur.)

I've checked all the uses of `face-spec-set' outside of custom and
faces.el.  It seems they would not need to be changed.

However, this would require rewriting the code that calls
`set-face-attribute' and the older functions such as
`set-face-foreground' that set single attributes.  There are only
about 8 packages in Emacs which do so, so it would not be a big job.
However, there may be some other programs that users use which still
rely on this feature.

What do people think?

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Simplification of faces
  2007-09-30 12:54 Simplification of faces Richard Stallman
@ 2007-09-30 15:25 ` Jason Rumney
  2007-10-01 17:41   ` Richard Stallman
  2007-09-30 23:53 ` Drew Adams
  1 sibling, 1 reply; 14+ messages in thread
From: Jason Rumney @ 2007-09-30 15:25 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

Richard Stallman wrote:
> However, this would require rewriting the code that calls
> `set-face-attribute' and the older functions such as
> `set-face-foreground' that set single attributes.  There are only
> about 8 packages in Emacs which do so, so it would not be a big job.
> However, there may be some other programs that users use which still
> rely on this feature.
>   
Maybe it would help developers of those other programs to mark those
functions as obsolete in 22.2, even though we will not change them until
22.1.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: Simplification of faces
  2007-09-30 12:54 Simplification of faces Richard Stallman
  2007-09-30 15:25 ` Jason Rumney
@ 2007-09-30 23:53 ` Drew Adams
  2007-10-01 17:40   ` Richard Stallman
  1 sibling, 1 reply; 14+ messages in thread
From: Drew Adams @ 2007-09-30 23:53 UTC (permalink / raw)
  To: rms, emacs-devel

> I am thinking of essentially eliminating the face attributes as a way
> to control what a face looks like.  Programs would use only `defface'
> and `face-spec-set'.

What about `modify-face'?

> In addition, a spec given in `face-spec-set' would totally replace
> whatever spec was previously given for the same face using the
> `defface' or `face-spec-set'.  Thus, the appearance information for a
> face would consist of a single Lisp datum, plus X resources.
> (Inheritance from other faces would still occur.)

I'm not too clear on `face-spec-set'. Is what it does now is replace only
those attributes that are included in its SPEC arg, leaving the others
alone?

Its code and doc are a bit confusing to me - it seems to say that it first
"resets all attributes of FACE on FRAME to unspecified"
(face-spec-reset-face). That makes me think that it does what you propose to
do: totally replace the existing spec.

Please help me a little to understand the issue.

> I've checked all the uses of `face-spec-set' outside of custom and
> faces.el.  It seems they would not need to be changed.
>
> However, this would require rewriting the code that calls
> `set-face-attribute' and the older functions such as
> `set-face-foreground' that set single attributes.  There are only
> about 8 packages in Emacs which do so, so it would not be a big job.
> However, there may be some other programs that users use which still
> rely on this feature.

Rely on which feature? Sorry, but it's not clear to me what feature you
would be taking away or changing. If you can clarify, I'll check my code to
see how it might be impacted. I do quite a lot of face attribute changing in
different ways. I hope that I will at least be able to still use
`modify-face'.

> What do people think?

I don't understand the difference in this regard between `face-spec-set' and
`set-face-attribute'. Could you summarize the problem that you want to fix
for the latter?

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Simplification of faces
  2007-09-30 23:53 ` Drew Adams
@ 2007-10-01 17:40   ` Richard Stallman
  2007-10-01 18:18     ` Drew Adams
  0 siblings, 1 reply; 14+ messages in thread
From: Richard Stallman @ 2007-10-01 17:40 UTC (permalink / raw)
  To: Drew Adams; +Cc: emacs-devel

    > I am thinking of essentially eliminating the face attributes as a way
    > to control what a face looks like.  Programs would use only `defface'
    > and `face-spec-set'.

    What about `modify-face'?

`modify-face' is another interface to `set-face-attribute'.  Under
this proposal, we would get rid of both.

    I'm not too clear on `face-spec-set'. Is what it does now is replace only
    those attributes that are included in its SPEC arg, leaving the others
    alone?

That is what I thought yesterday from reading its code, but I see that
in fact it calls `face-spec-reset-face'.  So it already does totally
replace any other settings for that face.

So this proposal therefore reduces to eliminating the
`set-face-attribute' level of interface for controlling faces.

    I hope that I will at least be able to still use
    `modify-face'.

Why do you want to use `modify-face'?

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Simplification of faces
  2007-09-30 15:25 ` Jason Rumney
@ 2007-10-01 17:41   ` Richard Stallman
  0 siblings, 0 replies; 14+ messages in thread
From: Richard Stallman @ 2007-10-01 17:41 UTC (permalink / raw)
  To: Jason Rumney; +Cc: emacs-devel

    Maybe it would help developers of those other programs to mark those
    functions as obsolete in 22.2, even though we will not change them until
    23.1.

I agree, if we do use this idea.  Whether to use this idea
at all is the main question.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: Simplification of faces
  2007-10-01 17:40   ` Richard Stallman
@ 2007-10-01 18:18     ` Drew Adams
  2007-10-02  3:32       ` Richard Stallman
  0 siblings, 1 reply; 14+ messages in thread
From: Drew Adams @ 2007-10-01 18:18 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

>     > I am thinking of essentially eliminating the face
>     > attributes as a way to control what a face looks like.
>     > Programs would use only `defface' and `face-spec-set'.
>
>     What about `modify-face'?
>
> `modify-face' is another interface to `set-face-attribute'.  Under
> this proposal, we would get rid of both.

Could you give a simple example of how a current use of `modify-face' would
be replaced with a call to `face-spec-set' or `defface' in your proposal?

I have nothing against doing things differently; I just want to know whether
and how I can still do what I do now (in some way). What I do now is change
only selected attributes of a face, leaving the rest as they were.

>     I'm not too clear on `face-spec-set'. Is what it does now is
>     replace only those attributes that are included in its SPEC arg,
>     leaving the others alone?
>
> That is what I thought yesterday from reading its code, but I see that
> in fact it calls `face-spec-reset-face'.  So it already does totally
> replace any other settings for that face.

That's what I thought.

See my proposal for `set-face', based on that understanding. AFAICT,
`face-spec-set' completely redefines an existing face, but it cannot be used
to create a new face.

For variables, we have `defvar' and `defcustom' that are analogous to
`defface', but we also have `setq', which is not analogous to
`face-spec-set', AFAICT: `setq' creates a variable if it did not already
exist. What I was asking for was an equivalent of `setq' for faces. Perhaps
`face-spec-set' could be redefined to do that, or a new function `set-face'
could be defined to do that.

> So this proposal therefore reduces to eliminating the
> `set-face-attribute' level of interface for controlling faces.
>
>     I hope that I will at least be able to still use
>     `modify-face'.
>
> Why do you want to use `modify-face'?

To modify a face. ;-)
To modify it only partly - only some attributes.

I have nothing against doing that some other way, but how to do that with
`face-spec-set' is not clear to me. Suppose, for instance, that I just want
to set (e.g. replace) the foreground color. How would I call `face-spec-set'
to do that (and still leave the rest of the face as it was defined?

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Simplification of faces
  2007-10-01 18:18     ` Drew Adams
@ 2007-10-02  3:32       ` Richard Stallman
  2007-10-02 15:05         ` Drew Adams
  0 siblings, 1 reply; 14+ messages in thread
From: Richard Stallman @ 2007-10-02  3:32 UTC (permalink / raw)
  To: Drew Adams; +Cc: emacs-devel

    Could you give a simple example of how a current use of `modify-face' would
    be replaced with a call to `face-spec-set' or `defface' in your proposal?

You need to write a function like `modify-face' that constructs a face
spec out of the args, and then calls `face-spec-set'.

If you want it to change only certain attributes and leave the others
unchanged, you would need to call frame-attribute to get the values of
the other attributes, and perhaps put them into the spec you
construct, so as to make sure they won't be altered.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: Simplification of faces
  2007-10-02  3:32       ` Richard Stallman
@ 2007-10-02 15:05         ` Drew Adams
  2007-10-02 22:00           ` Richard Stallman
  0 siblings, 1 reply; 14+ messages in thread
From: Drew Adams @ 2007-10-02 15:05 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

>     Could you give a simple example of how a current use of
>     `modify-face' would be replaced with a call to `face-spec-set'
>     or `defface' in your proposal?
>
> You need to write a function like `modify-face' that constructs a face
> spec out of the args, and then calls `face-spec-set'.
>
> If you want it to change only certain attributes and leave the others
> unchanged, you would need to call frame-attribute to get the values of
> the other attributes, and perhaps put them into the spec you
> construct, so as to make sure they won't be altered.

What does "call frame-attribute" mean? I see no such function in Emacs 22.1.
Could you please give a more concrete example?

Assuming I could understand and do what you describe, why would each person
need to do all of that, just to be able to change a face attribute? Can't we
have an Emacs function that does exactly that, change certain attributes
only? What was wrong with `modify-face', for that matter?

This is an important feature, for me at least. I need to be able to do this,
whether such a function is available or I need to roll my own. If there will
not be such a function, please let me know just how it can be done.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Simplification of faces
  2007-10-02 15:05         ` Drew Adams
@ 2007-10-02 22:00           ` Richard Stallman
  2007-10-04 16:47             ` Drew Adams
  2007-10-07 18:29             ` Michael Welsh Duggan
  0 siblings, 2 replies; 14+ messages in thread
From: Richard Stallman @ 2007-10-02 22:00 UTC (permalink / raw)
  To: Drew Adams; +Cc: emacs-devel

    > If you want it to change only certain attributes and leave the others
    > unchanged, you would need to call frame-attribute to get the values of
    > the other attributes, and perhaps put them into the spec you
    > construct, so as to make sure they won't be altered.

    What does "call frame-attribute" mean? I see no such function in Emacs 22.1.
    Could you please give a more concrete example?

Sorry, I should have written `face-attribute'.

    Assuming I could understand and do what you describe, why would each person
    need to do all of that, just to be able to change a face attribute? Can't we
    have an Emacs function that does exactly that, change certain attributes
    only? What was wrong with `modify-face', for that matter?

I don't mind.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: Simplification of faces
  2007-10-02 22:00           ` Richard Stallman
@ 2007-10-04 16:47             ` Drew Adams
  2007-10-05 16:14               ` Richard Stallman
  2007-10-07 18:29             ` Michael Welsh Duggan
  1 sibling, 1 reply; 14+ messages in thread
From: Drew Adams @ 2007-10-04 16:47 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

>     > If you want it to change only certain attributes and leave
>     > the others unchanged, you would need to call [face]-attribute
>     > to get the values of the other attributes, and perhaps put
>     > them into the spec you construct, so as to make sure they
>     > won't be altered.
>
>     Assuming I could understand and do what you describe, why
>     would each person need to do all of that, just to be able
>     to change a face attribute? Can't we have an Emacs function
>     that does exactly that, change certain attributes
>     only? What was wrong with `modify-face', for that matter?
>
> I don't mind.

What does that mean?  Will you (still) provide such a function?

Lisp programmers have been able to modify individual face attributes since
at least Epoch (~ GNU Emacs 18.58 + faces and such) in the early 90s. It
would really be a step backward to remove this feature and make everyone try
to roll his own.

Apologies if I misunderstand you - your reply was succinct to the point of
vacuity. To me, at least, this is an important feature; please elaborate a
bit.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Simplification of faces
  2007-10-04 16:47             ` Drew Adams
@ 2007-10-05 16:14               ` Richard Stallman
  2007-10-05 16:25                 ` Drew Adams
  0 siblings, 1 reply; 14+ messages in thread
From: Richard Stallman @ 2007-10-05 16:14 UTC (permalink / raw)
  To: Drew Adams; +Cc: emacs-devel

    What does that mean?  Will you (still) provide such a function?

I would not mind if a new `modify-face' function were added
which operated in terms of `face-spec-set'.  If someone writes it
and does it right, I'd be glad for it to be installed.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: Simplification of faces
  2007-10-05 16:14               ` Richard Stallman
@ 2007-10-05 16:25                 ` Drew Adams
  0 siblings, 0 replies; 14+ messages in thread
From: Drew Adams @ 2007-10-05 16:25 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

>     What does that mean?  Will you (still) provide such a function?
>
> I would not mind if a new `modify-face' function were added
> which operated in terms of `face-spec-set'.  If someone writes it
> and does it right, I'd be glad for it to be installed.

You are proposing a change that has as consequence removal of this feature
in its current form. It makes sense that you take the responsibility to make
sure it gets reimplemented (in some form).

FWIW, I, for one, would mind if this feature, available since the early 90s,
were no longer available. For me, that would be a showstopper.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Simplification of faces
  2007-10-02 22:00           ` Richard Stallman
  2007-10-04 16:47             ` Drew Adams
@ 2007-10-07 18:29             ` Michael Welsh Duggan
  2007-10-09  1:14               ` Richard Stallman
  1 sibling, 1 reply; 14+ messages in thread
From: Michael Welsh Duggan @ 2007-10-07 18:29 UTC (permalink / raw)
  To: rms; +Cc: Drew Adams, emacs-devel

Richard Stallman <rms@gnu.org> writes:

>     > If you want it to change only certain attributes and leave the others
>     > unchanged, you would need to call frame-attribute to get the values of
>     > the other attributes, and perhaps put them into the spec you
>     > construct, so as to make sure they won't be altered.
>
>     What does "call frame-attribute" mean? I see no such function in
>     Emacs 22.1.  Could you please give a more concrete example?
>
> Sorry, I should have written `face-attribute'.
>
>     Assuming I could understand and do what you describe, why would
>     each person need to do all of that, just to be able to change a
>     face attribute? Can't we have an Emacs function that does
>     exactly that, change certain attributes only? What was wrong
>     with `modify-face', for that matter?
>
> I don't mind.

I am looking at `face-attribute', and it looks like it would be easy
enough to rewrite `set-face-attribute' to use `face-spec-set' and
`face-attribute' instead of the current
`set-face-attribute-internal'.  Would this be a reasonable change?

-- 
Michael Welsh Duggan
(md5i@cs.cmu.edu)

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Simplification of faces
  2007-10-07 18:29             ` Michael Welsh Duggan
@ 2007-10-09  1:14               ` Richard Stallman
  0 siblings, 0 replies; 14+ messages in thread
From: Richard Stallman @ 2007-10-09  1:14 UTC (permalink / raw)
  To: Michael Welsh Duggan; +Cc: drew.adams, emacs-devel

    I am looking at `face-attribute', and it looks like it would be easy
    enough to rewrite `set-face-attribute' to use `face-spec-set' and
    `face-attribute' instead of the current
    `set-face-attribute-internal'.  Would this be a reasonable change?

Please give it a try.  To work properly, it will need to find
the spec that was used last, alter it, and specify that one.

It might be easier if we extend the kinds of specs that are possible.
Right now a spec can specify attributes for a particular kind of
screen, and it can specify default attributes that come after those.
If we extend the format of a face spec so that it can have
high-priority overriding attributes, which come before all the rest,
then `set-face-attribute' could work by changing those high-priority
overriding attributes in the spec.

What do people think about that?

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2007-10-09  1:14 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-30 12:54 Simplification of faces Richard Stallman
2007-09-30 15:25 ` Jason Rumney
2007-10-01 17:41   ` Richard Stallman
2007-09-30 23:53 ` Drew Adams
2007-10-01 17:40   ` Richard Stallman
2007-10-01 18:18     ` Drew Adams
2007-10-02  3:32       ` Richard Stallman
2007-10-02 15:05         ` Drew Adams
2007-10-02 22:00           ` Richard Stallman
2007-10-04 16:47             ` Drew Adams
2007-10-05 16:14               ` Richard Stallman
2007-10-05 16:25                 ` Drew Adams
2007-10-07 18:29             ` Michael Welsh Duggan
2007-10-09  1:14               ` Richard Stallman

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).