Emacs region syntax highlighting - emacs

emacs users out there. I've been tinkering my emacs and encountered a small problem. I have global-font-lock-mode set to t, so i get nice syntax highlighting and it's working fine but when i select a region, highlighting is disabled. Is there a way to fix that?
upd: The issue seems to appear with Solarized theme only. the zenburn theme works nicely.

The Solarized theme sets both the background colour and the foreground colour of the region face. The Zenburn theme only sets the background colour. You could create your own theme by modifying the Solarized theme.

Related

How to make Emacs modline in color?

I've seen number of times emacs screenshots where modline is in color like this one:
How can I do this in emacs?
See the Elisp manual, node Properties in Mode.
Mode-line constructs can be complex - or simple. At their simplest they are strings. And you can propertize strings, i.e., give them text properties, including properties such as face that provide visual effects such as foreground and background color.
You can try packages like powerline, smart-mode-line which do lot of customization to mode line and has some inbuilt themes.
You can get various themes from airline-themes
Here is a screenshot of powerline theme

Emacs Prelude: Background Color

I installed the Emacs Prelude as suggested in https://github.com/bbatsov/prelude . I find the background-color grey of the Zenburn theme to be disturbing. I wish to change the background-color to black. I tried (set-background-color "black") ,but it is not working. The background-color still remains grey. Can someone help on how to fix this ?
I'm assuming you didn't eval (set-background-color "black") (or didn't restart Emacs), since it worked just fine when I tested it with Prelude.
Placing the code in personal.el (as mentioned in the README) will work as well.
Btw, if you don't like Zenburn you might try a different theme, rather than playing its colours. You can see a list of available themes with M-x load-theme. There are details about this in the README as well.
The cleanest way to do this is to edit .emacs.d/init.el and add the following:
(disable-theme 'zenburn)
This will give you a "fresh start" with default color settings. You are then free to change the colors as you wish.
If you like a black background, you might want to install the popular Cyberpunk theme.
M-x package-install RET
cyberpunk themeRET

Controlling the background color of buffer and text in ansi-term in Emacs 24.x

I am running Emacs 24.1. On my .emacs start file I have the following line:
(load-theme 'tango-dark t)
However, when I run an ansi-term terminal, the background colors don't work well:
What's interesting is that for directories, the background color seems to be correct, while for some files the background color is black (even though the buffer's background color is dark grey).
I would like to either:
1: Have the background color of the buffer match the background color of the text (black in this case)
or
2: Have the background color of the text match the background color of the buffer (dark grey in this case), which in this case is configured by tango-dark.
How can I do this? (an answer for both possibilities would be ideal)
Since Emacs 24 the theming mechanism is built-in, and it is slightly different from the color-theme library used for the same purpose before, but it is very similar.
What I think happened is that somehow the theme was initialized before the setting for the terminal color was applied, or, maybe the old theme used to set this color, while the new one doesn't.
Essentially, the theme is a collection of faces, those the author of the theme believed you might use (so you can put into theme the faces that aren't built-in in Emacs). The theme, however, may set other things too, so it could've set the terminal background color using custom-theme-set-variables, or used to do that before, but not any more.
In any case, you should be always able to customize that by either customizing the face itself (which will override the theme settings), or customize the theme. You can do the first using M-xcustomize-faceRETdefaultRET and the second using M-xcustomize-themeRETtango-darkRET

Multiterm background color is wrong

I added multi-term to my emacs config. It works great, but any text in console and some whitespaces (including these in vim from ssh) have white background and since I use deeper-blue style with dark background it does not look nice. How to fix this?
Here is screen: http://tinypic.com/view.php?pic=rh1q9v&s=6
Colors in term.el does not work well sometimes, depending on the timing it is loaded. Calling this after setting your color theme may solve the problem.
(setq term-default-fg-color (face-foreground 'default))
(setq term-default-bg-color (face-background 'default))

Modifying an existing emacs color theme

I like the Emacs color theme clarity. I start the theme with M-x color-theme-clarity. However, I would rather have the background was always black, rather than the mixed black and white as seen in my screenshot. It seems like if there is a line that has never had text on it, it will be white rather than black. How do I fix this?
Thank you and best regards.
That is odd. I also use the clarity color theme and I sometimes notice that if I switch to it from another theme some of the colors are off in certain areas.
Try setting it as the initial color theme in your .emacs file so that it is the first theme used when Emacs is opened:
(require 'color-theme)
(setq color-theme-is-global t)
(color-theme-clarity)
This might help if the issue is caused by a conflict with a previously used theme.
This has been driving me crazy for a while, finally I think I have found the culprit.
It seems that it only happens when you have custom-set-faces settings in your .emacs configuration file. Try comment the settings to see if fixes the problem.
If the the problem is indeed caused by custom-set-faces you can simply set :background "yourcolour" :foreground "yourcolour2" of the custom-set-faces to fix it. "youcolour" and "yourcolour2" should be the colours used by your preferred theme.