File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -197,14 +197,15 @@ function."
197197
198198; ;; Special handling of ANSI sequences
199199
200- (defun jupyter-ansi-color-apply-on-region (begin end )
200+ (defun jupyter-ansi-color-apply-on-region (begin end &optional face-prop )
201201 " `ansi-color-apply-on-region' with Jupyter specific modifications.
202202In particular, does not delete escape sequences between BEGIN and
203203END from the buffer. Instead, an invisible text property with a
204204value of t is added to render the escape sequences invisible.
205205Also, the `ansi-color-apply-face-function' is hard-coded to a
206206custom function that prepends to the face property of the text
207- and also sets the font-lock-face to the prepended face.
207+ and also sets the FACE-PROP to the prepended face, if FACE-PROP
208+ is nil it defaults to `font-lock-face' .
208209
209210For convenience, a jupyter-invisible property is also added with
210211a value of t. This is mainly for modes like `org-mode' which
@@ -220,7 +221,7 @@ invisible property by adding it to `char-property-alias-alist'."
220221 (when face
221222 (setq face (list face))
222223 (font-lock-prepend-text-property beg end 'face face)
223- (put-text-property beg end 'font-lock-face face)))))
224+ (put-text-property beg end ( or face-prop 'font-lock-face ) face)))))
224225 (save-excursion
225226 (goto-char start-marker)
226227 ; ; Find the next escape sequence.
Original file line number Diff line number Diff line change @@ -568,14 +568,14 @@ property."
568568 begin next)
569569 (while (/= begin1 end1)
570570 (setq next (next-single-property-change
571- begin1 'font-lock -face nil end1))
572- (when (get-text-property begin1 'font-lock -face )
571+ begin1 'jupyter -face nil end1))
572+ (when (get-text-property begin1 'jupyter -face )
573573 (font-lock-prepend-text-property
574- begin1 next 'face (get-text-property begin1 'font-lock -face )))
574+ begin1 next 'face (get-text-property begin1 'jupyter -face )))
575575 (setq begin1 next)))
576576 (t
577577 (put-text-property begin next 'jupyter-ansi t )
578- (jupyter-ansi-color-apply-on-region begin next)
578+ (jupyter-ansi-color-apply-on-region begin next 'jupyter-face )
579579 (setq begin next))))))
580580
581581; ; Adapted from `org-fontify-meta-lines-and-blocks-1'
You can’t perform that action at this time.
0 commit comments