* Cannot run emacsclient in GUI
@ 2020-11-04 9:41 Ramón Lorenzo Panadés-Barrueta
2020-11-04 15:45 ` Eli Zaretskii
0 siblings, 1 reply; 5+ messages in thread
From: Ramón Lorenzo Panadés-Barrueta @ 2020-11-04 9:41 UTC (permalink / raw)
To: help-gnu-emacs
Hello everyone,
I have been trying to configure Emacs to have a transparent background when
used in the terminal, and specific background color when used in GUI. For
this I have defined the following hook:
(defun on-after-init ()
"Make transparent background only for terminal."
(if (display-graphic-p)
(progn (message "XWINDOW")
(set-face-background 'default "#292b2e"))
(progn (message "TERMINAL")
(set-face-background 'default "unspecified-bg"))))
(add-hook 'window-setup-hook 'on-after-init)
The above happens to work perfectly for emacs, but not for emacsclient,
which yield the following error:
$ emacsclient -c
Waiting for Emacs...
*ERROR*: Undefined color: "unspecified-bg"
On the other hand emacsclient -nw -c, works as expected. Could anyone
please give me some hints on how to solve this issue?
Thanks in advance.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Cannot run emacsclient in GUI
2020-11-04 9:41 Cannot run emacsclient in GUI Ramón Lorenzo Panadés-Barrueta
@ 2020-11-04 15:45 ` Eli Zaretskii
2020-11-04 16:19 ` Ergus
0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2020-11-04 15:45 UTC (permalink / raw)
To: help-gnu-emacs
> From: Ramón Lorenzo Panadés-Barrueta
> <rpana92@gmail.com>
> Date: Wed, 4 Nov 2020 10:41:31 +0100
>
> (defun on-after-init ()
> "Make transparent background only for terminal."
> (if (display-graphic-p)
> (progn (message "XWINDOW")
> (set-face-background 'default "#292b2e"))
> (progn (message "TERMINAL")
> (set-face-background 'default "unspecified-bg"))))
>
> (add-hook 'window-setup-hook 'on-after-init)
>
> The above happens to work perfectly for emacs, but not for emacsclient,
> which yield the following error:
>
> $ emacsclient -c
> Waiting for Emacs...
> *ERROR*: Undefined color: "unspecified-bg"
>
> On the other hand emacsclient -nw -c, works as expected. Could anyone
> please give me some hints on how to solve this issue?
unspecified-bg is meaningless for GUI frames, that's why you get the
error. Try this instead:
(face-spec-reset-face 'default)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Cannot run emacsclient in GUI
2020-11-04 15:45 ` Eli Zaretskii
@ 2020-11-04 16:19 ` Ergus
2020-11-04 16:39 ` Eli Zaretskii
0 siblings, 1 reply; 5+ messages in thread
From: Ergus @ 2020-11-04 16:19 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
Hi Eli:
I am interested in this question.
What's the right way to add a hook like this for emacsclient only?
I mean; does the emacsclient defines a variable to condition
window-setup-hooks? Something like (if emacsclient ...)? or are there
any emacsclient-hook?
The elisp manual about emacsclient specifics is not very explicit IMO.
On Wed, Nov 04, 2020 at 05:45:33PM +0200, Eli Zaretskii wrote:
>> From: Ram�n Lorenzo Panad�s-Barrueta
>> <rpana92@gmail.com>
>> Date: Wed, 4 Nov 2020 10:41:31 +0100
>>
>> (defun on-after-init ()
>> "Make transparent background only for terminal."
>> (if (display-graphic-p)
>> (progn (message "XWINDOW")
>> (set-face-background 'default "#292b2e"))
>> (progn (message "TERMINAL")
>> (set-face-background 'default "unspecified-bg"))))
>>
>> (add-hook 'window-setup-hook 'on-after-init)
>>
>> The above happens to work perfectly for emacs, but not for emacsclient,
>> which yield the following error:
>>
>> $ emacsclient -c
>> Waiting for Emacs...
>> *ERROR*: Undefined color: "unspecified-bg"
>>
>> On the other hand emacsclient -nw -c, works as expected. Could anyone
>> please give me some hints on how to solve this issue?
>
>unspecified-bg is meaningless for GUI frames, that's why you get the
>error. Try this instead:
>
> (face-spec-reset-face 'default)
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Cannot run emacsclient in GUI
2020-11-04 16:19 ` Ergus
@ 2020-11-04 16:39 ` Eli Zaretskii
2020-11-05 10:31 ` Robert Pluim
0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2020-11-04 16:39 UTC (permalink / raw)
To: help-gnu-emacs
> Date: Wed, 4 Nov 2020 17:19:35 +0100
> From: Ergus <spacibba@aol.com>
> Cc: help-gnu-emacs@gnu.org
>
> I am interested in this question.
>
> What's the right way to add a hook like this for emacsclient only?
>
> I mean; does the emacsclient defines a variable to condition
> window-setup-hooks? Something like (if emacsclient ...)? or are there
> any emacsclient-hook?
Your question is only tangentially relevant to the issue in this
thread. I think you want server-after-make-frame-hook.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Cannot run emacsclient in GUI
2020-11-04 16:39 ` Eli Zaretskii
@ 2020-11-05 10:31 ` Robert Pluim
0 siblings, 0 replies; 5+ messages in thread
From: Robert Pluim @ 2020-11-05 10:31 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
Eli Zaretskii <eliz@gnu.org> writes:
>> Date: Wed, 4 Nov 2020 17:19:35 +0100
>> From: Ergus <spacibba@aol.com>
>> Cc: help-gnu-emacs@gnu.org
>>
>> I am interested in this question.
>>
>> What's the right way to add a hook like this for emacsclient only?
>>
>> I mean; does the emacsclient defines a variable to condition
>> window-setup-hooks? Something like (if emacsclient ...)? or are there
>> any emacsclient-hook?
>
> Your question is only tangentially relevant to the issue in this
> thread. I think you want server-after-make-frame-hook.
Although if you want faces to have different attributes based on
whether youʼre using a gui or a tty frame, you can use the (type tty)
selector in the value.
Robert
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-11-05 10:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-04 9:41 Cannot run emacsclient in GUI Ramón Lorenzo Panadés-Barrueta
2020-11-04 15:45 ` Eli Zaretskii
2020-11-04 16:19 ` Ergus
2020-11-04 16:39 ` Eli Zaretskii
2020-11-05 10:31 ` Robert Pluim
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).