Commit graph

60 commits

Author SHA1 Message Date
John Miller
b2d1acc9d5 Issue #644: Add multilang support for xeus-cling
Multilang support for c, c++11, c++14, and c++17. Org babel source blocks are
also support.

Dropping (for a moment) testing against python27 on travis.
2020-01-24 11:16:56 -07:00
John Miller
f76edbbf42
Better consistency with kernel connections in anonymous ob-ein blocks. (#624)
* Better consistency with kernel connections in anonymous ob-ein blocks.

And some tests to try to prove this is the case.

* Make sure company-mode is enabled.

* Undo cursor shifts.

* Company mode still not catching.

* Travis unhappy with undo and anonymous completion.

Tests work locally, but fail on travis. Let's play around a bit.

* Revert undo position jiggers.

I think the issue is character or line ending encoding in WSL (i.e. Windows) and
a "normal" Linux setup.
2019-11-27 08:59:52 -07:00
Sam Steingold
448e161068 Avoid dependency on the deprecated package "cl"
Replace `defun*' with `cl-defun', `loop' with `cl-loop',
  `case' with `cl-case', `assert' with `cl-assert',
  `destructuring-bind' with `cl-destructuring-bind',
  `multiple-value-bind' with `cl-multiple-value-bind',
  `equalp` with `cl-equalp`, `defstruct' with `cl-defstruct`
  &c &c &c
Use lexical-binding instead of lexical-let.
Add declarations and defvar to avoid breakage.
2019-10-12 08:37:46 -05:00
dickmao
ed4522b787 ob-lang cannot require org
Generally, ob-lang modules cannot require org, else it gets into
infinite require loop.

This begs the question whether ob-ein is really used by anyone.
2019-09-29 17:16:25 -04:00
dickmao
507eaf4d9a fix NPE in poly-ein (revealed in ESS) 2019-09-29 12:19:46 -04:00
dickmao
189b89fb6c give purcell/nix-emacs-ci a spin 2019-09-29 12:19:36 -04:00
dickmao
2ca536fdec add org-export test 2019-08-10 21:16:51 -04:00
John Miller
ce419a12a5
Appveyor iterating (WIP) (#573)
* ob-ein: Bring back old functionality.

Bring back some old features to babel edit buffers while trying to respect
recent addition of polymode support.

* Override polymode if the user really wants.

Polymode is really for notebook buffers in any case, but this will override
whatever completion backmode a user has configured for python-mode.

* Install cask using python2.

For now python2 is the easiest option for testing on Windows since cask does
not properly support python3 when in Windows.

* Let's throw in the ert-runner, see what happens.

* Can I use my fork of cask?

Work around smartrep weirdness, try to live without command line wildcard
expansion.

* Get the url for the fork right.

* Experiment with python37, use test_script.

* Unstick appveyor, I hope.

* Fix parsing error.

* test_script is not executing. Why?

* Add ert testing.

But why are the test_script commands not executing?

* tasks: Automate building and testing using invoke.

Invoke leverages Python, which I hope will allow us to abstract out differences
in platforms when it comes to building and testing ein.

* Use invoke on appveyor.

* appveyor: Use the environment python.

So we can test versions other than python 2.7.

* Parsing error.

Is
https://packaging.python.org/guides/supporting-windows-using-appveyor/#setting-up
lying to me?

* Quote commands, just in case.

* Get python onto the path.

* Appveyor is catching up to travis.

* Parsing error.

* Update pip, try to get quoted syntax right.

* Still not liking my pip call.

Last try, next step we go to a requirements.txt file.

* Go to using a requirements file for pip.

* ecukes needs bash to work.

* Cleaning up and fiddling.

Seems like the emacs-jupyter guy has his act together - maybe we can take some
inspiration for our appveyor config.

* Syntax error in environment.

* More syntax errros.

* Maybe we need quoting.

* I give up.

* Formatting and cleanup.

* Add customization, yet another syntax error.

New customizable variable `ob-ein-babel-edit-polymode-ignore' to override
keybinding for \C-c\C-c in an org source code edit buffer.

* John learned some Powershell today.

* Fix the executable path.

Sometimes there is more than one curl installed on the system, make sure we can
account for that in testing.

* Handle updating the path inside invoke.

* Report which curl we are using before starting functional tests.

* Enable RDP so we can see error logs.

* Keep the build alive even when it finishes.

* Fix #568.

Apparently we need to specify the user agent when on windows, otherwise tornado
will start throwing 403 responses. Currently using Mozilla/4.0 as the agent, but
might be a good idea to make this value customizable.

* Clean up emacs config.

* Why is appveyor dropping the xsrf token?

* xsrf cookie found, what does the header look like?

* Try different user-agent header, reenable rdp.

* JSON encoding issues on Python side, it appears. Let's try an older Python.

Login works, contents query to get notebooklist works (i.e. GET on
/contents/api), but creating a notebook (i.e. POST on /contents/api) fails with
invalid JSON. ein and emacs-request appear to be generating the proper json, but
jupyter notebook does not see the same thing that is being written. Could be
bytes vs. text issue with modern v3.x python, so let us see how this all works
with Python 2.7.

* Python27 does not have pathlib out of the box.

* Make amends with Python27

* Back to python37.

Tornado/notebook still isn't reading the POST'ed json correctly.

* Do we need to specify content type?

* Must be selective in specifying application/json content.

* Re-enable rdp.

* Let's try a different curl.

* Ensure most recent curl is on path

* Try a different path.

* Try to warn user if suspicious curl detected.

* Remove debugging statements.

* EVM depends on trusty for 26.x

See issue #125 (https://github.com/rejeep/evm/issues/125). Let's hope I got the
travis.yml syntax right.

* Minimal support for ecukes from invoke.

* Cleaner server shutdowns, better ecukes support from invoke.

Use the /api/shutdown REST API call now to shutdown running server. Also support
more command line options for ecukes from invoke.

* Almost full support of ecukes using invoke.

But! Also disabling integration testing for the time being until I understand
why ecukes fails even though everything else is working.

* Just do integration and functional testing on appveyor.

Better than nothing while I work out what is breaking the integration tests.
2019-07-28 18:20:13 -06:00
dickmao
c7b8b4cb27 ob-ein bugfix
Currently, an org block that has no output (e.g., `foo = 5`) never
clears the `[....]` upon block completion.

Also, no `:session` should default to localhost.
2019-05-21 19:24:24 -04:00
dickmao
e491ac6f1c Ob-ein Improvements
Bring the org offering to feature parity.
2019-05-20 10:59:43 -04:00
finalpatch
e178f92772
fix last commit 2019-04-01 21:13:18 +11:00
finalpatch
35244abc88
indent name tag 2019-04-01 20:58:28 +11:00
dickmao
4f468ee5f7 Singleton
We can't be certain when the shared output cell can be safely turned
over to the next org block.  I have witnessed `display_data` updates being
received *after* both the `execute_result` and `execute_reply`
messages.  As a HACK, we `run-at-time 2` seconds the turning over of
the cell to accommodate any eleventh hour straggler display_data's.
2019-02-21 23:14:11 -05:00
dickmao
0f7f8b14cd Test C-c ' 2019-02-20 11:50:46 -05:00
dickmao
ed6482096e Add ob-ein tests
Also, speed up login and other cleanups
2019-02-19 10:06:15 -05:00
John Miller
50b9a8d134 ob-ein: Better output for babel.
Greg Sexton clearly knows his way around org better than I. For async execution
make sure we insert results "the org way."
2019-02-17 21:10:08 -06:00
dickmao
20de508c52 make test-compile and make install
test-compile attempts to egrep "bad" warnings with hardcoded strings.
This is better than nothing, but misses a lot.  We are close
to elimiinating this hack in favor of `(setq
byte-compile-error-on-warn t)` to enforce no warnings whatsoever.  Until
then, keep adding egrep strings to `test-compile`.

Without `(package-refresh-contents)`, the `make install` won't be able
to download and install dependencies for new users.  Remedy this.

Retire files that will never be used.
2018-12-01 08:32:56 -05:00
stardiviner
f6e55fde96
ob-ein support automatically create direct with parents 2018-11-26 14:57:31 +08:00
Jack Kamm
f96558004e Always prefer text to html for ob-ein output 2018-11-22 11:23:22 -08:00
Jack Kamm
9c98beaab2 Allow non-Python languages in ob-ein. 2018-11-22 11:22:43 -08:00
dickmao
0490031ec8 Sane File Navigation
As emacs users we prefer and have the luxury of fuzzy file navigation
via ido and projectile.  From a notebook or notebooklist buffer, the commands

`C-c C-f` ein:file-open
`C-c C-o` ein:notebook-open

offer an ido alternative to point and click navigation.

To populate the ido lists, retrieving the content hierarchy is on by
default.  Two custom variables determine how wide and deep the content query
probes (currently at 2 levels deep and 6 directories wide).  Set both
to zero to turn off.

tkf half finished code to quickly go from local file buffers to notebook
mode via `C-c C-z` or `C-c C-o`.  This is now possible.  EIN will
start the server from a suitable parent directory of the visited file.

Enable ido completion for `notebooklist-login`.

Remove the albatross `ein-loaddefs.el` in favor of more standard
`ein-autoloads.el` that is not git tracked.

Convenience `make install` from git source (local alternative to
melpa).
2018-10-26 18:40:19 -04:00
dickmao
3ba5548208 Issue #355 - remove an endless loop
Remove a waiting for godot loop in `ob-ein`.
Add a test stub for ob-ein.
2018-10-21 14:44:11 -04:00
John Miller
ad978aad11 ob-ein: Save source block contents before executing.
Fixes #358.
2018-10-19 13:41:13 -05:00
John Miller
81ea6b25fa ob-ein.el: Fix for starting sessions from an org buffer.
John has now achieved zen understanding of the difference between `funcall' and
`apply'.
2018-10-16 16:05:06 -05:00
dickmao
9c1271b8d9
Merge branch 'master' into issue-350 2018-10-15 12:32:28 -04:00
dickmao
512658883b @sam-s says Requiring ESS is wrong because it forces people who do NOT use it to install it.
The standard way to avoid this problem is to use autoload instead of require.
This way ESS is not required to compile and run EIN and it is only loaded if the user actually uses it.
2018-10-15 12:19:30 -04:00
John Miller
032c6f4d8c ob-ein: Make session url's consistent.
Ensure canonical representation defined in `ein:url' is being used for session
identifiers. Not doing this was confusing ob-ein on what kernelspec to use.
2018-10-15 11:04:55 -05:00
dickmao
bc10cea743 Normalize url-or-port
```
"http://localhost:8888"
"http://localhost:8888/"
"http://127.0.0.1:8888"
"http://127.0.0.1:8888/"
"8888"
8888
```

Ideally these should converge to the same thing.  Since many hash
tables are keyed off `url-or-port`, forgetting to
normalize `url-or-port` with `ein:url` leads to missed cache hits and
general malaise.  So we try to do that.

Address a FIXME: apply callbacks to `ein:notebook-list-login-and-open`.

Removed py3.5 from travis build matrix to reduce developer strain.
2018-10-12 21:55:33 -05:00
dickmao
11c2245c41 Asynchronize all server communication
Use deferred and callbacks instead of `:sync t` for tkf requests which
is known to have issues.  Query server attributes once on
notebooklist-open to avoid sequencing issue #176 (but allow Resync).
Under curl backend, a second request for the same "key" as a pending
request will abort the latter, which has resulted in a clobbered
curl-cookie-jar file, so merely warn and don't abort.

Fix #176
2018-10-07 00:40:48 -04:00
John Miller
81072a537f ob-ein: Execute hy code from org mode source blocks.
New source block ein-hy that will execute hy code if your python kernel has
hylang installed.
2018-06-09 11:59:42 -05:00
John Miller
8a91febf88 ob-ein: Allow code execution while in an edit buffer
Via the function `org-babel-edit:ein-execute' which s bound to `C-c C-c` by
default.
2018-06-04 08:10:50 -05:00
Sam Steingold
359d4caabc avoid compilation warnings about unused lexicals and fix minor typos 2018-05-29 17:20:54 -04:00
John Miller
f39ff47571 ob-ein: Fix for #300 2018-05-16 16:11:14 -05:00
John Miller
b6bd6bdb82 ob-ein.el: Fix for #298.
if-let* is not available in versions of emacs prior to 26.
2018-05-12 07:45:26 -05:00
colehaus
d99039c3dc
Used fixed case too 2018-05-08 21:06:56 -07:00
colehaus
74cbd99fd3
Make replace in async update literal
Without this, async updates choke on text which includes (for example) `\`
2018-05-08 20:46:33 -07:00
John Miller
847f7ca5a1 Prepare for v0.14, properly save and load hy codecells. 2018-04-14 13:29:16 -05:00
John Miller
73747d86d9 ein-shared-output: Queue up requests ala deferred:$
Try to gracefully handle multiple calls to `ein:shared-output-eval-string' by
wrapping calls to deferred:$. The deferred chain will not call
`ein:cell-execute' if the cell is already running.

Also did a bit of refactoring in ob-ein.
2018-03-10 07:53:49 -06:00
John Miller
a8fc712ca8 ob-ein: Wrap if-let* var list properly.
Make async work a little better, but can still have problems if one tries to
execute several source blocks at once.
2018-03-10 07:07:37 -06:00
John Miller
af45786726 ob-ein: Enable asynchronous execution of source blocks.
Can be enabled or disabled via `ein:org-async-p'.

Greatly inspired by ob-ipython-async and scimax (see the source code, Luke!).
2018-03-08 09:07:31 -06:00
Konrad Hinsen
9217994839
Add a comment giving credit to @jkitchin's work 2018-02-27 09:32:51 +01:00
John Miller
2ebb039e82 ob-ein: Make :image header argument optional.
Inspired by @khinsen's ob-ipython-async, automatically generate filenames for
inline images. That is, make :image an optional argument for ein source blocks
in org.
2018-02-25 12:43:12 -06:00
John Miller
ebbf7da36d ob-ein: More stable when starting sessions.
Still not 100%, but ob-ein behaves slightly better when trying to connect to a
notebook that is not currently open.
2017-11-07 15:13:23 -06:00
John Miller
1ab98b0c9d ein-jupyter: More stable ein:jupyter-server-start
Trying to increase reliability of starting a juptyer server from Emacs. Deferred
is cool, but a pain to understand for this old brain.

Fix some typos in ein-ob and be smarter selecting completion backend when
connecting a python buffer to a jupyter notebook.
2017-09-22 14:31:14 -05:00
John Miller
3fc8d55722 ob-ein: Connect edit buffer to running notebook.
Instead of just enabling auto complete why not just connect to the notebook ala
`ein:connect-to-notebook`?

Update dependencies documented in README.rst

Force version check when starting the jupyter server - ein seems to be easily
confused in this regard.
2017-09-20 14:40:27 -05:00
John Miller
40faf6fa4d ob-ein: More robust editing setup.
Try to do the right thing if a notebook server is not running.
2017-09-19 13:49:31 -05:00
John Miller
1bcc3b87c5 ob-ein: Tap into ein autocompletion for org source edit buffers.
Will try to use ein completion backend configured by user when editing ein
source blocks in org.

Also slightly more robust inspecting in ein_inspector.py
2017-09-19 13:08:13 -05:00
John Miller
db07da61d3 ob-ein: Always return full uri's for sessions, even if only port has been given. 2017-04-26 21:09:39 -05:00
John Miller
461e400c9d ob-ein: Handle full uri's in :session argument.
Correctly handle full uri's when they are provided as a :session. Also ob-ein
converts :session arguments that just specify the port into full uri's.
2017-04-26 21:09:39 -05:00
John Miller
2615d77a7f ob-ein's custom header name should be :image, not :images. 2017-01-30 21:34:58 -06:00