Strike through headlines for DONE tasks in Org - emacs

I'd really like to have my DONE task strikken through in Org-mode. Following the snippet from http://lists.gnu.org/archive/html/emacs-orgmode/2007-03/msg00179.html (via Sacha Chua's blog):
(setq org-fontify-done-headline t)
(custom-set-faces
'(org-done ((t (:foreground "PaleGreen"
:weight normal
:strike-through t))))
'(org-headline-done
((((class color) (min-colors 16) (background dark))
(:foreground "LightSalmon" :strike-through t)))))
This however doesn't work for me (colors are changed but no strike-through). I think it might be due to the solarized theme I use: https://github.com/sellout/emacs-color-theme-solarized
Unfortunately I couldn't fix it myself... If I look at customize-face of org-done Strike-through has value "On", but no visual effect.
Thank you very much!

If you are using a light background the snippet needs to be modified, the original author likely used a dark theme.
The key line is:
((class color) (min-colors 16) (background dark))
You could replace (background dark) with (background light), or just remove the background s-exp completely to work in both dark and light themes.
((class color) (min-colors 16))
After an eval-buffer on init.el it should work for your light themes. I did a quick test with solarized light and it works.

Related

Emacs org mode: background color of latex fragments (with `org-highlight-latex-and-related`) : which variable to change?

