Make sure Jupyter syntax highlighting works on first run

This commit is contained in:
Alexander Rosenberg 2025-02-08 00:27:16 -08:00
parent 9c413aaa38
commit 91a54013b9
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730

23
init.el
View File

@ -2023,17 +2023,7 @@ line in the block and manually deal with indentation."
;; jupyter ;; jupyter
(use-package jupyter (use-package jupyter
:hook (jupyter-repl-mode . my/-setup-jupyter-mode) :hook (jupyter-repl-mode . my/-setup-jupyter-mode)
:config :init
(defun company-doc-buffer (&optional string)
"Emulate company's `company-doc-buffer'."
(with-current-buffer (get-buffer-create "*company-documentation*")
(erase-buffer)
(fundamental-mode)
(when string
(save-excursion
(insert string)
(visual-line-mode)))
(current-buffer)))
(defun my/-jupyter-dont-use-ts-modes (retval) (defun my/-jupyter-dont-use-ts-modes (retval)
"Prevent `jupyter-kernel-language-mode-properties' from selecting TS modes." "Prevent `jupyter-kernel-language-mode-properties' from selecting TS modes."
(cl-destructuring-bind (mode syntax-table) retval (cl-destructuring-bind (mode syntax-table) retval
@ -2048,6 +2038,17 @@ line in the block and manually deal with indentation."
retval))) retval)))
(advice-add 'jupyter-kernel-language-mode-properties (advice-add 'jupyter-kernel-language-mode-properties
:filter-return #'my/-jupyter-dont-use-ts-modes) :filter-return #'my/-jupyter-dont-use-ts-modes)
:config
(defun company-doc-buffer (&optional string)
"Emulate company's `company-doc-buffer'."
(with-current-buffer (get-buffer-create "*company-documentation*")
(erase-buffer)
(fundamental-mode)
(when string
(save-excursion
(insert string)
(visual-line-mode)))
(current-buffer)))
(defun my/-jupyter-kick-use-back-to-cell () (defun my/-jupyter-kick-use-back-to-cell ()
"Kick the point out of the invisible read only area at the start of cells." "Kick the point out of the invisible read only area at the start of cells."
(let ((props (text-properties-at (point)))) (let ((props (text-properties-at (point))))