1
0
Fork 0

Take the buffer content if a buffer was chosen

This commit is contained in:
Bram Schoenmakers 2024-01-26 17:58:04 +01:00
parent 4ab79511c9
commit b9f47b194c
Signed by: bram
GPG key ID: 0CCD19DFDC63258F

View file

@ -436,7 +436,9 @@ result is short, otherwise it is displayed in a new buffer."
(list (if (use-region-p)
(buffer-substring-no-properties (region-beginning) (region-end))
(let ((buffer-or-text (read-buffer (format-prompt "Buffer name or text" nil))))
(cond ((get-buffer buffer-or-text) (buffer-string))
(cond ((get-buffer buffer-or-text)
(with-current-buffer buffer-or-text
(buffer-string)))
((< 0 (length buffer-or-text)) buffer-or-text)
(t (error "No buffer or text entered")))))
(kagi--read-language (format-prompt "Target language" nil))