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

* Re: Patch: hiding org emphasis markers
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Ihor Radchenko @ 2023-09-14 12:47 UTC (permalink / raw)
  To: Tommy Phillips; +Cc: emacs-orgmode

Tommy Phillips <tphil98@gmail.com> writes:

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

The patch is ok. Thanks for submitting!

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

Currently, `org-emphasis-alist' works independently from `org-hide-emphasis-markers'.
Your patch will constitute a breaking change for users who removed
entries from `org-emphasis-alist', but still expect the markers to be
hidden.

You may instead introduce a new allowed value for
`org-hide-emphasis-markers' to hide markers for non-nil entries in
`org-emphasis-alist'. Maybe even allow the value to be an explicit list
of the markers to be hidden '("*" "_" ...).

And do note that the effect of `org-emphasis-alist' is purely visual -
Org still considers entries removed from the alist as markup. It is just
the display in Org buffers that is changed.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: Patch: hiding org emphasis markers
  2023-09-14 12:47 ` Ihor Radchenko
@ 2023-10-15  9:05   ` Ihor Radchenko
  2024-09-01 14:48     ` Ihor Radchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Ihor Radchenko @ 2023-10-15  9:05 UTC (permalink / raw)
  To: Tommy Phillips; +Cc: emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:

> You may instead introduce a new allowed value for
> `org-hide-emphasis-markers' to hide markers for non-nil entries in
> `org-emphasis-alist'. Maybe even allow the value to be an explicit list
> of the markers to be hidden '("*" "_" ...).

One month have passed since the last activity in this thread.
Are you still interested to address the raised comments?
If you encounter any difficulties, feel free to ask us anything.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: Patch: hiding org emphasis markers
  2023-10-15  9:05   ` Ihor Radchenko
@ 2024-09-01 14:48     ` Ihor Radchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Ihor Radchenko @ 2024-09-01 14:48 UTC (permalink / raw)
  To: Tommy Phillips; +Cc: emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:

> Ihor Radchenko <yantar92@posteo.net> writes:
>
>> You may instead introduce a new allowed value for
>> `org-hide-emphasis-markers' to hide markers for non-nil entries in
>> `org-emphasis-alist'. Maybe even allow the value to be an explicit list
>> of the markers to be hidden '("*" "_" ...).
>
> One month have passed since the last activity in this thread.
> Are you still interested to address the raised comments?
> If you encounter any difficulties, feel free to ask us anything.

No response.
Canceled.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[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).