mirror of
https://github.com/vale981/emacs-jupyter
synced 2025-03-04 15:41:37 -05:00
jupyter-generate-request (jupyter-org-client): Handle indirect buffers
Verify that the `major-mode` of the `buffer-base-buffer` is derived from `org-mode` if the `current-buffer` happens to be an indirect one. This should allow `emacs-jupyter` to work better with `polymode`. See #171.
This commit is contained in:
parent
f5560e56f6
commit
afbb9b5134
1 changed files with 7 additions and 3 deletions
|
@ -116,11 +116,15 @@ See also the docstring of `org-image-actual-width' for more details."
|
|||
|
||||
(defvar org-babel-jupyter-current-src-block-params)
|
||||
|
||||
(cl-defmethod jupyter-generate-request ((_client jupyter-org-client) _msg
|
||||
&context (major-mode (eql org-mode)))
|
||||
(cl-defmethod jupyter-generate-request ((_client jupyter-org-client) _msg)
|
||||
"Return a `jupyter-org-request' for the current source code block."
|
||||
(if (and org-babel-current-src-block-location
|
||||
org-babel-jupyter-current-src-block-params)
|
||||
org-babel-jupyter-current-src-block-params
|
||||
(provided-mode-derived-p
|
||||
(buffer-local-value
|
||||
;; Handle indirect buffers used by packages like polymode, see #171.
|
||||
'major-mode (or (buffer-base-buffer) (current-buffer)))
|
||||
'org-mode))
|
||||
;; Only use a `jupyter-org-request' when executing code blocks, setting
|
||||
;; the `major-mode' context isn't enough, consider when a client is
|
||||
;; started due to sending a completion request.
|
||||
|
|
Loading…
Add table
Reference in a new issue