diff --git a/modules/lang/org/contrib/jupyter.el b/modules/lang/org/contrib/jupyter.el index e6737315d..7199e91cd 100644 --- a/modules/lang/org/contrib/jupyter.el +++ b/modules/lang/org/contrib/jupyter.el @@ -5,6 +5,23 @@ (use-package! jupyter-repl :defer t :config + ;; HACK: Don't use treesit ts-modes for syntax highlighting (is brittle). + (defadvice! +org-jupyter--suppress-major-mode-remapping-a (fn &rest args) + :around #'jupyter-kernel-language-mode-properties + (let (major-mode-remap-alist major-mode-remap-defaults) + (apply fn args))) + + ;; HACK: And un-remap the major mode when associating a repl with the current + ;; buffer, otherwise it will fail with any treesit-enabled (or otherwise + ;; remapped) modes. + (defadvice! +org-jupyter--unremap-major-mode-when-associating-buffer-a (fn &rest args) + :around #'jupyter-repl-associate-buffer + (let ((major-mode + (or (car (rassq major-mode (append major-mode-remap-alist + major-mode-remap-defaults))) + major-mode))) + (apply fn args))) + ;; HACK: If the user is anywhere but the last prompt, typing should move them ;; there instead of unhelpfully spewing read-only errors at them. ;; REVIEW: Upstream this (maybe?)