Hide EOL character in EMACS - emacs

I enabled whitespace in Emacs 24.4, and I like everything, except the EOL $ character showing. How can I hide it?
I know I can change it's color with
'(whitespace-newline ((t (:foreground "red" :background "nil"))))
but how can I make the foreground and the background match my theme, without setting the exact colors. Is there something like "transparent" on "invisible"?

It seems to me that you should customize the whitespace-style variable and simply remove the newline options.

Related

How do I change the highlight color for selected text with Emacs / deftheme?

I'm using Emacs 24; I've installed the zenburn theme, which is great, except I cannot see the selection highlight easily with the highlight color provided by zenburn:
By "selection" color, I mean the color of text that I've selected by setting a mark (C-space and moving the cursor to select text).
For the life of me, I cannot figure out how to change it. I've tried changing every combination of highlight, selection, etc.. that I can think of in zenburn-theme.el, but nothing seems to change it.
**For sanity's sake, I've tried changing other colors in the theme to make sure Emacs is loading the file properly - it is - those changes work.*
I would have especially thought that changing highlight would work, but no customizations to the highlight line seem to work:
;;;; Built-in
;;;;; basic coloring
...
`(highlight ((t (:background ,zenburn-bg-05 :foreground ,zenburn-yellow))))
How can I change the selection color?
What you're looking for is the region face. For example:
(set-face-attribute 'region nil :background "#666")
In addition to tungd's solution. You could also then change the font color to make it more readable. E.g. to white
(set-face-attribute 'region nil :background "#666" :foreground "#ffffff")
You can use the customize interface.
M-x customize-face
When prompted for which face, enter region. Then you'll see
something like:
Using customize makes it easy to experiment with lots of colors. Try
clicking [ Choose ] to access the color-picker), then
[ Apply and Save ]. It also nicely organizes your customizations
into a single file (rather than further polluting your init.el).

Emacs colors. why it is gray on current line? zenburn theme

I installed Prelude on my emacs24. I'm using ubuntu 12.04
It worked perfectly the first time I used it, but all the next times it doesn't.
On my current line the font color is gray so it's hard to see what I write. Previously it was a Bold case, keeping any color the line had for reserved words.
How can I fix this?
or also the empty lines with spaces are all yellow
I've been trying to fix it on the:
~/.emacs.d/elpa/zenburn-theme-20130716.1457/zenburn-theme.el
file but I can't find a solution... I think the problem could be between this lines:
;;;;; hl-line-mode
`(hl-line-face ((,class (:background ,zenburn-bg-05))
(t :weight bold)))
`(hl-line ((,class (:background ,zenburn-bg-05)) ; old emacsen
(t :weight bold)))
Thanks!
You can change the background and foreground to whatever you want, or turn it off completely. You can add bold or underline or overline or slant, or whatever floats your boat. One of my very first projects was to take the settings from color-theme and put it into my .emacs file and I haven't used a specific color theme since. Oh, and of course you want to open your .emacs or init file to see if there are any settings that conflict with the color theme you are using.
(global-hl-line-mode 1) ;; highlight current line -- see hl-line.el
(custom-set-faces
'(highlight ((t (:background "grey80" :foreground "black" :bold t)))) ;; highlight current line
)
Important:
Add to .bashrc file:
export TERM=xterm-256color
and I found the perfect configuration for me. Here it goes:
;;;;; hl-line-mode
(custom-set-faces
'(highlight ((t (:background "grey20" :foreground nil :bold t)))) ;; highligh\
t current line
)
This way you keep every color for reserved words all bold and a gray background for the current line. Everything will be beautiful =)

How to customize the volatile-highlights background color?

I use the volatitle-highlights-mode(VHL) to hightlights last edit region. But the background color of the VHL is much too light in color for the solarized-theme. So I want change the background color of the VHL.
I found the snippets from the VHL, as follow:
(defface vhl/default-face
(cond
((or vhl/.xemacsp
(vhl/.face-inheritance-possible-p))
'((((class color) (background light))
(:background "yellow1"))
(((class color) (background dark))
(:background "SkyBlue4"))
(t :inverse-video t)))
(t
'((t
:inherit secondary-selection
))))
"Face used for volatile highlights."
:group 'volatile-highlights)
this snippets specify the color of the VHL background, so how can I customize the background color in my .emacs.d to override the default VHL background color.
Snippets welcome! Thanks.
You can also just use M-x customize-face RET vhl/default-face. It does not matter how the face is defined: you can still use Customize to customize it.
The code above looks strange: It seems to check whether face inheritance is possible and, if not, try to inherit from the secondary-selection face (!!)
Anyway, the easiest thing to do is use customize-face, like wvxvw suggested in the comments to your question. I don't quite understand your response to his answer: setting a face that doesn't exist won't cause any error. However, if you're worried, you can cut the (custom-set-face .... ) form that appears in your .emacs and stick it in a file in .emacs.d: the warning about only using one instance in your .emacs is so that the customize infrastructure knows how to edit the file.

Change Emacs syntax highlighting colors

I'm running Emacs, editing files in C++ mode and PHP mode. I love syntax highlighting as a concept, but the default colors are a travesty. I can barely read some of them: way too dark. What is the easiest way to change their values? I can't seem to find anything about this on the web. I don't even mind changing the binary as I'm compiling my own Emacs. I just want to find the place where it says blue is #0000FF and change it to #AAAAFF for example.
I find it easiest to use color-theme for this sort of thing.
But if you don't want to do that, put the cursor over the offending text, and hit M-x customize-face. It should default to the face that the cursor is over.
See 49.1.6 Customizing Specific Items.
Two ways - you can install the package color-theme, which has lots of nice schemes to select and is easier to do it by hand. The by-hand looks like this (in your .emacs file)
(custom-set-faces
custom-set-faces was added by Custom.
If you edit it by hand, you could mess it up, so be careful.
Your init file should contain only one such instance.
If there is more than one, they won't work right.
'(default ((t (:inherit nil :stipple nil :background "lightyellow2" :foreground "gray20" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight bold :width normal :family "liberation mono"))))
'(background "blue")
'(font-lock-builtin-face ((((class color) (background dark)) (:foreground "Turquoise"))))
'(font-lock-comment-face ((t (:foreground "MediumAquamarine"))))
'(font-lock-constant-face ((((class color) (background dark)) (:bold t :foreground "DarkOrchid"))))
'(font-lock-doc-string-face ((t (:foreground "green2"))))
'(font-lock-function-name-face ((t (:foreground "SkyBlue"))))
'(font-lock-keyword-face ((t (:bold t :foreground "CornflowerBlue"))))
'(font-lock-preprocessor-face ((t (:italic nil :foreground "CornFlowerBlue"))))
'(font-lock-reference-face ((t (:foreground "DodgerBlue"))))
'(font-lock-string-face ((t (:foreground "LimeGreen"))))
...
etc. etc.
You can also type
`M-x customize-face RET`
which will give you all the customizations to set, ultimately end up in your .emacs file.
Put the cursor on a face ("color") that you want to change. Hit C-u C-x =. That will tell you which face(s) are present at that position, and it will let you click to customize it/them. Save your customizations.
If you don't care about color highlighting at all, or none of the previous answers work for you (or take too much time and effort to figure out), here is a very simple solution that will get rid of colors altogether.
Typing the following will get rid of colors:
M-x global-font-lock-mode
You can also do this as an interim step to allow you to actually see everything your screen to try any of the above answers. In my case, this was very useful because the color of certain key pieces of text which would allow me to change colors were themselves nearly invisible - for instance, the prompt of M-x.
If you want the change to be permanent, you can add this to your .emacs file:
(setq-default global-font-lock-mode nil)
Starting with Emacs 24.1, you can use M-x customize-themes to select a colour theme.
Emacs comes with a dozen or so themes with varying brightness and colourfulness, so you'll most likely find something that mostly matches your preferences.
You can also find more colour themes installable through MELPA at https://peach-melpa.org/ - no, that web site seems to be down. You can search for "theme" at melpa.org, but it doesn't show any screenshots.

Can I use cperl-mode with perl-mode colorization?

The Emacs cperl-mode seems to get confused less than perl-mode, but the Skittles effect makes the thing unusable for me. Does anyone have or know of an example of a .emacs block that causes cperl-mode to use the colorization from perl-mode, ideally in a form readable enough that I can go back and turn back on the default colors one element at a time until I reach something I'm comfortable with?
In particular there is a hideously shade of light green used for some builtins that I find quite unreadable, and I prefer my variables to not have the leading $ and $$ and such tinted red along with the variable name. Most of the rest are merely distracting.
Press M-x customize-group RET cperl-faces RET and change coloring to your liking.
With colour themes, the problem is limited to arrays and hashes - and it turns out that that's because cperl-mode defines those faces as being bold-weight, which colour themes don't appear to affect (Solarized doesn't).
In Emacs 23.3 on Mac OS, the following restored the colours to how the colour theme defined them:
(custom-set-faces
'(cperl-array-face ((t (:weight normal))))
'(cperl-hash-face ((t (:weight normal))))
)
You can also use the 'real' perl-mode coloring by overwriting font-lock settings with those of perl-mode.
(require 'perl-mode)
(add-hook 'cperl-mode-hook
(lambda ()
(setq font-lock-defaults
'((perl-font-lock-keywords perl-font-lock-keywords-1 perl-font-lock-keywords-2)
nil nil ((?\_ . "w")) nil
(font-lock-syntactic-face-function . perl-font-lock-syntactic-face-function)))
(font-lock-refresh-defaults)))
You can change the color theme if you don't like the particular default colors.