PavoDive <[email protected]> writes:

> I kept on working on the idea that a minor change to org-activate-links was a 
> simple, yet good solution, and propose that adding an overlay to the visible 
> part of the link (inside the comment) will allow us to set a different face. 
> This spares us from the precedence that font-lock-comment-face takes over 
> almost everything else, and still allows us a link inside a comment line that 
> will be distinguishable and actionable (both via keyboard and mouse).
>
> Attached is the tiny patch that modifies two files:
> - org.el/org-activate-links (added an overlay to links in comments).
> - org-faces.el/org-link-comment-face (added face).

Thanks for the patch!

Unfortunately, overlays are not the right approach to handle
fontification. The reason is twofold: (1) font-lock in Emacs is
traditionally done via text properties. All the machinery around assumes
this fact. Using overlays is sometimes acceptable, but that's rather an
exception; (2) overlays always belong to current buffer and will not
transfer to indirect buffers. So, the patch you propose will leave the
bug not fixed in all the indirect buffers.

So, we do need to use text properties.

A more general question is also whether we need to *parse* links and
other markup inside comments. It would make sense, especially given that
commented headings can contain markup. Although there might be pros and
cons.

-- 
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>

Reply via email to