emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Joe Riel <joer@san.rr.com>
To: "Thomas S. Dye" <tsd@tsdye.com>
Cc: Marco Maggesi <maggesi@math.unifi.it>, emacs-orgmode@gnu.org
Subject: Re: obtain ob-template.el for Babel language extension
Date: Wed, 16 Sep 2015 08:43:34 -0700	[thread overview]
Message-ID: <20150916084334.597c102b@gauss> (raw)
In-Reply-To: <m2zj0obe7j.fsf@tsdye.com>

On Mon, 14 Sep 2015 16:37:04 -1000
Thomas S. Dye <tsd@tsdye.com> wrote:

> 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 <maggesi@math.unifi.it> 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').

The questions were related.  The real problem, as I pointed out previously,
is that using first, second (or car, etc) doesn't work because it assumes
an ordering that doesn't exist, as Eric notes.  As such, ob-template.el 
is broken and should be replaced.  If I get some cycles I'll push a
patch.

> 
> >>
> >> 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 <maggesi@math.unifi.it> 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 <tsd@tsdye.com> ha
> > scritto:
> >
> >> Aloha Joe,
> >>
> >> Joe Riel <joer@san.rr.com> writes:
> >>
> >> > On Thu, 10 Sep 2015 20:38:12 -1000
> >> > Thomas S. Dye <tsd@tsdye.com> wrote:
> >> >
> >> >> Aloha Joe,
> >> >>
> >> >> Joe Riel <joer@san.rr.com> 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
> >>
> >>
> 



-- 
Joe Riel

  reply	other threads:[~2015-09-16 15:43 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-11  5:23 obtain ob-template.el for Babel language extension Joe Riel
2015-09-11  6:38 ` Thomas S. Dye
2015-09-11 14:37   ` Joe Riel
2015-09-11 16:03     ` Thomas S. Dye
2015-09-11 19:30       ` Marco Maggesi
2015-09-13 17:45         ` Joe Riel
2015-09-15  2:37         ` Thomas S. Dye
2015-09-16 15:43           ` Joe Riel [this message]
2015-09-12  4:13       ` Joe Riel
2015-09-12 17:15         ` Thomas S. Dye
2015-09-12 17:39           ` Joe Riel
2015-09-12 18:50           ` [PATCH] small improvements to info page, Working with source code Joe Riel
2015-09-13 17:32             ` [PATCH] small improvements to info page, Working with source code; add TINYCHANG Joe Riel
2015-09-13 18:24               ` Rasmus

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=20150916084334.597c102b@gauss \
    --to=joer@san.rr.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=maggesi@math.unifi.it \
    --cc=tsd@tsdye.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).