unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#43396: 27.1; Customized "cursor" face has no effect in daemon mode
@ 2020-09-14 13:23 Teemu Likonen
  2020-09-14 15:33 ` Eli Zaretskii
  0 siblings, 1 reply; 17+ messages in thread
From: Teemu Likonen @ 2020-09-14 13:23 UTC (permalink / raw)
  To: 43396

The "cursor" face's background attribute can be customized to change
text cursor's color. However, customized cursor does not have any effect
in Emacs session which is started with "emacs --daemon" in KDE Plasma
desktop system.

I can reliably reproduce this with these steps:


 1. Create Emacs init file ("~/.emacs.el") with the following content:

        (custom-set-faces
         '(cursor ((t (:background "#0f0")))))

 2. Start "emacs" in normal mode to see that the cursor is green (#0f0).
    Close this Emacs session.

 3. Start Emacs in daemon mode and open a client session:

        $ emacs --daemon=test
        $ emacsclient -c -s test

    This client session has black cursor, not green. (Stop the
    session: M-x kill-emacs RET)


I would expect to see green (#0f0) cursor in Emacs daemon's client
sessions too.



In GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.5)
 of 2020-08-09 built on mithlond
Repository revision: 86d8d76aa36037184db0b2897c434cdaab1a9ae8
Repository branch: emacs-27
Windowing system distributor 'The X.Org Foundation', version 11.0.12004000
System Description: Debian GNU/Linux 10 (buster)

Recent messages:
Loading /home/dtw/.emacs.d/omat/asetukset/org-kalenteri.el (source)...done
Loading /home/dtw/.emacs.d/omat/asetukset/posti.el (source)...done
Loading /home/dtw/.emacs.d/omat/asetukset/wcheck.el (source)...done
Loading /home/dtw/.emacs.d/omat/asetukset/latex.el (source)...done
Loading /home/dtw/.emacs.d/omat/asetukset/tulostus.el (source)...done
Loading /home/dtw/.emacs.d/omat/asetukset/sekalaiset.el (source)...done
Loading /home/dtw/.emacs.d/omat/asetukset/funktiot.el (source)...done
Loading /home/dtw/.emacs.d/omat/asetukset/korjauksia.el (source)...done
Starting Emacs daemon.
When done with this frame, type C-x 5 0

Configured using:
 'configure --prefix=/usr/local --with-x-toolkit=gtk3 --with-xwidgets
 --with-wide-int --without-compress-install'

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND DBUS GSETTINGS GLIB NOTIFY INOTIFY
LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS XWIDGETS
LIBSYSTEMD PDUMPER LCMS2 GMP

Important settings:
  value of $LANG: fi_FI.UTF-8
  value of $XMODIFIERS: @im=none
  locale-coding-system: utf-8-unix

Major mode: Text

Minor modes in effect:
  winner-mode: t
  show-paren-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  icomplete-mode: t
  fido-mode: t
  cl-old-struct-compat-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  window-divider-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  visual-line-mode: t
  transient-mark-mode: t

Load-path shadows:
~/.emacs.d/omat/elisp/loaddefs hides /usr/local/share/emacs/27.1/lisp/loaddefs

Features:
(shadow sort mail-extr emacsbug sendmail notmuch hl-line notmuch-tree
notmuch-jump notmuch-hello wid-edit notmuch-show notmuch-print
notmuch-crypto notmuch-mua notmuch-message notmuch-draft
notmuch-maildir-fcc notmuch-address notmuch-company notmuch-parser
notmuch-wash diff-mode easy-mmode coolj notmuch-query goto-addr
thingatpt icalendar diary-lib diary-loaddefs suomalainen-kalenteri solar
cal-dst holidays hol-loaddefs cal-menu calendar cal-loaddefs notmuch-tag
crm notmuch-lib notmuch-version notmuch-compat mm-view mml-smime smime
dig mailcap server rx message rmc puny dired dired-loaddefs format-spec
rfc822 mml mml-sec epa derived epg epg-config gnus-util rmail
rmail-loaddefs text-property-search time-date mm-decode mm-bodies
mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums
mail-prsvr mailabbrev mail-utils gmm-utils mailheader edmacro kmacro
TL-theme winner ring paren undo-tree diff icomplete cus-start cus-load
tex-site slime-autoloads info package easymenu browse-url url-handlers
url-parse auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs
password-cache json subr-x map url-vars seq byte-opt gv bytecomp
byte-compile cconv cl-loaddefs cl-lib tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads dbusbind inotify lcms2 dynamic-setting
system-font-setting font-render-setting xwidget-internal move-toolbar
gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 112103 10686)
 (symbols 48 13029 1)
 (strings 32 36830 2633)
 (string-bytes 1 1251488)
 (vectors 16 18840)
 (vector-slots 8 236189 4680)
 (floats 8 409 365)
 (intervals 56 316 0)
 (buffers 1000 14))


-- 
/// Teemu Likonen - .-.. http://www.iki.fi/tlikonen/
// OpenPGP: 4E1055DC84E9DFF613D78557719D69D324539450





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

* bug#43396: 27.1; Customized "cursor" face has no effect in daemon mode
  2020-09-14 13:23 bug#43396: 27.1; Customized "cursor" face has no effect in daemon mode Teemu Likonen
@ 2020-09-14 15:33 ` Eli Zaretskii
  2020-09-14 15:58   ` Teemu Likonen
  2021-06-12 12:22   ` Lars Ingebrigtsen
  0 siblings, 2 replies; 17+ messages in thread
