all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Editing/evaluation of code blocks
@ 2016-05-06  1:52 Norman Walsh
  2016-05-09 20:08 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: Norman Walsh @ 2016-05-06  1:52 UTC (permalink / raw)
  To: emacs-orgmode

[-- 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 --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Editing/evaluation of code blocks
  2016-05-06  1:52 Editing/evaluation of code blocks Norman Walsh
@ 2016-05-09 20:08 ` Nicolas Goaziou
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2016-05-09 20:08 UTC (permalink / raw)
  To: Norman Walsh; +Cc: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-05-09 20:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-06  1:52 Editing/evaluation of code blocks Norman Walsh
2016-05-09 20:08 ` Nicolas Goaziou

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.