Function: gptel--with-buffer-copy-internal
gptel--with-buffer-copy-internal is a natively compiled function
defined in gptel-request.el.
Signature
(gptel--with-buffer-copy-internal BUF START END BODY-THUNK)
Documentation
Prepare a temp buffer for a gptel request.
For BUF, START, END and BODY-THUNK see gptel--with-buffer-copy.
Source Code
;; Defined in /nix/store/q3r7g81pvghw7a523kjk2k2zih3pfk8z-emacs-packages-deps/share/emacs/site-lisp/elpa/gptel-20261002.545/gptel-request.el
(defun gptel--with-buffer-copy-internal (buf start end body-thunk)
"Prepare a temp buffer for a gptel request.
For BUF, START, END and BODY-THUNK see `gptel--with-buffer-copy'."
(let ((temp-buffer (gptel--temp-buffer " *gptel-prompt*")))
(with-current-buffer temp-buffer
(dolist (sym '( gptel-backend gptel-system-prompt gptel-model
gptel-mode gptel-track-response gptel-track-media
gptel-use-tools gptel-tools gptel-use-curl gptel--schema
gptel-use-context gptel-context gptel--num-messages-to-send
gptel-stream gptel-include-reasoning gptel--request-params
gptel-temperature gptel-max-tokens gptel-cache))
(set (make-local-variable sym) (buffer-local-value sym buf)))
(when (and start end) (insert-buffer-substring buf start end))
(setq major-mode (buffer-local-value 'major-mode buf))
(funcall body-thunk))))