From: Eli Zaretskii @ 2020-09-14 15:33 UTC (permalink / raw)
  To: Teemu Likonen; +Cc: 43396

> From: Teemu Likonen <tlikonen@iki.fi>
> Date: Mon, 14 Sep 2020 16:23:39 +0300
> 
> The "cursor" face's background attribute can be customized to change
> text cursor's color. However, customized cursor does not have any effect
> in Emacs session which is started with "emacs --daemon" in KDE Plasma
> desktop system.

I think you need to do that in server-after-make-frame-hook instead,
to make it work in a daemon session.  When the daemon reads your init
file, it doesn't have a GUI frame to play with, so some
display-related customizations don't work until there's a frame.





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

* bug#43396: 27.1; Customized "cursor" face has no effect in daemon mode
  2020-09-14 15:33 ` Eli Zaretskii
@ 2020-09-14 15:58   ` Teemu Likonen
  2021-06-12 12:22   ` Lars Ingebrigtsen
  1 sibling, 0 replies; 17+ messages in thread
From: Teemu Likonen @ 2020-09-14 15:58 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 43396

[-- Attachment #1: Type: text/plain, Size: 836 bytes --]

* 2020-09-14 18:33:31+03, Eli Zaretskii wrote:

> I think you need to do that in server-after-make-frame-hook instead,
> to make it work in a daemon session. When the daemon reads your init
> file, it doesn't have a GUI frame to play with, so some
> display-related customizations don't work until there's a frame.

Thanks for the info. My quick fix with (when (daemonp) ...) works too,
and it happens before creating any frames.


    ;;; ~/.emacs.d/init.el

    (setq custom-file "~/.emacs.d/custom.el")
    (load custom-file)

    (when (daemonp)
      (face-spec-set 'cursor '((((background dark)) :background "#fafafa")
                               (((background light)) :background "black"))))

-- 
/// Teemu Likonen - .-.. http://www.iki.fi/tlikonen/
// OpenPGP: 4E1055DC84E9DFF613D78557719D69D324539450

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 251 bytes --]

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

* bug#43396: 27.1; Customized "cursor" face has no effect in daemon mode
  2020-09-14 15:33 ` Eli Zaretskii
  2020-09-14 15:58   ` Teemu Likonen
@ 2021-06-12 12:22   ` Lars Ingebrigtsen
  2021-06-12 12:47     ` Eli Zaretskii
  1 sibling, 1 reply; 17+ messages in thread
From: Lars Ingebrigtsen @ 2021-06-12 12:22 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 43396, Teemu Likonen

Eli Zaretskii <eliz@gnu.org> writes:

>> The "cursor" face's background attribute can be customized to change
>> text cursor's color. However, customized cursor does not have any effect
>> in Emacs session which is started with "emacs --daemon" in KDE Plasma
>> desktop system.
>
> I think you need to do that in server-after-make-frame-hook instead,
> to make it work in a daemon session.  When the daemon reads your init
> file, it doesn't have a GUI frame to play with, so some
> display-related customizations don't work until there's a frame.

Is this a bug, or just how this has to work?  If it's the latter --
should this be documented more thoroughly?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#43396: 27.1; Customized "cursor" face has no effect in daemon mode
  2021-06-12 12:22   ` Lars Ingebrigtsen
@ 2021-06-12 12:47     ` Eli Zaretskii
  2021-06-13  7:56       ` Eli Zaretskii
  0 siblings, 1 reply; 17+ messages in thread
