[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Add new entity \-- serving as markup separator/escape symbol

From: Tim Cross
Subject: Re: [PATCH] Add new entity \-- serving as markup separator/escape symbol
Date: Fri, 29 Jul 2022 08:20:03 +1000
User-agent: mu4e 1.8.6; emacs 29.0.50

Ihor Radchenko <yantar92@gmail.com> writes:

> Ihor Radchenko <yantar92@gmail.com> writes:
>> I am attaching a tentative patch that will make Org export remove
>> zero-width spaces when those spaces actually separate the object
>> boundaries.
>> Any objections?
> Given the raised objections, zero-width space does not appear to be a
> useful escape symbol because it has its valid uses as a standalone space
> symbol.
> The raised objections can be solved using some kind of intricate
> heuristics, but I do not feel like it is a good direction to go. The
> code will be too complex and fragile.

Ihor, thanks for articulating this as it was something I was becoming
increasingly concerned about. 

> Therefore, I am proposing a different approach for shielding
> fontification: introducing a special entity.
> The new entity is \--, which is a valid boundary between emphasis
> markup. It will be removed during export (replaced by "").
> "\--" specifically is somewhat arbitrary choice. The actual requirements
> for the entity name are: (1) No clash with LaTeX (which is why simpler
> \- would not cut it); (2) Being a valid markup boundary: entity must end
> with (any space ?- ?\( ?' ?\" ?\{).
> I am attaching a tentative patch introducing the new entity. Note that
> some minor tweaks to the parser were needed. I do not see it as a big
> deal - the current entity regexp has much more cumbersome exceptions.
> Also, the patch will not work correctly on org → org export, similar to
> pointed in one of the replies to the previous abandoned approach. I do
> not want to address it here because a much more appropriate solution for
> this issue is changing org-element-interpret-data.
> Consider (org-element-interpret-data '("asd" (bold () "bold") "bsd"))
> This will return "asd*bold*bsd", which is not correct even though the
> given Org datum is not wrong by itself - such things can easily appear
> when user filters are applied to parse tree during org→org export.
> Otherwise, the patch should be good enough to play around and kick-start
> the discussion.

I think this is definitely preferred over the zero width space as it is
clearer and 'intentional'. While I'm still 'on the fence' regarding the
tension between the need for this new functionality and the additional
complexity it introduces, this approach seems potentially cleaner and
more manageable.

Given the important work you are doing to integrate parsing of elements
and fontification, I feel you are in the best position to judge whether
this addition can be justified wrt complexity vs functionality and am
confident your on the right track here.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]