
NBformat 4 has a tag key in the cell metadata. We use it to tag a cell depending on which worksheet it is in. For now the code does nothing else with this tag, but the goal is to reimplement multiple worksheets in ein.
3.6 KiB
Overview
Design
Notebook Buffer
Notebook information is stored as a struct. Always associated with a buffer, ein:notebook-buffer is used to find buffer associated with a notebook.
Notebook does not hold cells, that is delegated to instances of the worksheet class. Instances are stored as a list in the `ein:$notebook-worksheets` slot.
Notebooklist Buffer
Kernel communication
Contents API
Enhancements/Fixes
Imenu/Speedbar Cooperation
Seems to be a couple ways of doing this:
- Configuring `imenu-generic-expression` regex's.
- Redefining imenu-create-index ala python.el.
(2) seems to be the more elegant solution.
EIN currently has minimal support for imenu through `ein:worksheet-imenu-create-index`, but all it does is look for headings. Somehow this fails to work with speedbar and also does not handle indexing Python code (i.e. variables, function, classes, etc.).
To get the speedbar working we will need to define a minor mode per the following instructions.
For /name/~-speedbar-menu-items~ can I just use imenu-generic-expression
?
Maybe the way to do this is for each [[file:lisp/ein-cell.el::ein:codecell][codecell]]
create a temp buffer with the text
of that cell and call ein:imenu-create-index
.
(let ((text (ein:cell-get-text cell)))
(with-temp-buffer
(insert text)
(ein:imenu-create-index)))
Still will need way to map temp buffer positions to actual positions in the
notebook buffer (ein:cell-input-pos-min
and ein:cell-input-pos-max
)
Live links to other notebooks
- Understand how org-mode does it.
- Steal???
- Profit!!!
Use polymode
Polymode uses indirect buffers, which may or may not be a good solution for ein notebooks.
Access password protected notebooks
Connect to non-python kernels
Synergies with pymacs?
Detect system path of opened notebook
Jump to notebook code in traceback (issue #42)
What needs to be done:
- Carry notebook reference in the
[[file:lisp/ein-traceback.el::ein:traceback][ein:traceback]]
structure. - Look for
<ipython-input-3-05c9758a9c21> in <module>()
. The number 3 means input #3 in the notebook. - Find cell based on input number. Can iterate through list of cells () and look for matching
input-prompt-number
. - Call
ein:cell-goto
on that cell. May need to swap buffers first.
Return of worksheets
tkf/ein and IPython 2.x allowed for multiple worksheets within an individual notebook. This feature was removed in 3.0 since multiple worksheets do not make much sense in the context of a tabbed web browser interface. EIN's legacy code still supports worksheets, though at the moment that information is lost upon saving a notebook.
Having multiple worksheet support makes some sense for ein; below is thinking on how to reimplement this feature.
IPython nbformat 4 specifies a metadata key which can be used to store general information. Cell metadad has a tag key which is a "A list of string tags on the cell. Commas are not allowed in a tag."
Best place to set the tag key is when generating /hiro/emacs-ipython-notebook/src/commit/93b449be343dae39efb4d17fba5f035c8943e0d9/content for saving a notebook.