From: Eli Zaretskii @ 2021-06-12 12:47 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 43396, tlikonen

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: Teemu Likonen <tlikonen@iki.fi>,  43396@debbugs.gnu.org
> Date: Sat, 12 Jun 2021 14:22:28 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> The "cursor" face's background attribute can be customized to change
> >> text cursor's color. However, customized cursor does not have any effect
> >> in Emacs session which is started with "emacs --daemon" in KDE Plasma
> >> desktop system.
> >
> > I think you need to do that in server-after-make-frame-hook instead,
> > to make it work in a daemon session.  When the daemon reads your init
> > file, it doesn't have a GUI frame to play with, so some
> > display-related customizations don't work until there's a frame.
> 
> Is this a bug, or just how this has to work?

Frankly, I'm not sure.  Given the workaround the OP posted, it sounds
like it could be a subtle bug somewhere: custom-set-faces doesn't seem
to call face-set-spec in the daemon case.





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

* bug#43396: 27.1; Customized "cursor" face has no effect in daemon mode
  2021-06-12 12:47     ` Eli Zaretskii
@ 2021-06-13  7:56       ` Eli Zaretskii
  2021-06-28 10:09         ` Teemu Likonen
  0 siblings, 1 reply; 17+ messages in thread
From: Eli Zaretskii @ 2021-06-13  7:56 UTC (permalink / raw)
  To: tlikonen; +Cc: 43396, larsi

> Date: Sat, 12 Jun 2021 15:47:36 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 43396@debbugs.gnu.org, tlikonen@iki.fi
> 
> > > I think you need to do that in server-after-make-frame-hook instead,
> > > to make it work in a daemon session.  When the daemon reads your init
> > > file, it doesn't have a GUI frame to play with, so some
> > > display-related customizations don't work until there's a frame.
> > 
> > Is this a bug, or just how this has to work?
> 
> Frankly, I'm not sure.  Given the workaround the OP posted, it sounds
> like it could be a subtle bug somewhere: custom-set-faces doesn't seem
> to call face-set-spec in the daemon case.

First thing I'd like to know is: when the first GUI frame is created
by that daemon, is there a 'cursor-color' frame parameter in that
frame's parameters list?





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

* bug#43396: 27.1; Customized "cursor" face has no effect in daemon mode
  2021-06-13  7:56       ` Eli Zaretskii
@ 2021-06-28 10:09         ` Teemu Likonen
  2021-06-28 11:54           ` Eli Zaretskii
  0 siblings, 1 reply; 17+ messages in thread
From: Teemu Likonen @ 2021-06-28 10:09 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 43396, larsi

[-- Attachment #1: Type: text/plain, Size: 547 bytes --]

* 2021-06-13 10:56:40+0300, Eli Zaretskii wrote:

> First thing I'd like to know is: when the first GUI frame is created
> by that daemon, is there a 'cursor-color' frame parameter in that
> frame's parameters list?

What do you know by "that frame's parameters list"? Is it in some
variable? Can I test it with the following steps?

    $ emacs --daemon=test
    $ emacsclient -c -s test

    C-h v some-variable RET

-- 
/// Teemu Likonen - .-.. https://www.iki.fi/tlikonen/
// OpenPGP: 4E1055DC84E9DFF613D78557719D69D324539450

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 251 bytes --]

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

* bug#43396: 27.1; Customized "cursor" face has no effect in daemon mode
  2021-06-28 10:09         ` Teemu Likonen
@ 2021-06-28 11:54           ` Eli Zaretskii
  2021-06-28 12:51             ` Teemu Likonen
  0 siblings, 1 reply; 17+ messages in thread
From: Eli Zaretskii @ 2021-06-28 11:54 UTC (permalink / raw)
  To: Teemu Likonen; +Cc: 43396, larsi

> From: Teemu Likonen <tlikonen@iki.fi>
> Cc: larsi@gnus.org, 43396@debbugs.gnu.org
> Date: Mon, 28 Jun 2021 13:09:30 +0300
> 
> * 2021-06-13 10:56:40+0300, Eli Zaretskii wrote:
> 
> > First thing I'd like to know is: when the first GUI frame is created
> > by that daemon, is there a 'cursor-color' frame parameter in that
> > frame's parameters list?
> 
> What do you know by "that frame's parameters list"?

The frame parameters list of the first GUI frame created by the daemon
session, when you connect to it with emacsclient for the first time.

> Is it in some variable?

There's a function frame-parameter, it will give you the answer.

> Can I test it with the following steps?
> 
>     $ emacs --daemon=test
>     $ emacsclient -c -s test
> 
>     C-h v some-variable RET

Instead of the last line do this:

  M-: (frame-parameter nil 'cursor-color) RET





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

* bug#43396: 27.1; Customized "cursor" face has no effect in daemon mode
  2021-06-28 11:54           ` Eli Zaretskii
