0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-07-16 19:16:26 +00:00

org-babel-js-function-wrapper: Fix when the last line is a comment

* lisp/ob-js.el (org-babel-js-function-wrapper): Ensure that last line
of the body being comment does not shadow the closing parenthesis.

Reported-by: sgherdao@tuta.io
Link: https://orgmode.org/list/NT8rSmu--F-9@tutanota.com
This commit is contained in:
Ihor Radchenko 2023-04-17 13:10:10 +02:00
parent c827341dfb
commit 7d8a9324f8
No known key found for this signature in database
GPG key ID: 6470762A7DA11D8B

View file

@ -69,7 +69,10 @@
:safe #'stringp)
(defvar org-babel-js-function-wrapper
"require('process').stdout.write(require('util').inspect(function(){%s}()));"
;; Note that newline after %s - it makes sure that closing
;; parenthesis are not shadowed if the last line of the body is a
;; line comment.
"require('process').stdout.write(require('util').inspect(function(){%s\n}()));"
"Javascript code to print value of body.")
(defun org-babel-execute:js (body params)