unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Setting rectangle-preview face in init.
@ 2019-10-11 12:45 Ergus
  2019-10-11 14:00 ` Stefan Monnier
  2019-10-11 14:08 ` Eli Zaretskii
  0 siblings, 2 replies; 11+ messages in thread
From: Ergus @ 2019-10-11 12:45 UTC (permalink / raw)
  To: "T.V Raman" via "Emacs development discussions."

Hi:

I am trying to set the rectangle-preview face in my init.el (to set it
different to region) but I get an error that rectangle-preview is not
a valid face. I see it is not documented, but it is supposed to be
customizable in the customize dialog.

What I am missing here??

Is it possible that rect.el is loaded lazily, so when the init.el is
executed it has not been loaded yet?



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

* Re: Setting rectangle-preview face in init.
  2019-10-11 12:45 Setting rectangle-preview face in init Ergus
@ 2019-10-11 14:00 ` Stefan Monnier
  2019-10-11 14:10   ` Ergus
  2019-10-11 14:08 ` Eli Zaretskii
  1 sibling, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2019-10-11 14:00 UTC (permalink / raw)
  To: Ergus; +Cc: "T.V Raman" via "Emacs development discussions."

> I am trying to set the rectangle-preview face in my init.el

How?

> Is it possible that rect.el is loaded lazily, so when the init.el is
> executed it has not been loaded yet?

It's perfectly normal and a common occurrence for custom-set-faces to be
used before some of the faces are defined, so it's seems unlikely to be
the source of the problem.


        Stefan




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

* Re: Setting rectangle-preview face in init.
  2019-10-11 12:45 Setting rectangle-preview face in init Ergus
  2019-10-11 14:00 ` Stefan Monnier
@ 2019-10-11 14:08 ` Eli Zaretskii
  2019-10-11 14:11   ` Ergus
  1 sibling, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2019-10-11 14:08 UTC (permalink / raw)
  To: Ergus; +Cc: emacs-devel

> Date: Fri, 11 Oct 2019 14:45:30 +0200
> From: Ergus <spacibba@aol.com>
> 
> I am trying to set the rectangle-preview face in my init.el (to set it
> different to region) but I get an error that rectangle-preview is not
> a valid face. I see it is not documented, but it is supposed to be
> customizable in the customize dialog.
> 
> What I am missing here??
> 
> Is it possible that rect.el is loaded lazily, so when the init.el is
> executed it has not been loaded yet?

How do you cause rect.el to be loaded in your init.el?



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

* Re: Setting rectangle-preview face in init.
  2019-10-11 14:00 ` Stefan Monnier
@ 2019-10-11 14:10   ` Ergus
  2019-10-11 14:22     ` Stefan Monnier
  0 siblings, 1 reply; 11+ messages in thread
From: Ergus @ 2019-10-11 14:10 UTC (permalink / raw)
  To: Stefan Monnier
  Cc: "T.V Raman" via "Emacs development discussions."

On Fri, Oct 11, 2019 at 10:00:16AM -0400, Stefan Monnier wrote:
>> I am trying to set the rectangle-preview face in my init.el
>
>How?
>
(set-face-attribute 'rectangle-preview nil :background "#cd0000")

And I get:

==============================
Warning (initialization): An error occurred while loading ???/home/ergo/.emacs.d/init.el???:

error: Invalid face, rectangle-preview

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the ???--debug-init??? option to view a complete error backtrace.
=============================

>> Is it possible that rect.el is loaded lazily, so when the init.el is
>> executed it has not been loaded yet?
>
>It's perfectly normal and a common occurrence for custom-set-faces to be
>used before some of the faces are defined, so it's seems unlikely to be
>the source of the problem.
>
>
>        Stefan
>



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

* Re: Setting rectangle-preview face in init.
  2019-10-11 14:08 ` Eli Zaretskii
