From mboxrd@z Thu Jan 1 00:00:00 1970 From: stardiviner Subject: Re: [PATCH] add :session support for ob-js.el Date: Mon, 26 Mar 2018 09:40:59 +0800 Message-ID: <7b4490aa-ec98-366f-f89b-07118deab4f8@gmail.com> References: <4f31b760-06ac-5c32-8dbd-76f1017d3cd1@gmail.com> <87efko8iwr.fsf@nicolasgoaziou.fr> <307cac72-36e9-0ba6-262b-a12f291953a0@gmail.com> <87a7v7dkdp.fsf@nicolasgoaziou.fr> <366d0e08-8e60-88a2-f7e5-28db5ba3deb8@gmail.com> <87y3if9817.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="------------EE734BAA89D6134AD11E92FB" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:52965) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0H8G-0000Vh-Nw for emacs-orgmode@gnu.org; Sun, 25 Mar 2018 21:41:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0H8D-0008Vv-L7 for emacs-orgmode@gnu.org; Sun, 25 Mar 2018 21:41:08 -0400 Received: from mail-pl0-x233.google.com ([2607:f8b0:400e:c01::233]:43717) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f0H8D-0008VV-BK for emacs-orgmode@gnu.org; Sun, 25 Mar 2018 21:41:05 -0400 Received: by mail-pl0-x233.google.com with SMTP id f23-v6so10980186plr.10 for ; Sun, 25 Mar 2018 18:41:05 -0700 (PDT) In-Reply-To: <87y3if9817.fsf@nicolasgoaziou.fr> Content-Language: en-US List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Nicolas Goaziou Cc: org-mode This is a multi-part message in MIME format. --------------EE734BAA89D6134AD11E92FB Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Thanks for your refactoring. I must be recklessof this. I will be careful next time. On 03/26/2018 05:09 AM, Nicolas Goaziou wrote: > Hello, > > stardiviner writes: > >> I attached my new generated patches. >> >> >> On 03/17/2018 07:14 PM, Nicolas Goaziou wrote: >>> Some comments follow. >>>> + (result (if (not (string= (cdr (assq :session params)) "none")) >>> You can integrate the test above in the `cond': >>> >>> (cond >>> ((string= "none" (cdr (assq :session params))) nil) >>> ((string= "*JS REPL*" session) ...) >>> ...) >> This is modified in new patch. >>>> + (sit-for .5) (goto-char (point-max)) >>> (sit-for .5) >>> (goto-char (point-max)) >> This is in original code, might because ob-js initialize REPL backend >> need some time so original author added `site-for`. After test, this >> seems does not matter. So remote the sit-for now. >>>> + (mapc (lambda (var) >>>> + (insert var) (comint-send-input nil t) >>>> + (org-babel-comint-wait-for-output session) >>>> + (sit-for .1) (goto-char (point-max))) var-lines))) >>>> session)) >>> (dolist (var ...) >>> ...) >> modified in new patch. >> >> I don't know how to apply master branch new update on my local >> `ob-js-session` branch so to get ob-js related commits on top to >> generate new patches. (Do you have any idea on this?) The new patches >> are behind latest `master` branch. But should be compatible still. If >> generating patches based on latest `master` branch commit is must, >> I can do that. > I applied you patch. However, I rewrote your commit messages: they need > to refer to modified variables and functions. I also fixed dangling > parenthesis, and fixed a typo in a move from `mapc' + `lambda' to > `dolist'. > > Thank you. > > Regards, > --------------EE734BAA89D6134AD11E92FB Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit

Thanks for your refactoring. I must be reckless of this. I will be careful next time.


On 03/26/2018 05:09 AM, Nicolas Goaziou wrote:
Hello,

stardiviner <numbchild@gmail.com> writes:

I attached my new generated patches.


On 03/17/2018 07:14 PM, Nicolas Goaziou wrote:
Some comments follow.
+	       (result (if (not (string= (cdr (assq :session params)) "none"))
You can integrate the test above in the `cond':

(cond
  ((string= "none" (cdr (assq :session params))) nil)
  ((string= "*JS REPL*" session) ...)
  ...)
This is modified in new patch.
+	      (sit-for .5) (goto-char (point-max))
(sit-for .5)
(goto-char (point-max))
This is in original code, might because ob-js initialize REPL backend
need some time so original author added `site-for`. After test, this
seems does not matter. So remote the sit-for now.

          
+	      (mapc (lambda (var)
+		            (insert var) (comint-send-input nil t)
+		            (org-babel-comint-wait-for-output session)
+		            (sit-for .1) (goto-char (point-max))) var-lines)))
      session))
   (dolist (var ...)
    ...)
modified in new patch.

I don't know how to apply master branch new update on my local
`ob-js-session` branch so to get ob-js related commits on top to
generate new patches. (Do you have any idea on this?) The new patches
are behind latest `master` branch. But should be compatible still. If
generating patches based on latest `master` branch commit is must,
I can do that.
I applied you patch. However, I rewrote your commit messages: they need
to refer to modified variables and functions. I also fixed dangling
parenthesis, and fixed a typo in a move from `mapc' + `lambda' to
`dolist'.

Thank you.

Regards,


--------------EE734BAA89D6134AD11E92FB--