Make scratch buffers easier to identify

This commit is contained in:
Tomasz Mieszkowski 2021-11-27 19:32:30 +01:00 committed by Nathaniel Nicandro
parent 7b64e18144
commit 57306bf385
2 changed files with 4 additions and 5 deletions

View file

@ -112,9 +112,7 @@ called if needed.")
(cl-defgeneric jupyter-comm-id ((comm jupyter-comm-layer)) (cl-defgeneric jupyter-comm-id ((comm jupyter-comm-layer))
"Return an identification string for COMM. "Return an identification string for COMM.
Can be used to identify this communication channel. For example, Can be used to identify this communication channel.")
used in `jupyter-repl-scratch-buffer' to name the scratch
buffer.")
(cl-defgeneric jupyter-event-handler (_obj _event) (cl-defgeneric jupyter-event-handler (_obj _event)
"Handle EVENT using OBJ." "Handle EVENT using OBJ."

View file

@ -1653,8 +1653,9 @@ Return the buffer switched to."
(interactive) (interactive)
(if (jupyter-repl-connected-p) (if (jupyter-repl-connected-p)
(let* ((client jupyter-current-client) (let* ((client jupyter-current-client)
(name (format "*jupyter-scratch[%s]*" (name (replace-regexp-in-string "^*jupyter-repl"
(jupyter-comm-id (oref client kcomm))))) "*jupyter-scratch"
(buffer-name) (oref client buffer))))
(unless (get-buffer name) (unless (get-buffer name)
(with-current-buffer (get-buffer-create name) (with-current-buffer (get-buffer-create name)
(funcall (jupyter-kernel-language-mode client)) (funcall (jupyter-kernel-language-mode client))