emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 34/38] org-link-make-string: Throw error when both LINK and DE


From: Ihor Radchenko
Subject: [PATCH v2 34/38] org-link-make-string: Throw error when both LINK and DESCRIPTION are empty
Date: Wed, 20 Apr 2022 21:28:18 +0800

This behaviour is expected according to `test-ol/make-string'.
---
 lisp/ol.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/ol.el b/lisp/ol.el
index 86f55d7cf..22eaae8fb 100644
--- a/lisp/ol.el
+++ b/lisp/ol.el
@@ -999,7 +999,9 @@ (defun org-link-make-string (link &optional description)
                (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) "")))))
-- 
2.35.1



-- 
Ihor Radchenko,
PhD,
Center for Advancing Materials Performance from the Nanoscale (CAMP-nano)
State Key Laboratory for Mechanical Behavior of Materials, Xi'an Jiaotong 
University, Xi'an, China
Email: yantar92@gmail.com, ihor_radchenko@alumni.sutd.edu.sg



reply via email to

[Prev in Thread] Current Thread [Next in Thread]