10

Strike-through texts (like this: +text+) in Org-mode are black by default. I want to make them gray. The problem is, I can't find the place to customize it. I've tried M=x describe-face, and the result is "default face", which is puzzling. Doesn't Org-mode have a place to configure the strike-through color?

Drew
  • 29,895
  • 7
  • 74
  • 104
Betty
  • 512
  • 7
  • 19
  • What version of org-mode are you using? In my 7.9.1 strike +text+ don't change color, only a strike line appears. – Roberto Huelga Nov 02 '12 at 08:33
  • Mine is 7.7. My point is, I want it to change color. – Betty Nov 02 '12 at 12:55
  • As far as I can tell from the docs, strike-through is *not* a face, but an attribute of the text/face which in this case is imposed on top of whatever face is in effect (like, default-face). In other words, you cannot customize it using customize face. – Joost Diepenmaat Nov 02 '12 at 13:36

1 Answers1

12

Customize the org-emphasis-alist variable with M-x customize-variable. Find the list entry where the "marker character" is + and choose the "Font-lock-face" option in the "Value menu" popup. Input the value of a face of your choosing, whose exact look you can customize the usual way, for example with M-x customize-face.

Or, more succinctly:

(require 'cl)   ; for delete*
(setq org-emphasis-alist
      (cons '("+" '(:strike-through t :foreground "gray"))
            (delete* "+" org-emphasis-alist :key 'car :test 'equal)))
user4815162342
  • 141,790
  • 18
  • 296
  • 355
  • This answer is still relevant and works, but the `cl` package has been deprecated as of Emacs 27. Maybe an approach that doesn't depend on `cl` is to define a custom `org-custom-strike-through` face and apply it to the `custom-set-variables` under `org-emphasis-alist`. I can see that somewhat recently there is a patch for a `defface` on strike-through face in `org-faces`, but it's not been merged (idk, I might be mistaken)? [source](https://orgmode.org/list/87a74najrb.fsf@gnu.org/t/) – mnestorov May 13 '21 at 10:47
  • 1
    @mnestorov `cl` is deprecated, but `cl-lib` is alive and well, and defines `cl-delete` which is the equivalent of `delete*`. Of course, you could do it without either, but it would be less elegant/succinct. – user4815162342 May 13 '21 at 11:05
  • Yep, that's true :) I just thought it would be a good idea to mention it, since I recently looked into what's happening with `cl`. – mnestorov May 13 '21 at 11:07