From e2e2cd2371ef5b82a0b89f360bfa922445d3a12a Mon Sep 17 00:00:00 2001 From: Tom Gillespie Date: Tue, 16 Aug 2022 11:18:17 -0700 Subject: [PATCH 1/2] jupyter-repl-mode handle yank-excluded-properties t The value of `yank-excluded-properties' can be t, in which case it is not possible to `remq' 'field, causing an error. This fix will allow the mode to start, but does not handle the fact that the 'field property is still stripped. --- jupyter-repl.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jupyter-repl.el b/jupyter-repl.el index 8fcf2ff4..2c8d6702 100644 --- a/jupyter-repl.el +++ b/jupyter-repl.el @@ -1651,7 +1651,8 @@ Return the buffer switched to." (setq-local yank-handled-properties (append '((field . jupyter-repl-yank-handle-field-property)) yank-handled-properties)) - (setq-local yank-excluded-properties (remq 'field yank-excluded-properties)) + (unless (booleanp yank-excluded-properties) ; `yank-excluded-properties' can be set to t + (setq-local yank-excluded-properties (remq 'field yank-excluded-properties))) ;; Initialize a buffer using the major-mode correponding to the kernel's ;; language. This will be used for indentation and to capture font lock ;; properties. From 8568798ff10570ba48704bcd81b84ca810518cf4 Mon Sep 17 00:00:00 2001 From: Tom Gillespie Date: Wed, 7 Dec 2022 20:19:20 -0800 Subject: [PATCH 2/2] jupyter-repl-mode better handling of yank-excluded-properties The previous fix changed the behavior so that field was always excluded. We now restore the default list for jupyter mode buffers so that field will make it through as expected. There is no way to get all text properties so we reproduce the list from simple.el --- jupyter-repl.el | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/jupyter-repl.el b/jupyter-repl.el index 2c8d6702..4953e358 100644 --- a/jupyter-repl.el +++ b/jupyter-repl.el @@ -1651,8 +1651,15 @@ Return the buffer switched to." (setq-local yank-handled-properties (append '((field . jupyter-repl-yank-handle-field-property)) yank-handled-properties)) - (unless (booleanp yank-excluded-properties) ; `yank-excluded-properties' can be set to t - (setq-local yank-excluded-properties (remq 'field yank-excluded-properties))) + (setq-local yank-excluded-properties + (remq 'field + (or + (and (listp yank-excluded-properties) + yank-excluded-properties) + ;; if the user sets `yank-excluded-properties' to t we cannot recover + ;; the default list of properties, so it is reproduced here for consistency + '(category field follow-link fontified font-lock-face help-echo + intangible invisible keymap local-map mouse-face read-only yank-handler)))) ;; Initialize a buffer using the major-mode correponding to the kernel's ;; language. This will be used for indentation and to capture font lock ;; properties.