org-babel-expand-noweb-references: Add trialing newline after comments

* lisp/ob-core.el (org-babel-expand-noweb-references): After closing
comment, when using :comments noweb, leave trailing newline after the
closing comment.
* testing/lisp/test-ob-tangle.el (ob-tangle/comment-noweb-relative):
Modify test to check for the newline.

Reported-by: João Pedro <jpedrodeamorim@gmail.com>
Link: https://orgmode.org/list/87fruy2rw6.fsf@ergo
This commit is contained in:
Ihor Radchenko 2024-05-04 14:30:25 +03:00
parent 0d24857ccf
commit 1523e21d82
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
2 changed files with 52 additions and 52 deletions

View File

@ -3155,7 +3155,7 @@ block but are passed literally to the \"example-block\"."
(let ((cs (org-babel-tangle-comment-links ,i)))
(concat (c-wrap (car cs)) "\n"
b "\n"
(c-wrap (cadr cs)))))))
(c-wrap (cadr cs)) "\n")))))
(expand-references
(ref)
`(pcase (gethash ,ref org-babel-expand-noweb-references--cache)

View File

@ -191,8 +191,8 @@ echo 1
* Main
#+header: :tangle \"test-ob-tangle.el\" :comments noweb :noweb yes
#+begin_src emacs-lisp
1
<<inner>>
'(1
<<inner>>)
#+end_src"
(unwind-protect
(let ((org-babel-tangle-use-relative-file-links t))
@ -203,7 +203,7 @@ echo 1
(goto-char (point-min))
(and
(search-forward (concat ";; [[file:" (file-name-nondirectory file) "::inner") nil t)
(search-forward ";; inner ends here" nil t))))
(search-forward ";; inner ends here\n" nil t))))
(delete-file "test-ob-tangle.el")))))
(ert-deftest ob-tangle/comment-noweb-absolute ()