org-link-make-string: Throw error when both LINK and DESCRIPTION are empty

This behaviour is expected according to `test-ol/make-string'.
This commit is contained in:
Ihor Radchenko 2022-01-29 18:46:00 +08:00
parent 87babca898
commit f28f02bde9
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 3 additions and 1 deletions

View File

@ -999,7 +999,9 @@ LINK is escaped with backslashes for inclusion in buffer."
(replace-regexp-in-string "]\\'"
(concat "\\&" zero-width-space)
(org-trim description))))))
(if (not (org-string-nw-p link)) description
(if (not (org-string-nw-p link))
(or description
(error "Empty link"))
(format "[[%s]%s]"
(org-link-escape link)
(if description (format "[%s]" description) "")))))