@ 2019-10-11 14:11   ` Ergus
  2019-10-11 14:35     ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Ergus @ 2019-10-11 14:11 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

On Fri, Oct 11, 2019 at 05:08:38PM +0300, Eli Zaretskii wrote:
>> Date: Fri, 11 Oct 2019 14:45:30 +0200
>> From: Ergus <spacibba@aol.com>
>>
>> I am trying to set the rectangle-preview face in my init.el (to set it
>> different to region) but I get an error that rectangle-preview is not
>> a valid face. I see it is not documented, but it is supposed to be
>> customizable in the customize dialog.
>>
>> What I am missing here??
>>
>> Is it possible that rect.el is loaded lazily, so when the init.el is
>> executed it has not been loaded yet?
>
>How do you cause rect.el to be loaded in your init.el?

I don't, that's why I am asking. 



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

* Re: Setting rectangle-preview face in init.
  2019-10-11 14:10   ` Ergus
@ 2019-10-11 14:22     ` Stefan Monnier
  2019-10-11 15:44       ` Ergus
  0 siblings, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2019-10-11 14:22 UTC (permalink / raw)
  To: Ergus; +Cc: "T.V Raman" via "Emacs development discussions."

>>> I am trying to set the rectangle-preview face in my init.el
>>How?
> (set-face-attribute 'rectangle-preview nil :background "#cd0000")

Why?  Use Customize instead.  It really works much more sanely for faces.


        Stefan




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

* Re: Setting rectangle-preview face in init.
  2019-10-11 14:11   ` Ergus
@ 2019-10-11 14:35     ` Eli Zaretskii
  0 siblings, 0 replies; 11+ messages in thread
From: Eli Zaretskii @ 2019-10-11 14:35 UTC (permalink / raw)
  To: Ergus; +Cc: emacs-devel

> Date: Fri, 11 Oct 2019 16:11:34 +0200
> From: Ergus <spacibba@aol.com>
> Cc: emacs-devel@gnu.org
> 
> >How do you cause rect.el to be loaded in your init.el?
> 
> I don't, that's why I am asking. 

Then I guess you aren't loading it at all.  Using a face's attribute
doesn't load the file where the face is defined.



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

* Re: Setting rectangle-preview face in init.
  2019-10-11 14:22     ` Stefan Monnier
@ 2019-10-11 15:44       ` Ergus
  2019-10-11 16:13         ` Daniele Nicolodi
                           ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Ergus @ 2019-10-11 15:44 UTC (permalink / raw)
  To: Stefan Monnier
  Cc: "T.V Raman" via "Emacs development discussions."

On Fri, Oct 11, 2019 at 10:22:29AM -0400, Stefan Monnier wrote:
>>>> I am trying to set the rectangle-preview face in my init.el
>>>How?
>> (set-face-attribute 'rectangle-preview nil :background "#cd0000")
>
>Why?  Use Customize instead.  It really works much more sanely for faces.
>
>
>        Stefan
>
Thanks for the answer. I will find another way in any case. But this is
the first time this happens to me.

Just to comment:

I don't like to use Customize interfaces because:

I have my config in a git repo:

1) It changes my init file if I don't define a separate custom-file, and
it modifies it every time I install a package (sometimes just to test)
or change an option.

2) It adds all the stuff outside my pretty ordered config based in
use-packages at the end of the file or where it decides.

3) Some complex setups breaks it (like defining conditional faces
depending of some if conditions (window-system, (display-graphic-p)).)

4) Defining a custom-file (to not track it with git after every
update/package install) then all the faces customization go there too,
so my config will be not portable without it. The init file should
contain only one custom-set-faces... so I cannot mix them.

I won't ask for a change for anything of this, as most of the people
seems to agree with it, but in my case it only makes things more
difficult and disordered.




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

* Re: Setting rectangle-preview face in init.
  2019-10-11 15:44       ` Ergus
@ 2019-10-11 16:13         ` Daniele Nicolodi
  2019-10-11 16:41         ` Stefan Monnier
  2019-10-11 18:50         ` Yuri Khan
  2 siblings, 0 replies; 11+ messages in thread
From: Daniele Nicolodi @ 2019-10-11 16:13 UTC (permalink / raw)
  To: emacs-devel

On 11-10-2019 09:44, Ergus wrote:
> On Fri, Oct 11, 2019 at 10:22:29AM -0400, Stefan Monnier wrote:
>>>>> I am trying to set the rectangle-preview face in my init.el
>>>> How?
>>> (set-face-attribute 'rectangle-preview nil :background "#cd0000")
>>
>> Why?  Use Customize instead.  It really works much more sanely for faces.
>>
> Thanks for the answer. I will find another way in any case. But this is
> the first time this happens to me.
> 
> Just to comment:
> 
> I don't like to use Customize interfaces because:

[snip]

I think Stefan was trying to point you to `custom-set-faces`.

Cheers,
Dan



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

* Re: Setting rectangle-preview face in init.
  2019-10-11 15:44       ` Ergus
  2019-10-11 16:13         ` Daniele Nicolodi
@ 2019-10-11 16:41         ` Stefan Monnier
  2019-10-11 18:50         ` Yuri Khan
  2 siblings, 0 replies; 11+ messages in thread
From: Stefan Monnier @ 2019-10-11 16:41 UTC (permalink / raw)
  To: Ergus; +Cc: "T.V Raman" via "Emacs development discussions."

> I don't like to use Customize interfaces because:

I don't either, but for faces I've found its advantages are significant
compared to the various problems with set-face-attribute.

> 3) Some complex setups breaks it (like defining conditional faces
> depending of some if conditions (window-system, (display-graphic-p)).)

Given that Emacs can have GUI and tty frames within the same session, if
you want your config to work reliably, the
window-system/display-graphic-p/... tests need to be re-executed for
every frame created (rather than calling set-face-attribute such that it
applies to all frames).

Custom actually does let you deal with that by specifying different
attribute values depending on window-system/display-graphic-p/...
(the UI isn't great for that, so I typically edit the custom-set-faces
by hand to do that, which is of course not recommended either, ...).

> I won't ask for a change for anything of this,

FWIW, I think it'd be good to have Elisp-access to Custom's
face manipulation so you wouldn't have to choose between the two,


        Stefan




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

* Re: Setting rectangle-preview face in init.
  2019-10-11 15:44       ` Ergus
  2019-10-11 16:13         ` Daniele Nicolodi
  2019-10-11 16:41         ` Stefan Monnier
@ 2019-10-11 18:50         ` Yuri Khan
  2 siblings, 0 replies; 11+ messages in thread
From: Yuri Khan @ 2019-10-11 18:50 UTC (permalink / raw)
  To: Ergus; +Cc: Stefan Monnier, T.V Raman via Emacs development discussions.

On Fri, 11 Oct 2019 at 22:51, Ergus <spacibba@aol.com> wrote:

> I don't like to use Customize interfaces because:
>
> I have my config in a git repo:
>
> 2) It adds all the stuff outside my pretty ordered config based in
> use-packages at the end of the file or where it decides.

If you are using use-package, you can put custom faces there with :custom-face.



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

end of thread, other threads:[~2019-10-11 18:50 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-11 12:45 Setting rectangle-preview face in init Ergus
2019-10-11 14:00 ` Stefan Monnier
2019-10-11 14:10   ` Ergus
2019-10-11 14:22     ` Stefan Monnier
2019-10-11 15:44       ` Ergus
2019-10-11 16:13         ` Daniele Nicolodi
2019-10-11 16:41         ` Stefan Monnier
2019-10-11 18:50         ` Yuri Khan
2019-10-11 14:08 ` Eli Zaretskii
2019-10-11 14:11   ` Ergus
2019-10-11 14:35     ` Eli Zaretskii

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