|
194 | 194 | (setq hex (nconc hex (list (aref hex-chars (random 16)))))) |
195 | 195 | (apply #'string hex))) |
196 | 196 |
|
197 | | -(defun gptel--gh-save (obj) |
198 | | - "Save OBJ to FILE." |
199 | | - (message "New GitHub token: %s" (prin1-to-string obj)) |
200 | | - (setq gptel--gh-github-token obj)) |
| 197 | +(defun gptel--gh-github-token-save (token) |
| 198 | + "Saves the new github token for use." |
| 199 | + (setq gptel--gh-github-token token)) |
201 | 200 |
|
202 | 201 | (defun gptel-gh-login () |
203 | 202 | "Login to GitHub Copilot API. |
@@ -229,10 +228,12 @@ If your browser does not open automatically, browse to %s." |
229 | 228 | :device_code ,device_code |
230 | 229 | :grant_type "urn:ietf:params:oauth:grant-type:device_code")) |
231 | 230 | :access_token) |
232 | | - (gptel--gh-save)) |
| 231 | + (gptel--gh-github-token-save)) |
233 | 232 | (if (and gptel--gh-github-token |
234 | 233 | (not (string-empty-p gptel--gh-github-token))) |
235 | | - (message "Successfully logged in to GitHub Copilot") |
| 234 | + (progn |
| 235 | + (message "New GitHub token: %s" (prin1-to-string gptel--gh-github-token)) |
| 236 | + (message "Successfully logged in to GitHub Copilot")) |
236 | 237 | (user-error "Error: You might not have access to GitHub Copilot Chat!")))) |
237 | 238 |
|
238 | 239 | (defun gptel--gh-renew-token () |
@@ -336,7 +337,7 @@ for." |
336 | 337 | (declare (indent 1)) |
337 | 338 | (if (and (not gptel--gh-github-token) |
338 | 339 | github-token-init) |
339 | | - (gptel--gh-save (funcall github-token-init))) |
| 340 | + (gptel--gh-github-token-save (funcall github-token-init))) |
340 | 341 | (let ((backend (gptel--make-gh |
341 | 342 | :name name |
342 | 343 | :host host |
|
0 commit comments