emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Mark E. Shoulson" <mark@shoulson.com>
To: org-mode mailing list <emacs-orgmode@gnu.org>
Subject: [PATCH] strike-through text in tables
Date: Tue, 10 Mar 2020 18:56:47 -0400	[thread overview]
Message-ID: <1f816f99-e3a2-f905-53c6-7d1c005ec1da@kli.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 1379 bytes --]

I didn't see a response to this, and I hope it's just because I sent it 
wrongly or something.  If not, is there something amiss with this?

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-emphasis-alist.


Humbly submitted for your approval...


~mark

[-- Attachment #2: 0001-org-faces.el-Add-org-strike-through-face.patch --]
[-- Type: text/plain, Size: 1500 bytes --]

From 9a489ddf9d411bfc907a5b765d015e757b0b6903 Mon Sep 17 00:00:00 2001
From: "Mark E. Shoulson" <mark@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


             reply	other threads:[~2020-03-10 22:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-10 22:56 Mark E. Shoulson [this message]
2020-03-10 23:10 ` [PATCH] strike-through text in tables Bastien
2020-05-22 15:50 ` Bastien
  -- strict thread matches above, loose matches on Subject: below --
2020-03-05 15:30 Mark E. Shoulson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1f816f99-e3a2-f905-53c6-7d1c005ec1da@kli.org \
    --to=mark@shoulson.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).