emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Patch: hiding org emphasis markers
@ 2023-09-11 18:25 Tommy Phillips
  2023-09-14 12:47 ` Ihor Radchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Tommy Phillips @ 2023-09-11 18:25 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 159 bytes --]

Hello,

Here is a suggested small patch for how org hides emphasis markers.
It's my first patch so hopefully I'm submitting it correctly.

All the best,
Tommy

[-- Attachment #1.2: Type: text/html, Size: 262 bytes --]

[-- Attachment #2: 0001-lisp-org.el-Only-hide-emphasis-markers-that-are-in-o.patch --]
[-- Type: application/octet-stream, Size: 1347 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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-09-01 14:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-11 18:25 Patch: hiding org emphasis markers Tommy Phillips
2023-09-14 12:47 ` Ihor Radchenko
2023-10-15  9:05   ` Ihor Radchenko
2024-09-01 14:48     ` Ihor Radchenko

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).