Commit graph

42 commits

Author SHA1 Message Date
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
John Miller
5c945a174f Document changes to ob-ein. Error when no :image header specified.
ob-ein will alert the user if they are generating an image in the ob-ein source
block and no :image header has been supplied. Added some documentation for good
measure, though people will probably still get tripped up by this.
2017-01-18 10:31:30 -06:00
John Miller
7e222f3ebf ob-ein: better formatting for results.
Return the results of execution as a single string instead of a list of strings.
This allows some more flexibility when dealing with :results parameters and
seems to fix a bug with inserting matplotlib images. Hint: try using `:results
value raw`.
2017-01-18 09:58:37 -06:00
John Miller
e226b30139 Follow redirects, numerous other fixes.
Content api tries to handle redirects, pointing new content towards the
redirected url instead of the one supplied by the user. Login with redirects not
working, though.

Other fixes:

 - Fixed bug in ein-ac that was generating errors outside of ein buffers.
 - New function `ein:pyools-set-figure-size` as shortcut for modifying
   matplotlib figsize rcParam.
 - ob-ein will output tracebacks when ein source block generates an error.
2017-01-11 07:42:06 -06:00
John Miller
481d8a879f Smarter ein block execution in org.
Be smarter when detecting if ein source block has finished executing. Also make
timeout user-configurable via the variable `ein:org-execute-timeout`.
2016-12-28 09:41:02 -06:00
John Miller
17a445946d Polishing cell edit buffer.
Now with overlays and better point motion in the original buffer!
2016-11-10 07:13:16 -06:00
John Miller
c0144e2cbf Edit notebook cells in popout buffer ala org-mode
Using C-c', users can create a temporary buffer running an appropriate
mode to edit the contents of a notebook cell. This functionality is
intentionally very similar to what org-mode provides for editing blocks
of code or other.
2016-10-25 18:00:51 -05:00
John Miller
7cab72cac3 Stability fixes.
Get the call signature correct, try to avoid always calling
`ein:query-kernelspec`.
2016-10-16 19:52:01 -05:00
John Miller
3d50f72e0a Handle session and kernelspec slightly better.
Try to be more robust in handling session and kernelspec parameters for
org source blocks.

Get rid of submodules (again). The future is Cask.
2016-10-13 15:15:08 -05:00
John Miller
ea9933ec9d Better return values, except for images
Do a better job return results of code execution, however images are not
being saved to file. Very unsure why this is.
2016-10-12 13:42:19 -05:00
John Miller
f4dfd363dc Basic support for org code blocks
We can execute code blocks via the shared output buffer, but support for
handling return values is very rudimentary.
2016-10-11 20:29:48 -05:00