jupyter
jupyter copied to clipboard
ANSI color sequences broken on emacs master since `ansi-color--find-face` was renamed
I know there are already several other open and closed issues and an open PR around issues with ANSI color sequences. I'm opening this one since I suspect this is a separate issue from those that only occurs on emacs master.
Emacs commit 21dcb9830a renamed ansi-color--find-face to ansi-color--face-vec-face. Since that commit I see the following error:
Error during redisplay: (jit-lock-function 10140) signaled (void-function ansi-color--find-face)
Since errors during redisplay don't yield backtraces when debug-on-error is t, I manually ran (jupyter-org--ansi-color-apply-on-region (point-min) (point-max)) on an org buffer to get the backtrace
Debugger entered--Lisp error: (void-function ansi-color--find-face)
ansi-color--find-face(nil)
jupyter-ansi-color-apply-on-region(4925 4928)
jupyter-org--ansi-color-apply-on-region(1 4928)
#<subr eval-expression>((jupyter-org--ansi-color-apply-on-region (point-min) (point-max)) nil nil 127)
apply(#<subr eval-expression> ((jupyter-org--ansi-color-apply-on-region (point-min) (point-max)) nil nil 127))
eval-expression((jupyter-org--ansi-color-apply-on-region (point-min) (point-max)) nil nil 127)
funcall-interactively(eval-expression (jupyter-org--ansi-color-apply-on-region (point-min) (point-max)) nil nil 127)
command-execute(eval-expression)
In trying to fix this for myself I found that since emacs commit 8700319109, ansi-color-apply-on-region supports an optional argument preserve-sequences which seems to mean that jupyter-ansi-color-apply-on-region is no longer necessary. When I redefine it to
(defun jupyter-ansi-color-apply-on-region (begin end)
(ansi-color-apply-on-region begin end t))
ANSI color sequences work for me again. The only issue I see with the fix is that ANSI sequences in a results drawer do not seem to be fontified when an org file is first loaded, although they are correctly fontified after any modifications are made to the buffer.
Thank you! I had this issue as well.
Same here.
Does not work in case of org-babel-execute-buffer, but the issue seems to be that jupyter-org-font-lock-ansi-escapes is not invoked at all in that case. Seems to work fine with org-ctrl-c-ctrl-c however.
I'm experiencing this issue. I'm finding that redefining jupyter-ansi-color-apply-on-region is not working because when executing a cell with C-c C-c the function is redefined again to its original form.
Finally, this issue is fixed. Regards.
Finally, this issue is fixed. Regards.
It seems that the issue still exists when the output is put in the example block. Try the following code:
#+begin_src jupyter-R
library(tidyverse)
#+end_src