forked from mirrors/org-mode
Merge branch 'maint'
This commit is contained in:
commit
8d731ad256
|
@ -474,9 +474,9 @@ non-nil, return the full association list to be used by
|
||||||
file)
|
file)
|
||||||
(if (and org-babel-tangle-use-relative-file-links
|
(if (and org-babel-tangle-use-relative-file-links
|
||||||
(string-match org-link-types-re link)
|
(string-match org-link-types-re link)
|
||||||
(string= (match-string 0 link) "file"))
|
(string= (match-string 1 link) "file"))
|
||||||
(concat "file:"
|
(concat "file:"
|
||||||
(file-relative-name (match-string 1 link)
|
(file-relative-name (substring link (match-end 0))
|
||||||
(file-name-directory
|
(file-name-directory
|
||||||
(cdr (assq :tangle params)))))
|
(cdr (assq :tangle params)))))
|
||||||
link)
|
link)
|
||||||
|
|
|
@ -1047,7 +1047,10 @@ DESC is the description part of the link, or the empty string.
|
||||||
INFO is a plist holding contextual information. See
|
INFO is a plist holding contextual information. See
|
||||||
`org-export-data'."
|
`org-export-data'."
|
||||||
(let* ((type (org-element-property :type link))
|
(let* ((type (org-element-property :type link))
|
||||||
(raw-path (org-element-property :path link))
|
(raw-path
|
||||||
|
(replace-regexp-in-string
|
||||||
|
"[@{}]" "@\\&"
|
||||||
|
(org-element-property :path link)))
|
||||||
;; Ensure DESC really exists, or set it to nil.
|
;; Ensure DESC really exists, or set it to nil.
|
||||||
(desc (and (not (string= desc "")) desc))
|
(desc (and (not (string= desc "")) desc))
|
||||||
(path (org-texinfo--sanitize-content
|
(path (org-texinfo--sanitize-content
|
||||||
|
|
|
@ -122,6 +122,43 @@ echo 1
|
||||||
(search-forward "[H:2]]" nil t))))
|
(search-forward "[H:2]]" nil t))))
|
||||||
(delete-file "test-ob-tangle.el")))))
|
(delete-file "test-ob-tangle.el")))))
|
||||||
|
|
||||||
|
(ert-deftest ob-tangle/comment-links-relative-file ()
|
||||||
|
"Test relative file name handling when commenting with links."
|
||||||
|
(should
|
||||||
|
(org-test-with-temp-text-in-file
|
||||||
|
"* H
|
||||||
|
#+header: :tangle \"test-ob-tangle.el\" :comments link
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
1
|
||||||
|
#+end_src"
|
||||||
|
(unwind-protect
|
||||||
|
(let ((org-babel-tangle-use-relative-file-links t))
|
||||||
|
(org-babel-tangle)
|
||||||
|
(with-temp-buffer
|
||||||
|
(insert-file-contents "test-ob-tangle.el")
|
||||||
|
(buffer-string)
|
||||||
|
(goto-char (point-min))
|
||||||
|
(search-forward
|
||||||
|
(concat "[file:" (file-name-nondirectory file))
|
||||||
|
nil t)))
|
||||||
|
(delete-file "test-ob-tangle.el"))))
|
||||||
|
(should
|
||||||
|
(org-test-with-temp-text-in-file
|
||||||
|
"* H
|
||||||
|
#+header: :tangle \"test-ob-tangle.el\" :comments link
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
1
|
||||||
|
#+end_src"
|
||||||
|
(unwind-protect
|
||||||
|
(let ((org-babel-tangle-use-relative-file-links nil))
|
||||||
|
(org-babel-tangle)
|
||||||
|
(with-temp-buffer
|
||||||
|
(insert-file-contents "test-ob-tangle.el")
|
||||||
|
(buffer-string)
|
||||||
|
(goto-char (point-min))
|
||||||
|
(search-forward (concat "[file:" file) nil t)))
|
||||||
|
(delete-file "test-ob-tangle.el")))))
|
||||||
|
|
||||||
(ert-deftest ob-tangle/jump-to-org ()
|
(ert-deftest ob-tangle/jump-to-org ()
|
||||||
"Test `org-babel-tangle-jump-to-org' specifications."
|
"Test `org-babel-tangle-jump-to-org' specifications."
|
||||||
;; Standard test.
|
;; Standard test.
|
||||||
|
|
Loading…
Reference in New Issue