emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Eric Schulte" <schulte.eric@gmail.com>
To: scrawler@gmail.com
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: [BABEL] help adding a language, please?
Date: Thu, 22 Jul 2010 15:30:59 -0700	[thread overview]
Message-ID: <871vavi1xb.fsf@gmail.com> (raw)
In-Reply-To: 20100722151308.17057f89@bigblessing.tville

Hi,

scrawler@gmail.com writes:

> Hi guys,
>
> Org-mode newbie, here.  I'd like to add newlisp to the list
> of languages that babel supports.

That's fantastic.

> I got ob-template.el and replaced all occurrences of "template" with
> "newlisp."
>
> When I try to execute a code block, it fails, looking for
> "inf-newlisp."  That's "inferior-mode," right?  Can I work
> around that somehow?  There is a newlisp mode available
> here:
> http://github.com/may/newlisp-mode
> I'm running Org-mode 7.01.
>

This depends if you'd rather execute newlisp code blocks in a "session"
(i.e. in an inferior newlisp buffer, which would require newlisp-mode),
or if you'd rather evaluate newlisp externally.  Most languages support
both types of evaluation, but I'd recommend starting with a single
execution mode (whichever will be simpler to implement), and then
incrementally adding functionality.

I just installed newlisp locally, it looks like a nice language, I may
start using this as I've been looking for a light-weight lisp/scheme for
small scripting tasks.

I just put together the following, which works for me as a simple
evaluation function -- note this takes the "external evaluation" path.

--8<---------------cut here---------------start------------->8---
(defun org-babel-execute:newlisp (body params)
  (let ((tmp-file (make-temp-file "org-babel-newlisp")))
    (with-temp-file tmp-file
      (insert
       (format "(println (begin\n%s\n))\n(exit)" body)))
    (prog1 (org-babel-eval (format "newlisp -f %s" tmp-file) "")
      (delete-file tmp-file))))
--8<---------------cut here---------------end--------------->8---

Note, this doesn't make use of *any* of Babels header argument
functionality, but it could serve as a place to start.

>
> Org-mode is great!  I sure hope you guys are tolerant of
> stupid questions, because I've got a bunch of them. 
> :-)

Please don't be shy about asking questions, we can be a very
understanding bunch.

Happy Hacking -- Eric

  reply	other threads:[~2010-07-22 22:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-22 20:13 [BABEL] help adding a language, please? scrawler
2010-07-22 22:30 ` Eric Schulte [this message]
2010-07-22 23:20 ` David O'Toole
2010-07-23 16:01   ` Eric Schulte
2010-07-23 16:04     ` David O'Toole

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=871vavi1xb.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=scrawler@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).