Ihor Radchenko <[email protected]> writes:
> Ihor Radchenko <[email protected]> writes:
>
>> "J.D. Smith" <[email protected]> writes:
>> I think we can slowly move to the code review.
>
> Before we go full-on there, I forgot one more thing - comparison with
> org-appear.
Happy to take a look, but be aware: there is no explicit goal to replace
org-appear. The main new capability (indicate inside state without
unhiding) is the primary functionality, which AFAIK no preexisting tool
implements.
See the new commits.
> There are few good points missed that org-appear does.
>
> The most important missing features in org-inside are:
> 1. sub/superscript support
> 2. org-hidden-keywords support
> 3. hiding in pre-command hook, so that things like fill-paragraph are
> not affected by cursor position
> 4. (maybe) delayed appearance change
>
> Disclosure: I am not familiar with org-appear, so I tasked LLM with
> reviewing the codes. Below is the original full report on the
> differences:
Fine for generating ideas, but better for real org-appear users to try
org-inside and comment.
> What org-appear has that org-inside does not
>
> 1. Subscript/superscript marker toggling
A good idea. I have pushed an implementation for sub/superscripts. I
needed to add a new symbol `org-raise' to the invisibility spec, and add
a new hidden-text-functions type.
Note that the plain variety, e.g.:
upper_lower
has no positional ambiguity on the right hand side. Point and cursor
have only one value there. So no matter what, this behaves differently
than
upper_{lower}
even if it looks the same in the buffer. You can still /see/ where
insertions will go, but you can't alter in the same way by moving in
from one side or the other, except by appending a space or something not
allowable within a "bare" super/subscript. I'm afraid there is no easy
way around this difference.
> 3. Keyword toggling
>
> =org-appear-autokeywords= toggles visibility of keywords listed in
> =org-hidden-keywords= (e.g., =#+TITLE:=, =#+AUTHOR:=). It removes/adds
> the =invisible= and =org-link= text properties on the keyword region.
>
> org-inside does not handle hidden keywords; its type list in
> =org-inside--hidden-contents-types= only includes emphasis and links.
This doesn't add much value. Keywords are standalone on a line and
usually begin at line beginning. They have nothing hidden at their end,
so have the same "after" ambiguity of plain subscripts.
> 2. Entity toggling
>
> =org-appear-autoentities= toggles Org entities like =\alpha=, =\to=,
> etc. -- it calls =decompose-region= to show the raw TeX-like source and
> =compose-region= to restore the UTF-8 glyph. Controlled by
> =org-pretty-entities=.
>
> org-inside has no entity handling at all.
> 4. LaTeX fragment support
>
> =org-appear-inside-latex= applies toggling inside LaTeX fragments and
> environments. When enabled, sub/superscript markers and entities are
> toggled within =latex-fragment= and =latex-environment= element types.
>
> org-inside does not handle LaTeX fragments or environments at all.
These are also less apt. `org-inside' is primarily about precisely
editing in and around hidden contents entities, without needing to
reveal the hidden text. For text which is fully replaced using display
properties or character composition, this idea doesn't make sense.
That said, it would probably be good to add something /else/ to `C-c
C-c` hook to unhide tex-like things.
Note that supporting sub/superscripts inside latex fragments is also not
possible at present, since those are not parsed separately by
org-element. If a future version of org-element adds support
(i.e. sub/superscript are parsed /inside/ latex-fragment), these can be
supported.
> 5. Configurable delay
>
> =org-appear-delay= (default =0.0=) introduces an idle-timer delay before
> showing hidden markers. The timer is cancelled if the cursor moves away
> before it fires. Useful for reducing visual noise during rapid
> navigation.
>
> org-inside uses cursor-sensor-functions, which fire instantaneously on
> entry/exit. No delay mechanism exists.
A reasonable idea; added in `org-inside-unhide-delay', defaulting to
1.0s (can consider 0.0). Note that emacs v31 (and it's `moved' cursor
sensor type) is required for further delaying after each movement.
> 6. Trigger modes
>
> =org-appear-trigger= offers three modes:
> - =always= -- toggle on every cursor movement (default)
> - =on-change= -- toggle only when the buffer is modified or the element is
> clicked
> - =manual= -- toggle only when
> =org-appear-manual-start=/=org-appear-manual-stop= are called
Not relevant.
> 7. =manual-linger= option
>
> =org-appear-manual-linger= controls whether elements stay visible after
> =org-appear-manual-stop=. When nil (default), elements are re-hidden
> immediately on stop.
We always re-hide immediately on exit.
> 8. =just-brackets= link mode
>
> =org-appear-autolinks= can be set to the symbol =just-brackets=, which
> reveals only the =[[= and =]]= brackets around descriptive links without
> showing the URL portion. This is a third visibility state beyond "fully
> hidden" and "fully shown."
This is better handled by inside/outside editing using the face/cursor
hints, and on-demand toggling when you want to edit the URL.
> 9. Evil-mode integration pattern
>
> org-appear has a documented evil-mode integration pattern using the
> =manual= trigger:
Modal editing is not explicitly supported by org AFAIK.
> 10. Pre-command hook for specific commands
>
> org-appear's =pre-command-hook= hides elements before
> =org-fill-paragraph= and =org-ctrl-c-ctrl-c= execute, because these
> commands depend on column positions and would misbehave if hidden
> markers were temporarily visible.
Can someone confirm this and describe a case in more detail?