From a0943af912bdda3bbe5a5cb2b49cb529a20a5a6a Mon Sep 17 00:00:00 2001 From: dickmao Date: Sat, 14 Mar 2020 00:31:37 -0400 Subject: [PATCH] ecukes clear kernel connect message --- features/notebook.feature | 4 ++-- features/step-definitions/ein-steps.el | 9 ++++++--- lisp/ein-kernel.el | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/features/notebook.feature b/features/notebook.feature index b7618b7..697ca5b 100644 --- a/features/notebook.feature +++ b/features/notebook.feature @@ -118,5 +118,5 @@ Scenario: Test ein:on-kernel-connect-functions abnormal hooks Given I set the kernel connect message Given new python notebook And I wait for the smoke to clear - And I switch to buffer "*Messages*" - Then I should see "Hello ein." + Then I should see message "Hello ein" + And I clear the kernel connect message diff --git a/features/step-definitions/ein-steps.el b/features/step-definitions/ein-steps.el index df3f348..ee1d07b 100644 --- a/features/step-definitions/ein-steps.el +++ b/features/step-definitions/ein-steps.el @@ -2,9 +2,12 @@ (lambda () (insert-char 37))) -(When "^I set the kernel connect message$" - (lambda () - (add-to-list 'ein:on-kernel-connect-functions #'(lambda (_) (message "Hello ein."))))) +(When "^I \\(set\\|clear\\) the kernel connect message$" + (lambda (which) + (if (string= which "clear") + (setq ein:on-kernel-connect-functions nil) + (add-to-list 'ein:on-kernel-connect-functions + (apply-partially #'message "Hello ein"))))) (When "^I type session port \\([0-9]+\\)$" (lambda (port) diff --git a/lisp/ein-kernel.el b/lisp/ein-kernel.el index e4d2f42..0b982e8 100644 --- a/lisp/ein-kernel.el +++ b/lisp/ein-kernel.el @@ -299,7 +299,7 @@ See https://github.com/ipython/ipython/pull/3307" (let* ((websocket (websocket-client-data ws)) (kernel (ein:$websocket-kernel websocket))) (when (ein:kernel-live-p kernel) - (ein:log 'verbose "ein:start-single-websocket: Running on-connect abnormal hooks.") + (ein:log 'debug "ein:start-single-websocket: Running on-connect abnormal hooks.") (run-hook-with-args 'ein:on-kernel-connect-functions kernel) (when cb (funcall cb kernel)))