From 93d6ad47325986d8d6c50625067884a72e82a2ed Mon Sep 17 00:00:00 2001 From: Akira Kyle Date: Fri, 24 Nov 2023 13:02:56 -0700 Subject: [PATCH] Fix org-element-cache issue with ansi colors --- jupyter-mime.el | 15 +++------------ jupyter-org-client.el | 4 ---- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/jupyter-mime.el b/jupyter-mime.el index 9f199b1c..dab8b2a7 100644 --- a/jupyter-mime.el +++ b/jupyter-mime.el @@ -205,23 +205,14 @@ value of t is added to render the escape sequences invisible. Also, the `ansi-color-apply-face-function' is hard-coded to a custom function that prepends to the face property of the text and also sets the FACE-PROP to the prepended face, if FACE-PROP -is nil it defaults to `font-lock-face'. - -For convenience, a jupyter-invisible property is also added with -a value of t. This is mainly for modes like `org-mode' which -strip invisible properties during fontification. In such cases, -the jupyter-invisible property can act as an alias to the -invisible property by adding it to `char-property-alias-alist'." - (cl-letf (((symbol-function #'delete-region) - (lambda (beg end) - (add-text-properties beg end '(invisible t jupyter-invisible t)))) - (ansi-color-apply-face-function +is nil it defaults to `font-lock-face'. " + (cl-letf ((ansi-color-apply-face-function (lambda (beg end face) (when face (setq face (list face)) (font-lock-prepend-text-property beg end 'face face) (put-text-property beg end (or face-prop 'font-lock-face) face))))) - (ansi-color-apply-on-region begin end))) + (ansi-color-apply-on-region begin end t))) ;;; `jupyter-insert' method diff --git a/jupyter-org-client.el b/jupyter-org-client.el index 7c7be208..c651ee92 100644 --- a/jupyter-org-client.el +++ b/jupyter-org-client.el @@ -640,8 +640,6 @@ C-x C-e `jupyter-eval-line-or-region'" (add-hook 'after-revert-hook 'jupyter-org-interaction-mode nil t) (setq-local char-property-alias-alist (copy-tree char-property-alias-alist)) - (cl-callf append (alist-get 'invisible char-property-alias-alist) - '(jupyter-invisible)) (unless (cl-find-if (lambda (x) (eq (car x) 'jupyter-org-font-lock-ansi-escapes)) org-font-lock-keywords) @@ -650,8 +648,6 @@ C-x C-e `jupyter-eval-line-or-region'" (t (remove-hook 'completion-at-point-functions 'jupyter-org-completion-at-point t) (remove-hook 'after-revert-hook 'jupyter-org-interaction-mode t) - (cl-callf2 delq 'jupyter-invisible - (alist-get 'invisible char-property-alias-alist)) (cl-callf2 cl-remove-if (lambda (x) (eq (car x) 'jupyter-org-font-lock-ansi-escapes)) org-font-lock-keywords))))