Check whether 'yank-transform-functions' is bound

* eat.el (eat-yank, eat-yank-from-kill-ring): Check whether
'yank-transform-functions' is bound before using it's value.
The variable is not available in Emacs 28.
This commit is contained in:
Akib Azmain Turja 2022-12-11 18:40:27 +06:00
parent 731ead9bfb
commit fffca2c06e
No known key found for this signature in database
GPG key ID: 5535FCF54D88616B

22
eat.el
View file

@ -4581,11 +4581,12 @@ ARG is passed to `yank', which see."
(when eat--terminal
(funcall eat--synchronize-scroll-function)
(eat-send-string-as-yank
eat--terminal (let ((yank-hook yank-transform-functions))
(with-temp-buffer
(setq-local yank-transform-functions yank-hook)
(yank arg)
(buffer-string))))))
eat--terminal
(let ((yank-hook (bound-and-true-p yank-transform-functions)))
(with-temp-buffer
(setq-local yank-transform-functions yank-hook)
(yank arg)
(buffer-string))))))
(defun eat-yank-from-kill-ring (string &optional arg)
"Same as `yank-from-kill-ring', but for Eat.
@ -4596,11 +4597,12 @@ STRING and ARG are passed to `yank-pop', which see."
(when eat--terminal
(funcall eat--synchronize-scroll-function)
(eat-send-string-as-yank
eat--terminal (let ((yank-hook yank-transform-functions))
(with-temp-buffer
(setq-local yank-transform-functions yank-hook)
(yank-from-kill-ring string arg)
(buffer-string))))))
eat--terminal
(let ((yank-hook (bound-and-true-p yank-transform-functions)))
(with-temp-buffer
(setq-local yank-transform-functions yank-hook)
(yank-from-kill-ring string arg)
(buffer-string))))))
;; When changing these keymaps, be sure to update the manual, README
;; and commentary.