Highlighting a region in emacs is invisible because region color equals window color

Bug #1628707 reported by Daniel Barrett on 2016-09-28
This bug affects 6 people
Affects Status Importance Assigned to Milestone
emacs24 (Ubuntu)

Bug Description

If you open an Emacs window in Plasma/KDE, and you try to highlight a region of text by dragging the mouse, no highlighting appears. This is because the color for highlighting a region is identical to the color for the window background. I believe this color clash occurs between Ubuntu's emacs24 package and Ubuntu's X resource settings.

To reproduce, log into Plasma, remove your $HOME/.emacs init file (so you have no personal customizations), and run emacs in an X window:

  $ emacs

The window's background color is a light gray. Then type any text, click and drag the mouse over the text (or use keystroke commands to define a region). No highlighting appears, because the "region" color is also light gray. You can see this by running the emacs command:

  M-x list-faces-display <ENTER>

I'll attach a screenshot so you can see that the "region" highlighting doesn't show up.

The problem goes away if you disable the Ubuntu-supplied emacs init files:

  $ emacs -Q

This is why I suspect the color is set badly in the Ubuntu emacs24 package.

You can see the X background color by running the "appres" command in a shell window, which proves a light gray background is set, the same color as region highlighting:

  *background: #eff0f1

I tried to find the file where this background color is set, but I was not successful.

ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: emacs24 24.5+1-6ubuntu1
ProcVersionSignature: Ubuntu 4.4.0-38.57-generic 4.4.19
Uname: Linux 4.4.0-38-generic x86_64
ApportVersion: 2.20.1-0ubuntu2.1
Architecture: amd64
CurrentDesktop: KDE
Date: Wed Sep 28 18:07:25 2016
InstallationDate: Installed on 2016-09-25 (3 days ago)
InstallationMedia: Kubuntu 16.04.1 LTS "Xenial Xerus" - Release amd64 (20160719)
SourcePackage: emacs24
UpgradeStatus: No upgrade log present (probably fresh install)

Daniel Barrett (dbarrett-m) wrote :
Daniel Barrett (dbarrett-m) wrote :

It's possible that some X resource hidden in my account is setting the background color. Can someone please tell me where to look for these resource settings?

Joachim Klaehn (chipknecht) wrote :

Hello, i have got the same problem.

emacs -q shows the error
emacs -Q doesn't

lets me assume either emacs is doing something worong when getting x configuration or x config is wrong

my work around was putting following line to my .emacs file

(set-face-attribute 'region nil :background "#666" :foreground "#ffffff")

to set back and foreground of selection manually, which solved the problem

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in emacs24 (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers