mirror of
https://github.com/vale981/emacs-jupyter
synced 2025-03-05 07:41:37 -05:00
Add jupyter-repl-propertize-output
Currently this function changes the syntax of " characters in inserted output so that they do not get recognized for syntactic fontification. Syntactic fontification should only happen for cell code.
This commit is contained in:
parent
8b75a8b2e2
commit
2911ac34bf
1 changed files with 13 additions and 5 deletions
|
@ -583,15 +583,23 @@ image."
|
|||
org-preview-latex-default-process)
|
||||
(goto-char end)))
|
||||
|
||||
(defun jupyter-repl-propertize-output (beg end)
|
||||
"Remove string syntax from quote characters between BEG and END."
|
||||
(save-excursion
|
||||
(save-restriction
|
||||
(narrow-to-region beg end)
|
||||
(goto-char (point-min))
|
||||
(while (search-forward "\"" nil t)
|
||||
(put-text-property (1- (point)) (point)
|
||||
'syntax-table '(3 . ?_))))))
|
||||
|
||||
(defun jupyter-repl-insert-ansi-coded-text (text)
|
||||
"Insert TEXT, converting ANSI color codes to font lock faces."
|
||||
(setq text (ansi-color-apply text))
|
||||
(jupyter-repl-add-font-lock-properties 0 (length text) text)
|
||||
;; NOTE: Mark text with a specific syntax class so that string characters do
|
||||
;; not get registered as strings. This requires
|
||||
;; `parse-sexp-lookup-properties' to be non-nil.
|
||||
(add-text-properties 0 (length text) '(syntax-table (3)) text)
|
||||
(jupyter-repl-insert text))
|
||||
(let ((beg (point)))
|
||||
(jupyter-repl-insert text)
|
||||
(jupyter-repl-propertize-output beg (point))))
|
||||
|
||||
(defun jupyter-repl-insert-data (data metadata)
|
||||
"Insert DATA into the REPL buffer in order of decreasing richness.
|
||||
|
|
Loading…
Add table
Reference in a new issue