The Emacs IPython Notebook

_images/ein_logo.jpg

The Emacs IPython Notebook (EIN) package provides a IPython Notebook client and integrated REPL (like SLIME) in Emacs. EIN improves notebook editing by allowing you to use Emacs, it also expose IPython features such as code evaluation, object inspection and code completion. These features can be accessed anywhere in Emacs and improve Python code editing and reading in general in Emacs.

Highlighted features:

  • Copy/paste cells in and between notebooks.
  • Console integration: You can easily connect to a kernel via a console application. This enables you to start debugging in the same kernel. It is even possible to connect a console over ssh [1].
  • IPython kernel can be “connected” to a buffer. This enables you to evaluate buffer/region using same kernel as notebook. Notebook goodies such as tooltip help, help browser and code completion are available in these buffers. [2]
  • Jump to definition (go to the definition by hitting M-. over an object).
  • Execute code from an org-mode source block in a running kernel.

Other notebook features:

  • Inline images
  • Auto/manual-completion
  • Popup (tooltip) help
  • Syntax highlighting in each cell types (Python/Markdown/ReST/HTML)
  • Help browser (opens when executing function?)
  • Traceback viewer

Links:

[1]You need to setup ein:console-args properly
[2]Use the command ein:connect-to-notebook-command.

Quick try

The fastest way to get EIN running in this modern age is to download from MELPA or, if you are a spacemacs user, through installing the ipython-notebook layer. Using zeroein is no longer supported, though in theory it should still work.

If you are installing from MELPA and have issues with some functions not being available after emacs starts, try adding the following to your emacs init file:

