From b7188ff51f30cbf7018c765f771dc5d945ea5dfe Mon Sep 17 00:00:00 2001 From: dickmao Date: Sat, 4 Jan 2020 11:28:56 -0500 Subject: [PATCH 1/2] remove ein:polymode --- Makefile | 7 ------- lisp/ein-notebook.el | 34 ++++++++-------------------------- lisp/poly-ein.el | 17 ++--------------- test/test-poly.el | 2 -- test/test-uncompiled.el | 15 --------------- 5 files changed, 10 insertions(+), 65 deletions(-) delete mode 100644 test/test-poly.el delete mode 100644 test/test-uncompiled.el diff --git a/Makefile b/Makefile index a1a541f..0b45179 100644 --- a/Makefile +++ b/Makefile @@ -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: diff --git a/lisp/ein-notebook.el b/lisp/ein-notebook.el index 795f4d2..140a4b1 100644 --- a/lisp/ein-notebook.el +++ b/lisp/ein-notebook.el @@ -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 diff --git a/lisp/poly-ein.el b/lisp/poly-ein.el index dee2092..36bad75 100644 --- a/lisp/poly-ein.el +++ b/lisp/poly-ein.el @@ -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) diff --git a/test/test-poly.el b/test/test-poly.el deleted file mode 100644 index 8595f45..0000000 --- a/test/test-poly.el +++ /dev/null @@ -1,2 +0,0 @@ -(custom-set-variables - '(ein:polymode nil)) diff --git a/test/test-uncompiled.el b/test/test-uncompiled.el deleted file mode 100644 index 57d208e..0000000 --- a/test/test-uncompiled.el +++ /dev/null @@ -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))) From 6a525cde7f7efb200f61abc68360defe8184839c Mon Sep 17 00:00:00 2001 From: dickmao Date: Sat, 4 Jan 2020 11:34:55 -0500 Subject: [PATCH 2/2] bump version --- lisp/ein-pkg.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/ein-pkg.el b/lisp/ein-pkg.el index a3cb8e2..ea790f6 100644 --- a/lisp/ein-pkg.el +++ b/lisp/ein-pkg.el @@ -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")))