Make a org-mode table. In one of the cells of the table, have
some text that is +struck out+. Note that the struck-out text is
default text color (black, for me), and not org-table text color
(blue, for me). It's even worse if you're running
org-variable-pitch-mode, because the text also won't be set in a
fixed-pitch face, and so will screw up the alignment of table
text. I found out why.
When org-do-emphasis-faces constructs the new face that it applies to the text, it passes the lookup value from the org-emphasis-alist to font-lock-prepend-text-property, which makes a list, composing it with the existing face. This would fail for strike-though mode in a table, since the org-emphasis-alist lookup would return (:strike-through t), resulting in a face of (:strike-through t org-table), which is an invalid face, and then emacs has no choice but to render it unfaced.
Attaching a patch for the issue. Rather than try to figure out how to make org-do-emphasis-faces somehow smart enough to deal with this situation (I'm not sure it's possible, in general), I took the easy way out and defined an org-strike-through face which can be used in org-empasis-alist.
Humbly submitted for your approval...
~mark |
>From 9a489ddf9d411bfc907a5b765d015e757b0b6903 Mon Sep 17 00:00:00 2001 From: "Mark E. Shoulson" <m...@kli.org> Date: Thu, 5 Mar 2020 10:03:37 -0500 Subject: [PATCH] org-faces.el: Add org-strike-through face
org-faces.el: Create org-strike-through face. org.el: Use org-strike-through-face in org-emphasis-alist. --- lisp/org-faces.el | 4 ++++ lisp/org.el | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/org-faces.el b/lisp/org-faces.el index d78b606ec..107ea9763 100644 --- a/lisp/org-faces.el +++ b/lisp/org-faces.el @@ -427,6 +427,10 @@ For source-blocks `org-src-block-faces' takes precedence." :group 'org-faces :version "22.1") +(defface org-strike-through '((t (:strike-through t))) + "Face for struck-through text." + :group 'org-faces) + (defface org-quote '((t (:inherit org-block))) "Face for #+BEGIN_QUOTE ... #+END_QUOTE blocks. Active when `org-fontify-quote-and-verse-blocks' is set." diff --git a/lisp/org.el b/lisp/org.el index 31133c554..8b27e4708 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -3677,7 +3677,7 @@ You need to reload Org or to restart Emacs after setting this.") ("_" underline) ("=" org-verbatim verbatim) ("~" org-code verbatim) - ("+" (:strike-through t))) + ("+" org-strike-through)) "Alist of characters and faces to emphasize text. Text starting and ending with a special character will be emphasized, for example *bold*, _underlined_ and /italic/. This variable sets the -- 2.24.1