Michael <[email protected]> writes: > This behavior seems unexpected to me, and might be a bug. Sharing here > to seek clarification, or to report this as a bug if it's not > expected. > > Behavior description: In certain scenarios when yanking links that > have blank descriptions, the link text is not fontified into an > org-link.
Note that links cannot have blank description. [[https://orgmode.org][]] is "[[" + link + "][]]". > elisp to reproduce: > (defun unexpected-behavior () > "Demo org-mode not fontifying to org-link" > (interactive) > (with-temp-buffer > (org-mode) > (insert "[[http://example.com][]]\n\n[[http://example.com][]]") > (font-lock-fontify-buffer) > (goto-char 5) > (get-char-property (point) 'face))) > > -> nil What is a bug here is that http://example.com is not being fontified as a (plain) link. Fixed, on main. https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=ded231f70 > Expected behavior: I'd expect the function to return "org-link" > here. Indeed if you change the inserted text to just > "[[http://example.com][]]", the function returns "org-link" instead of > nil. It's possible the blank description is an invalid link format, > but I didn't find that specified in the link syntax docs either way. https://orgmode.org/worg/org-syntax.html#org3266b39 does specify that the link description should be non-empty: DESCRIPTION (optional) One or more objects enclosed by square brackets. It can contain the ^^^^^^^^^^^^^^^^^^^ minimal set of objects as well as export snippets, inline babel calls, inline source blocks, macros, and statistics cookies. It can also contain another link, but only when it is a plain or angle link. It can contain square brackets, but not ]]. -- 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>
