Commit graph

81 commits

Author SHA1 Message Date
John Miller
4c33a8b057 ein-utils: Make gc-cons-threshold adjustment optional.
EIN doesn't seem to always return gc-cons-threshold to its original value; this
makes for performance problems, particularly on Windows builds, so this behavior
is now optional and user-configurable.
2019-01-14 12:56:32 -06:00
John Miller
76c3ddb7ce Revert "Merge pull request #426 from millejoh/faster-generate-menu"
This reverts commit 0ba5e42009, reversing
changes made to 483bbe8d3f.
2018-12-12 09:37:21 -06:00
John Miller
ba1c812147 ein-utils: Make ein:get-docstring a deferred construct.
This may or may not help performance during startup. See issue #409.
2018-12-06 09:11:45 -06:00
dickmao
f0984eab55 jupyterhub basic (PAM only)
`ein:login` or `ein:notebooklist-login` is the preferred way to access
jupyterhub, although `ein:jupyterhub-connect` is still autoloaded.
2018-12-04 18:31:44 -05:00
dickmao
6ca6752319 C-c C-q improved visual feedback
As `ein:notebok-kill-kernel-then-close-cmmand` must wait for the
server to delete the session, the buffer wouldn't disappear right
away, leaving the user nonplussed whether the `C-c C-q` took.  Display
a status message "Ending session" with a modest animation instead.

Also add a "Stop" test for notebooklist.  Sorry about breaking "Stop"
in ee3b0f0
2018-11-10 00:09:44 -05: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
e693a53e5a master fixes
ein:url normalization issue (fails the passworded server test).
"No servers running here" warning is unsettling for I think the
majority of users who do not run jupyter locally.
2018-10-23 02:12:45 -04:00
dickmao
085a188b20 Streamline login
Merge the login and open commands (open aliased to login).  Add login
tests described in #352.

Attempt to improve user experience by synchronously executing
`ein:jupyter-server-start`.  `ein:dev-prefer-deferred` custom variable
allows easy switch to compare sychronous versus old asynchronous behavior.
2018-10-17 16:52:10 -04: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
John Miller
a3482660a2 Support eldoc.
Really basic support for eldoc, buidling off the oinfo cache code written to
support function annotations for the ein company backend. In theory should also
work the other completion backends, but untested at the moment.
2018-09-18 21:48:07 -05:00
Tomasz Mieszkowski
c7d77ec2f5 Fix for bumping gc-cons-threshold while opening notebooks
Make `ein:gc-prepare-operation` idempotent and add missing call to
`ein:gc-complete-operation` - without it, each subsequently opened notebook
bumps gc threshold to a higher and higher value, effectively disabling all
garbage collection and seriously degrading overall performance.
2018-08-25 21:10:19 +02:00
John Miller
658787dfc1 Some utility functions in case we ever try to implement capf.
Some functions to find the beginning and ending positions of the python symbol
at point - we might need this if we ever try to implement support for
capf (completion at point function).
2018-08-25 12:25:05 -04:00
Jack
78c981597d
Fix ein:object-at-point' in subword-mode'
This fixes the `ein:object-at-point' function so it works in `subword-mode'. 

Original issue here:

https://github.com/millejoh/emacs-ipython-notebook/issues/313

-------------------------------------------------------------------------

When `subword-mode` is enabled, the `(ein:object-at-point)` function fails after dots. For example, let's say `|` is the cursor and `subword-mode` is enabled: 

Calling `(ein:object-at-point)` on this: `tf|` returns `"tf"`. This is correct.

Calling `(ein:object-at-point)` on this: `tf.|` returns `nil`. It should return `"tf."`.

Calling `(ein:object-at-point)` on this: `tf.nn|` returns `nil`. It should return `"tf.nn"`.

One side effect of this is that `company-mode` suggestions stop working after dots in `subword-mode`. For example:

```
import tensorflow as tf
tf.n|
```

Will not provide suggestions from the ein completion engine. 

I tried changing the `(ein:object-at-point)` function to return the *symbol* at point, rather than the word, and this fixed the problem. Would this produce any undesirable side effects? If not, I can submit a pull request.
2018-06-05 14:57:53 -07:00
Sam Steingold
b6e6dff7ba avoid unnecessary `eval' 2018-05-29 10:01:25 -04:00
Sam Steingold
58a199e1c6 code cleanup: remove ein:min and ein:do-nothing (ELisp has min and ignore) 2018-05-27 12:04:13 -04:00
Sam Steingold
264f355081 make timestamp format customizable and default to ISO 8601
add ein:format-time-string and use it for both ein:timestamp-format
and ein:notebooklist-date-format
2018-05-25 11:43:39 -04:00
John Miller
4ce1a31793 ein-cell: Fix for #268.
User can now ask ein to truncate long outputs in a worksheet. Use the
customizable variable `ein:truncate-long-cell-output' to control this behavior.
Set to nil to have no truncation, otherwise an integer value specifying the
number of lines to keep before truncating.
2018-03-08 13:36:09 -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
John Miller
7a4d58ea36 ein-notebook: Try to suspend GC operations when loading notebooks.
Loading large notebooks (>1M) can be slow. At least some of this is due to
downloading from the jupyter server, but this operation is asynchronous and
should not block emacs. My suspicion is that when Emacs blocks it is when it is
generating the internal data structures used to represent the notebook in emacs.
This is somewhat unavoidable, but part of the slow down may be due to reaching
the cons threshold. These changes try to temporarily increase the cons threshold
while loading the notebook. We'll see if it helps at all.
2018-03-08 09:03:09 -06:00
John Miller
c0eabfe2ad ein-notebooklist: Fix possible bug specifying notebook urls
Don't think we were handling https:// url's correctly.

