From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Kyle Meyer <kyle@kyleam.com>
Cc: Org-mode <emacs-orgmode@gnu.org>
Subject: Re: Babel support for Stan
Date: Mon, 24 Aug 2015 16:51:26 +0200 [thread overview]
Message-ID: <877fokbuz5.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <87si794dkk.fsf@kyleam.com> (Kyle Meyer's message of "Sun, 23 Aug 2015 22:36:59 -0400")
Hello,
Kyle Meyer <kyle@kyleam.com> writes:
> I'd like to put ob-stan.el (attached) in the contrib directory. It adds
> support for the Stan [1] programming language. I wrote it a while back,
> but a recent post on the Stan ML [2] made me think that others may find
> it useful (although I'd guess that the intersection of Stan and Org
> users is quite small). It's short because the only output that really
> makes sense is to dump the contents to a file (and maybe compile it),
> which is then used by a downstream interface [3].
Thank you.
> Please let me know if you have any comments about the implementation or
> if you don't think contrib directory is a good place for it.
I think core is fine for new languages, but you need to update file
headers accordingly.
A few comments follow.
> (defun org-babel-execute:stan (body params)
> "Execute a block of Stan code with org-babel.
> A :file header argument must be given. If
> `org-babel-stan-cmdstan-directory' is non-nil and the file name
> does not have a \".stan\" extension, compile the block to file.
> Otherwise, write the Stan code to the file."
BODY and PARAMS references are missing from docstring.
> (let ((file (expand-file-name
> (or (cdr (assoc :file params))
Nitpick: `assoc' -> `:assq'.
> (user-error "Set :file argument to execute Stan blocks")))))
> (if (or (not org-babel-stan-cmdstan-directory)
> (org-string-match-p "\\.stan\\'" file))
> (with-temp-file file (insert body))
> (with-temp-file (concat file ".stan") (insert body))
> (let ((default-directory org-babel-stan-cmdstan-directory))
> (call-process-shell-command (concat "make " file))))
You don't use `org-babel-stan-cmdstan-directory' to store FILE, i.e.,
FILE is saved in current directory, or any directory provided in its
path, which doesn't necessarily match
`org-babel-stan-cmdstan-directory'. Yet, make is called on
`org-babel-stan-cmdstan-directory'.
Is it intentional?
> nil)) ;; Signal that output has been written to file.
Nitpick: one semi-colon only for end of line comments.
Regards,
--
Nicolas Goaziou
next prev parent reply other threads:[~2015-08-24 14:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-24 2:36 Babel support for Stan Kyle Meyer
2015-08-24 14:51 ` Nicolas Goaziou [this message]
2015-08-24 16:40 ` Kyle Meyer
2015-08-24 15:31 ` Thomas S. Dye
2015-08-24 16:40 ` Kyle Meyer
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=877fokbuz5.fsf@nicolasgoaziou.fr \
--to=mail@nicolasgoaziou.fr \
--cc=emacs-orgmode@gnu.org \
--cc=kyle@kyleam.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).