emacs-ipython-notebook/lisp/ein-ipynb-mode.el
dickmao 085a188b20 Streamline login
Merge the login and open commands (open aliased to login).  Add login
tests described in #352.

Attempt to improve user experience by synchronously executing
`ein:jupyter-server-start`.  `ein:dev-prefer-deferred` custom variable
allows easy switch to compare sychronous versus old asynchronous behavior.
2018-10-17 16:52:10 -04:00

57 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.")
;; TODO replace ignore with ein:process-find-file-callback in the
;; eagerly awaited "without-notebooklist" branch
(let ((map ein:ipynb-mode-map))
(define-key map "\C-c\C-z" 'ignore)
(define-key map "\C-c\C-o" 'ignore)
(easy-menu-define ein:ipynb-menu map "EIN IPyNB Mode Menu"
`("EIN IPyNB File"
,@(ein:generate-menu
'(("Open notebook" ignore))))))
;;;###autoload
(add-to-list 'auto-mode-alist '(".*\\.ipynb\\'" . ein:ipynb-mode))
(provide 'ein-ipynb-mode)
;;; ein-ipynb-mode.el ends here