From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Jeremy T. Braun" Newsgroups: gmane.emacs.bugs Subject: bug#23403: 25.1.50; cua-mode does not interact with cursor-face and themes well Date: Fri, 29 Apr 2016 11:19:06 -0700 Message-ID: <5723A59A.6020909@squidevil.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1461954351 20870 80.91.229.3 (29 Apr 2016 18:25:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 29 Apr 2016 18:25:51 +0000 (UTC) To: 23403@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Apr 29 20:25:38 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1awD6d-0001jU-Rg for geb-bug-gnu-emacs@m.gmane.org; Fri, 29 Apr 2016 20:25:36 +0200 Original-Received: from localhost ([::1]:55817 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1awD6Z-0000jw-RI for geb-bug-gnu-emacs@m.gmane.org; Fri, 29 Apr 2016 14:25:31 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37242) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1awD6P-0000TA-K3 for bug-gnu-emacs@gnu.org; Fri, 29 Apr 2016 14:25:28 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1awD6D-0002nW-37 for bug-gnu-emacs@gnu.org; Fri, 29 Apr 2016 14:25:16 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:43416) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1awD6A-0002fs-HP for bug-gnu-emacs@gnu.org; Fri, 29 Apr 2016 14:25:09 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1awD67-00044c-60 for bug-gnu-emacs@gnu.org; Fri, 29 Apr 2016 14:25:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Jeremy T. Braun" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 29 Apr 2016 18:25:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 23403 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.146195427615586 (code B ref -1); Fri, 29 Apr 2016 18:25:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 29 Apr 2016 18:24:36 +0000 Original-Received: from localhost ([127.0.0.1]:55747 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1awD5e-00043F-TW for submit@debbugs.gnu.org; Fri, 29 Apr 2016 14:24:36 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:43789) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1awD1T-0003vo-5K for submit@debbugs.gnu.org; Fri, 29 Apr 2016 14:20:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1awD13-00005C-NW for submit@debbugs.gnu.org; Fri, 29 Apr 2016 14:20:06 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:43813) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1awD11-0008SF-Bz for submit@debbugs.gnu.org; Fri, 29 Apr 2016 14:19:49 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34251) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1awD0p-0000eA-7J for bug-gnu-emacs@gnu.org; Fri, 29 Apr 2016 14:19:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1awD0a-0008FZ-Lg for bug-gnu-emacs@gnu.org; Fri, 29 Apr 2016 14:19:27 -0400 Original-Received: from out5-smtp.messagingengine.com ([66.111.4.29]:58545) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1awD0Y-0008Cy-7Q for bug-gnu-emacs@gnu.org; Fri, 29 Apr 2016 14:19:20 -0400 Original-Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id D55C42065E for ; Fri, 29 Apr 2016 14:19:07 -0400 (EDT) Original-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 Original-Received: from [10.60.0.30] (unknown [192.31.242.195]) by mail.messagingengine.com (Postfix) with ESMTPA id 53173C00016 for ; Fri, 29 Apr 2016 14:19:07 -0400 (EDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 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-Mailman-Approved-At: Fri, 29 Apr 2016 14:24:33 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:117235 Archived-At: 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))