standalone CoreMirror (specialized web server)

Hello All,

I’m coding my MELT monitor (in relation with MELT, a domain specific language to customize the GCC compiler). FWIW the grandiose long-term goal might be a free software static analyzer with a Web interface (Coverity like -without copying any of its particular interface or functionality feature-, to give an idea). I’m not at all sure to reach that goal :frowning:

The MELT monitor is a standalone C program (GPLv3+ licensed free software, currently alpha-stage) which uses the libonion HTTP server library to provide a web interface (and several othe free software libraries). So the user would for example run the monitor as ./monimelt -Dweb -W localhost:8086 then would browse http://localhost:8086/hackc.html

My question is: what is the minimal self-contained set of CodeMirror files to be able to use in a standalone way CodeMirror for only C code, neo theme and emacs keymap, and what URL file tree is CodeMirror expecting?

I currently have the following files (in my “document root” for libonion)

  -rw-r--r-- 1 basile  basile  154024 Oct 28 09:40 webroot/codemirror-5.8-compressed.js
  -rw-r--r-- 1 basile  basile   17038 Oct 28 09:40 webroot/codemirror-clike-5.8-compressed.js
  lrwxrwxrwx 1 basile  basile      34 Oct 28 09:45 webroot/codemirror-clike.js -> codemirror-clike-5.8-compressed.js
  -rw-r--r-- 1 basile  basile    8023 Aug 19 15:47 webroot/codemirror.css
  -rw-r--r-- 1 basile  basile    7231 Oct 28 09:42 webroot/codemirror-emacs-keymap-5.8-compressed.js
  lrwxrwxrwx 1 basile  basile      41 Oct 28 09:45 webroot/codemirror-emacs-keymap.js -> codemirror-emacs-keymap-5.8-compressed.js
  lrwxrwxrwx 1 basile  basile      28 Oct 28 09:44 webroot/codemirror.js -> codemirror-5.8-compressed.js
  lrwxrwxrwx 1 basile  basile      24 Oct 28 10:54 webroot/codemirror-theme.css -> codemirror-theme-neo.css
  -rw-r--r-- 1 basile  basile     947 Aug 19 15:47 webroot/codemirror-theme-neo.css

for what it is worth, it is the ffe6390de8e… commit of my github. The HTML code is hackc.html

But things are not working like I expect, in particular the theme is not visible at all.

Another question is: I am authorized to redistribute parts of CodeMirror in a GPLv3+ software? (I guess that yes, but I would prefer a confirmation of that).


Basile Starynkevitch
France ; email basile at starynkevitch dot net

If you are loading the scripts with script tags, then the directory structure is entirely up to you. If you are using a module loader, you have to preserve the relative paths as they are in the distribution. But you’d probably want to bundle the files up and minify them as a single file instead.

Did you set the theme option on your editor?

And yes, MIT code can be distributed as part of a GPL project.

Thanks for your help.

I finally found the error. Since I’m using Jquery, I have incorrectly coded prologuetxa = $("#prologuetxa_id") but I was missing the [0].

The code below is working:

  var prologuetxa;
  var prologuecodmir;
  prologuetxa = $("#prologuetxa_id")[0];  /// [0] is required
  prologuecodmir = CodeMirror.fromTextArea(prologuetxa, {
  lineNumbers: true,
  theme: "default",
  mode: "text/x-csrc"

Perhaps CodeMirror.fromTextArea could call console.error if the argument is not of the right type?

Regards and thanks for your help!

Basile Starynkevitch -