Skip to content

Commit 5ef5986

Browse files
author
xenodium
committed
Adds chatgpt-shell-prompt-compose-refresh
1 parent b7bb456 commit 5ef5986

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

chatgpt-shell-prompt-compose.el

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,21 @@ If BACKWARDS is non-nil, go to previous interaction."
387387
(text-property-search-forward 'prompt t)
388388
next))
389389

390+
(defun chatgpt-shell-prompt-compose-refresh ()
391+
"Refresh compose buffer content with curernt item from shell."
392+
(interactive)
393+
(unless (eq (current-buffer) (chatgpt-shell-prompt-compose-buffer))
394+
(error "Not in a compose buffer"))
395+
(when-let ((shell-buffer (chatgpt-shell--primary-buffer))
396+
(compose-buffer (chatgpt-shell-prompt-compose-buffer))
397+
(current (with-current-buffer (chatgpt-shell--primary-buffer)
398+
(or (shell-maker--command-and-response-at-point)
399+
(shell-maker-next-command-and-response t)))))
400+
(chatgpt-shell-prompt-compose-replace-interaction
401+
(car current) (cdr current))
402+
(text-property-search-forward 'prompt t)
403+
current))
404+
390405
(defun chatgpt-shell-prompt-compose-previous-interaction ()
391406
"Show previous interaction (request / response)."
392407
(interactive)

0 commit comments

Comments
 (0)