3

In Emacs color-theme libraries, which items control the visual selection foreground and background?

I'm in the process of giving Emacs a try after many years of Vim use. The vim emulator, Evil, is working imporessively well for me but I'm having trouble with visual selection highlighting. The problem seems to be with my chosen color theme rather than with Evil. I say this because if I comment out the the theme I can see the selected text properly highlighted, but not with my chosen theme which is a port of the ir-black them I use in Vim.

I got the theme from https://github.com/jmdeldin/ir-black-theme.el/blob/master/ir-black-theme.el

Here's the section in my .emacs file that loads Evil and the theme.

;Enable "Evil", the Vim emulation package
(add-to-list 'load-path "~/.emacs.d/evil")
(require 'evil)
(evil-mode 1)
(line-number-mode t)

(add-to-list 'load-path "~/.emacs.d/color-theme-6.6.0")
(require 'color-theme)
(color-theme-initialize)
(color-theme-ir-black)    

I've searched color-theme-ir-black.el for "visual" and find only the following lines that seem possibly relevant.

;;visual selection: #1D1E2C
 (region ((t (:background "#1D1E2C"))))
 (speedbar-file-face ((t (:foreground "#1D1E2C"))))

FWIW, I'm running GNU Emacs 24.4.1 on OS X 10.9.5

6
  • 1
    Why are you loading it with color-theme? Starting from 24, emacs has a built-in color theme manager, which is what ir-black-theme in your link is using. So you load it with (load-theme 'ir-black) (and add its path to custom-theme-load-path). Does doing this address the problem at all?
    – Kirill
    Jan 9, 2015 at 21:23
  • FWIW, I'm using evil and can confirm that region is what controls the visual selection you're describing.
    – Dan
    Jan 9, 2015 at 21:43
  • @Kirill That doesn't seem to work. I tried (add-to-list 'custom-theme-load-path "~/.emacs.d/color-theme-6.6.0/themes") (load-theme 'ir-black) and got a complaint that it couldn't find the theme.
    – Mike Ellis
    Jan 9, 2015 at 22:45
  • 1
    But ir-black in the link that you posted is not an old-style color-theme, you are doing something strange, I think. Try this: remove all mentions to color-theme, download the link you posted (ir-black-theme.el) into ~/.emacs.d, and run (load-theme 'ir-black). I think color-theme is obsoleted by Emacs's custom themes.
    – Kirill
    Jan 9, 2015 at 22:49
  • 1
    FWIW, you shouldn't be using the color-theme package, especially not in combination with load-theme. Get rid of that part of that config and see whether that's it.
    – wasamasa
    Mar 5, 2015 at 9:49

1 Answer 1

1

You could try

(custom-theme-set-faces 'ir-black
  `(region ((t :background "magenta"))))

in your emacs config somewhere after initializing the theme.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.