Ihor Radchenko <[email protected]> writes:

> "J.D. Smith" <[email protected]> writes:
>
>> Instead I just reused the regexps `org-raise-scripts' uses, with
>> `org-inside-regexp'.  Seems to work OK; see/test new commit.
>
> Thanks!
>
> While testing, I found how I managed to reproduce the problem last time.
> It is a bout the order of invocation.
> If I do M-x org-inside-mode and *then* M-x org-toggle-pretty-entities,
> the sub/superscripts do not get highlighted.

True.  The list of entities to search for is set at mode start (per
buffer):

  (defun org-inside--setup-hidden-contents-types ()
    "Setup entity types with hidden contents."
    (setq org-inside--hidden-contents-types
          `(,@(and org-hide-emphasis-markers
                   '(bold code italic verbatim underline strike-through))
            ,@(and org-link-descriptive '(link))
            ,@(and org-pretty-entities
                   org-pretty-entities-include-sub-superscripts
                   '(subscript superscript latex-fragment)))))

If you need to change these settings "live", you'll want to restart the
mode.  I suppose I could compute this list dynamically during
`org-inside--elems-at-point', but your existing font-locking will be
invalid anyway if you do this.

>> To be honest, I find the sub/superscript support a little annoying,
>> because of the difference between a_{b} and a_b, which /appear/ the same
>> in the buffer, but behave subtly differently at their right boundary.
>> All of our other entities have hidden contents both before and after the
>> visible text, so this one stands out.
>
> IMHO, it is no different from the example with links I pointed to
> earlier:
> - https://orgmode.org
> - vs [[https://orgmode.org]]
>
>> I've been thinking of gating the sub/super-script functionality behind a
>> custom var.  Maybe I'm being picky; users can set
>> `org-use-sub-superscripts' to '{} if they hate "plain" sub-superscript
>> after all.  Thoughts?
>
> My thinking is to have highlighting/cursor change even when there is
> nothing hidden, in bare links/sub/superscripts as an option. It is
> somewhat different from what you propose as I understand.

I can't see how a completely bare link (your first element) is related
here, other than the fact that org applies similar styling to bare and
"real" links.  If we change the appearance inside such an entity, we are
misrepresenting the case: there are no hidden contents, and thus no
ambiguity about the position of point.  There is no "inside"
vs. "outside".

At least for the case of a bare subscript, there is "something" hidden
(the `_'/`^' chars), and therefore there is an inside/outside
distinction at one end (the front of the super/sub-scripted text).

BTW, have you had a look at the manual entries?  I just cleaned that up
a bit.

Reply via email to