emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Norman Walsh <ndw@nwalsh.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Editing/evaluation of code blocks
Date: Mon, 09 May 2016 22:08:39 +0200	[thread overview]
Message-ID: <87inynyoxk.fsf@saiph.selenimh> (raw)
In-Reply-To: <8760usrlzp.fsf@nwalsh.com> (Norman Walsh's message of "Thu, 05 May 2016 20:52:42 -0500")

Hello,

Norman Walsh <ndw@nwalsh.com> writes:

> 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.

I may be wide off the mark, but could you introduce marklogic-xquery
marklogic-js marklogic-sparql instead?


Regards,

-- 
Nicolas Goaziou

      reply	other threads:[~2016-05-09 20:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-06  1:52 Editing/evaluation of code blocks Norman Walsh
2016-05-09 20:08 ` Nicolas Goaziou [this message]

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=87inynyoxk.fsf@saiph.selenimh \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=ndw@nwalsh.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).