emacsemacs24minttyrxvt

How to fix terminal emacs selection highlighting


I'm giving terminal emacs a go. I'm running it in mintty on Cygwin and rxvt on Ubuntu 12.04.

I have a problem: selected text is too hard to read.

Here's how the text looks in mintty with TERM=xterm (I use a slightly different mapping for blue to make it more generally usable):

And TERM=xterm-256color:

And in rxvt:

The selected text is rather hard to read in all cases. I generally use rxvt on Linux, so I'm limited to 16 colors.

Where do I look to change the selection highlighting mode? Ideally I want reverse video for selection so that it is reliably high-contrast, rather than looking for some color to use as the background, as my color palette is extremely limited and I'd rather not waste a slot on it.

Note: I'm not interested in running emacs outside of the terminal. Part of the reason for running it in the terminal is to minimize the differences between Linux, OS X, Solaris and Cygwin, and any one of those systems accessed over ssh, etc.


Solution

  • After much searching, I discovered that emacs uses the term "region" to describe the selected text (I was looking for selected, highlighted, marked). Once I knew it was called "region", I discovered I could use:

    (set-face-background 'region "white")
    (set-face-foreground 'region "black")
    

    which approximates reverse video selection, albeit without any syntax highlighting beyond text decoration (bold and underline).