emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: stardiviner <numbchild@gmail.com>
Cc: org-mode <emacs-orgmode@gnu.org>
Subject: Re: [PATCH] add :session support for ob-js.el
Date: Tue, 13 Mar 2018 09:43:48 +0100	[thread overview]
Message-ID: <87efko8iwr.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <4f31b760-06ac-5c32-8dbd-76f1017d3cd1@gmail.com> (stardiviner's message of "Mon, 12 Mar 2018 17:02:26 +0800")

Hello,

stardiviner <numbchild@gmail.com> writes:

> I added org-mode babel ob-js.el header argument :session.
>
> Following packages :session are supported:
>
> - skewer-mode
>
> - js-comint
>
> - Indium

I don't know any of these, but here come some comments about the code.

>  then create.  Return the initialized session."
>    (unless (string= session "none")
>      (cond

Nitpick: You can merge the `unless' into the `cond'.

> -     ((string= "*skewer-repl*" session)
> +     ((and (string= "js-comint" org-babel-js-cmd) ; `js-comint'
> +	   (string= "*Javascript REPL*" session))
> +      (require 'js-comint)
> +      (let ((session-buffer "*Javascript REPL*"))
> +	(if (and (org-babel-comint-buffer-livep (get-buffer session-buffer))
> +		 (comint-check-proc session-buffer))
> +	    session-buffer
> +	  (call-interactively 'run-js)

The `run-js' probably needs to be declared at the beginning of the file.

> +		     (cond
> +		      ;; Indium Node
> +		      ((string= "*JS REPL*" session)
> +		       (require 'indium-repl)
> +		       (unless (get-buffer session)
> +			 (indium-run-node))

The function above needs to be declared, too.

> +		       (indium-eval full-body))

So does this one.

> +		      (t
> +		       (let ((session (org-babel-prep-session:js
> +				       (cdr (assq :session params)) params)))
> +			 (nth 1
> +			      (org-babel-comint-with-output
> +				  (session (format "%S" org-babel-js-eoe) t body)
> +				(mapc	; FIXME: stack on this scope when `skewer-eval'

What does mean this FIXME?

> +				 (lambda (line)

Nitpick: `mapc' + `lambda' -> `dolist'

>      (cond
> +     ((string= "*skewer-repl*" session)
> +      (require 'skewer-repl)
> +      (let ((session-buffer (get-buffer "*skewer-repl*")))
> +	(if (and (org-babel-comint-buffer-livep (get-buffer session-buffer))
> +		 (comint-check-proc session-buffer))
> +	    session-buffer
> +	  ;; start skewer REPL.
> +	  (sit-for .5)

Why is this `sit-for' needed?

> +	  (httpd-start)
> +	  (run-skewer)

These functions need to be declared.

Regards,

-- 
Nicolas Goaziou

  reply	other threads:[~2018-03-13  9:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-12  9:02 [PATCH] add :session support for ob-js.el stardiviner
2018-03-13  8:43 ` Nicolas Goaziou [this message]
2018-03-13 11:51   ` stardiviner
2018-03-17 11:14     ` Nicolas Goaziou
2018-03-17 17:51       ` About the assignment of FSF papers stardiviner
2018-03-18 16:15         ` Nicolas Goaziou
2018-03-22 18:47           ` stardiviner
2018-03-24 19:02             ` Nicolas Goaziou
2018-03-25  3:31       ` [PATCH] add :session support for ob-js.el stardiviner
2018-03-25 21:09         ` Nicolas Goaziou
2018-03-26  1:40           ` stardiviner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87efko8iwr.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=numbchild@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).