No Wayman <iarchivedmywholel...@gmail.com> writes:

If `v-a' is an empty string, the call to `replace-match' throws an
Args out of range error. Similar assignments in that area of the
code use an `and' comparison to guard against this, so perhaps it
should be:


(v-L (if (and v-a (string-match l-re v-a))
                (replace-match "\\1" nil nil v-a)
              v-a))

See attached patch

>From be476c236e40dd0ba87be9d466dd5cd00a6960b7 Mon Sep 17 00:00:00 2001
From: Nicholas Vollmer <iarchivedmywholel...@gmail.com>
Date: Fri, 25 Sep 2020 03:42:57 -0400
Subject: [PATCH] capture: Fix bare link "Args out of range"

* lisp/org-capture.el (org-capture-fill-template): guard against empty
annotation string
---
 lisp/org-capture.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index a6e95f24e..67c58ffdd 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -1595,7 +1595,7 @@ The template may still contain \"%?\" for cursor positioning."
 	 (v-l (if (and v-a (string-match l-re v-a))
 		  (replace-match "[[\\1]]" nil nil v-a)
 		v-a))
-	 (v-L (if (or v-a (string-match l-re v-a))
+	 (v-L (if (and v-a (string-match l-re v-a))
 		  (replace-match "\\1" nil nil v-a)
 		v-a))
 	 (v-n user-full-name)
-- 
2.28.0

Reply via email to