39
39
:group 'comm
40
40
:link '(url-link :tag " Repository" " https://github.com/emacs-openai/codegpt" ))
41
41
42
- (defun codegpt-code--internal (instruction start end )
42
+ ; ;
43
+ ; ;; Application
44
+
45
+ (defun codegpt--internal (instruction start end )
43
46
" Do INSTRUCTION with partial code.
44
47
45
48
The partial code is defined in with the region, and the START nad END are
@@ -54,8 +57,10 @@ boundaries of that region in buffer."
54
57
(openai--with-buffer openai-completion-buffer-name
55
58
(openai--pop-to-buffer openai-completion-buffer-name)
56
59
(let* ((choices (openai-completion--data-choices data))
57
- (result (openai-completion--get-choice choices)))
58
- (insert (string-trim result) " \n " ))))))))
60
+ (result (openai-completion--get-choice choices))
61
+ (original-point (point )))
62
+ (insert (string-trim result) " \n " )
63
+ (fill-region original-point (point )))))))))
59
64
60
65
;;;### autoload
61
66
(defun codegpt-doc (start end )
@@ -64,7 +69,7 @@ boundaries of that region in buffer."
64
69
This command is interactive region only, the START and END are boundaries of
65
70
that region in buffer."
66
71
(interactive " r" )
67
- (openai-completion-code --internal
72
+ (codegpt --internal
68
73
" Please write the documentation for the following function."
69
74
start end))
70
75
@@ -75,7 +80,7 @@ that region in buffer."
75
80
This command is interactive region only, the START and END are boundaries of
76
81
that region in buffer."
77
82
(interactive " r" )
78
- (openai-completion-code --internal
83
+ (codegpt --internal
79
84
" There is a bug in the following function, please help me fix it."
80
85
start end))
81
86
@@ -86,7 +91,7 @@ that region in buffer."
86
91
This command is interactive region only, the START and END are boundaries of
87
92
that region in buffer."
88
93
(interactive " r" )
89
- (openai-completion-code --internal
94
+ (codegpt --internal
90
95
" What is the following?"
91
96
start end))
92
97
@@ -97,7 +102,7 @@ that region in buffer."
97
102
This command is interactive region only, the START and END are boundaries of
98
103
that region in buffer."
99
104
(interactive " r" )
100
- (openai-completion-code --internal
105
+ (codegpt --internal
101
106
" Please improve the following."
102
107
start end))
103
108
@@ -108,7 +113,7 @@ that region in buffer."
108
113
This command is interactive region only, the START and END are boundaries of
109
114
that region in buffer."
110
115
(interactive " r" )
111
- (openai-completion-code --internal
116
+ (codegpt --internal
112
117
(read-string " Instruction: " )
113
118
start end))
114
119
0 commit comments