X-Loop: help-debbugs@HIDDEN
Subject: bug#23403: 25.1.50; cua-mode does not interact with cursor-face and themes well
Resent-From: "Jeremy T. Braun" <spamprevent@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Fri, 29 Apr 2016 18:25:03 +0000
Resent-Message-ID: <handler.23403.B.146195427615586 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 23403
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: 23403 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.146195427615586
(code B ref -1); Fri, 29 Apr 2016 18:25:03 +0000
Received: (at submit) by debbugs.gnu.org; 29 Apr 2016 18:24:36 +0000
Received: from localhost ([127.0.0.1]:55747 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1awD5e-00043F-TW
for submit <at> debbugs.gnu.org; Fri, 29 Apr 2016 14:24:36 -0400
Received: from eggs.gnu.org ([208.118.235.92]:43789)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <spamprevent@HIDDEN>) id 1awD1T-0003vo-5K
for submit <at> debbugs.gnu.org; Fri, 29 Apr 2016 14:20:15 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
(envelope-from <spamprevent@HIDDEN>) id 1awD13-00005C-NW
for submit <at> debbugs.gnu.org; Fri, 29 Apr 2016 14:20:06 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level:
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,T_DKIM_INVALID
autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:43813)
by eggs.gnu.org with esmtp (Exim 4.71)
(envelope-from <spamprevent@HIDDEN>) id 1awD11-0008SF-Bz
for submit <at> debbugs.gnu.org; Fri, 29 Apr 2016 14:19:49 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:34251)
by lists.gnu.org with esmtp (Exim 4.71)
(envelope-from <spamprevent@HIDDEN>) id 1awD0p-0000eA-7J
for bug-gnu-emacs@HIDDEN; Fri, 29 Apr 2016 14:19:41 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
(envelope-from <spamprevent@HIDDEN>) id 1awD0a-0008FZ-Lg
for bug-gnu-emacs@HIDDEN; Fri, 29 Apr 2016 14:19:27 -0400
Received: from out5-smtp.messagingengine.com ([66.111.4.29]:58545)
by eggs.gnu.org with esmtp (Exim 4.71)
(envelope-from <spamprevent@HIDDEN>) id 1awD0Y-0008Cy-7Q
for bug-gnu-emacs@HIDDEN; Fri, 29 Apr 2016 14:19:20 -0400
Received: from compute3.internal (compute3.nyi.internal [10.202.2.43])
by mailout.nyi.internal (Postfix) with ESMTP id D55C42065E
for <bug-gnu-emacs@HIDDEN>; Fri, 29 Apr 2016 14:19:07 -0400 (EDT)
Received: from frontend1 ([10.202.2.160])
by compute3.internal (MEProxy); Fri, 29 Apr 2016 14:19:07 -0400
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=squidevil.net; h=
content-transfer-encoding:content-type:date:from:message-id
:mime-version:subject:to:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=lMJ
Q0eXho/GMbmCsIYAnHZq08Ws=; b=JXOYlo0XoDvN1ZuDOSH1U3GCCAFZTz55a8c
Uf8O4JvTvOEBu/HCjT7r2FRzmdLQZ4h4i7e+IUHQFpetUoURxVJnA9HtR59dP+yx
nCRcmGLRbdQyJTVOWFqSIA4CRBFINj3/uA64d/+MWVAf0BPGeazvO4Znzxj1umRs
J0Z7GsfI=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=
messagingengine.com; h=content-transfer-encoding:content-type
:date:from:message-id:mime-version:subject:to:x-sasl-enc
:x-sasl-enc; s=smtpout; bh=lMJQ0eXho/GMbmCsIYAnHZq08Ws=; b=WLw5l
LI2+1up1Bg/6J3yxnKZzT1GlgMtNgZcppifgfYohbFEHtljYX5EyXc0o4RzVlTqj
Sd1CWLBK4OdAgHgHVgPdZ/w7VCdsDO0EQaG2V9NVP3I7UZBmn6G88dm10RpR3E6O
EfQefuZToPkMswcdYIQUWO5xbe0MbVoXk/E2IQ=
X-Sasl-enc: W0Ufl9gb55HmuyVhtmIm1N91PDhQLAnU8n8ezeN5N/o8 1461953947
Received: from [10.60.0.30] (unknown [192.31.242.195])
by mail.messagingengine.com (Postfix) with ESMTPA id 53173C00016
for <bug-gnu-emacs@HIDDEN>; Fri, 29 Apr 2016 14:19:07 -0400 (EDT)
From: "Jeremy T. Braun" <spamprevent@HIDDEN>
Message-ID: <5723A59A.6020909@HIDDEN>
Date: Fri, 29 Apr 2016 11:19:06 -0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101
Thunderbird/38.7.2
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.4 (----)
X-Mailman-Approved-At: Fri, 29 Apr 2016 14:24:33 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.4 (----)
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))
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: "Jeremy T. Braun" <spamprevent@HIDDEN> Subject: bug#23403: Acknowledgement (25.1.50; cua-mode does not interact with cursor-face and themes well) Message-ID: <handler.23403.B.146195427615586.ack <at> debbugs.gnu.org> References: <5723A59A.6020909@HIDDEN> X-Gnu-PR-Message: ack 23403 X-Gnu-PR-Package: emacs Reply-To: 23403 <at> debbugs.gnu.org Date: Fri, 29 Apr 2016 18:25:03 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-gnu-emacs@HIDDEN If you wish to submit further information on this problem, please send it to 23403 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 23403: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D23403 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.