Merge branch 'sphinx'

This commit is contained in:
Takafumi Arakaki 2012-06-11 06:17:26 +02:00
commit 11f8a9a169
13 changed files with 857 additions and 33 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
doc/build/

3
.gitmodules vendored
View file

@ -1,3 +1,6 @@
[submodule "tests/mocker"]
path = tests/mocker
url = https://github.com/sigma/mocker.el.git
[submodule "doc/eldomain"]
path = doc/eldomain
url = git://github.com/tkf/sphinx-eldomain.git

View file

@ -25,7 +25,7 @@ Highlighted features:
* Copy/paste cells, even to/from different notebooks.
* Console integration: You can easily connect to kernel via console
application. This enables you to start debugging in the same
kernel.
kernel. It is even possible to connect console over ssh.
* IPython kernel can be "connected" to any buffers. This enables you
to evaluate buffer/region using same kernel as notebook. Notebook
goodies such as tooltip help, help browser and code completion are
@ -40,6 +40,7 @@ Other notebook features:
* Popup (tooltip) help
* Syntax highlighting in each cell types (Python/Markdown)
* Help browser (opens when executing ``function?``)
* Traceback viewer
Quick try

153
doc/Makefile Normal file
View file

@ -0,0 +1,153 @@
# Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = build
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
clean:
-rm -rf $(BUILDDIR)/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/EmacsIPythonNotebook.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/EmacsIPythonNotebook.qhc"
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/EmacsIPythonNotebook"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/EmacsIPythonNotebook"
@echo "# devhelp"
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."
info:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
gettext:
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
@echo
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."

1
doc/eldomain Submodule

@ -0,0 +1 @@
Subproject commit b6ad502aea841a10cf3e6de926a222f27905045f

190
doc/make.bat Normal file
View file

@ -0,0 +1,190 @@
@ECHO OFF
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set BUILDDIR=build
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% source
set I18NSPHINXOPTS=%SPHINXOPTS% source
if NOT "%PAPER%" == "" (
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
)
if "%1" == "" goto help
if "%1" == "help" (
:help
echo.Please use `make ^<target^>` where ^<target^> is one of
echo. html to make standalone HTML files
echo. dirhtml to make HTML files named index.html in directories
echo. singlehtml to make a single large HTML file
echo. pickle to make pickle files
echo. json to make JSON files
echo. htmlhelp to make HTML files and a HTML help project
echo. qthelp to make HTML files and a qthelp project
echo. devhelp to make HTML files and a Devhelp project
echo. epub to make an epub
echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
echo. text to make text files
echo. man to make manual pages
echo. texinfo to make Texinfo files
echo. gettext to make PO message catalogs
echo. changes to make an overview over all changed/added/deprecated items
echo. linkcheck to check all external links for integrity
echo. doctest to run all doctests embedded in the documentation if enabled
goto end
)
if "%1" == "clean" (
for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
del /q /s %BUILDDIR%\*
goto end
)
if "%1" == "html" (
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
goto end
)
if "%1" == "dirhtml" (
%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
goto end
)
if "%1" == "singlehtml" (
%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
goto end
)
if "%1" == "pickle" (
%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can process the pickle files.
goto end
)
if "%1" == "json" (
%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can process the JSON files.
goto end
)
if "%1" == "htmlhelp" (
%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can run HTML Help Workshop with the ^
.hhp project file in %BUILDDIR%/htmlhelp.
goto end
)
if "%1" == "qthelp" (
%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can run "qcollectiongenerator" with the ^
.qhcp project file in %BUILDDIR%/qthelp, like this:
echo.^> qcollectiongenerator %BUILDDIR%\qthelp\EmacsIPythonNotebook.qhcp
echo.To view the help file:
echo.^> assistant -collectionFile %BUILDDIR%\qthelp\EmacsIPythonNotebook.ghc
goto end
)
if "%1" == "devhelp" (
%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished.
goto end
)
if "%1" == "epub" (
%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The epub file is in %BUILDDIR%/epub.
goto end
)
if "%1" == "latex" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
if errorlevel 1 exit /b 1
echo.
echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "text" (
%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The text files are in %BUILDDIR%/text.
goto end
)
if "%1" == "man" (
%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The manual pages are in %BUILDDIR%/man.
goto end
)
if "%1" == "texinfo" (
%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
goto end
)
if "%1" == "gettext" (
%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
goto end
)
if "%1" == "changes" (
%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
if errorlevel 1 exit /b 1
echo.
echo.The overview file is in %BUILDDIR%/changes.
goto end
)
if "%1" == "linkcheck" (
%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
if errorlevel 1 exit /b 1
echo.
echo.Link check complete; look for any errors in the above output ^
or in %BUILDDIR%/linkcheck/output.txt.
goto end
)
if "%1" == "doctest" (
%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
if errorlevel 1 exit /b 1
echo.
echo.Testing of doctests in the sources finished, look at the ^
results in %BUILDDIR%/doctest/output.txt.
goto end
)
:end

