mirror of
https://github.com/vale981/emacs-ipython-notebook
synced 2025-03-06 09:31:39 -05:00

As emacs users we prefer and have the luxury of fuzzy file navigation via ido and projectile. From a notebook or notebooklist buffer, the commands `C-c C-f` ein:file-open `C-c C-o` ein:notebook-open offer an ido alternative to point and click navigation. To populate the ido lists, retrieving the content hierarchy is on by default. Two custom variables determine how wide and deep the content query probes (currently at 2 levels deep and 6 directories wide). Set both to zero to turn off. tkf half finished code to quickly go from local file buffers to notebook mode via `C-c C-z` or `C-c C-o`. This is now possible. EIN will start the server from a suitable parent directory of the visited file. Enable ido completion for `notebooklist-login`. Remove the albatross `ein-loaddefs.el` in favor of more standard `ein-autoloads.el` that is not git tracked. Convenience `make install` from git source (local alternative to melpa).
54 lines
1.7 KiB
EmacsLisp
54 lines
1.7 KiB
EmacsLisp
;;; ein-ipynb-mode.el --- A simple mode for ipynb file
|
|
|
|
;; Copyright (C) 2012 Takafumi Arakaki
|
|
|
|
;; Author: Takafumi Arakaki <aka.tkf at gmail.com>
|
|
|
|
;; This file is NOT part of GNU Emacs.
|
|
|
|
;; ein-ipynb-mode.el is free software: you can redistribute it and/or modify
|
|
;; it under the terms of the GNU General Public License as published by
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
;; (at your option) any later version.
|
|
|
|
;; ein-ipynb-mode.el is distributed in the hope that it will be useful,
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
;; GNU General Public License for more details.
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
;; along with ein-ipynb-mode.el.
|
|
;; If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
;;; Commentary:
|
|
|
|
;;
|
|
|
|
;;; Code:
|
|
|
|
(require 'ein-process)
|
|
|
|
(defvar ein:ipynb-parent-mode 'js-mode
|
|
"A mode (a symbol) to use for parent mode for `ein:ipynb-mode'.
|
|
Note that this variable must be set *before* compiling EIN.")
|
|
|
|
(defalias 'ein:ipynb-parent-mode ein:ipynb-parent-mode)
|
|
|
|
;;;###autoload
|
|
(define-derived-mode ein:ipynb-mode ein:ipynb-parent-mode "ein:ipynb"
|
|
"A simple mode for ipynb file.")
|
|
|
|
(let ((map ein:ipynb-mode-map))
|
|
(define-key map "\C-c\C-z" 'ein:process-find-file-callback)
|
|
(define-key map "\C-c\C-o" 'ein:process-find-file-callback)
|
|
(easy-menu-define ein:ipynb-menu map "EIN IPyNB Mode Menu"
|
|
`("EIN IPyNB File"
|
|
,@(ein:generate-menu
|
|
'(("Open notebook" ein:process-find-file-callback))))))
|
|
|
|
;;;###autoload
|
|
(add-to-list 'auto-mode-alist '(".*\\.ipynb\\'" . ein:ipynb-mode))
|
|
|
|
(provide 'ein-ipynb-mode)
|
|
|
|
;;; ein-ipynb-mode.el ends here
|