Merge pull request #56 from dickmao/dev

Dev
This commit is contained in:
dickmao 2020-01-04 11:55:29 -05:00 committed by GitHub
commit 301a71d19e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 66 deletions

View file

@ -70,12 +70,6 @@ test-jupyterhub: test-compile
.PHONY: test
test: quick test-int
.PHONY: test-unpoly
test-poly:
cask exec ert-runner -L ./lisp -L ./test -l test/testfunc.el test/test-poly.el test/test-func.el
cp test/test-poly.el features/support/test-poly.el
cask exec ecukes --reporter magnars ; (ret=$$? ; rm -f features/support/test-poly.el && exit $$ret)
.PHONY: test-int
test-int:
cask exec ecukes --reporter magnars
@ -83,7 +77,6 @@ test-int:
.PHONY: test-unit
test-unit:
cask exec ert-runner -L ./lisp -L ./test -l test/testein.el test/test-ein*.el
cask exec ert-runner -L ./lisp -L ./test test/test-uncompiled.el
.PHONY: test-ob-ein-recurse
test-ob-ein-recurse:

View file

@ -286,11 +286,8 @@ will be updated with kernel's cwd."
(ein:worksheet-focus-cell))
(unless no-pop*
(with-current-buffer (ein:notebook-buffer notebook*)
(if ein:polymode
(progn
(pm-select-buffer (pm-innermost-span))
(pop-to-buffer (pm-span-buffer (pm-innermost-span))))
(pop-to-buffer (ein:notebook-buffer notebook*)))))
(pm-select-buffer (pm-innermost-span))
(pop-to-buffer (pm-span-buffer (pm-innermost-span)))))
(when (and (not noninteractive)
(null (plist-member (ein:$notebook-metadata notebook*) :kernelspec)))
(aif (ein:$notebook-kernelspec notebook*)
@ -563,27 +560,12 @@ This is equivalent to do ``C-c`` in the console program."
(defun ein:notebook--worksheet-render (notebook ws)
(ein:worksheet-render ws)
(with-current-buffer (ein:worksheet-buffer ws)
(let (multilang-failed)
(if ein:polymode
(poly-ein-mode)
;; Changing major mode here is super dangerous as it
;; kill-all-local-variables.
;; Our saviour has been `ein:deflocal' which applies 'permanent-local
;; to variables assigned up to this point, but we ought not rely on it
(funcall (ein:notebook-choose-mode))
(ein:worksheet-reinstall-undo-hooks ws)
(condition-case err
(aif (ein:$notebook-kernelspec notebook)
(ein:ml-lang-setup it))
(error (ein:log 'error (error-message-string err))
(setq multilang-failed t))))
(unless multilang-failed
(ein:notebook-mode)
(ein:notebook--notification-setup notebook)
(ein:notebook-setup-kill-buffer-hook)
(setq ein:%notebook% notebook)
(when ein:polymode
(poly-ein-fontify-buffer (ein:notebook-buffer notebook)))))))
(poly-ein-mode)
(ein:notebook-mode)
(ein:notebook--notification-setup notebook)
(ein:notebook-setup-kill-buffer-hook)
(setq ein:%notebook% notebook)
(poly-ein-fontify-buffer (ein:notebook-buffer notebook))))
(defun ein:notebook--notification-setup (notebook)
(ein:notification-setup

View file

@ -1,5 +1,5 @@
(define-package "ein"
"0.16.2"
"0.17.0"
"Emacs IPython Notebook"
'((emacs "25")
(websocket "20190620.338")
@ -8,5 +8,6 @@
(deferred "0.5")
(polymode "20190426.1729")
(markdown-mode "20171116.756")
(kubernetes "20200104.353")
(dash "2.13.0")
(s "1.11.0")))

View file

@ -4,21 +4,6 @@
(declare-function polymode-inhibit-during-initialization "polymode-core")
(defcustom ein:polymode t
"When enabled ein will use polymode to provide multi-major mode
support in a notebook buffer, otherwise ein's custom and outdated
multi-major mode support will be used. Emacs must be restarted
after changing this setting!"
:type 'boolean
:set (lambda (symbol value)
(set-default symbol value)
(when value
(if (featurep 'poly-ein)
(poly-ein--decorate-functions)
(with-eval-after-load 'poly-ein
(poly-ein--decorate-functions)))))
:group 'ein)
(defmacro poly-ein--remove-hook (label functions)
"Remove any hooks saying LABEL from FUNCTIONS"
`(mapc (lambda (x) (when (cl-search ,label (symbol-name x))
@ -351,4 +336,6 @@ TYPE can be 'body, nil."
(make-variable-buffer-local 'parse-sexp-lookup-properties)
(poly-ein--decorate-functions)
(provide 'poly-ein)

View file

@ -1,2 +0,0 @@
(custom-set-variables
'(ein:polymode nil))

View file

@ -1,15 +0,0 @@
(custom-set-variables '(company-frontends nil)
'(python-indent-guess-indent-offset-verbose nil)
'(ein:polymode nil))
(require 'ein-dev)
(require 'ein-testing)
(require 'ert)
(require 'byte-compile)
(ert-deftest ein:should-not-compile-advised ()
(should (ad-should-compile 'syntax-ppss nil))
(should (ad-should-compile 'syntax-propertize nil))
(poly-ein--decorate-functions)
(should-not (ad-should-compile 'syntax-ppss nil))
(should-not (ad-should-compile 'syntax-propertize nil)))