11
doc/source/conf.el Normal file
View file

@ -0,0 +1,11 @@
(add-to-list 'load-path "~/.emacs.d/el-get/ein/")
(add-to-list 'load-path "~/.emacs.d/el-get/websocket/")
(add-to-list 'load-path "~/.emacs.d/el-get/nxhtml/util/") ; mumamo
(require 'ein-notebooklist)
(require 'ein-mumamo)
(require 'ein-connect)
;; Load `wid-edit'. Otherwise the following error will be raised:
;; Symbol's function definition is void: widget-button-press
(require 'wid-edit)

251
doc/source/conf.py Normal file
View file

@ -0,0 +1,251 @@
# -*- coding: utf-8 -*-
#
# Emacs IPython Notebook documentation build configuration file, created by
# sphinx-quickstart on Sun Jun 10 13:37:13 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.join(os.path.abspath('..'), 'eldomain'))
# -- General configuration -----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
'sphinx.ext.todo',
'eldomain',
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'Emacs IPython Notebook'
copyright = u'2012, Takafumi Arakaki'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0'
# The full version, including alpha/beta/rc tags.
release = '0'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = []
# The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# -- Options for HTML output ---------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'default'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = 'EmacsIPythonNotebookdoc'
# -- Options for LaTeX output --------------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'EmacsIPythonNotebook.tex', u'Emacs IPython Notebook Documentation',
u'Takafumi Arakaki', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# If true, show page references after internal links.
#latex_show_pagerefs = False
# If true, show URL addresses after external links.
#latex_show_urls = False
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_domain_indices = True
# -- Options for manual page output --------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'emacsipythonnotebook', u'Emacs IPython Notebook Documentation',
[u'Takafumi Arakaki'], 1)
]
# If true, show URL addresses after external links.
#man_show_urls = False
# -- Options for Texinfo output ------------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'EmacsIPythonNotebook', u'Emacs IPython Notebook Documentation',
u'Takafumi Arakaki', 'EmacsIPythonNotebook', 'One line description of project.',
'Miscellaneous'),
]
# Documents to append as an appendix to all manuals.
#texinfo_appendices = []
# If false, no module index is generated.
#texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
# -- Options for EL domain -----------------------------------------------------
emacs_executable = 'emacs-snapshot'
elisp_packages = {'ein': 'ein:'}

160
doc/source/index.rst Normal file
View file

@ -0,0 +1,160 @@
Welcome to Emacs IPython Notebook's documentation!
==================================================
.. el:package:: ein
Emacs IPython Notebook (EIN) provides fully featured IPython Notebook
client and integrated REPL (like SLIME_).
.. _SLIME: http://common-lisp.net/project/slime/
Highlighted features:
* Copy/paste cells, even to/from different notebooks.
* Console integration: You can easily connect to kernel via console
application. This enables you to start debugging in the same
kernel. It is even possible to connect console over ssh [#]_.
* IPython kernel can be "connected" to any buffers. 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.
* Jump to definition (go to the definition by hitting ``M-.`` over an
object).
Other notebook features:
* Inline images
* Auto/manual-completion
* Popup (tooltip) help
* Syntax highlighting in each cell types (Python/Markdown)
* Help browser (opens when executing ``function?``)
* Traceback viewer
.. [#] You need to setup :el:symbol:`ein:notebook-console-args` properly
Keybinds
--------
Notebook list
^^^^^^^^^^^^^
You can start notebook by ``M-x ein:notebooklist-open`` and enter the
port or URL of the IPython notebook server.
.. el:function:: ein:notebooklist-open
.. el:function:: ein:notebooklist-new-notebook
.. el:function:: ein:notebooklist-open-notebook-global
.. el:function:: ein:notebooklist-new-scratch-notebook
Notebook
^^^^^^^^
The following keybinds are available in notebook buffers.
.. el:keymap:: ein:notebook-mode-map
Connected buffer
^^^^^^^^^^^^^^^^
You can connect any buffer (typically buffer opening Python file) to
opened notebook and use the kernel of the notebook to execute the
code, inspect objects, auto-complete code, jump to the other source,
etc. Once the buffer is connected to the notebook, minor mode
:el:symbol:`ein:connect-mode` is enabled and the following keybinds
are available.
.. el:keymap:: ein:connect-mode-map
Other useful commands:
.. el:function:: ein:connect-to-notebook
.. el:function:: ein:connect-eval-buffer
.. el:function:: ein:connect-run-buffer
Shared output buffer
^^^^^^^^^^^^^^^^^^^^
.. el:function:: ein:shared-output-pop-to-buffer
.. el:keymap:: ein:shared-output-mode-map
Traceback viewer
^^^^^^^^^^^^^^^^
Traceback in notebook buffer is not easy to understand. You can open
Traceback viewer by the command :el:symbol:`ein:notebook-view-traceback`.
In the Traceback viewer, following keybinds are available.
.. el:keymap:: ein:traceback-mode-map
PyTools
^^^^^^^
These commands can be used in the notebook buffer and the connected
buffer.
.. el:function:: ein:pytools-whos
.. el:function:: ein:pytools-hierarchy
Customization
-------------
You can customize EIN using the Emacs customization UI by typing
``M-x customize-group RET ein RET``.
All the configurable variables are listed below.
Subpackages
^^^^^^^^^^^
.. el:variable:: ein:use-auto-complete
.. el:variable:: ein:use-auto-complete-superpack
.. el:variable:: ein:use-smartrep
.. el:variable:: ein:load-dev
Notebook list
^^^^^^^^^^^^^
.. el:variable:: ein:url-or-port
.. el:variable:: ein:scratch-notebook-name-template
Notebook
^^^^^^^^
.. el:variable:: ein:notebook-discard-output-on-save
.. el:variable:: ein:notebook-modes
.. el:variable:: ein:notebook-kill-buffer-ask
.. el:variable:: ein:notebook-console-security-dir
.. el:variable:: ein:notebook-console-executable
.. el:variable:: ein:notebook-console-args
Connect
^^^^^^^
.. el:variable:: ein:connect-run-command
.. el:variable:: ein:connect-save-before-run
.. el:variable:: ein:propagate-connect
MuMaMo
^^^^^^
.. el:variable:: ein:mumamo-codecell-mode
.. el:variable:: ein:mumamo-textcell-mode
.. el:variable:: ein:mumamo-htmlcell-mode
.. el:variable:: ein:mumamo-markdowncell-mode
.. el:variable:: ein:mumamo-rawcell-mode
.. el:variable:: ein:mumamo-headingcell-mode
.. el:variable:: ein:mumamo-fallback-mode
Misc
^^^^
.. el:variable:: ein:query-timeout
Indices and tables
==================
* :ref:`genindex`
* :ref:`search`

View file

@ -61,7 +61,8 @@ of OPTION:
;;; Variable/class
(defcustom ein:connect-run-command "%run -n"
"%run command used for `ein:connect-run-buffer'."
"``%run`` magic command used for `ein:connect-run-buffer'.
Types same as `ein:notebook-console-security-dir' are valid."
:type '(choice
(string :tag "command" "%run")
(alist :tag "command mapping"
@ -125,13 +126,15 @@ of OPTION:
(ein:$notebook-kernel (ein:connect-get-notebook)))
(defun ein:connect-eval-buffer ()
"Evaluate the whole buffer. Note that this will run the code
inside the ``if __name__ == \"__main__\":`` block."
(interactive)
(ein:connect-eval-string-internal (buffer-string))
(ein:log 'info "Whole buffer is sent to the kernel."))
(defun ein:connect-run-buffer (&optional ask-command)
"Run buffer using %run. Ask for option if the prefix (C-u) is given.
Variable `ein:connect-run-options' sets the default option."
"Run buffer using ``%run``. Ask for command if the prefix ``C-u`` is given.
Variable `ein:connect-run-command' sets the default command."
(interactive "P")
;; FIXME: this should be more intelligent than just `buffer-file-name'
;; to support connecting IPython over ssh.
@ -150,7 +153,11 @@ Variable `ein:connect-run-options' sets the default option."
"Use `ein:connect-eval-buffer' instead."))))
(defun ein:connect-run-or-eval-buffer (&optional eval)
"Run buffer with %run or eval whole buffer if the prefix (C-u) is given."
"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'."
(interactive "P")
(if eval
(ein:connect-eval-buffer)

View file

@ -57,13 +57,15 @@
(defcustom ein:notebook-discard-output-on-save 'no
"Configure if the output part of the cell should be saved or not.
`no' (symbol) : Save output. This is the default.
`yes' (symbol) : Always discard output.
a function : This function takes two arguments, notebook
and cell. Return `t' to discard output and
return `nil' to save.
If you don't want to save image output, use
`ein:notebook-cell-has-image-output-p'.
`no' : symbol
Save output. This is the default.
`yes' : symbol
Always discard output.
a function
This function takes two arguments, notebook and cell. Return
`t' to discard output and return `nil' to save. For example,
if you don't want to save image output but other kind of
output, use `ein:notebook-cell-has-image-output-p'.
Note that using function needs EIN lisp API, which is not defined
yet. So be careful when using EIN functions. They may change."
@ -392,6 +394,9 @@ But be careful!"
(ein:aif (ein:notebook-get-current-cell) (ein:cell-goto it))))
(defun ein:notebook-kill-cell-command ()
"Kill (\"cut\") the cell at point.
Note the kill-ring for cells is not shared with the default
kill-ring of Emacs (kill-ring for texts)."
(interactive)
(ein:notebook-with-cell nil
(ein:cell-save-text cell)
@ -400,11 +405,14 @@ But be careful!"
(ein:aif (ein:notebook-get-current-cell) (ein:cell-goto it))))
(defun ein:notebook-copy-cell-command ()
"Copy the cell at point. (Put the current cell into the kill-ring.)"
(interactive)
(ein:notebook-with-cell nil
(ein:kill-new (ein:cell-deactivate (ein:cell-copy cell)))))
(defun ein:notebook-yank-cell-command (&optional arg)
"Insert (\"paste\") the latest killed cell.
Prefixes are act same as the normal `yank' command."
(interactive "*P")
;; Do not use `ein:notebook-with-cell'.
;; `ein:notebook-insert-cell-below' handles empty cell.
@ -487,6 +495,9 @@ when the prefix argument is given."
cell))))
(defun ein:notebook-toggle-cell-type ()
"Toggle the cell type of the cell at point.
Use `ein:notebook-change-cell-type' to change the cell type
directly."
(interactive)
(ein:notebook-with-cell nil
(let ((type (case (ein:$notebook-nbformat ein:notebook)
@ -504,6 +515,8 @@ when the prefix argument is given."
(ein:cell-goto new)))))
(defun ein:notebook-change-cell-type ()
"Change the cell type of the current cell.
Prompt will appear in the minibuffer."
(interactive)
(ein:notebook-with-cell nil
(let* ((choices (case (ein:$notebook-nbformat ein:notebook)
@ -628,6 +641,8 @@ If prefix is given, merge current cell into previous cell."
(setf (ein:$notebook-dirty notebook) t))
(defun ein:notebook-toggle-output-command ()
"Toggle the visibility of the output of the cell at point.
This does not alter the actual data stored in the cell."
(interactive)
(ein:notebook-with-cell #'ein:codecell-p
(ein:notebook-toggle-output ein:notebook cell)))
@ -668,6 +683,7 @@ Do not clear input prompts when the prefix argument is given."
;;; Traceback
(defun ein:notebook-view-traceback ()
"Open traceback viewer for the traceback at point."
(interactive)
(ein:notebook-with-cell #'ein:codecell-p
(let ((tb-data
@ -700,6 +716,7 @@ Do not clear input prompts when the prefix argument is given."
(ein:kernel-restart (ein:$notebook-kernel notebook)))
(defun ein:notebook-restart-kernel-command ()
"Send request to the server to restart kernel."
(interactive)
(if ein:notebook
(when (y-or-n-p "Really restart kernel? ")
@ -786,6 +803,9 @@ Do not clear input prompts when the prefix argument is given."
(ein:notebook-request-help ein:notebook))
(defun ein:notebook-request-tool-tip-or-help-command (&optional pager)
"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."
(interactive "P")
(if pager
(ein:notebook-request-help-command)
@ -808,6 +828,8 @@ Do not clear input prompts when the prefix argument is given."
(ein:notebook-complete-at-point ein:notebook))))
(defun ein:notebook-kernel-interrupt-command ()
"Interrupt the kernel.
This is equivalent to do ``C-c`` in the console program."
(interactive)
(ein:kernel-interrupt (ein:$notebook-kernel ein:notebook)))
@ -819,6 +841,11 @@ Do not clear input prompts when the prefix argument is given."
;; misc kernel related
(defun ein:notebook-eval-string (code)
"Evaluate a 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'."
(interactive "sIP[y]: ")
(let ((cell (ein:shared-output-get-cell))
(kernel (ein:$notebook-kernel ein:notebook))
@ -895,6 +922,7 @@ Do not clear input prompts when the prefix argument is given."
`((204 . ,(cons #'ein:notebook-save-notebook-success notebook))))))
(defun ein:notebook-save-notebook-command ()
"Save the notebook."
(interactive)
(ein:notebook-save-notebook ein:notebook 0))
@ -959,9 +987,13 @@ it is installed. If not, a simple mode derived from `python-mode' is
used.
Examples:
* To avoid using MuMaMo even when it is installed:
Avoid using MuMaMo even when it is installed::
(setq ein:notebook-modes (delq 'ein:notebook-mumamo-mode ein:notebook-modes))
* Do not use `python-mode'. Use plain mode when MuMaMo is not installed:
Do not use `python-mode'. Use plain mode when MuMaMo is not installed::
(setq ein:notebook-modes '(ein:notebook-mumamo-mode ein:notebook-plain-mode))
"
:type '(repeat (choice (const :tag "MuMaMo" ein:notebook-mumamo-mode)
@ -1128,16 +1160,20 @@ Called via `kill-emacs-query-functions'."
(defcustom ein:notebook-console-security-dir ""
"Security directory setting.
Following type is accepted:
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."
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."
:type '(choice
(string :tag "Security directory"
"~/.config/ipython/profile_nbserver/security/")
@ -1156,8 +1192,8 @@ function : Called with an argument URL-OR-PORT (integer or string).
(defcustom ein:notebook-console-executable (executable-find "ipython")
"IPython executable used for console.
Example: \"/user/bin/ipython\"
Types same as `ein:notebook-console-security-dir' are accepted."
Example: ``\"/user/bin/ipython\"``.
Types same as `ein:notebook-console-security-dir' are valid."
:type '(choice
(string :tag "IPython executable" "/user/bin/ipython")
(alist :tag "IPython executable mapping"
@ -1174,8 +1210,8 @@ Types same as `ein:notebook-console-security-dir' are accepted."
(defcustom ein:notebook-console-args "--profile nbserver"
"Additional argument when using console.
Example: \"--ssh HOSTNAME\"
Types same as `ein:notebook-console-security-dir' are accepted."
Example: ``\"--ssh HOSTNAME\"``.
Types same as `ein:notebook-console-security-dir' are valid."
:type '(choice
(string :tag "Arguments to IPython"
"--profile nbserver --ssh HOSTNAME")
@ -1210,8 +1246,10 @@ Types same as `ein:notebook-console-security-dir' are accepted."
"Open IPython console.
To use this function, `ein:notebook-console-security-dir' and
`ein:notebook-console-args' must be set properly.
This function requires Fabian Gallina's python.el for now:
https://github.com/fgallina/python.el"
This function requires `Fabian Gallina's python.el`_ for now;
It should be possible to support python-mode.el. Patches are welcome!
.. _`Fabian Gallina's python.el`: https://github.com/fgallina/python.el"
;; FIXME: use %connect_info to get connection file, then I can get
;; rid of `ein:notebook-console-security-dir'.
(interactive)

View file

@ -128,6 +128,9 @@ If OTHER-WINDOW is non-`nil', open the file in the other window."
(list object other-window notebook-buffer)))))
(defun ein:pytools-jump-to-source-command (&optional other-window)
"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."
(interactive "P")
(require 'ein-connect)
(let ((kernel (ein:pytools-get-kernel))
@ -139,6 +142,9 @@ If OTHER-WINDOW is non-`nil', open the file in the other window."
(ein:pytools-get-notebook-buffer)))))
(defun ein:pytools-jump-back-command (&optional other-window)
"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."
(interactive "P")
(when (ein:aand (car ein:pytools-jump-stack)
(equal (point) (marker-position it)))
@ -155,14 +161,15 @@ If OTHER-WINDOW is non-`nil', open the file in the other window."
(ein:cell-execute cell kernel code popup)))
(defun ein:pytools-whos ()
"Execute %whos magic command and popup the result."
"Execute ``%whos`` magic command and popup the result."
(interactive)
(ein:pytools-eval-string-internal "%whos" t))
(defun ein:pytools-hierarchy (&optional ask)
"Draw inheritance graph of the class at point.
hierarchymagic extension is needed to be installed.
see: https://github.com/tkf/ipython-hierarchymagic"
hierarchymagic_ extension is needed to be installed.
.. _hierarchymagic: https://github.com/tkf/ipython-hierarchymagic"
(interactive "P")
(let ((object (ein:object-at-point)))
(when ask

View file

@ -123,6 +123,7 @@ Create a cell if the buffer has none."
(oref cell :kernel))))
(defun ein:shared-output-pop-to-buffer ()
"Open shared output buffer."
(interactive)
(ein:shared-output-get-or-create)
(pop-to-buffer (ein:shared-output-create-buffer)))