Open yuchen-lea opened 8 months ago
@yuchen-lea Modify the function immersive-translate-paragraph
to:
(defun immersive-translate-paragraph ()
"Translate the current paragraph."
(interactive)
(save-excursion
(unless (immersive-translate-disable-p)
(when-let* ((paragraph (immersive-translate-join-lin
(immersive-translate--get-paragraph)))
(content (if (eq immersive-translate-backend 'chatgpt)
(immersive-translate-chatgpt-create-prompt paragraph)
paragraph))
(ov t))
(immersive-translate-end-of-paragraph)
(if (immersive-translate--cache-p content)
(let ((translation (immersive-translate--cache-get content)))
(progn
(kill-new translation) ;; copy the translated result to kill-ring
(immersive-translate--add-ov translation)))
(setq ov (make-overlay (1- (point)) (point)))
(overlay-put ov
'after-string
immersive-translate-pending-message)
(immersive-translate-do-translate content))))))
while overlay shows, the translation results will copy to the kill-ring instantly.
Thanks for the suggestion, but I prefer that the translated text could be manually selected and then copied like the original text
It would be very helpful for taking notes.