@ 2021-06-28 12:51             ` Teemu Likonen
  2021-06-28 14:53               ` Eli Zaretskii
  0 siblings, 1 reply; 17+ messages in thread
From: Teemu Likonen @ 2021-06-28 12:51 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 43396, larsi

[-- Attachment #1: Type: text/plain, Size: 743 bytes --]

* 2021-06-28 14:54:33+0300, Eli Zaretskii wrote:

> Instead of the last line do this:
>
>   M-: (frame-parameter nil 'cursor-color) RET

Thanks. So, the original recipe:


     1. Create Emacs init file ("~/.emacs.el") with the following
        content:

            (custom-set-faces
             '(cursor ((t (:background "#0f0")))))

     2. Start "emacs" in normal mode to see that the cursor is green
        (#0f0). Close this Emacs session.


M-: (frame-parameter nil 'cursor-color) RET
Retuns: "#0f0" 


     3. Start Emacs in daemon mode and open a client session:

            $ emacs --daemon=test
            $ emacsclient -c -s test


M-: (frame-parameter nil 'cursor-color) RET
Returns: "#31363b"

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 251 bytes --]

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

* bug#43396: 27.1; Customized "cursor" face has no effect in daemon mode
  2021-06-28 12:51             ` Teemu Likonen
@ 2021-06-28 14:53               ` Eli Zaretskii
  2021-06-28 17:07                 ` Teemu Likonen
  0 siblings, 1 reply; 17+ messages in thread
From: Eli Zaretskii @ 2021-06-28 14:53 UTC (permalink / raw)
  To: Teemu Likonen; +Cc: 43396, larsi

> From: Teemu Likonen <tlikonen@iki.fi>
> Cc: larsi@gnus.org, 43396@debbugs.gnu.org
> Date: Mon, 28 Jun 2021 15:51:48 +0300
> 
>      3. Start Emacs in daemon mode and open a client session:
> 
>             $ emacs --daemon=test
>             $ emacsclient -c -s test
> 
> 
> M-: (frame-parameter nil 'cursor-color) RET
> Returns: "#31363b"

You are being hit by the transparent TTY color translation.

What happens if, instead of #0f0 you use #0000ffff0000 ?





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

* bug#43396: 27.1; Customized "cursor" face has no effect in daemon mode
  2021-06-28 14:53               ` Eli Zaretskii
@ 2021-06-28 17:07                 ` Teemu Likonen
  2021-06-28 17:24                   ` Eli Zaretskii
  0 siblings, 1 reply; 17+ messages in thread
From: Teemu Likonen @ 2021-06-28 17:07 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 43396, larsi

[-- Attachment #1: Type: text/plain, Size: 372 bytes --]

* 2021-06-28 17:53:54+0300, Eli Zaretskii wrote:

>> M-: (frame-parameter nil 'cursor-color) RET
>> Returns: "#31363b"
>
> You are being hit by the transparent TTY color translation.
>
> What happens if, instead of #0f0 you use #0000ffff0000 ?

In normal emacs session ("emacs") it returns "#0000ffff0000" but in a
client session ("emacsclient -c") it is still "#31363b".

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 251 bytes --]

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

* bug#43396: 27.1; Customized "cursor" face has no effect in daemon mode
  2021-06-28 17:07                 ` Teemu Likonen
@ 2021-06-28 17:24                   ` Eli Zaretskii
  2021-06-28 18:47                     ` Teemu Likonen
  0 siblings, 1 reply; 17+ messages in thread
From: Eli Zaretskii @ 2021-06-28 17:24 UTC (permalink / raw)
  To: Teemu Likonen; +Cc: 43396, larsi

> From: Teemu Likonen <tlikonen@iki.fi>
> Cc: larsi@gnus.org, 43396@debbugs.gnu.org
> Date: Mon, 28 Jun 2021 20:07:13 +0300
> 
> >> M-: (frame-parameter nil 'cursor-color) RET
> >> Returns: "#31363b"
> >
> > You are being hit by the transparent TTY color translation.
> >
> > What happens if, instead of #0f0 you use #0000ffff0000 ?
> 
> In normal emacs session ("emacs") it returns "#0000ffff0000" but in a
> client session ("emacsclient -c") it is still "#31363b".

And if, instead of custom-set-faces, you use

  (add-to-list 'default-frame-alist '(cursor-color . #0f0))

?





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

* bug#43396: 27.1; Customized "cursor" face has no effect in daemon mode
  2021-06-28 17:24                   ` Eli Zaretskii
@ 2021-06-28 18:47                     ` Teemu Likonen
  2021-06-29 12:21                       ` Eli Zaretskii
  0 siblings, 1 reply; 17+ messages in thread
From: Teemu Likonen @ 2021-06-28 18:47 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 43396, larsi

[-- Attachment #1: Type: text/plain, Size: 887 bytes --]

* 2021-06-28 20:24:24+0300, Eli Zaretskii wrote:

> And if, instead of custom-set-faces, you use
>
>   (add-to-list 'default-frame-alist '(cursor-color . #0f0))

That works -- using the string "#0f0". The client session now has a
cursor with background color "#0f0".

I sent my original report about "Customized 'cursor' face" after reading
Emacs reference manual section "(emacs) Cursor Display". It says:

    On a graphical display, many more properties of the text cursor can be
    altered. To customize its color, change the ‘:background’ attribute of
    the face named ‘cursor’ (*note Face Customization::).

It seems to me that it's a bug if customizing cursor face doesn't work.
It would be odd to define that a feature, so that in normal session we
customize cursor face's background and in daemon we must use
default-frame-alist variable instead.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 251 bytes --]

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

* bug#43396: 27.1; Customized "cursor" face has no effect in daemon mode
  2021-06-28 18:47                     ` Teemu Likonen
@ 2021-06-29 12:21                       ` Eli Zaretskii
  2021-06-29 13:38                         ` Teemu Likonen
  2021-06-30 12:14                         ` Lars Ingebrigtsen
  0 siblings, 2 replies; 17+ messages in thread
From: Eli Zaretskii @ 2021-06-29 12:21 UTC (permalink / raw)
  To: Teemu Likonen; +Cc: 43396, larsi

> From: Teemu Likonen <tlikonen@iki.fi>
> Cc: larsi@gnus.org, 43396@debbugs.gnu.org
> Date: Mon, 28 Jun 2021 21:47:24 +0300
> 
> > And if, instead of custom-set-faces, you use
> >
> >   (add-to-list 'default-frame-alist '(cursor-color . #0f0))
> 
> That works -- using the string "#0f0". The client session now has a
> cursor with background color "#0f0".
> 
> I sent my original report about "Customized 'cursor' face" after reading
> Emacs reference manual section "(emacs) Cursor Display". It says:
> 
>     On a graphical display, many more properties of the text cursor can be
>     altered. To customize its color, change the ‘:background’ attribute of
>     the face named ‘cursor’ (*note Face Customization::).
> 
> It seems to me that it's a bug if customizing cursor face doesn't work.

But it does work, as you have just demonstrated.  The color of the
'cursor' face does change -- except that it changes to a color that is
the closest approximation on a text-mode frame to the color you
requested.  That's because the frame that is selected when the daemon
applies the customizations via custom-set-faces is the daemon frame,
which is not a GUI frame.

> It would be odd to define that a feature, so that in normal session we
> customize cursor face's background and in daemon we must use
> default-frame-alist variable instead.

custom-set-faces recalculates the face attributes and then applies
those attributes to the frame(s).  I don't know how to defer that
recalculation to some future time, when a GUI frame is available,
without hurting more important use cases with face customizations,
which generally need such an immediate recalculation of attributes.

Yes, we have a design bug here (and in some other places):
customizations that need GUI features don't work well when invoked at
startup time in daemon sessions.  If someone knows how to fix
custom-set-faces so that the face is re-evaluated when the first GUI
frame is created, patches and/or ideas are welcome.  Failing that, I
thought I was doing well by helping you resolve this issue in your
init files...





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

* bug#43396: 27.1; Customized "cursor" face has no effect in daemon mode
  2021-06-29 12:21                       ` Eli Zaretskii
@ 2021-06-29 13:38                         ` Teemu Likonen
  2021-06-30 12:14                         ` Lars Ingebrigtsen
  1 sibling, 0 replies; 17+ messages in thread
From: Teemu Likonen @ 2021-06-29 13:38 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 43396, larsi

[-- Attachment #1: Type: text/plain, Size: 498 bytes --]

* 2021-06-29 15:21:45+0300, Eli Zaretskii wrote:

> I thought I was doing well by helping you resolve this issue in your
> init files...

Thank you. You helped be to understand the behaviour. My personal fix
has been an additional (when (daemonp) ...) code:


    (setq custom-file "~/.emacs.d/custom.el")
    (load custom-file)

    (when (daemonp)
      (face-spec-set 'cursor '((((background dark)) :background "#eee")
                               (((background light)) :background "#000"))))

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 251 bytes --]

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

* bug#43396: 27.1; Customized "cursor" face has no effect in daemon mode
  2021-06-29 12:21                       ` Eli Zaretskii
  2021-06-29 13:38                         ` Teemu Likonen
@ 2021-06-30 12:14                         ` Lars Ingebrigtsen
  2021-06-30 12:29                           ` Eli Zaretskii
  1 sibling, 1 reply; 17+ messages in thread
From: Lars Ingebrigtsen @ 2021-06-30 12:14 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 43396, Teemu Likonen

Eli Zaretskii <eliz@gnu.org> writes:

> Yes, we have a design bug here (and in some other places):
> customizations that need GUI features don't work well when invoked at
> startup time in daemon sessions.  If someone knows how to fix
> custom-set-faces so that the face is re-evaluated when the first GUI
> frame is created, patches and/or ideas are welcome. 

Yeah, it's a tricky problem...  unless we just add some brute-forcing of
this when the first graphical frame is created.

That is, we just go through all the faces that have been created already
(with `custom-set-faces') when the user eventually creates a frame, and
then re-evaluate everything.

But...  it seems like there's so many possible negative repercussions to
doing that (if the user has changed the faces further outside the custom
machinery) that it sounds like a kinda chaotic thing to do.

Uhm...  perhaps we could have a `custom-reset-faces' function that
people can put in a server/client hook to achieve this if they want to?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#43396: 27.1; Customized "cursor" face has no effect in daemon mode
  2021-06-30 12:14                         ` Lars Ingebrigtsen
@ 2021-06-30 12:29                           ` Eli Zaretskii
  0 siblings, 0 replies; 17+ messages in thread
From: Eli Zaretskii @ 2021-06-30 12:29 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 43396, tlikonen

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: Teemu Likonen <tlikonen@iki.fi>,  43396@debbugs.gnu.org
> Date: Wed, 30 Jun 2021 14:14:58 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > Yes, we have a design bug here (and in some other places):
> > customizations that need GUI features don't work well when invoked at
> > startup time in daemon sessions.  If someone knows how to fix
> > custom-set-faces so that the face is re-evaluated when the first GUI
> > frame is created, patches and/or ideas are welcome. 
> 
> Yeah, it's a tricky problem...  unless we just add some brute-forcing of
> this when the first graphical frame is created.
> 
> That is, we just go through all the faces that have been created already
> (with `custom-set-faces') when the user eventually creates a frame, and
> then re-evaluate everything.

We have custom-reevaluate-setting, but I think it only works on
variables.  And we lack a mechanism that would perform re-evaluation
of faces that were customized.

> Uhm...  perhaps we could have a `custom-reset-faces' function that
> people can put in a server/client hook to achieve this if they want to?

That could be a sufficient stop-gap solution, IMO.





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

end of thread, other threads:[~2021-06-30 12:29 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-14 13:23 bug#43396: 27.1; Customized "cursor" face has no effect in daemon mode Teemu Likonen
2020-09-14 15:33 ` Eli Zaretskii
2020-09-14 15:58   ` Teemu Likonen
2021-06-12 12:22   ` Lars Ingebrigtsen
2021-06-12 12:47     ` Eli Zaretskii
2021-06-13  7:56       ` Eli Zaretskii
2021-06-28 10:09         ` Teemu Likonen
2021-06-28 11:54           ` Eli Zaretskii
2021-06-28 12:51             ` Teemu Likonen
2021-06-28 14:53               ` Eli Zaretskii
2021-06-28 17:07                 ` Teemu Likonen
2021-06-28 17:24                   ` Eli Zaretskii
2021-06-28 18:47                     ` Teemu Likonen
2021-06-29 12:21                       ` Eli Zaretskii
2021-06-29 13:38                         ` Teemu Likonen
2021-06-30 12:14                         ` Lars Ingebrigtsen
2021-06-30 12:29                           ` 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).