[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org 06648d43e4 1/2: Merge branch 'bugfix'
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org 06648d43e4 1/2: Merge branch 'bugfix' |
Date: |
Wed, 7 Dec 2022 06:57:57 -0500 (EST) |
branch: externals/org
commit 06648d43e45d49387080d4180dcaf3c9a8c253fd
Merge: dd499ccab8 cc5427b7ef
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>
Merge branch 'bugfix'
---
lisp/ob-core.el | 8 +++++---
testing/lisp/test-ob.el | 17 +++++++++++++++++
2 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index aa3d6b101e..62b0d36124 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -2691,8 +2691,8 @@ specified as an an \"attachment:\" style link."
(same-directory?
(and base-file-name
(not (string= (expand-file-name default-directory)
- (expand-file-name
- base-directory)))))
+ (expand-file-name
+ base-directory)))))
(request-attachment (eq type 'attachment))
(attach-dir (let* ((default-directory base-directory)
(dir (org-attach-dir nil t)))
@@ -2708,7 +2708,9 @@ specified as an an \"attachment:\" style link."
((and 'attachment (guard in-attach-dir)) "attachment")
(_ "file"))
(if (and request-attachment in-attach-dir)
- (file-relative-name result-file-name)
+ (file-relative-name
+ result-file-name
+ (file-name-as-directory attach-dir))
(if (and default-directory
base-file-name same-directory?)
(if (eq org-link-file-path-type 'adaptive)
diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el
index e4090d6d8b..c8dbd44f44 100644
--- a/testing/lisp/test-ob.el
+++ b/testing/lisp/test-ob.el
@@ -1954,6 +1954,23 @@ nil
(file-exists-p (format "%s/test.txt" (org-attach-dir nil t)))
(string= (buffer-substring-no-properties (point) (line-end-position))
"[[attachment:test.txt]]"))))
+ ;; Strip attach dir from the file path.
+ (should
+ (org-test-with-temp-text-in-file
+ "* heading
+:PROPERTIES:
+:DIR: custom-attach-dir
+:END:
+
+<point>#+begin_src elisp :results value file
+\"custom-attach-dir/test.txt\"
+#+end_src"
+ (message "DIR: %s" (org-attach-dir t))
+ (org-babel-execute-src-block)
+ (goto-char (org-babel-where-is-src-block-result))
+ (forward-line)
+ (string= (buffer-substring-no-properties (point) (line-end-position))
+ "[[attachment:test.txt]]")))
(should-error
(org-test-with-temp-text-in-file
"* 'attach with no ID or DIR