Also some code cleanup in ein-connect; fix longstanding bug in ein:load-files,
and tweak default timeout for starting a jupyter session from within emacs.
2017-10-03 10:04:41 -05:00
John Miller
213cea559e ein-jupyter: Add timeout to ein:jupyter-server-start
Add configurable timeout (see `ein:jupyter-server-run-timeout`) that will
hopefully abort calls to `ein:jupyter-server-run` that hang; this is to help
with issues like those reported in #176.

Also update documentation, dependencies in preparation for 0.13.0 release.
2017-09-03 10:29:54 -05:00
John Miller
5c2f34ceeb Implement company locate command.
ein company backend now dutifully looks for the file and line where an object is
defined when company so asks it. When ein fails in its duty it fails silently
and I am not sure yet if that is the correct behavior. For now it will stand,
until I think of something better.
2017-04-21 19:07:16 -05:00
John Miller
0ea4a9adef Cleaning up compile warnings.
Slowly move towards cl-generic instead of EIEIO.

Got rid of json encoding defadvices. So far so good.
2017-03-16 16:16:16 -05: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
45f9b00449 Better macro name, make sure it gets required.
Better name for support macro to temporarily disable undo, add a require to the
code where it is being used.
2016-12-18 22:19:50 -06:00
John Miller
d57c74577f Undo for cell actions: motion, insert, execute.
Some cell actions now have a true undo. Moving, inserting and executing cells
can all be undone. Deleting cell does not have an undo at the moment, though the
preferred method for users is to call ein:worksheet-kill-cell which puts the
removed cell into the kill-ring.
2016-12-16 18:01:06 -06: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
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
John Miller
c5cf44a795 Fix saving new notebooks, whitespace updates.
Newly created notebooks no longer error on saving - bug in how
kernelspec metadata was being filled in.

Also a number of miscellaneous fixes to indentation that have
inexplicably appeared in the code.

Some small fixes for typos and catching up on version info.
2016-03-01 16:02:00 -06:00
John Miller
a1489613ac Fixing null in output metadata
Somewhat hackish solution by defadvicing json.el code to
overcome possible bug in said code. Apparently
`json-encode` does not handle nested empty hash tables properly.
2016-01-03 08:23:55 -07:00
John Miller
55be1cbf26 Refactoring support for contents API
Start of a refactor of code for accessing Jupyter's new contents API.
First up an implementation of list contents.

New function for flattening lists borrowed from cl-alexandria (how did
we survive withoutthis in the before times?)

Updating author list here and there.
2015-01-31 10:13:49 -06:00
Takafumi Arakaki
d62dc59869 Require 'cc-mode in ein-utils.el
It looks like in new Emacs version (> 24.3?), c-mode-syntax-table is not
available by default.
2014-03-17 19:14:02 +01:00
Takafumi Arakaki
992104ebf5 Send proper cookie in ein:kernel-send-cookie 2012-12-17 17:39:46 +01:00
Takafumi Arakaki
827717cd0d ein:console-args can take a list as value now 2012-12-06 23:16:44 +01:00
Takafumi Arakaki
bd122efe7e Add ein:display-warning-once and use it in ein:console-make-command 2012-12-06 23:16:44 +01:00
Takafumi Arakaki
5f0f75dcc8 Add utility function ein:plist-exclude 2012-12-06 17:41:39 +01:00
Takafumi Arakaki
997e8660cd Make ein:and-let* work with edebug 2012-10-15 18:34:49 +02:00
Takafumi Arakaki
d5b741a292 Move ein:html-get-data-in-body-tag to ein-utils.el 2012-10-09 15:27:36 +02:00
Takafumi Arakaki
509064d8d8 Test ein:find-leftmot-column more and fix it 2012-10-09 14:23:06 +02:00
Takafumi Arakaki
585739e6b2 Add a command ein:worksheet-dedent-cell-text 2012-10-09 14:02:39 +02:00
Takafumi Arakaki
f41e2b206d Document ein:call-process 2012-09-28 17:00:59 +02:00
Takafumi Arakaki
6a9ff84a18 Add ein:version *function* 2012-09-28 16:41:35 +02:00
Takafumi Arakaki
5dd62427f4 Fix ein:json-encode-char: use \uNNNN for char > 126
See the patch I sent to emacs-devel and the actual fix here:

* http://bzr.savannah.gnu.org/lh/emacs/trunk/revision/110227
* http://lists.gnu.org/archive/html/emacs-devel/2012-09/msg00701.html
2012-09-27 19:37:53 +02:00
Takafumi Arakaki
610120ded7 Simplify ein:list-move-left 2012-09-02 04:20:39 +02:00
Takafumi Arakaki
f25e3b98a7 Add utility function ein:list-move-right 2012-09-02 04:05:44 +02:00
Takafumi Arakaki
81ec270382 Add utility function ein:list-move-left 2012-09-02 04:04:45 +02:00
Takafumi Arakaki
df0b8fb45b Add ein:list-insert-before/after 2012-09-01 23:26:42 +02:00
Takafumi Arakaki
1f301973c8 Set buffer in ein:worksheet-to-json 2012-08-29 21:32:06 +02:00
Takafumi Arakaki
bf9d4f7b5d Move EIN specific stuff to ein-core from ein-utils 2012-08-28 15:36:15 +02:00
Takafumi Arakaki
8ce439b927 Add ein:kernel-history-request 2012-08-28 12:18:12 +02:00