emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Norman Walsh <ndw@nwalsh.com>
To: emacs-orgmode@gnu.org
Subject: Editing/evaluation of code blocks
Date: Thu, 05 May 2016 20:52:42 -0500	[thread overview]
Message-ID: <8760usrlzp.fsf@nwalsh.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1943 bytes --]

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 <ndw@nwalsh.com> | We are what we repeatedly do.
http://nwalsh.com/            | Excellence, then, is not an act, but a
                              | habit.--Aristotle

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 172 bytes --]

             reply	other threads:[~2016-05-06  1:53 UTC|newest]

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

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=8760usrlzp.fsf@nwalsh.com \
    --to=ndw@nwalsh.com \
    --cc=emacs-orgmode@gnu.org \
    /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).