For those of you who use `org-hide-emphasis-markers=t' (and not
`org-appear'), I'm sure you've experience the phenomenon of not knowing
where edits will go when point is "adjacent" to emphasized text.  Is
point inside or outside of the markers?

I recently worked up a small pair of advices to org fontification, to
aid precise editing at the ends of emphasized text.  So far it has
proven very intuitive.

The approach:

1. Apply `rear-nonsticky=(... invisible)' to both the front and back
   hidden markers.

2. Change cursor (from box to bar), when edits would occur /inside/ the
   markers of the emphasized text.  This requires placing cursor sensor
   functions on the entire emphasized text (save the leftmost marker).

The `rear-nonsticky' property causes the display engine to place point
on the RHS/LHS of the hidden markers depending on what side they are
/approached from/ (from outside direction: stay out; from inside
direction: stay in).  The video linked below should make this clearer.

This could potentially be a minor-mode — `org-hidden-cursor-mode' or so
— which could allow customizing the "inside" cursor type/color, etc.  It
could apply to keywords, links, etc. as well.  It would need to turn on
`cursor-sensor-mode'.

Find more details, the several lines of code implementing this for
emphasized text, and a video demo, here:

  https://gist.github.com/jdtsmith/87ce361830466dd9ab2e304d17ddc2e4

Happy to contribute some code for this if you think it could be a good
fit for Org.

JD


Reply via email to