emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Tommy Phillips <tphil98@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Patch: hiding emphasis markers
Date: Mon, 11 Sep 2023 19:20:41 +0100	[thread overview]
Message-ID: <75DEDF11-98C7-405D-9373-231AD9AD334D@gmail.com> (raw)

[-- Attachment #1: Type: text/html, Size: 735 bytes --]

[-- Attachment #2: 0001-lisp-org.el-Only-hide-emphasis-markers-that-are-in-o.patch --]
[-- Type: application/octet-stream, Size: 1382 bytes --]

From e0ca6ad91afee63a015736026082937d97715418 Mon Sep 17 00:00:00 2001
From: Thomas Phillips <tphil98@gmail.com>
Date: Mon, 11 Sep 2023 19:02:50 +0100
Subject: [PATCH] lisp/org.el: Only hide-emphasis-markers that are in
 org-emphasis-alist

* lisp/org.el (org-do-emphasis-faces): Add additional predicate to the
  'and' clause that determines whether emphasis markers are hidden.

Problem:
Want to hide only the emphasis markers mentioned in org-emphasis-alist.
After removing "underline" from org-emphasis-alist, '_underline_' is not underlined (correct behaviour), but the '_'s are hidden (incorrect behaviour).

TINYCHANGE
---
 lisp/org.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index 006f3688b..9ecf96c0d 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5157,7 +5157,8 @@ stacked delimiters is N.  Escaping delimiters is not possible."
 	      (add-text-properties (match-beginning 2) (match-end 2)
 				   '(font-lock-multiline t org-emphasis t))
 	      (when (and org-hide-emphasis-markers
-			 (not (org-at-comment-p)))
+			 (not (org-at-comment-p))
+			 (assoc marker org-emphasis-alist))
 		(add-text-properties (match-end 4) (match-beginning 5)
 				     '(invisible t))
                 ;; https://orgmode.org/list/8b691a7f-6b62-d573-e5a8-80fac3dc9bc6@vodafonemail.de
-- 
2.38.1


             reply	other threads:[~2024-08-25 18:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-11 18:20 Tommy Phillips [this message]
2024-09-01 14:49 ` Patch: hiding emphasis markers Ihor Radchenko

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=75DEDF11-98C7-405D-9373-231AD9AD334D@gmail.com \
    --to=tphil98@gmail.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).