diff --git a/ein-cell.el b/ein-cell.el index 51fa78f..32cf042 100644 --- a/ein-cell.el +++ b/ein-cell.el @@ -754,16 +754,16 @@ Called from ewoc pretty printer via `ein:cell-insert-output'." (defmethod ein:cell--handle-output ((cell ein:codecell) msg-type content) (let* ((json (list :output_type msg-type))) - (case msg-type - (:stream + (ein:case-equal msg-type + (("stream") (plist-put json :text (plist-get content :data)) (plist-put json :stream (plist-get content :name))) - ((:display_data :pyout) - (when (eql msg-type :pyout) + (("display_data" "pyout") + (when (equal msg-type "pyout") (plist-put json :prompt_number (plist-get content :execution_count))) (setq json (ein:output-area-convert-mime-types json (plist-get content :data)))) - (:pyerr + (("pyerr") (plist-put json :ename (plist-get content :ename)) (plist-put json :evalue (plist-get content :evalue)) (plist-put json :traceback (plist-get content :traceback)))) diff --git a/ein-kernel.el b/ein-kernel.el index 0886f73..f1de4ac 100644 --- a/ein-kernel.el +++ b/ein-kernel.el @@ -302,8 +302,7 @@ For example, the EXECUTE-REPLY-CALLBACK is called as: (`funcall' FUNCTION ARGUMENT CONTENT) .. [#output] One of `stream', `display_data', `pyout', `pyerr'. -.. [#output2] The argument MSG-ID for the FUNCTION is `keyword'. - (e.g., `:stream') +.. [#output2] The argument MSG-ID for the FUNCTION is a string. .. [#clear]_ Content object has `stdout', `stderr' and `other' fields that are booleans. @@ -400,10 +399,10 @@ http://ipython.org/ipython-doc/dev/development/messaging.html#complete (destructuring-bind (&key header content parent_header &allow-other-keys) (ein:json-read-from-string packet) - (let* ((msg-type (intern (format ":%s" (plist-get header :msg_type)))) + (let* ((msg-type (plist-get header :msg_type)) (msg-id (plist-get parent_header :msg_id)) (callbacks (ein:kernel-get-callbacks-for-msg kernel msg-id)) - (cb (plist-get callbacks msg-type))) + (cb (plist-get callbacks (intern (format ":%s" msg-type))))) (if cb (ein:funcall-packed cb content) (ein:log 'debug "no callback for: msg_type=%s msg_id=%s" @@ -429,18 +428,18 @@ http://ipython.org/ipython-doc/dev/development/messaging.html#complete (destructuring-bind (&key content parent_header header &allow-other-keys) (ein:json-read-from-string packet) - (let* ((msg-type (intern (format ":%s" (plist-get header :msg_type)))) + (let* ((msg-type (plist-get header :msg_type)) (callbacks (ein:kernel-get-callbacks-for-msg kernel (plist-get parent_header :msg_id))) (events (ein:$kernel-events kernel))) (ein:log 'debug "HANDLE-IOPUB-REPLY: msg_type = %s" msg-type) - (if (and (not (eql msg-type :status)) (null callbacks)) + (if (and (not (equal msg-type "status")) (null callbacks)) (ein:log 'verbose "Got message not from this kernel.") - (case msg-type - ((:stream :display_data :pyout :pyerr) + (ein:case-equal msg-type + (("stream" "display_data" "pyout" "pyerr") (ein:aif (plist-get callbacks :output) (ein:funcall-packed it msg-type content))) - (:status + (("status") (ein:case-equal (plist-get content :execution_state) (("busy") (ein:events-trigger events '(status_busy . Kernel))) @@ -449,7 +448,7 @@ http://ipython.org/ipython-doc/dev/development/messaging.html#complete (("dead") (ein:kernel-stop-channels kernel) (ein:events-trigger events '(status_dead . Kernel))))) - (:clear_output + (("clear_output") (ein:aif (plist-get callbacks :clear_output) (ein:funcall-packed it content))))))))