From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Babel support for Stan Date: Mon, 24 Aug 2015 16:51:26 +0200 Message-ID: <877fokbuz5.fsf@nicolasgoaziou.fr> References: <87si794dkk.fsf@kyleam.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42696) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZTt4K-0005Q9-N3 for emacs-orgmode@gnu.org; Mon, 24 Aug 2015 10:49:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZTt4H-00049Q-8o for emacs-orgmode@gnu.org; Mon, 24 Aug 2015 10:49:52 -0400 Received: from relay3-d.mail.gandi.net ([2001:4b98:c:538::195]:42979) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZTt4G-00048C-VO for emacs-orgmode@gnu.org; Mon, 24 Aug 2015 10:49:49 -0400 In-Reply-To: <87si794dkk.fsf@kyleam.com> (Kyle Meyer's message of "Sun, 23 Aug 2015 22:36:59 -0400") 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Kyle Meyer Cc: Org-mode Hello, Kyle Meyer 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