Skip to content

Commit cd747c6

Browse files
author
xenodium
committed
Fixes needing to start a shell before using compose? #280
1 parent 3a34238 commit cd747c6

File tree

2 files changed

+47
-47
lines changed

2 files changed

+47
-47
lines changed

chatgpt-shell-prompt-compose.el

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -115,53 +115,6 @@ t if invoked from a transient frame (quitting closes the frame).")
115115
:keymap chatgpt-shell-prompt-compose-view-mode-map
116116
(setq buffer-read-only chatgpt-shell-prompt-compose-view-mode))
117117

118-
;;;###autoload
119-
(defun chatgpt-shell-prompt-compose (prefix)
120-
"Compose and send prompt from a dedicated buffer.
121-
122-
With PREFIX, clear existing history (wipe asociated shell history).
123-
124-
Whenever `chatgpt-shell-prompt-compose' is invoked, appends any active
125-
region (or flymake issue at point) to compose buffer.
126-
127-
Additionally, if point is at an error/warning raised by flymake,
128-
automatically add context (error/warning + code) to expedite ChatGPT
129-
for help to fix the issue.
130-
131-
The compose buffer always shows the latest interaction, but it's
132-
backed by the shell history. You can always switch to the shell buffer
133-
to view the history.
134-
135-
Editing: While compose buffer is in in edit mode, it offers a couple
136-
of magit-like commit buffer bindings.
137-
138-
`\\[chatgpt-shell-prompt-compose-send-buffer]` to send the buffer query.
139-
`\\[chatgpt-shell-prompt-compose-cancel]` to cancel compose buffer.
140-
`\\[chatgpt-shell-prompt-compose-search-history]` search through history.
141-
`\\[chatgpt-shell-prompt-compose-previous-history]` cycle through previous
142-
item in history.
143-
`\\[chatgpt-shell-prompt-compose-next-history]` cycle through next item in
144-
history.
145-
146-
Read-only: After sending a query, the buffer becomes read-only and
147-
enables additional key bindings.
148-
149-
`\\[chatgpt-shell-prompt-compose-send-buffer]` After sending offers to abort
150-
query in-progress.
151-
`\\[View-quit]` Exits the read-only buffer.
152-
`\\[chatgpt-shell-prompt-compose-retry]` Refresh (re-send the query). Useful
153-
to retry on disconnects.
154-
`\\[chatgpt-shell-prompt-compose-next-item]` Jump to next source block.
155-
`\\[chatgpt-shell-prompt-compose-previous-item]` Jump to next previous block.
156-
`\\[chatgpt-shell-prompt-compose-reply]` Reply to follow-up with additional questions.
157-
`\\[chatgpt-shell-prompt-compose-request-entire-snippet]` Send \"Show entire snippet\" query.
158-
`\\[chatgpt-shell-prompt-compose-insert-block-at-point]` Insert block at point at last known location.
159-
`\\[chatgpt-shell-prompt-compose-request-more]` Send \"Show me more\" query.
160-
`\\[chatgpt-shell-prompt-compose-other-buffer]` Jump to other buffer (ie. the shell itself).
161-
`\\[chatgpt-shell-mark-block]` Mark block at point."
162-
(interactive "P")
163-
(chatgpt-shell-prompt-compose-show-buffer :clear-history prefix))
164-
165118
(defvar-local chatgpt-shell--ring-index nil)
166119

167120
(cl-defun chatgpt-shell-prompt-compose-show-buffer (&key content clear-history transient-frame-p)

chatgpt-shell.el

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1693,6 +1693,53 @@ STREAMING (optional): non-nil to received streamed ON-OUTPUT events."
16931693
:on-success on-success
16941694
:on-failure on-failure))
16951695

1696+
;;;###autoload
1697+
(defun chatgpt-shell-prompt-compose (prefix)
1698+
"Compose and send prompt from a dedicated buffer.
1699+
1700+
With PREFIX, clear existing history (wipe asociated shell history).
1701+
1702+
Whenever `chatgpt-shell-prompt-compose' is invoked, appends any active
1703+
region (or flymake issue at point) to compose buffer.
1704+
1705+
Additionally, if point is at an error/warning raised by flymake,
1706+
automatically add context (error/warning + code) to expedite ChatGPT
1707+
for help to fix the issue.
1708+
1709+
The compose buffer always shows the latest interaction, but it's
1710+
backed by the shell history. You can always switch to the shell buffer
1711+
to view the history.
1712+
1713+
Editing: While compose buffer is in in edit mode, it offers a couple
1714+
of magit-like commit buffer bindings.
1715+
1716+
`\\[chatgpt-shell-prompt-compose-send-buffer]` to send the buffer query.
1717+
`\\[chatgpt-shell-prompt-compose-cancel]` to cancel compose buffer.
1718+
`\\[chatgpt-shell-prompt-compose-search-history]` search through history.
1719+
`\\[chatgpt-shell-prompt-compose-previous-history]` cycle through previous
1720+
item in history.
1721+
`\\[chatgpt-shell-prompt-compose-next-history]` cycle through next item in
1722+
history.
1723+
1724+
Read-only: After sending a query, the buffer becomes read-only and
1725+
enables additional key bindings.
1726+
1727+
`\\[chatgpt-shell-prompt-compose-send-buffer]` After sending offers to abort
1728+
query in-progress.
1729+
`\\[View-quit]` Exits the read-only buffer.
1730+
`\\[chatgpt-shell-prompt-compose-retry]` Refresh (re-send the query). Useful
1731+
to retry on disconnects.
1732+
`\\[chatgpt-shell-prompt-compose-next-item]` Jump to next source block.
1733+
`\\[chatgpt-shell-prompt-compose-previous-item]` Jump to next previous block.
1734+
`\\[chatgpt-shell-prompt-compose-reply]` Reply to follow-up with additional questions.
1735+
`\\[chatgpt-shell-prompt-compose-request-entire-snippet]` Send \"Show entire snippet\" query.
1736+
`\\[chatgpt-shell-prompt-compose-insert-block-at-point]` Insert block at point at last known location.
1737+
`\\[chatgpt-shell-prompt-compose-request-more]` Send \"Show me more\" query.
1738+
`\\[chatgpt-shell-prompt-compose-other-buffer]` Jump to other buffer (ie. the shell itself).
1739+
`\\[chatgpt-shell-mark-block]` Mark block at point."
1740+
(interactive "P")
1741+
(chatgpt-shell-prompt-compose-show-buffer :clear-history prefix))
1742+
16961743
;; TODO: move to cl-defun and consider removing `chatgpt-shell-prompt-query-response-style'.
16971744
(defun chatgpt-shell-send-to-buffer (input &optional review handler on-finished response-style)
16981745
"Send INPUT to *chatgpt* shell buffer.

0 commit comments

Comments
 (0)