emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] Editing/evaluation of code blocks


From: Norman Walsh
Subject: [O] Editing/evaluation of code blocks
Date: Thu, 05 May 2016 20:52:42 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Hello,

I’ve started using Org Mode more frequently and I thought it would be
fun to extend org-babel support to evaluate XQuery, JavaScript, and
SPARQL code blocks by sending them off to MarkLogic server.

I was right, it was fun :-)

If I type C-c C-c in this block:

#+begin_src marklogic :var startDate="2017-04-19T12:34:57"
  xquery version "1.0-ml";

  declare default function namespace "http://www.w3.org/2005/xpath-functions";;

  declare option xdmp:mapping "false";

  declare variable $startDate external;

  let $date   := $startDate cast as xs:dateTime
  let $diff   := current-dateTime() - $date
  return
    current-dateTime() - $date
#+end_src

I get back a result!

#+RESULTS:
: -P348DT10H59M31.387138S

Win!

But C-c ' fails because “marklogic-mode” isn’t the mode for editing
XQuery. There’s an xquery-mode for that.

I found org-src-lang-modes which allows me to make ‘marklogic’ use
xquery-mode, except that that’s wrong when I’m editing JavaScript
or SPARQL. :-(

Is there some way, in the source block itself, to specify
*independently* the mode that should be used to edit and the language
package that should be used for evaluation?

Guessing not, I considered refactoring the code to support ‘xquery’,
‘javascript’, and ‘sparql’ languages.

That would be fine, but I presume there are (or will eventually be)
other backends for evaluating these languages. Maybe the answer then
is simply not to load two different ones at the same time, but that
doesn’t seem very satisfying.

Am I overlooking something?

Suggestions most welcome.

                                        Be seeing you,
                                          norm

-- 
Norman Walsh <address@hidden> | We are what we repeatedly do.
http://nwalsh.com/            | Excellence, then, is not an act, but a
                              | habit.--Aristotle

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]