File tree Expand file tree Collapse file tree 2 files changed +7
-16
lines changed Expand file tree Collapse file tree 2 files changed +7
-16
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ Copy all `.el` files in this repository to `~/.emacs.d/lisp` and add the followi
4747
4848``` elisp
4949(add-to-list 'load-path "~/.emacs.d/lisp/")
50- (require codegpt)
50+ (require ' codegpt)
5151```
5252
5353## 🔑 Obtaining API key
Original file line number Diff line number Diff line change 5757 :type 'list
5858 :group 'codegpt )
5959
60- (defconst codegpt--actions-functions
61- '((" custom" . codegpt-custom)
62- (" doc" . codegpt-doc)
63- (" fix" . codegpt-fix)
64- (" explain" . codegpt-explain)
65- (" improve" . codegpt-improve))
66- " Alist of code completion actions and its functions." )
67-
6860; ;
6961; ;; Application
7062
@@ -160,9 +152,7 @@ that region in buffer."
160152(defun codegept--execute-predefined-template (start end question )
161153 " Ask predefined QUESTION for provided region.
162154the START and END are boundaries of that region in buffer."
163- (codegpt--internal
164- question
165- start end))
155+ (codegpt--internal question start end))
166156
167157;;;### autoload
168158(defun codegpt (start end )
@@ -186,12 +176,13 @@ that region in buffer."
186176 (cdr (assoc cand codegpt-action-alist))))))
187177 (complete-with-action action codegpt-action-alist string predicate)))
188178 nil t ))
189- (action-fn (cdr-safe (assoc action codegpt--actions-functions))))
190- (if action-fn
179+ ; ; XXX: Guess the function name, `codegpt-xxx'
180+ (action-fn (intern (format " codegpt-%s " action))))
181+ (if (fboundp action-fn)
191182 (funcall action-fn start end)
183+ ; ; Call predefined action from `codegpt-action-alist'
192184 (codegept--execute-predefined-template
193- start
194- end
185+ start end
195186 (cdr (assoc action codegpt-action-alist))))))
196187
197188(provide 'codegpt )
You can’t perform that action at this time.
0 commit comments