Skip to content

Commit 2c1fc87

Browse files
committed
Fix indentation
1 parent 16b27de commit 2c1fc87

File tree

1 file changed

+41
-41
lines changed

1 file changed

+41
-41
lines changed

codegpt.el

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,10 @@
144144
`(progn
145145
(openai--pop-to-buffer codegpt-buffer-name) ; create it
146146
(openai--with-buffer codegpt-buffer-name
147-
(codegpt-mode)
148-
(erase-buffer)
149-
(insert ,instruction "\n\n")
150-
,@body)))
147+
(codegpt-mode)
148+
(erase-buffer)
149+
(insert ,instruction "\n\n")
150+
,@body)))
151151

152152
(defun codegpt--fill-region (start end)
153153
"Like function `fill-region' (START to END), improve readability."
@@ -169,43 +169,43 @@ boundaries of that region in buffer."
169169
(let ((text (string-trim (buffer-substring start end)))
170170
(original-window (selected-window)))
171171
(codegpt--ask-in-buffer instruction
172-
(insert text "\n\n")
173-
(funcall
174-
(cl-case codegpt-tunnel
175-
(`completion #'openai-completion)
176-
(`chat #'openai-chat))
177-
(cl-case codegpt-tunnel
178-
(`completion (buffer-string))
179-
(`chat `[(("role" . "user")
180-
("content" . ,(buffer-string)))]))
181-
(lambda (data)
182-
(setq codegpt-requesting-p nil)
183-
(codegpt-mode--cancel-timer)
184-
(openai--with-buffer codegpt-buffer-name
185-
(openai--pop-to-buffer codegpt-buffer-name)
186-
(let ((original-point (point)))
187-
(cl-case codegpt-tunnel
188-
(`completion
189-
(let* ((choices (openai--data-choices data))
190-
(result (openai--get-choice choices)))
191-
(insert (string-trim result) "\n")))
192-
(`chat
193-
(let ((choices (let-alist data .choices))
194-
(result))
195-
(mapc (lambda (choice)
196-
(let-alist choice
197-
(let-alist .message
198-
(setq result (string-trim .content)))))
199-
choices)
200-
(insert (string-trim result) "\n"))))
201-
(codegpt--fill-region original-point (point))))
202-
(unless codegpt-focus-p
203-
(select-window original-window)))
204-
:model codegpt-model
205-
:max-tokens codegpt-max-tokens
206-
:temperature codegpt-temperature)
207-
(unless codegpt-focus-p
208-
(select-window original-window)))))
172+
(insert text "\n\n")
173+
(funcall
174+
(cl-case codegpt-tunnel
175+
(`completion #'openai-completion)
176+
(`chat #'openai-chat))
177+
(cl-case codegpt-tunnel
178+
(`completion (buffer-string))
179+
(`chat `[(("role" . "user")
180+
("content" . ,(buffer-string)))]))
181+
(lambda (data)
182+
(setq codegpt-requesting-p nil)
183+
(codegpt-mode--cancel-timer)
184+
(openai--with-buffer codegpt-buffer-name
185+
(openai--pop-to-buffer codegpt-buffer-name)
186+
(let ((original-point (point)))
187+
(cl-case codegpt-tunnel
188+
(`completion
189+
(let* ((choices (openai--data-choices data))
190+
(result (openai--get-choice choices)))
191+
(insert (string-trim result) "\n")))
192+
(`chat
193+
(let ((choices (let-alist data .choices))
194+
(result))
195+
(mapc (lambda (choice)
196+
(let-alist choice
197+
(let-alist .message
198+
(setq result (string-trim .content)))))
199+
choices)
200+
(insert (string-trim result) "\n"))))
201+
(codegpt--fill-region original-point (point))))
202+
(unless codegpt-focus-p
203+
(select-window original-window)))
204+
:model codegpt-model
205+
:max-tokens codegpt-max-tokens
206+
:temperature codegpt-temperature)
207+
(unless codegpt-focus-p
208+
(select-window original-window)))))
209209

210210
;;;###autoload
211211
(defun codegpt-doc (start end)

0 commit comments

Comments
 (0)