Ihor Radchenko <[email protected]> writes:
> "J.D. Smith" <[email protected]> writes:
>
>> I've pushed a substantial update to org-inside. I've now added support
>> for hidden links.
>
Thanks for the feedback.
> For some reason, the cursor is changing even when links are not hidden.
Maybe I haven't understood when hiding for links is used. Is
`org-link-descriptive' the only way? Easy workaround if so.
> When I do make repro, open Org file, and run M-x org-inside-mode, I get
> Debugger entered--Lisp error: (wrong-type-argument symbolp 'org-inside-mode)
> (defvar 'org-inside-mode)
> load-with-code-conversion("/home/yantar92/Git/org-mode/lisp/org-inside.el"
> "/home/yantar92/Git/org-mode/lisp/org-inside.el" nil t)
> command-execute(org-inside-mode record)
> execute-extended-command(nil "org-inside-mode" "org-insi")
> funcall-interactively(execute-extended-command nil "org-inside-mode"
> "org-insi")
> command-execute(execute-extended-command)
Stray defvar, should be fixed now.
> Also, I tried to
> 1. make repro
> 2. M-: (setopt org-hide-emphasis-markers t)
> 3. C-x C-f /tmp/test.org
> 4. Insert
>
> *bold*
> <point>
> 5. M-x org-inside-mode
> 6. C-b and C-f many times to cross the bold
> 7. C-b does not change cursor shape
The overlay is per window, so if you had already used the mode in that
window prior to `setopt', that could explain it. I had asked earlier:
is the expectation with org that we use a custom-set function for live
updates when an option/customize variable is changed? Or is M-x
org-mode-restart usually recommended?
>> I've also implemented the new command `org-inside-toggle-hidden', which
>> can be used at any time to toggle hiding for the specific entity you are
>> in (only). There is no need to enable auto-unhiding to use this
>> command. I think this is ideal:
>>
>> 1. For normal updates to emphasized text or e.g. a link description,
>> just move "inside" and make your edits. No distracting reflow of
>> visual paragraphs, etc. The cursor/face changes make it clear when
>> you are inside.
>>
>> 2. For more difficult operations, e.g. to edit the raw link itself, run
>> `org-inside-toggle-hidden', and a single entity will be revealed.
>> Once finished, just leave and the link will automatically re-hide.
>>
>> We could consider a keybinding for `org-inside-toggle-hidden'.
>
> As I said in another email, org-appear would fit here. It also has a
> bind C-c C-r already.
Not sure I catch you here. That key sequence is bound to
`org-fold-reveal' for me. `org-appear' is a 3rd party package. Are you
saying we should re-use the binding for `org-fold-reveal' if
`org-inside-mode' is enabled? That could work, unless you'd want both.
I don't find a good use for `org-fold-reveal' myself (maybe I don't
understand what it does).
>> 1. I implemented a new abnormal hook
>> `org-activate-hidden-links-functions'.
>
> And this hook is only called in bracket-style links for some reason.
What other link types have hidden markers?
> Similarly, `org-do-emphasis-hook' is only called when
> org-hide-emphasis-markers is non-nil.
Fixed.
>> ... This appears to be somewhat
>> close to the `(org-link-get-parameter type :activate-func)',
>> parameter but:
>> a. I don't know what TYPE's are valid and therefore where to set my
>> function (on multiple TYPEs?).
>> b. It does not include visible-start/end among the arguments, which I
>> need.
>
> Sounds like you are over-complicating things. Do we really need
> hyper-specialized per-link-type activation here?
That's the existing design of the :activate-func. If you are OK with
using the hook instead, no need to worry about it.
>> 2. Emphasized text has an `org-emphasis' text property, but links do
>> _not_ have an equivalent 'org-link' property. I'm using
>> 'htmlize-link' to quickly find the boundaries of the link (including
>> hidden text). Is there a better way?
>
> org-element-context.
I thought of using org-element for both types:
(when-let*
((ctx (org-element-context))
(elem (org-element-lineage
ctx '(link bold code italic underline verbatim) t))
(beg (org-element-begin elem))
(end (org-element-end elem)))
(org-inside--set-appearance win beg end))
But apparently the elements span the whitespace afterwards as well, so
this doesn't work well. Is there another property of org elements like
link or verbatim that does not included the final whitespace?