From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id qACWAoLzPGQyRgEASxT56A (envelope-from ) for ; Mon, 17 Apr 2023 09:21:38 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id SAqXAoLzPGQMaQAA9RJhRA (envelope-from ) for ; Mon, 17 Apr 2023 09:21:38 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9EE946DA7 for ; Mon, 17 Apr 2023 09:21:37 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1poJAV-0007JU-2v; Mon, 17 Apr 2023 03:20:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1po0qf-00022e-6d for emacs-orgmode@gnu.org; Sun, 16 Apr 2023 07:47:13 -0400 Received: from w4.tutanota.de ([81.3.6.165]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1po0qR-0000i3-Jf for emacs-orgmode@gnu.org; Sun, 16 Apr 2023 07:47:11 -0400 Received: from tutadb.w10.tutanota.de (unknown [192.168.1.10]) by w4.tutanota.de (Postfix) with ESMTP id 1798A106015C for ; Sun, 16 Apr 2023 11:46:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1681645616; s=s1; d=tuta.io; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Cc:Date:Date:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:Sender; bh=mjIGrzcWPyRl0U++gnI4qIgYj81hDCdc1ZkGXM6kDng=; b=NDMn/6ZOtikInl9R8Km7ZjG+DBftEw+dM6cJ8pb0aImAKx/G+uM0YiTAHBYEO/2n xhBY5dSpbProDCYf73Czyhx54YWkGlksSLv9jZSREommY5ZRKg1u0eP/NTenMM1TMQY c+nY1mYvXbxng7y50duPXJUpLWOL8ZVUXr5jIOzABHAtMLFEkeoCs8o9Fg7YEeD+VFR V4dePjKdAeR46b0F9mU4ytgxAJRh61qB761EnTB7YbJlmZGQ+GVJmXoENbslMKZ+5OB oatVJvP5Qbo9ZHyCysxV9pnN2QEp7BcqqSqBcCT0xjpfIDg82iKTM1Hs/afsrDpRaHQ xaqhrvz7hQ== Date: Sun, 16 Apr 2023 13:46:56 +0200 (CEST) To: Emacs Orgmode Message-ID: Subject: [BUG] ob-js "SyntaxError: Unexpected end of input" when code block ends with comment MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_248664_121147865.1681645616087" Received-SPF: pass client-ip=81.3.6.165; envelope-from=sgherdao@tuta.io; helo=w4.tutanota.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Mon, 17 Apr 2023 03:20:41 -0400 X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: sgherdao@tuta.io From: sgherdao--- via "General discussions about Org-mode." Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1681716097; a=rsa-sha256; cv=none; b=MHXeRUAwCakIcT+OOgoBt789P2QLjjqTYJD2VvY5HsGallIrDW9gM/qe8syekaMYhCSLQx JwBHIJ64gljDUbbv5xzCUHY3aOcmXdl5sfqunceJBi8g1gwIPinlYLh+60Rvkur8oZXSgX f5QpaAUz0CCe7J36ddUE8IOYD3A+VEeVNKwU35ZLvPQfiZdmXNw7quESlwGS6sV1o3bgm4 oxqY1RNEhd5HHnV9Ancdr3i7mG1kjM5dhZBanu6Bv0np2Ff64ABK831iwd8qwjr4fTsvUL eXXCHlj5RRUZSSTZlVIDXippwjJjkqICwxTrHC7rVlQpxEC12xVxrv4Gul6XaA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=tuta.io header.s=s1 header.b="NDMn/6ZO"; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1681716097; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=mjIGrzcWPyRl0U++gnI4qIgYj81hDCdc1ZkGXM6kDng=; b=BQVHfHkRlZdiqjNoClSW5pLo843tG99RQCmvBGJxvjVugkpfOMaEGqyoqzIZ0mP5n/yvVI s8DGk8/QDPA5HpPpYFitMwKmeZ9i1AzSlEjLn/MXtaK50wagG+5mzvppcmG6IHp1v82TSp 8WOdJoOpNuNQgU3UIRfericu6AkV+X0shUuk/uxm/p6EJxdjBgjeMAGgEnp2a7R7GR3gwx gQ4E2WdHnAww/cLAzSf72lSiQyogb4ZUK7z3ViFpJLBFV2I20d+7YBaJven8bvh38d+xXc 0O+DwkaiNif4MEM4prk5SH7woZKohFIZDZJ6rMzyHult/AonfBY9T9iGU221GA== X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: -3.51 X-Spam-Score: -3.51 X-Migadu-Queue-Id: 9EE946DA7 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=tuta.io header.s=s1 header.b="NDMn/6ZO"; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org X-TUID: iL6mxoJ+h1iA ------=_Part_248664_121147865.1681645616087 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hello, I would like to report a bug, I am using the following versions GNU Emacs 28.2 Org mode version 9.6.1 Node v19.9.0 The following code snippet fails to execute #+begin_src js console.log("Hello Friends!"); // -> logs "Hello Friends" #+end_src I encounter the following error message: #+begin_src text /tmp/js-script-dn2Wrp:2 // -> logs "Hello Friends"}())); SyntaxError: Unexpected end of input =C2=A0=C2=A0=C2=A0 at internalCompileFunction (node:internal/vm:73:18) =C2=A0=C2=A0=C2=A0 at wrapSafe (node:internal/modules/cjs/loader:1195:20) =C2=A0=C2=A0=C2=A0 at Module._compile (node:internal/modules/cjs/loader:123= 9:27) =C2=A0=C2=A0=C2=A0 at Module._extensions..js (node:internal/modules/cjs/loa= der:1329:10) =C2=A0=C2=A0=C2=A0 at Module.load (node:internal/modules/cjs/loader:1133:32= ) =C2=A0=C2=A0=C2=A0 at Module._load (node:internal/modules/cjs/loader:972:12= ) =C2=A0=C2=A0=C2=A0 at Function.executeUserEntryPoint [as runMain] (node:int= ernal/modules/run_main:83:12) =C2=A0=C2=A0=C2=A0 at node:internal/main/run_main_module:23:47 #+end_src Upon further inspection, I found that the generated JavaScript code in the = tmp file contains an unbalanced brace and parentheses, as shown below: #+begin_src js require('process').stdout.write(require('util').inspect(function(){console.= log("Hello Friends!"); // -> logs "Hello Friends"}())); #+end_src Since the last line of the code snippet contains a comment the brace and pa= rens are unbalanced This seems to point to the way the following variable is defined in ob-js.e= l #+begin_src emacs-lisp (defvar org-babel-js-function-wrapper =C2=A0 "require('process').stdout.write(require('util').inspect(function(){= %s}()));" =C2=A0 "Javascript code to print value of body.") #+end_src As a simple fix, I have added a \n after %s #+begin_src emacs-lisp (defvar org-babel-js-function-wrapper =C2=A0 "require('process').stdout.write(require('util').inspect(function(){= %s\n}()));" =C2=A0 "Javascript code to print value of body.") #+end_src Please let me know if you need any additional information or if there's any= thing else I can do to help resolve this issue. Best regards, -- Salah ------=_Part_248664_121147865.1681645616087 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hello,

I would = like to report a bug, I am using the following versions

GNU Emacs 28.2
Org mode version 9.6.1
Node v19.9.0


The following code snippet fails to execute
#+begin_src js
console.= log("Hello Friends!");
// -> logs "Hello Frie= nds"
#+end_src

I encounter the following error message:

#+begin_src text
/tmp/js-script-dn2Wrp:2
// -> log= s "Hello Friends"}()));

SyntaxError: Unexpected end of input
 &= nbsp;  at internalCompileFunction (node:internal/vm:73:18)
    at wrapSafe (node:internal/modules/cjs/l= oader:1195:20)
    at Module._com= pile (node:internal/modules/cjs/loader:1239:27)
=     at Module._extensions..js (node:internal/modules/cjs/loa= der:1329:10)
    at Module.load (= node:internal/modules/cjs/loader:1133:32)
 =    at Module._load (node:internal/modules/cjs/loader:972:12)
<= /div>
    at Function.executeUserEntryPoint= [as runMain] (node:internal/modules/run_main:83:12)
    at node:internal/main/run_main_module:23:47
#+end_src


Upon further inspection, I found that= the generated JavaScript code in the tmp file contains an unbalanced brace= and parentheses, as shown below:


#+begin_src js
require('process').stdout.write(require('util').inspect(function(= ){console.log("Hello Friends!");
// -> logs "= Hello Friends"}()));
#+end_src


Since the= last line of the code snippet contains a comment the brace and parens are = unbalanced
This seems to point to the way the fo= llowing variable is defined in ob-js.el


#+begin_src emacs-lisp
<= /div>
(defvar org-babel-js-function-wrapper
  "require('process').stdout.write(require('util').inspec= t(function(){%s}()));"
  "Javascript code t= o print value of body.")
#+end_src

As a simple fix, I have added a \= n after %s

#+begin_s= rc emacs-lisp
(defvar org-babel-js-function-wrap= per
  "require('process').stdout.write(requ= ire('util').inspect(function(){%s\n}()));"
 = ; "Javascript code to print value of body.")
#+e= nd_src


Please let me know if you need any additional information or= if there's anything else I can do to help resolve this issue.


Best= regards,
--
Salah

------=_Part_248664_121147865.1681645616087--