From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas S. Dye Subject: Re: obtain ob-template.el for Babel language extension Date: Mon, 14 Sep 2015 16:37:04 -1000 Message-ID: References: <20150910222354.743ce9f2@gauss> <20150911073700.356f5760@gauss> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37933) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zbg7a-0002FK-Hl for emacs-orgmode@gnu.org; Mon, 14 Sep 2015 22:37:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zbg7X-0005pz-QO for emacs-orgmode@gnu.org; Mon, 14 Sep 2015 22:37:26 -0400 Received: from gproxy2-pub.mail.unifiedlayer.com ([69.89.18.3]:52399) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1Zbg7X-0005pY-Ip for emacs-orgmode@gnu.org; Mon, 14 Sep 2015 22:37:23 -0400 In-reply-to: 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: Marco Maggesi Cc: emacs-orgmode@gnu.org, Joe Riel Aloha all, I took the liberty of forwarding Marco's queries to Eric Schulte, the author of ob-template.el. Eric no longer maintains Babel or reads the mailing list, but he replied to the queries as follows: > Marco Maggesi writes: > >> Hi, >> >> I also have a few questions about ob-template.el >> >> 1. Can we assume that the HEAD version of ob-template.el is adequate as a >> basis for an implementation which is compatible with org version 8.2.xx >> (i.e., with older versions of org-mode)? >> I would look at the latest commit to ob-template, and assume that it was sufficient to concurrent versions of Org-mode. Alternate suitable jumping off points for development of new language extensions would be the more actively used languages. Probably ob-shell is the most general and actively used. >> >> 2. In function org-babel-execute:template functions first, second, third, >> etc are used to extract values from processed-params. However, such >> function are not defined in elisp, (nth N processed-params) should be used >> instead. Is it correct? This may incorrectly assume that cl.el has been loaded. This is where these functions are defined. They should probably be replaced with the less intuitive but more portable car, cadr, caddr, etc... >> >> Also, it seems from other examples that the usual approach is to use >> assoc, e.g., (cdr (assoc ":session" params)). Are there enforced >> conventions that ensure the order in processed-params? >> I'm confused by the two components of this question. First, yes assoc is commonly used as params is an association list, however the order of elements does not matter for an association list. Second, no the order of the elements in processed-params is not guaranteed and you should not write code which makes assumptions about the order of the elements of this list (it is not mentioned in the documentation string of `org-babel-process-params'). >> >> 3. In function org-babel-expand-body:template we assume that vars is a list >> of pairs. However, it seems to me from some experiments that sometimes >> vars contains symbols. Am I wrong? >> :var elements in params should always have the following form. (:var name . value) Their cdr should always be a cons cell whose car is the name of the variable "as a symbol" and whose value is the value of the variable. I hope this helps, Eric Marco Maggesi writes: > Hi, > > I also have a few questions about ob-template.el > > 1. Can we assume that the HEAD version of ob-template.el is adequate as a > basis for an implementation which is compatible with org version 8.2.xx > (i.e., with older versions of org-mode)? > > 2. In function org-babel-execute:template functions first, second, third, > etc are used to extract values from processed-params. However, such > function are not defined in elisp, (nth N processed-params) should be used > instead. Is it correct? > Also, it seems from other examples that the usual approach is to use assoc, > e.g., (cdr (assoc ":session" params)). Are there enforced conventions that > ensure the order in processed-params? > > 3. In function org-babel-expand-body:template we assume that vars is a list > of pairs. However, it seems to me from some experiments that sometimes > vars contains symbols. Am I wrong? > > Thank you, > Marco > > > Il giorno ven 11 set 2015 alle ore 18:03 Thomas S. Dye ha > scritto: > >> Aloha Joe, >> >> Joe Riel writes: >> >> > On Thu, 10 Sep 2015 20:38:12 -1000 >> > Thomas S. Dye wrote: >> > >> >> Aloha Joe, >> >> >> >> Joe Riel writes: >> >> >> >> > How do I get a copy of ob-template.el? >> >> > The file can be viewed at >> http://orgmode.org/w/worg.git/blob/HEAD:/org-contrib/babel/ob-template.el >> >> > however, that is an html file and not the elisp. >> >> > I tried using git to clone http://orgmode.org/w/worg.git >> >> > but that does not work. >> >> >> >> ~$ git clone git://orgmode.org/worg.git >> >> >> >> You should find ob-template.el in org-contrib/babel/ >> > >> > Thanks, that was helpful. Probably mention of that fact >> > should be added to the languages.org file---currently it >> > links directly to the html file which is less useful. >> >> Done. Thanks. >> >> > Are elisp files that implement the languages in worg? >> > I found the *.org files that document them, but not their >> > sources. >> >> The language source files are distributed with Org mode. You can find >> them at lisp/ob-*.el. >> >> hth, >> Tom >> -- >> Thomas S. Dye >> http://www.tsdye.com >> >> -- Thomas S. Dye http://www.tsdye.com