* bug#23403: 25.1.50; cua-mode does not interact with cursor-face and themes well
@ 2016-04-29 18:19 Jeremy T. Braun
0 siblings, 0 replies; only message in thread
From: Jeremy T. Braun @ 2016-04-29 18:19 UTC (permalink / raw
To: 23403
I've had issues where themes couldn't change cursor colors. I finally
figured out the culprit, cua-mode. Details on what I noticed and how I
found it follow.
I believe the "correct" way for themes to interact with the cursor color
is to modify the :background attribute of the face named cursor. See:
https://www.gnu.org/software/emacs/manual/html_node/emacs/Cursor-Display.html
cua-mode defines a variable cua-normal-cursor-color. By default this is
set to one of initial-cursor-color, cursor-color from initial-frame-alis
or default-frame-alist, the frame-parameter 'cursor-color, or "red" if
those are all not true.
When cua-enable-cursor-indications is enabled, cua--update-indications
is run as a part of cua--post-command-handler, which is added to
post-command-hook.
When run, cua-enable-cursor-indications typically calls set-cursor-color
to one of the cua-*-cursor-color variables.
The result? Themes can change the cursor-color (via the face or via
set-cursor-color, but after they are loaded/run, the post-command-hook
eventually runs cua--update-indications, which overwrites the theme's
new "normal" cursor color with whatever was previously stored in
cua-normal-cursor-color (for "normal" buffers, anyway).
I first noticed this because I run emacs in --daemon mode a lot. When
emacs is in --daemon mode, I think that .emacs/init.el is run in the
frame/context of the terminal or background emacs process. When my
init.el is run, (frame-parameter nil 'cursor-color) returns "white",
which cua-normal-cursor-color is set to. When I switch between the
background-mode = dark/light color themes linked below, the cursor
always stays white, and it's illegible in the "light" theme.
https://github.com/sellout/emacs-color-theme-solarized
When I launch emacs without --daemon, my init.el loads the theme first,
which sets frame-parameter.cursor-color to #839496, which initializes
cua-normal-cursor-color, which is legible in both dark and light modes.
I'm not sure how "best" to fix this. Options I see:
* Change documentation on custom themes, requiring that in addition to
modifying the cursor face, they should also modify cua-*-cursor-color.
* Change cua-mode to be aware that themes may modify the cursor face,
and either update cua-normal-cursor-face to reflect the cursor face's
:background attribute, or maybe have cua--update-indications use
something like:
(or cua-normal-cursor-face (grab the :background attribute of
cursor-face))
And then the user can set/customize cua-normal-cursor-face to nil to
allow the theme to control it.
* Document this, and require the user to hook theme loading and
after-make-frame-functions to update cua-normal-cursor-color to be
(frame-parameter frame 'cursor-color), which would have been set by
the theme at that point.
* Other?
Thanks,
Jeremy
In GNU Emacs 25.1.50.2 (x86_64-pc-linux-gnu, GTK+ Version 3.10.8)
of 2016-04-25 built on lgw01-57
Windowing system distributor 'The X.Org Foundation', version 11.0.11501000
System Description: Ubuntu 14.04.4 LTS
Configured using:
'configure --build=x86_64-linux-gnu --prefix=/usr
'--includedir=${prefix}/include' '--mandir=${prefix}/share/man'
'--infodir=${prefix}/share/info' --sysconfdir=/etc --localstatedir=/var
'--libdir=${prefix}/lib/x86_64-linux-gnu'
'--libexecdir=${prefix}/lib/x86_64-linux-gnu' --disable-maintainer-mode
--disable-dependency-tracking --prefix=/usr --sharedstatedir=/var/lib
--program-suffix=-snapshot --with-x=yes --with-x-toolkit=gtk3
'CFLAGS=-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat
-Werror=format-security' CPPFLAGS=-D_FORTIFY_SOURCE=2
'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro''
Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11
Important settings:
value of $LANG: en_US.UTF-8
value of $XMODIFIERS: @im=ibus
locale-coding-system: utf-8-unix
Major mode: Lisp Interaction
Minor modes in effect:
tooltip-mode: t
global-eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Load-path shadows:
None found.
Features:
(shadow sort mail-extr emacsbug message puny seq byte-opt gv bytecomp
byte-compile cl-extra help-mode cconv cl-loaddefs pcase cl-lib dired
dired-loaddefs format-spec rfc822 mml easymenu mml-sec password-cache
epa derived epg epg-config gnus-util rmail rmail-loaddefs mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
time-date mule-util 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 newcomment elisp-mode
lisp-mode prog-mode register page menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame 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 charscript case-table epa-hook jka-cmpr-hook help simple abbrev
obarray minibuffer 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
dbusbind inotify dynamic-setting system-font-setting font-render-setting
move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)
Memory information:
((conses 16 97251 6761)
(symbols 48 20808 0)
(miscs 40 433 132)
(strings 32 17940 4659)
(string-bytes 1 555138)
(vectors 16 13743)
(vector-slots 8 447013 4512)
(floats 8 181 19)
(intervals 56 231 0)
(buffers 976 11)
(heap 1024 33150 1055))
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-04-29 18:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-29 18:19 bug#23403: 25.1.50; cua-mode does not interact with cursor-face and themes well Jeremy T. Braun
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.