(package-initialize)
(require 'ein)
(require 'ein-loaddefs)
(require 'ein-notebook)
(require 'ein-subpackages)

Requirements

  • IPython 2.0 or higher.

  • Tornado 4.0.2 or higher.

  • websocket.el 1.3

  • request.el >= 0.2

  • (optional) mumamo developmental version: It will be automatically loaded when it is on the path. The official way to setup path is to load nXhtml.

  • (optional) markdown-mode

  • (optional) python-mode: It should work with either python.el or python-mode.el. python.el is required to use ein:console-open command.

  • (optional) auto-complete.el You need to configure subpackage ein-ac to enable this feature.

  • (optional) smartrep.el: This package enables you to omit typing prefix keys (e.g., C-c C-n C-n C-n ... instead of C-c C-n C-c C-n C-c C-n ...). You need to configure subpackage ein-smartrep to enable this feature.

  • (optional) jedi.el: Python auto-completion for emacs using jedi. In your emacs initialization file add

    (add-hook 'ein:connect-mode-hook 'ein:jedi-setup)

Also, EIN heavily relies on standard Emacs libraries including EWOC, EIEIO and json.el.

[3]See Gotchas and caveats > python-mode.el.

Install

Warning

As EIN relies on many packages and it will not work properly with outdated versions, installing it using el-get or MELPA is highly recommended.

Using el-get

If you use developmental version of el-get installation is simple. Emacs IPython Notebook is registered as package ein. See the el-get website for more information.

Note

If you get error “Cannot open load file: request” that means you have an older version of el-get. You can fix this problem by either (1) installing request.el manually, (2) using the latest recipe, or (3) updating el-get to its master.

You can get the latest recipe here:

See issue 98 for more information.

Using package.el (MELPA)

You can install EIN using package.el when MELPA package repository is added to its setting. See MELPA website for more information.

Manual install

Put Emacs lisp ein*.el files and Python file ein.py in a directory defined in your load-path.

You should byte compile EIN, especially when using MuMaMo, otherwise editing large notebook will be very slow. You can use the following command to compile EIN. If you don’t specify all the optional packages, there will be compiler warning but that is OK as long as you don’t use that optional package.

emacs -Q -batch -L .          \  # don't forget the dot!
    -L PATH/TO/websocket/     \
    -L PATH/TO/requests/      \
    -L PATH/TO/nxhtml/util/   \  # optional (for MuMaMo)
    -L PATH/TO/auto-complete/ \  # optional
    -L PATH/TO/popup/         \  # optional (for auto-complete)
    -L PATH/TO/fuzzy/         \  # optional (for auto-complete)
    -L PATH/TO/smartrep/      \  # optional
    -L PATH/TO/rst-mode/      \  # optional
    -f batch-byte-compile *.el

Setup

Here is the minimal configuration. See customization for more details.

(require 'ein)
(require 'ein-loaddefs)
(require 'ein-notebook)
(require 'ein-subpackages)

Usage

  1. Start the Jupyter notebook server from the terminal or call M-x ein:jupyter-server-start from emacs. Note starting the notebook server from emacs will automatically call ein:jupyter-server-login-and-open, making steps 2 and 3 below unnecessary!
  2. If you have token or password authentication enabled then you will need to call M-x ein:notebooklist-login and enter the appropriate password.
  3. Hit M-x ein:notebooklist-open to open notebook list. This will open notebook list buffer.
  4. In the notebook list buffer, you can open notebooks by selecting the [Open] buttons. See the notebook section for operations and commands available in the notebook buffer.

Commands/Keybinds

Running a Jupyter Notebook Server from Emacs

Using the commands below you start a jupyter notebook session from within emacs (i.e. no need to drop to the terminal shell and call jupyter notebook). If you are particularly lucky ein will also determine the access url and token authentication for the running server and automatically log you in.

Note that the below work best with current (> v4.3.1) versions of jupyter.

function (ein:jupyter-server-start server-cmd-path notebook-directory &optional no-login-after-start-p)

Start the jupyter notebook server at the given path.

This command opens an asynchronous process running the jupyter notebook server and then tries to detect the url and token to generate automatic calls to ‘ein:notebooklist-login’ and ‘ein:notebooklist-open’.

On executing the command will prompt the user for the path to the jupyter executable and the path for the root directory containing the notebooks the user wants to access.

The buffer named by ‘ein:jupyter-server-buffer-name’ will contain the log of the running jupyter server.

function ein:jupyter-server-stop

Stop a running jupyter notebook server.

Use this command to stop a running jupyter notebook server. If there is no running server then no action will be taken.

function ein:jupyter-server-login-and-open

Log in and open a notebooklist buffer for a running jupyter notebook server.

Determine if there is a running jupyter server (started via a call to ‘ein:jupyter-server-start’) and then try to guess if token authentication is enabled. If a token is found use it to generate a call to ‘ein:notebooklist-login’ and once authenticated open the notebooklist buffer via a call to ‘ein:notebooklist-open’.

Notebook list

You can start notebook by M-x ein:notebooklist-open and enter the port or URL of the IPython notebook server.

function (ein:notebooklist-open &optional url-or-port path no-popup)

Open notebook list buffer.

function (ein:notebooklist-new-notebook &optional url-or-port kernelspec path callback cbargs)

Ask server to create a new notebook and open it in a new buffer.

function (ein:notebooklist-open-notebook-global nbpath &optional callback cbargs)

Choose notebook from all opened notebook list and open it. Notebook is specified by a string NBPATH whose format is “URL-OR-PORT/NOTEBOOK-NAME”.

When used in lisp, CALLBACK and CBARGS are passed to ‘ein:notebook-open’.

function (ein:notebooklist-login url-or-port password &optional retry-p)

Login to IPython notebook server.

function (ein:junk-new name kernelspec url-or-port)

Open a notebook to try random thing. Notebook name is determined based on ‘ein:junk-notebook-name-template’.

When prefix argument is given, it asks URL or port to use.

function (ein:notebooklist-enable-keepalive &optional url-or-port)

Enable periodic calls to the notebook server to keep long running sessions from expiring. By long running we mean sessions to last days, or weeks. The frequency of the refresh (which is very similar to a call to ‘ein:notebooklist-open‘) is controlled by ‘ein:notebooklist-keepalive-refresh-time‘, and is measured in terms of hours. If ‘ein:enable-keepalive’ is non-nil this will automatically be called during calls to ‘ein:notebooklist-open‘.

function ein:notebooklist-disable-keepalive

Disable the notebooklist keepalive calls to the jupyter notebook server.

Keymap for ein:notebooklist-mode.

<remap> <self-insert-command> undefined
- negative-argument
0 digit-argument
1 digit-argument
2 digit-argument
3 digit-argument
4 digit-argument
5 digit-argument
6 digit-argument
7 digit-argument
8 digit-argument
9 digit-argument
q quit-window
SPC scroll-up-command
S-SPC scroll-down-command
DEL scroll-down-command
? describe-mode
h describe-mode
> end-of-buffer
< beginning-of-buffer
g revert-buffer
TAB widget-forward
C-M-i widget-backward
<S-tab> widget-backward
<backtab> widget-backward
C-c C-r ein:notebooklist-reload

Reload current Notebook list.

p ein:notebooklist-prev-item
n ein:notebooklist-next-item

Notebook

The following keybinds are available in notebook buffers. Modified notebooks are saved automatically with a frequency dependenant on the setting of ein:notebook-autosave-frequency. If ein:notebook-create-checkpoint-on-save is True than a checkpoint will also be generated in the Jupyter server every time the notebook is saved. A notebook can be returned to a previous checkpoint via ein:notebook-restore-to-checkpoint. Checkpoints can also be manually created via ein:notebook-create-checkpoint.

C-c i ein:inspect-object
C-c ' ein:edit-cell-contents

Edit the contents of the current cell in a buffer using an appropriate language major mode. Functionality is very similar to ‘org-edit-special’.

C-c S ein:worksheet-toggle-slideshow-view
Changes the display of
slideshow metadata in the current worksheet.
C-c C-c ein:worksheet-execute-cell

Execute code type CELL.

C-c C-' ein:worksheet-turn-on-autoexec

Turn on auto-execution flag of the cells in region or cell at point. When the prefix argument is given, turn off the flag instead.

To use autoexec feature, you need to turn on auto-execution mode in connected buffers, using the ‘ein:connect-toggle-autoexec’ command.

C-c C-e ein:worksheet-toggle-output

Toggle the visibility of the output of the cell at point. This does not alter the actual data stored in the cell.

C-c C-v ein:worksheet-set-output-visibility-all

Show all cell output. When prefix is given, hide all cell output.

C-c C-l ein:worksheet-clear-output

Clear output from the current cell at point. Do not clear input prompt when the prefix argument is given.

C-c C-S-l ein:worksheet-clear-all-output

Clear output from all cells. Do not clear input prompts when the prefix argument is given.

C-c C-; ein:shared-output-show-code-cell-at-point

Show code cell at point in shared-output buffer. It is useful when the output of the cell at point is truncated. See also ‘ein:cell-max-num-outputs’.

C-c C-k ein:worksheet-kill-cell

Kill (“cut”) the cell at point or cells in region. Note that the kill-ring for cells is not shared with the default kill-ring of Emacs (kill-ring for texts).

C-c M-w ein:worksheet-copy-cell

Copy the cell at point. (Put the current cell into the kill-ring.)

C-c M-{ ein:notebook-worksheet-move-prev

Switch the current worksheet with the previous one.

C-c M-} ein:notebook-worksheet-move-next

Switch the current worksheet with the previous one.

C-c M-+ ein:notebook-worksheet-insert-prev

Insert a new worksheet before this worksheet and open it. See also ‘ein:notebook-worksheet-insert-next’.

(fn NOTEBOOK WS &optional (RENDER t) (SHOW #’switch-to-buffer))

C-c C-w ein:worksheet-copy-cell

Copy the cell at point. (Put the current cell into the kill-ring.)

C-c C-y ein:worksheet-yank-cell

Insert (“paste”) the latest killed cell. Prefixes are act same as the normal ‘yank’ command.

C-c C-a ein:worksheet-insert-cell-above

Insert cell above. Insert markdown cell instead of code cell when the prefix argument is given. See also: ‘ein:worksheet-insert-cell-below’.

C-c C-b ein:worksheet-insert-cell-below

Insert cell below. Insert markdown cell instead of code cell when the prefix argument is given.

When used as a lisp function, insert a cell of TYPE-OR-CELL just after PIVOT and return the new cell.

C-c C-t ein:worksheet-toggle-cell-type

Toggle the cell type of the cell at point. Use ‘ein:worksheet-change-cell-type’ to change the cell type directly.

C-c C-d ein:worksheet-toggle-slide-type
Toggle the slide metadata of the cell at point. Available slide settings are:
[slide, subslide, fragment, skip, notes, - (none)].
C-c C-u ein:worksheet-change-cell-type

Change the cell type of the current cell. Prompt will appear in the minibuffer.

When used in as a Lisp function, TYPE (string) should be chose from “code”, “markdown”, “raw” and “heading”. LEVEL is an integer used only when the TYPE is “heading”.

C-c C-s ein:worksheet-split-cell-at-point

Split cell at current position. Newlines at the splitting point will be removed. This can be omitted by giving a prefix argument (C-u).

C-c C-m ein:worksheet-merge-cell

Merge previous cell into current cell. If prefix is given, merge current cell into next cell.

C-c C-n ein:worksheet-goto-next-input
C-c C-p ein:worksheet-goto-prev-input
C-c <up> ein:worksheet-move-cell-up
C-c <down> ein:worksheet-move-cell-down
C-c C-f ein:pytools-request-tooltip-or-help

Show the help for the object at point using tooltip. When the prefix argument ‘‘C-u‘‘ is given, open the help in the pager buffer. You can explicitly specify the object by selecting it.

C-c C-i ein:completer-complete

Start completion for the code at point.

(fn KERNEL &rest ARGS &key CALLBACKS &allow-other-keys)

C-c C-x ein:tb-show

Show full traceback in traceback viewer.

C-c C-r ein:notebook-restart-kernel-command

Send request to the server to restart kernel.

C-c C-z ein:notebook-kernel-interrupt-command

Interrupt the kernel. This is equivalent to do ‘‘C-c‘‘ in the console program.

C-c C-q ein:notebook-kill-kernel-then-close-command

Kill kernel and then kill notebook buffer. To close notebook without killing kernel, just close the buffer as usual.

C-c C-# ein:notebook-close

Close NOTEBOOK and kill its buffer.

C-c C-o ein:console-open

Open IPython console. To use this function, ‘ein:console-security-dir’ and ‘ein:console-args’ must be set properly. This function works best with the new python.el which is shipped with Emacs 24.2 or later. If you don’t have it, this function opens a “plain” command line interpreter (comint) buffer where you cannot use fancy stuff such as TAB completion. It should be possible to support python-mode.el. Patches are welcome!

C-c C-. ein:pytools-jump-to-source-command

Jump to the source code of the object at point. When the prefix argument ‘‘C-u‘‘ is given, open the source code in the other window. You can explicitly specify the object by selecting it.

C-c C-, ein:pytools-jump-back-command

Go back to the point where ‘ein:pytools-jump-to-source-command’ is executed last time. When the prefix argument ‘‘C-u‘‘ is given, open the last point in the other window.

C-c C-/ ein:notebook-scratchsheet-open

Open “scratch sheet”. Open a new one when prefix argument is given. Scratch sheet is almost identical to worksheet. However, EIN will not save the buffer. Use this buffer like of normal IPython console. Note that you can always copy cells into the normal worksheet to save result.

C-c ! ein:worksheet-rename-sheet

Change worksheet name (not notebook name).

C-c { ein:notebook-worksheet-open-prev-or-last

Open previous or last worksheet. See also ‘ein:notebook-worksheet-open-next-or-first’ and ‘ein:notebook-worksheet-open-prev’.

C-c } ein:notebook-worksheet-open-next-or-first

Open next or first worksheet.

Try to open the worksheet to the worksheet WS using the function ‘ein:notebook-worksheet-open-next’, open the first worksheet if not found.

SHOW is a function to be called with the worksheet buffer if given.

C-c + ein:notebook-worksheet-insert-next

Insert a new worksheet after this worksheet and open it. See also ‘ein:notebook-worksheet-insert-prev’.

(fn NOTEBOOK WS &optional (RENDER t) (SHOW #’switch-to-buffer))

C-c - ein:notebook-worksheet-delete

Delete the current worksheet. When used as a lisp function, delete worksheet WS from NOTEBOOk.

C-c 1 ein:notebook-worksheet-open-1th

Open 1-th worksheet.

C-c 2 ein:notebook-worksheet-open-2th

Open 2-th worksheet.

C-c 3 ein:notebook-worksheet-open-3th

Open 3-th worksheet.

C-c 4 ein:notebook-worksheet-open-4th

Open 4-th worksheet.

C-c 5 ein:notebook-worksheet-open-5th

Open 5-th worksheet.

C-c 6 ein:notebook-worksheet-open-6th

Open 6-th worksheet.

C-c 7 ein:notebook-worksheet-open-7th

Open 7-th worksheet.

C-c 8 ein:notebook-worksheet-open-8th

Open 8-th worksheet.

C-c 9 ein:notebook-worksheet-open-last

Open the last worksheet.

M-RET ein:worksheet-execute-cell-and-goto-next

Execute cell at point if it is a code cell and move to the next cell, or insert if none.

M-. ein:pytools-jump-to-source-command

Jump to the source code of the object at point. When the prefix argument ‘‘C-u‘‘ is given, open the source code in the other window. You can explicitly specify the object by selecting it.

M-, ein:pytools-jump-back-command

Go back to the point where ‘ein:pytools-jump-to-source-command’ is executed last time. When the prefix argument ‘‘C-u‘‘ is given, open the last point in the other window.

M-p ein:worksheet-previous-input-history

Insert the previous input in the execution history. You can go back further in the history by repeating this command. Use ‘ein:worksheet-next-input-history’ to go forward in the history.

M-n ein:worksheet-next-input-history

Insert next input in the execution history. You can go forward further in the history by repeating this command. Use ‘ein:worksheet-previous-input-history’ to go back in the history.

<M-S-return> ein:worksheet-execute-cell-and-insert-below

Execute cell at point if it is a code cell and insert a cell bellow.

<C-up> ein:worksheet-goto-prev-input
<C-down> ein:worksheet-goto-next-input
<M-up> ein:worksheet-move-cell-up
<M-down> ein:worksheet-move-cell-down
C-: ein:shared-output-eval-string

Evaluate a piece of code. Prompt will appear asking the code to run. This is handy when you want to execute something quickly without making a cell. If the code outputs something, it will go to the shared output buffer. You can open the buffer by the command ‘ein:shared-output-pop-to-buffer’.

C-x C-s ein:notebook-save-notebook-command

Save the notebook.

C-x C-w ein:notebook-rename-command

Rename current notebook and save it immediately.

NAME is any non-empty string that does not contain ’/’ or ’’.

function (ein:worksheet-execute-all-cell ws)

Execute all cells in the current worksheet buffer.

function (ein:worksheet-delete-cell ws cell &optional focus)

Delete a cell. (WARNING: no undo!) This command has no key binding because there is no way to undo deletion. Use kill to play on the safe side.

If you really want use this command, you can do something like this (but be careful when using it!):

(define-key ein:notebook-mode-map "\C-c\C-d"
            ’ein:worksheet-delete-cell)
function (ein:junk-rename name)

Rename the current notebook based on ‘ein:junk-notebook-name-template’ and save it immediately.

function ein:notebook-kill-all-buffers

Close all opened notebooks.

function (ein:iexec-mode &optional arg)

Instant cell execution minor mode. Code cell at point will be automatically executed after any change in its input area.

function (ein:notebook-create-checkpoint notebook)

Create checkpoint for current notebook based on most recent save.

function (ein:notebook-restore-to-checkpoint notebook checkpoint)

Restore notebook to previous checkpoint saved on the Jupyter server. Note that if there are multiple checkpoints the user will be prompted on which one to use.

function (ein:notebook-enable-autosaves notebook)

Enable automatic, periodic saving for notebook.

function (ein:notebook-disable-autosaves notebook)

Disable automatic, periodic saving for current notebook.

Advanced Editing

Worksheet cells can be edited in a manner similar to source blocks in Org buffers. Use C-c ' to edit the contents of the current cell. You can execute the contents of the buffer and the results will be sent to the output of the cell being edited.

C-c ' ein:edit-cell-exit

Close the EIN source edit buffer, saving contents back to the original notebook cell, unless being called via ‘ein:edit-cell-abort’.

C-c C-k ein:edit-cell-abort

Abort editing the current cell, contents will revert to previous value.

C-c C-c ein:edit-cell-save-and-execute

Save, then execute the countents of the EIN source edit buffer and place results (if any) in output of original notebook cell.

C-c C-x ein:edit-cell-view-traceback

Jump to traceback, if there is one, for current edit.

C-x C-s ein:edit-cell-save

Save contents of EIN source edit buffer back to original notebook cell.

function ein:edit-cell-contents

Edit the contents of the current cell in a buffer using an appropriate language major mode. Functionality is very similar to ‘org-edit-special’.

function ein:edit-cell-exit

Close the EIN source edit buffer, saving contents back to the original notebook cell, unless being called via ‘ein:edit-cell-abort’.

function ein:edit-cell-abort

Abort editing the current cell, contents will revert to previous value.

function ein:edit-cell-save

Save contents of EIN source edit buffer back to original notebook cell.

function ein:edit-cell-save-and-execute

Save, then execute the countents of the EIN source edit buffer and place results (if any) in output of original notebook cell.

Connected buffer

You can connect any buffer (though typically a buffer that contains a Python file) to an opened notebook and use the kernel of that notebook to execute code, inspect objects, auto-complete code, jump to the other source, etc. Once the buffer is connected to the notebook, minor mode ein:connect-mode is enabled and the following keybinds are available.

C-c C-c ein:connect-run-or-eval-buffer

Run buffer using the ‘‘%run‘‘ magic command or eval whole buffer if the prefix ‘‘C-u‘‘ is given. Variable ‘ein:connect-run-command’ sets the command to run. You can change the command and/or set the options. See also: ‘ein:connect-run-buffer’, ‘ein:connect-eval-buffer’.

C-c C-l ein:connect-reload-buffer

Reload buffer using the command set by ‘ein:connect-reload-command’.

C-c C-r ein:connect-eval-region
C-c C-f ein:pytools-request-tooltip-or-help

Show the help for the object at point using tooltip. When the prefix argument ‘‘C-u‘‘ is given, open the help in the pager buffer. You can explicitly specify the object by selecting it.

C-c C-i ein:completer-complete

Start completion for the code at point.

(fn KERNEL &rest ARGS &key CALLBACKS &allow-other-keys)

C-c C-z ein:connect-pop-to-notebook
C-c C-a ein:connect-toggle-autoexec

Toggle auto-execution mode of the current connected buffer.

When auto-execution mode is on, cells in connected notebook will be automatically executed whenever run, eval or reload command [3] is called in this buffer.

[4]

Namely, one of

  • ‘ein:connect-run-buffer’
  • ‘ein:connect-eval-buffer’
  • ‘ein:connect-run-or-eval-buffer’
  • ‘ein:connect-reload-buffer’

Note that you need to set cells to run in the connecting buffer or no cell will be executed. Use the ‘ein:worksheet-turn-on-autoexec’ command in notebook to change the cells to run.

C-c C-o ein:console-open

Open IPython console. To use this function, ‘ein:console-security-dir’ and ‘ein:console-args’ must be set properly. This function works best with the new python.el which is shipped with Emacs 24.2 or later. If you don’t have it, this function opens a “plain” command line interpreter (comint) buffer where you cannot use fancy stuff such as TAB completion. It should be possible to support python-mode.el. Patches are welcome!

C-c C-x ein:tb-show

Show full traceback in traceback viewer.

C-c C-. ein:pytools-jump-to-source-command

Jump to the source code of the object at point. When the prefix argument ‘‘C-u‘‘ is given, open the source code in the other window. You can explicitly specify the object by selecting it.

C-c C-, ein:pytools-jump-back-command

Go back to the point where ‘ein:pytools-jump-to-source-command’ is executed last time. When the prefix argument ‘‘C-u‘‘ is given, open the last point in the other window.

C-c C-/ ein:notebook-scratchsheet-open

Open “scratch sheet”. Open a new one when prefix argument is given. Scratch sheet is almost identical to worksheet. However, EIN will not save the buffer. Use this buffer like of normal IPython console. Note that you can always copy cells into the normal worksheet to save result.

C-: ein:shared-output-eval-string

Evaluate a piece of code. Prompt will appear asking the code to run. This is handy when you want to execute something quickly without making a cell. If the code outputs something, it will go to the shared output buffer. You can open the buffer by the command ‘ein:shared-output-pop-to-buffer’.

M-. ein:pytools-jump-to-source-command

Jump to the source code of the object at point. When the prefix argument ‘‘C-u‘‘ is given, open the source code in the other window. You can explicitly specify the object by selecting it.

M-, ein:pytools-jump-back-command

Go back to the point where ‘ein:pytools-jump-to-source-command’ is executed last time. When the prefix argument ‘‘C-u‘‘ is given, open the last point in the other window.

Other useful commands:

function (ein:connect-to-notebook-command &optional not-yet-opened)

Connect to notebook. When the prefix argument is given, you can choose any notebook on your server including the ones not yet opened. Otherwise, already chose from already opened notebooks.

function ein:connect-eval-buffer

Evaluate the whole buffer. Note that this will run the code inside the ‘‘if __name__ == “__main__”:‘‘ block.

function (ein:connect-run-buffer &optional ask-command)

Run buffer using ‘‘%run‘‘. Ask for command if the prefix ‘‘C-u‘‘ is given. Variable ‘ein:connect-run-command’ sets the default command.

Shared output buffer

function ein:shared-output-pop-to-buffer

Open shared output buffer.

The map for ein:shared-output-mode-map.

C-c C-x ein:tb-show

Show full traceback in traceback viewer.

C-c C-. ein:pytools-jump-to-source-command

Jump to the source code of the object at point. When the prefix argument ‘‘C-u‘‘ is given, open the source code in the other window. You can explicitly specify the object by selecting it.

M-. ein:pytools-jump-to-source-command

Jump to the source code of the object at point. When the prefix argument ‘‘C-u‘‘ is given, open the source code in the other window. You can explicitly specify the object by selecting it.

Traceback viewer

Tracebacks from the notebook buffer can be difficult to understand. You can open a Traceback viewer by calling ein:notebook-view-traceback.

In the Traceback viewer, following keybinds are available.

Keymap for ein:traceback-mode.

RET ein:tb-jump-to-source-at-point-command
p ein:tb-prev-item
n ein:tb-next-item

PyTools

These commands can be used in the notebook buffer and the connected buffer.

function ein:pytools-doctest

Do the doctest of the object at point.

function ein:pytools-whos

Execute ‘‘%whos‘‘ magic command and popup the result.

function (ein:pytools-hierarchy &optional ask)

Draw inheritance graph of the class at point. hierarchymagic extension is needed to be installed. You can explicitly specify the object by selecting it.

function (ein:pytools-pandas-to-ses dataframe)

View pandas DataFrame in SES (Simple Emacs Spreadsheet). Open a ‘ses-mode’ buffer and import DataFrame object into it.

SES is distributed with Emacs since Emacs 22, so you don’t need to install it if you are using newer Emacs.

function (ein:pytools-export-buffer buffer format)

Export contents of notebook using nbconvert to user-specified format (options will depend on the version of nbconvert available) to a new buffer.

Currently EIN/IPython supports exporting to the following formats:

  • HTML
  • JSON (this is basically the same as opening the ipynb file in a buffer).
  • Latex
  • Markdown
  • Python
  • RST
  • Slides

Misc

function helm-ein-kernel-history

Search kernel execution history then insert the selected one.

function helm-ein-notebook-buffers

Choose opened notebook using helm interface.

function anything-ein-kernel-history

Search kernel execution history then insert the selected one.

function anything-ein-notebook-buffers

Choose opened notebook using anything.el interface.

Org-mode integration

You can execute org source blocks in EIN by adding ein to org:babel-load-languages. You need to specify a notebook via the :session argument. The format for the session argument is {url-or-port}/{path-to-notbooke}. For example:

#+BEGIN_SRC ein :session 8888/Untitled.ipynb
import sys

a = 14500
b = a+1000
sys.version
#+END_SRC

If your code block generates an image, like from an matplotlib plot, then specify the file to save the image to using the :image argument as in the example below:

#BEGIN_SRC ein :session 8888/Untitled.ipynb :image output.png
import matplotlib.pyplot as plt
import numpy as np

%matplotlib inline
x = np.linspace(0, 1, 100)
y = np.random.rand(100,1)
plt.plot(x,y)
#+END_SRC

You can also link to an IPython notebook from org-mode files.

  1. Call org-mode function org-store-link [5] in notebook buffer. You can select a region to specify a position in the notebook.
  2. Go to org-mode file and type C-c C-l (org-insert-link). This will insert a link to the notebook.
  3. Type C-c C-o (org-open-at-point) to open the link at the point of cursor.

Customization

You can customize EIN by typing M-x customize-group RET ein RET. All the configurable variables are listed below.

Subpackages

variable ein:completion-backend

Determines which completion backend to use in opened EIN notebooks.

After changing the value of this variable it is recommended that you restart Emacs. The available completion backends are:

* ein:use-ac-backend : Use auto-complete with IPython's builtin completion engine.
* ein:use-ac-jedi-backend : Use auto-complete with the Jedi backend.
* ein:use-company-backend : Use company-mode with IPython's builtin completiong engine.
* ein:use-company-jedi-backends : Use company-mode with the Jedi backend (currently not implemented).
variable ein:use-auto-complete-superpack

Set to t to use preset a little bit hacky auto-complete configuration. When this option is enabled, cached omni completion is available.

variable ein:ac-max-cache
variable ein:use-smartrep

Set to t to use preset smartrep configuration.

Warning

When used with MuMaMo (see ein:notebook-modes), keyboard macro which manipulates cell (add, remove, move, etc.) may start infinite loop (you need to stop it with C-g). Please be careful using this option if you are a heavy keyboard macro user. Using keyboard macro for other commands is fine.

variable ein:load-dev

Load development helper.

Notebook list

variable ein:url-or-port

List of default url-or-port values. This will be used for completion. So put your IPython servers. You can connect to servers not in this list (but you will need to type every time).

variable ein:default-url-or-port

Default URL or port. This should be your main IPython Notebook server.

function (ein:notebooklist-load &optional url-or-port)

Load notebook list but do not pop-up the notebook list buffer.

For example, if you want to load notebook list when Emacs starts, add this in the Emacs initialization file:

(add-to-hook ’after-init-hook ’ein:notebooklist-load)

or even this (if you want fast Emacs start-up):

;; load notebook list if Emacs is idle for 3 sec after start-up
(run-with-idle-timer 3 nil #’ein:notebooklist-load)

You should setup ‘ein:url-or-port’ or ‘ein:default-url-or-port’ in order to make this code work.

See also: ‘ein:connect-to-default-notebook’, ‘ein:connect-default-notebook’.

Notebook

variable ein:worksheet-enable-undo

Configure undo in notebook buffers.

no : symbol
Do not use undo in notebook buffers. It is the safest option.
yes : symbol
Enable undo in notebook buffers. You can’t undo after modification of cell (execution, add, remove, etc.). This is default.
full : symbol
Enable full undo in notebook buffers. It is powerful but sometime (typically after the cell specific commands) undo mess up notebook buffer. Use it on your own risk. When the buffer is messed up, you can just redo and continue editing, or save it once and reopen it if you want to be careful.

You need to reopen the notebook buffer to reflect the change of this value.

variable ein:notebook-modes

Notebook modes to use (in order of preference).

When the notebook is opened, mode in this value is checked one by one and the first usable mode is used.

Available modes:

  • ein:notebook-multilang-mode
  • ein:notebook-mumamo-mode
  • ein:notebook-python-mode
  • ein:notebook-plain-mode

Examples:

Use MuMaMo if it is installed. Otherwise, use plain mode. This is the old default setting:

(setq ein:notebook-modes '(ein:notebook-mumamo-mode ein:notebook-plain-mode))

Avoid using MuMaMo even when it is installed:

(setq ein:notebook-modes '(ein:notebook-plain-mode))

Use simple python-mode based notebook mode when MuMaMo is not installed:

(setq ein:notebook-modes '(ein:notebook-mumamo-mode ein:notebook-python-mode))
variable ein:notebook-kill-buffer-ask

Whether EIN should ask before killing unsaved notebook buffer.

variable ein:notebook-querty-timeout-open
variable ein:notebook-querty-timeout-save

Query timeout for saving notebook. Similar to ein:notebook-querty-timeout-open, but for saving notebook. For global setting and more information, see ein:query-timeout.

variable ein:cell-traceback-level

Number of traceback stack to show. Hidden tracebacks are not discarded. You can always view them using the command ein:notebook-view-traceback.

variable ein:cell-autoexec-prompt

String shown in the cell prompt when the auto-execution flag is on. See also ein:connect-aotoexec-lighter.

variable ein:junk-notebook-name-template

Junk notebook name template. This value is used from ein:notebooklist-new-scratch-notebook and ein:notebook-rename-to-scratch-command. This must be a format string which can be passed to format-time-string.

variable ein:iexec-delay

Delay before executing cell after change in second.

variable ein:complete-on-dot

Start completion when inserting a dot. Note that ein:use-auto-complete (or ein:use-auto-complete-superpack) must be t to enable this option. This variable has effect on notebook buffers and connected buffers.

variable ein:helm-kernel-history-search-key

Bind helm-ein-kernel-history to this key in notebook mode.

Example:

(setq ein:helm-kernel-history-search-key "\M-r")

This key will be installed in the ein:notebook-mode-map.

variable ein:anything-kernel-history-search-key

Bind anything-ein-kernel-history to this key in notebook mode.

Example:

(setq ein:anything-kernel-history-search-key "\M-r")

This key will be installed in the ein:notebook-mode-map.

variable ein:helm-kernel-history-search-auto-pattern

Automatically construct search pattern when non-nil.

  1. Single space is converted to “*”.
  2. A backslash followed by a space is converted to a single space.
  3. A “*” is added at the beginning and end of the pattern.

This variable applies to both helm-ein-kernel-history and anything-ein-kernel-history.

variable ein:output-type-preference

Output types to be used in notebook. First output-type found in this list will be used. This variable can be a list or a function returning a list given DATA plist. See also ein:output-type-prefer-pretty-text-over-html.

Example: If you prefer HTML type over text type, you can set it as:

(setq ein:output-type-preference
      '(emacs-lisp svg png jpeg html text latex javascript))

Note that html comes before text.

variable ein:shr-env

Variables let-bound while calling shr-insert-document.

To use default shr setting:

(setq ein:shr-env nil)

Draw boundaries for table (default):

(setq ein:shr-env
      '((shr-table-horizontal-line ?-)
        (shr-table-vertical-line ?|)
        (shr-table-corner ?+)))
variable ein:worksheet-show-slide-data
Controls whether to show slide metadata by default when
opening or creating worksheets. Note that viewing of slide metadata can be toggled in an open worksheet using the command C-cS.
variable ein:notebook-autosave-frequency

Sets the frequency (in seconds) at which the notebook is automatically saved.

Autosaves are automatically enabled when a notebook is opened, but can be controlled manually via ein:notebook-enable-autosave and ein:notebook-disable-autosave.

If this parameter is changed than you must call ein:notebook-disable-autosave and then ein:notebook-enable-autosave on all open notebooks for the changes to take effect.

variable ein:notebook-create-checkpoint-on-save

If non-nil a checkpoint will be created every time the notebook is saved. Otherwise checkpoints must be created manually via ein:notebook-create-checkpoint.

Console

variable ein:console-security-dir

Security directory setting.

Following types are valid:

string
Use this value as a path to security directory. Handy when you have only one IPython server.
alist
An alist whose element is “(URL-OR-PORT . DIR)”. Key (URL-OR-PORT) can be string (URL), integer (port), or default (symbol). The value of default is used when other key does not much. Normally you should have this entry.
function
Called with an argument URL-OR-PORT (integer or string). You can have complex setting using this.
variable ein:console-executable

IPython executable used for console.

Example: "/user/bin/ipython". Types same as ein:console-security-dir are valid.

variable ein:console-args

Additional argument when using console.

Warning

Space-separated string is obsolete now. Use a list of string as value now.

Setting to use IPython profile named “YOUR-IPYTHON-PROFILE”:

(setq ein:console-args '("--profile" "YOUR-IPYTHON-PROFILE"))

Together with ein:console-security-dir, you can open IPython console connecting to a remote kernel.:

(setq ein:console-args '("--ssh" "HOSTNAME"))
(setq ein:console-security-dir "PATH/TO/SECURITY/DIR")

You can setup ein:console-args per server basis using alist form:

(setq ein:console-args
      '((8888 . '("--profile" "PROFILE"))
        (8889 . '("--ssh" "HOSTNAME"))
        (default . '("--profile" "default"))))

If you want to use more complex setting, you can set a function to it:

(setq ein:console-args
      (lambda (url-or-port) '("--ssh" "HOSTNAME")))

See also: ein:console-security-dir.

Connect

variable ein:connect-run-command

%run magic command used for ein:connect-run-buffer. Types same as ein:console-security-dir are valid.

variable ein:connect-reload-command

Setting for ein:connect-reload-buffer. Same as ein:connect-run-command.

variable ein:connect-save-before-run

Whether the buffer should be saved before ein:connect-run-buffer.

variable ein:propagate-connect

Set to t to connect to the notebook after jumping to a buffer.

variable ein:connect-aotoexec-lighter

String appended to the lighter of ein:connect-mode (ein:c) when auto-execution mode is on. When nil, use the same string as ein:cell-autoexec-prompt.

variable ein:connect-default-notebook

Notebook to be connect when ein:connect-to-default-notebook is called.

Example setting to connect to “My_Notebook” in the server at port 8888 when opening any buffer in python-mode:

(setq ein:connect-default-notebook "8888/My_Notebook")
(add-hook 'python-mode-hook 'ein:connect-to-default-notebook)

ein:connect-default-notebook can also be a function without any argument. This function must return a string (notebook path of the form “URL-OR-PORT/NOTEBOOK-NAME”).

As ein:connect-to-default-notebook requires notebook list to be loaded, consider using ein:notebooklist-load to load notebook list if you want to connect to notebook without manually opening notebook list.

function ein:connect-to-default-notebook

Connect to the default notebook specified by ‘ein:connect-default-notebook’. Set this to ‘python-mode-hook’ to automatically connect any python-mode buffer to the notebook.

Jedi.el

function ein:jedi-setup

Setup auto-completion using EIN and Jedi.el together.

Jedi.el is a Python auto-completion library for Emacs. To use EIN and Jedi together, add the following in your Emacs setup before loading EIN.:

(setq ein:completion-backend ’ein:use-ac-jedi-backend)

MuMaMo

variable ein:mumamo-codecell-mode
variable ein:mumamo-textcell-mode
variable ein:mumamo-htmlcell-mode
variable ein:mumamo-markdowncell-mode
variable ein:mumamo-rawcell-mode
variable ein:mumamo-headingcell-mode
variable ein:mumamo-fallback-mode
variable ein:use-mumamo-indent-line-function-workaround

Misc

variable ein:filename-translations

Convert file paths between Emacs and Python process.

This value can take these form:

alist
Its key specifies URL-OR-PORT and value must be a list of two functions: (TO-PYTHON FROM-PYTHON). Key (URL-OR-PORT) can be string (URL), integer (port), or default (symbol). The value of default is used when other key does not much.
function
Called with an argument URL-OR-PORT (integer or string). This function must return a list of two functions: (TO-PYTHON FROM-PYTHON).

Here, the functions TO-PYTHON and FROM-PYTHON are defined as:

TO-PYTHON
A function which converts a file name (returned by buffer-file-name) to the one Python understands.
FROM-PYTHON
A function which converts a file path returned by Python process to the one Emacs understands.

Use ein:tramp-create-filename-translator to easily generate the pair of TO-PYTHON and FROM-PYTHON.

function (ein:tramp-create-filename-translator remote-host &optional username)

Generate a pair of TO-PYTHON and FROM-PYTHON for ‘ein:filename-translations’.

Usage:

(setq ein:filename-translations
      ‘((8888
         . ,(ein:tramp-create-filename-translator "MY-HOSTNAME"))))
;; Equivalently:
(setq ein:filename-translations
      (lambda (url-or-port)
        (when (equal url-or-port 8888)
          (ein:tramp-create-filename-translator "MY-HOSTNAME"))))

This setting assumes that the IPython server which can be connected using the port 8888 in localhost is actually running in the host named MY-HOSTNAME.

Adapted from ‘slime-create-filename-translator’.

variable ein:query-timeout

Default query timeout for HTTP access in millisecond.

Setting this to nil means no timeout. If you have curl command line program, it is automatically set to nil as curl is reliable than url-retrieve therefore no need for a workaround (see below).

If you do the same operation before the timeout, old operation will be canceled (see also ein:query-singleton-ajax).

Note

This value exists because it looks like url-retrieve occasionally fails to finish (start?) querying. Timeout is used to let user notice that their operation is not finished. It also prevent opening a lot of useless process buffers. You will see them when closing Emacs if there is no timeout.

If you know how to fix the problem with url-retrieve, please let me know or send pull request at github! (Related bug report in Emacs bug tracker: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11469)

Gotchas and caveats

Although EIN mostly works fine, there are some deficits I noticed but have not fixed yet. It seems that they originate from some upstream bugs so there is little I can do in EIN (but I’m not sure – it’s possible that I am misusing the libraries!).

If you know how to fix/workaround them, patches are very welcome.

url-retrieve

While using EIN, probably most of the error messages are about server connections. It looks like the problem is in url-retrieve. But in those cases you don’t lose any notebook data and your IPython kernel is fine. You can just type the command again and it will go fine most of the time. For saving notebook, I implemented code to retry when there is an error comes from url-retrieve to make it even safer.

MuMaMo

When using MuMaMo based notebook mode, you will notice that highlighting outside of the cell input is turned off while you are in the input area. It seems there is a bug in MuMaMo [6].

If you are using smartrep and MuMaMo together, see also the warning in ein:use-smartrep document.

[6]See the relevant bug report I posted: https://bugs.launchpad.net/nxhtml/+bug/1013794

python-mode.el

In my environment, using python-mode.el without byte-compiling it in MuMaMo based notebook mode produces segfault.

Also, mumamo-idle-set-major-mode messages error (wrong-type-argument listp python-saved-check-command) time to time, making minibuffer bit noisy while editing notebook. See Tips to fix this problem.

Advanced

By telling IPython a little bit about Emacs Lisp, you can execute Emacs Lisp from IPython, just like you can execute Javascript in the web client. See emacslisp.py for more details.

In [1]:
%run PATH/TO/emacslisp.py

In [2]:
EmacsLisp('(+ 1 2 3)')
Out [2]:
6

Reporting issues

Please use M-x ein:dev-bug-report-template to write a bug report. It pops up a buffer containing some system information and instruction for bug report.

Logging

Sometime more information than provided in the *Message* is needed to debug.

  1. Execute (ein:log-set-level 'debug) (e.g., M-: (ein:log-set-level 'debug) RET).

  2. Then do some operation which cause the problem.

  3. Go to the log buffer _*ein:log-all* (it starts with a space) and paste the whole buffer to the issue tracker.

    Please enclose the log with three backquotes to make the snippet as a code block, like this:

    ```
    [verbose] Start logging. @#<buffer *ein: 8888/NAME*>
    [info] Notebook NAME is ready @#<buffer *ein: 8888/NAME*>
    [info] Kernel started: 5e4f74d1-ce91-4e7e-9575-9646adea5172 @#<buffer *scratch*>
    ```
    

    See also: GitHub Flavored Markdown - Introduction

    If it is too long, you can use paste bin service such as gist.

websocket.el

websocket.el has its own logging buffer. Sometime it is useful to see this log. To do this:

  1. (require 'ein-dev)
  2. (setq websocket-debug t) or call ein:dev-start-debug.
  3. Then do the operation which causes the problem.
  4. Go to log buffer using ein:dev-pop-to-debug-shell and ein:dev-pop-to-debug-iopub. These command must be called in the notebook buffer.

Debugging

If you are interested in debugging EIN, you should start by calling the command ein:dev-start-debug. If the bug is websocket related, you may need to run it with a prefix key like this: C-u M-x ein:dev-start-debug RET to get a backtrace. This command sets debug-on-error to t and does some patching to the debugger. This patching is required because printing EWOC objects freezes Emacs otherwise. It also changes log level to report everything the log buffer. You can reset the patch and log level with ein:dev-stop-debug.

Change Log

v0.13.0

  • Added commands ein:jupyter-server-start, ein:jupyter-server-stop, and ein:jupyter-server-login-and-open.
  • New interface for configuring code completion. See the new customizable variable ein:completion-backend.
  • Because of this ein:use-auto-complete is now deprecated, but EIN will still try to do the right thing if it sees this variable is still defined.

v0.12.3

This release is an attempt to cherry-pick some of the more recent bugfixes and enhancments while still maintaining compatibility with Emacs 24. Note that support for running a jupyter server in an Emacs buffer will likely not be possible in Emacs 24 due to the lack of the make-process command, i.e. asyncronous communication with external processes.

v0.12.2

  • Improve integration with org mode source code blocks.
  • Better cell editing buffers.
  • Add ~ein:notebooklist-enable-keepalive~ and ~ein:notebooklist-disable-keepalive~ to keep long-running sessions from expiring on the jupyter servier.

v0.12.1

  • Improved support for undo cell movement, addition and deletion.
  • Compatibility with new security features in jupyter notebook v4.3.1.
  • EIN now does a better job following redirects (i.e. 302, 304, 307, etc) when talking to a jupyter notebook server.
  • Correct encoding for notebooks with non-English characters.
  • Improved support for non-python kernels. R at least seems to work, if imperfectly.
  • Yet another attempt to improve travis CI support - we almost have it.
  • Baby steps towards using cask to manage the project.
  • New theme, alabaster, for documentation. Isn’t it pretty?
  • Numerous other bug fixes and small improvements.

v0.12.0

  • Cell edit buffers ala org source block edit buffers.
  • Better integration with org source blocks.

v0.11.0

  • Add support for creating and restoring checkpoints on the Jupyter server.

v0.10.0

  • Allow user to change the kernel of a running notebook.
  • The notebooklist buffer now lists all opened notebook buffers.

v0.9.1

  • Fix issues with shared-output and notebook connected buffers.

v0.9.0

  • Add support for setting slide attributes for notebook/worksheet cells.

v0.8.2

  • Fixes for issues #92 and #91.

v0.8.1

  • Fix potential overwrite issue caused by setting buffer-file-name.

v0.8.0

  • Support for multiple Jupyter kernels. EIN still thinks everything is Python code, but it should be possible to create notebooks that run any language supported by a Jupyter kernel.

v0.7.1

  • Fix bug saving images in v4 notebook format.
  • Be more graceful handling errors during content saves.

v0.7

  • Support logging in to password protected jupyter servers.

v0.6

  • Deprecate ein:set-buffer-file-name, instead use the power of Python!
  • Jump to notebook cells from traceback buffers.
  • Run ipbd/pdb from a comint buffer.
  • Fix serious bug with starting and restarting kernels in IPython 3.x.

v0.5

  • Add support for stdin channel. This mean getpass.getpass() and the ipdb work in notebook buffers.

v0.4

  • Finalizing support for IPython 3.0.
  • Better support for globally opening notebooks stored in a directory hierarchy.
  • Partial refactoring of the interace to IPython’s content/notebook REST interface into ein-contents-api.el.
  • ein-mumamo.el has been moved into its own package, ein-mumamo. This should get rid of compilation errors for anyone who does not happen to have nxhtml installed.
  • Restore support for heading level cells with nbformat v4 notebooks.
  • New (buggy) pytools function ein:pytools-export-buffer for using nbconvert on a notebook buffer.

v0.3

v0.2.1

  • Cached auto-complete is removed. ac-source-ein-cached and ac-complete-ein-cached are obsolete. ein:ac-max-cache has no effect now.
  • ein:query-timeout is nil if curl backend is used by request.el.
  • History search interface (helm-ein-kernel-history and anything-ein-kernel-history) discards duplications. This functionality requires at least version 4.0 of IPython kernel. It is introduced by the pull request ipython/ipython#2792. As of writing, you need IPython 0.14.dev from github. For older versions of kernels, it continues to work but you will see duplications.
  • Add support for kernel_info request for IPython kernel protocol, which is introduced by ipython/ipython#2649. This protocol is not used in EIN anywhere yet.
  • Use request.el for smoother experience.

v0.2

  • Preliminary login support. See ein:notebooklist-login.
  • Code completion in notebook happens really automatically. You don’t need to hit a key to start completion.
  • ein:console-open works without python.el.
  • Expand code cell output on execution. (#88).
  • Improve ein:completer-dot-complete and ein:jedi-dot-complete. Do not expand common part when inserting dot, to make typing code containing dots less surprising.
  • Add support for Jedi.el. See ein:jedi-setup.
  • Add a simple org-mode link support.
  • Add built-in multiple language fontification for notebook: ein:notebook-multilang-mode. This is the new default for ein:notebook-modes.
  • Add helm/anything interface to search kernel history: helm-ein-kernel-history and anything-ein-kernel-history. See also the configurable options to use these commands: ein:helm-kernel-history-search-key and ein:anything-kernel-history-search-key.
  • Preliminary support for multiple worksheets.
  • Rename notion of “scratch notebook” to “junk notebook”. This is to avoid confusion with newly added “scratch sheet”. Old commands are renamed to ein:junk-new and ein:junk-rename.
  • Preferred MIME types to be used can be configured using the variable ein:output-type-preference.
  • HTML content is rendered SHR (Simple HTML Renderer) by default. Use ein:shr-env to tweak how HTML rendered.
  • ein:notebook-discard-output-on-save is obsolete now.
  • Support execution history. Commands ein:worksheet-previous-input-history and ein:worksheet-next-input-history can be used to insert previously executed code into the current cell.
  • Add ein:pseudo-console-mode.
  • Add “scratch sheet”. This acts almost as same as worksheet, but you don’t need to save it. You can use try any code without saving junks in your notebook. Use the command ein:notebook-scratchsheet-open to open scratch sheet.
  • Menu support in notebook mode and notebook list mode.
  • Auto-connection support. The new function ein:connect-to-default-notebook can be added to python-mode-hook to automatically connect python-mode buffers to default notebook specified by ein:connect-default-notebook. See also ein:notebooklist-load.
  • Add ein:worksheet-execute-cell-and-insert-below.
  • Change the timing to trigger auto-execution in connected buffer. It was triggered on save before. Now it is on run, eval or reload. See ein:connect-toggle-autoexec.

v0.1.2

  • Mostly refactoring for worksheet support in v0.2.
  • Rename command ein:notebook-console-open to ein:console-open. It is available from non-notebook buffer such as connected buffer now.
  • Add ein:connect-reload-buffer. Old default ein:connect-run-buffer behavior is replaced by this function. ein:connect-run-buffer now actually runs buffer instead of loading it.

v0.1.1

v0.1

  • First release.

License

Emacs IPython Notebook is licensed under GPL v3. See COPYING for details.

Indices and tables