[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org 2bd34edb64 2/2: ob-tangle.el: Handle non-string arg
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org 2bd34edb64 2/2: ob-tangle.el: Handle non-string arguments more gracefully |
Date: |
Sat, 30 Apr 2022 23:57:44 -0400 (EDT) |
branch: externals/org
commit 2bd34edb64c854e9939e8a34080e267547956707
Author: Jacopo De Simoi <jacopods@protonmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>
ob-tangle.el: Handle non-string arguments more gracefully
* lisp/ob-tangle.el (org-babel-tangle-single-block): If the
argument to :tangle is nil (e.g. when parsing conditional
tangling such as (when condition "yes") the current code
throws an error in `file-name-directory'. This commit
checks if the argument is a string before calling the fun
TINYCHANGE
---
lisp/ob-tangle.el | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el
index 7ae319d4fa..16d938afb7 100644
--- a/lisp/ob-tangle.el
+++ b/lisp/ob-tangle.el
@@ -529,6 +529,7 @@ non-nil, return the full association list to be used by
(match-end 0)
(point-min))))
(point)))))
+ (src-tfile (cdr (assq :tangle params)))
(result
(list start-line
(if org-babel-tangle-use-relative-file-links
@@ -536,11 +537,12 @@ non-nil, return the full association list to be used by
file)
(if (and org-babel-tangle-use-relative-file-links
(string-match org-link-types-re link)
- (string= (match-string 1 link) "file"))
+ (string= (match-string 1 link) "file")
+ (stringp src-tfile))
(concat "file:"
(file-relative-name (substring link (match-end 0))
(file-name-directory
- (cdr (assq :tangle params)))))
+ src-tfile)))
link)
source-name
params
@@ -549,8 +551,7 @@ non-nil, return the full association list to be used by
(org-trim (org-remove-indentation body)))
comment)))
(if only-this-block
- (let* ((src-tfile (cdr (assq :tangle (nth 4 result))))
- (file-name (org-babel-effective-tangled-filename
+ (let* ((file-name (org-babel-effective-tangled-filename
(nth 1 result) src-lang src-tfile)))
(list (cons file-name (list (cons src-lang result)))))
result)))