"J.D. Smith" <[email protected]> writes: >> 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.
Yes. >> 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. No. The recipe starts from make repro - start fresh Emacs. > .. 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? No, org-mode-restart is not the recommended way. Built-in Elisp features like custom-set function are used when possible. >>> 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). I meant that org-inside could hook into org-fold-reveal. org-fold-reveal does something similar to org-inside-toggle-hidden, except it does not toggle, but only reveal hidden things around. What org-fold-reveal does is * heading <folded> **** child some text<point> or * heading <folded> some text<point> C-c C-r will reveal the hierarchy: * heading ** subheading *** sub-sub-heading **** child some text<point> >>> 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? Good point. Other link types do not hide anything. >> Similarly, `org-do-emphasis-hook' is only called when >> org-hide-emphasis-markers is non-nil. > > Fixed. I guess I was looking at the hidden-links-functions after org-do-emphasis-hook, which is more general. Now, I am wondering if we really need general hook for emphasis, and specialized hook for links. Maybe we instead have a single abnormal hook for all kinds if hidden things that will trigger both on links and emphasis? Then, potentially, we can automatically get support for anything we decide to hide in the future. >>> ... 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. Yes, I see no reason to do different things depending on link type. >>> 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? You can do (- :end :post-blank). In the future, there will be :pos-before-blank, but not yet. -- Ihor Radchenko // yantar92, Org mode maintainer, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>
