mirror of
https://github.com/doomemacs/doomemacs
synced 2025-09-18 16:06:56 -05:00
fix(org): +jupyter: syntax highlighting for remapped modes
Particularly treesit ts-modes.
This commit is contained in:
@@ -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?)
|
||||
|
Reference in New Issue
Block a user