|
210 | 210 | (setq hex (nconc hex (list (aref hex-chars (random 16)))))) |
211 | 211 | (apply #'string hex))) |
212 | 212 |
|
213 | | -(defun gptel--gh-save (obj) |
214 | | - "Save OBJ to FILE." |
215 | | - (message "New GitHub token: %s" (prin1-to-string obj)) |
216 | | - (setq gptel--gh-github-token obj)) |
| 213 | +(defun gptel--gh-github-token-save (token) |
| 214 | + "Saves the new github token for use." |
| 215 | + (setq gptel--gh-github-token token)) |
217 | 216 |
|
218 | 217 | (defun gptel-gh-login () |
219 | 218 | "Login to GitHub Copilot API. |
@@ -245,10 +244,12 @@ If your browser does not open automatically, browse to %s." |
245 | 244 | :device_code ,device_code |
246 | 245 | :grant_type "urn:ietf:params:oauth:grant-type:device_code")) |
247 | 246 | :access_token) |
248 | | - (gptel--gh-save)) |
| 247 | + (gptel--gh-github-token-save)) |
249 | 248 | (if (and gptel--gh-github-token |
250 | 249 | (not (string-empty-p gptel--gh-github-token))) |
251 | | - (message "Successfully logged in to GitHub Copilot") |
| 250 | + (progn |
| 251 | + (message "New GitHub token: %s" (prin1-to-string gptel--gh-github-token)) |
| 252 | + (message "Successfully logged in to GitHub Copilot")) |
252 | 253 | (user-error "Error: You might not have access to GitHub Copilot Chat!")))) |
253 | 254 |
|
254 | 255 | (defun gptel--gh-renew-token () |
@@ -352,7 +353,7 @@ for." |
352 | 353 | (declare (indent 1)) |
353 | 354 | (if (and (not gptel--gh-github-token) |
354 | 355 | github-token-init) |
355 | | - (gptel--gh-save (funcall github-token-init))) |
| 356 | + (gptel--gh-github-token-save (funcall github-token-init))) |
356 | 357 | (let ((backend (gptel--make-gh |
357 | 358 | :name name |
358 | 359 | :host host |
|
0 commit comments