jupyter-org-client.el: Add outline sections

This commit is contained in:
Nathaniel Nicandro 2018-11-30 22:54:54 -06:00
parent 0c0547dd95
commit df54627f68
No known key found for this signature in database
GPG key ID: C34814B309DD06B8

View file

@ -94,6 +94,10 @@ source code block. Set by `org-babel-execute:jupyter'.")))
(req jupyter-org-request))
(set-marker (jupyter-org-request-marker req) nil))
;;; Handlers
;;;; Stream
(cl-defmethod jupyter-handle-stream ((_client jupyter-org-client)
(req jupyter-org-request)
_name
@ -109,7 +113,7 @@ source code block. Set by `org-babel-execute:jupyter'.")))
(insert (ansi-color-apply text)))
(buffer-string))))
;;; Errors
;;;; Errors
(defvar jupyter-org-goto-error-map
(let ((map (make-sparse-keymap)))
@ -133,7 +137,7 @@ line in the previous source block. See
(org-babel-previous-src-block)
(forward-line loc))))
;;;; `jupyter-org-error-location'
;;;;; `jupyter-org-error-location'
;; Inspiration from https://kitchingroup.cheme.cmu.edu/blog/2017/06/10/Adding-keymaps-to-src-blocks-via-org-font-lock-hook/
;; TODO: Do something similar for `jupyter-inspect-at-point' using `jupyter-org-with-src-block-client'.
@ -175,6 +179,8 @@ to."
(put-text-property pos end 'keymap jupyter-org-goto-error-map)
(setq pos end)))))))
;;;;; Error handler
(cl-defmethod jupyter-handle-error ((_client jupyter-org-client)
(req jupyter-org-request)
ename
@ -193,6 +199,8 @@ to."
(when goto-error
(jupyter-org--add-result req (concat "# " goto-error "\n")))))
;;;; Execute result
(cl-defmethod jupyter-handle-execute-result ((_client jupyter-org-client)
(req jupyter-org-request)
_execution-count
@ -202,6 +210,8 @@ to."
(jupyter-org--add-result
req (jupyter-org-result req data metadata))))
;;;; Display data
(cl-defmethod jupyter-handle-display-data ((_client jupyter-org-client)
(req jupyter-org-request)
data
@ -214,6 +224,8 @@ to."
_transient)
(jupyter-org--add-result req (jupyter-org-result req data metadata)))
;;;; Execute reply
(cl-defmethod jupyter-handle-execute-reply ((client jupyter-org-client)
(req jupyter-org-request)
status
@ -231,7 +243,6 @@ to."
(jupyter-org--clear-request-id req)
(run-hooks 'org-babel-after-execute-hook)))
;;; Completions in code blocks
(defvar jupyter-org--src-block-cache nil
@ -441,6 +452,8 @@ returned drawer has a name of \"RESULTS\"."
;;; Inserting results
;;;; `jupyter-org-result'
(defun jupyter-org-image-file-name (data ext)
"Return a file name based on DATA and EXT.
`jupyter-org-resource-directory' is used as the directory name of