Function: gptel-send--steer-relocate

gptel-send--steer-relocate is a natively compiled function defined in gptel.el.

Signature

(gptel-send--steer-relocate REQ-INFO)

Documentation

Move an unsent steering message in REQ-INFO to the next prompt.

Source Code

;; Defined in /nix/store/q3r7g81pvghw7a523kjk2k2zih3pfk8z-emacs-packages-deps/share/emacs/site-lisp/elpa/gptel-20261002.545/gptel.el
(defun gptel-send--steer-relocate (req-info)
  "Move an unsent steering message in REQ-INFO to the next prompt."
  (when-let* ((msg (plist-get req-info :steering-message)))
    (plist-put req-info :steering-message nil) ;consume and move to next prompt
    (if-let* ((tm (plist-get req-info :tracking-marker))
              (tbuf (marker-buffer tm))
              ((and (not (plist-get req-info :in-place)) (buffer-live-p tbuf))))
        (with-current-buffer tbuf ;Insert steering prompt at start of next prompt
          (save-excursion
            (save-restriction
              (goto-char tm)
              (dolist (elem (list gptel-response-separator (gptel-prompt-prefix-string)))
                (when (looking-at (regexp-quote elem)) (goto-char (match-end 0))))
              (if (or buffer-read-only (get-char-property (point) 'read-only))
                  (message "Cannot insert steering message, buffer read-only: \"%s\"" msg)
                (message "Could not send steering message, moving to next prompt")
                (insert msg)))))
      (message "Could not send steering message: \"%s\"" msg))))