Ok, so my org-mode latex fragments have a slightly off background color, but only when I:
(setq org-highlight-latex-and-related '(native))
As seen here
It looks similar to the background highlighting functionality as involved in ~~ (code).
Does anyone know what to do?
BONUS:
I'm using doom emacs and the gruvbox theme.
TRIED:
I don't think this is related to the fragments themselves a la org-format-latex-options (as seen in many other posts)
This is NOT helped by setting font-latex-math-face :background
HINTS:
I feel like it IS related to the face org-latex-and-related, but I can work out how the chance the background, when I 'customise' the face i get the following:
(defface org-latex-and-related
(let ((font (cond ((assq :inherit custom-face-attributes)
'(:inherit underline))
(t '(:underline t)))))
`((((class grayscale) (background light))
(:foreground "DimGray" ,#font))
(((class grayscale) (background dark))
(:foreground "LightGray" ,#font))
(((class color) (background light))
(:foreground "SaddleBrown"))
(((class color) (background dark))
(:foreground "burlywood"))
(t (,#font))))
"Face used to highlight LaTeX data, entities and sub/superscript."
:group 'org-faces
:version "24.4"
:package-version '(Org . "8.0"))
Answering my own question.
As usual, tecosaur got there first and gives a good breakdown of the internals.
The code that does the magic is
(require 'org-src)
(add-to-list 'org-src-block-faces '("latex" (:inherit default :extend t)))

orgmode - change code block background color

Below code will change html export background color to #eff0fe:
#+ATTR_HTML: :style background-color:#eff0fe;
#+BEGIN_EXAMPLE
hello world!
#+END_EXAMPLE
like below:
How can we change the background color when edit in emacs?
I saw Pretty fontification of source code blocks document but sounds like it doesn't work for me!
Another approach (which I think is more general) is explained in this page and I have copy-pasted the snippet here. It will only change the code block, and not the #+BEGIN, #+END, or #+RESULTS lines.
The example below will darken the code block by 3 percent (notice the number 3 at the last parameter) relative to the background color of your emacs theme. However, if you change your theme during editing the color of the code block will stay the same.
(require 'color)
(set-face-attribute 'org-block nil :background
(color-darken-name
(face-attribute 'default :background) 3))
Output using a light theme:
Output using a dark theme:
You can modify further the code block color for individual programming language. The example below will modify the code block color for emacs-lisp and python.
(setq org-src-block-faces '(("emacs-lisp" (:background "#EEE2FF"))
("python" (:background "#E5FFB8"))))
Sounds like some face name changed, below config works:
(custom-set-faces
'(org-block-begin-line
((t (:underline "#A7A6AA" :foreground "#008ED1" :background "#EAEAFF" :extend t))))
'(org-block
((t (:background "#EFF0F1" :extend t))))
'(org-block-end-line
((t (:overline "#A7A6AA" :foreground "#008ED1" :background "#EAEAFF" :extend t))))
)
Output:

Customizing highlighting faces in Emacs: Only change the background color

Is there any way to define a face in Emacs (e.g. highlight such as hl-line) so that it only changes the background color (and have Emacs use the foreground color as if the word was not highlighted).
More specifically, I tried the following on the tango-dark theme
(custom-set-faces
'(region ((t (:inherit nil :background "RoyalBlue4"))))
'(highlight ((t (:inherit region :background "dark olive green"))))
'(hl-line ((t (:inherit highlight)))))
and, as can be seen below, region highlighting does respect the foreground font (i.e. it only changes the background color):
                     
but the highlighting of the current line does't:
                       
Why? and how can I get the same effect with hl-line?
Update:
This seems to a bug in the tango-dark theme (a builtin theme of Emacs). The code works well with the default theme (which loads with emacs -Q). I posted this on the official bugs mailing list.
I struggled with this some time ago, and it seems to be a bug of the color theme.
I've come up with a workaround, however. This works for me:
(load-theme 'tango-dark t)
(set-face-attribute 'highlight nil :foreground 'unspecified)
I had a bit similar problem:
(add-hook 'after-make-frame-functions
(lambda (frame)
(select-frame frame)
(when (display-graphic-p frame)
(custom-set-faces '(region ((t (:inherit nil :background "RoyalBlue4")))))
)

Syntax highlighting conflicts with flymake errline color in emacs?

I'm using flymake with jshint to highlight javascript problems in emacs24. My custom.el has
(custom-set-faces '('(flymake-errline ((((class color)) (:background "Red" :foreground "Black")))))
This sets the background color to red for code that jshint complains about, and, because some colors are hard to read against a red background, sets the foreground color to black.
The problem is that if the highlighted code has syntax highlighting, the syntax highlighting color overrides my :foreground "Black", and I still wind up not being able to read the highlighted code.
Aside from picking different colors, what are people doing to avoid this problem?
Update: Strangely, some colors are overridden by my :foreground "Black".
'cat' this to your emacs config file:
(custom-set-faces
'(flymake-errline ((((class color)) (:background "Gray30"))))
'(flymake-warnline ((((class color)) (:background "Gray20")))))

Emacs: whitespace face overriden by solarized?

I tried out the solarized theme (available from here) and really liked it. However, it somehow overwrites my whitespace settings and no matter how I configure the whitespace-face, it gets overwritten. Any ideas on how to control the color of my whitespaces while keeping the neat looking color-theme-solarized-dark?
From .emacs:
;;; Install colortheme
(add-to-list 'load-path "/home/blabla/.emacs.d/color-theme-6.6.0/")
(require 'color-theme)
(eval-after-load "color-theme"
'(progn
(color-theme-initialize)
(color-theme-hober)))
;;; Install solarized
(add-to-list 'load-path "/home/blabla/.emacs.d/emacs-color-theme-solarized")
(require 'color-theme-solarized)
(color-theme-solarized-dark)
This was my previous setup:
(custom-set-faces
'(whitespace-space ((((class color) (background light)) (:background "white" :foreground "darkgrey"))))
'(whitespace-tab ((((class color) (background light)) (:background "white" :foreground "darkgrey")))))
The only thing I found to have any effect was:
(whitespace-space ((t (:background "red"))))
Of course, that just renders an ugly background for every white space.
Using GNU Emacs 23.3.1.
The version of Solarized here has all the faces needed for whitespace-mode to look good with Solarized. It's for Emacs 24 (but may work on Emacs 23 as well if load-theme is present there) only though, but if you don't want to use it you can simply copy the relevant colors into the definition of the color theme you've downloaded.