|
216 | 216 | (setq hex (nconc hex (list (aref hex-chars (random 16)))))) |
217 | 217 | (apply #'string hex))) |
218 | 218 |
|
219 | | -(defun gptel--gh-save (obj) |
220 | | - "Save OBJ to FILE." |
221 | | - (message "New GitHub token: %s" (prin1-to-string obj)) |
222 | | - (setq gptel--gh-github-token obj)) |
| 219 | +(defun gptel--gh-github-token-save (token) |
| 220 | + "Saves the new github token for use." |
| 221 | + (setq gptel--gh-github-token token)) |
223 | 222 |
|
224 | 223 | (defun gptel-gh-login () |
225 | 224 | "Login to GitHub Copilot API. |
@@ -251,10 +250,12 @@ If your browser does not open automatically, browse to %s." |
251 | 250 | :device_code ,device_code |
252 | 251 | :grant_type "urn:ietf:params:oauth:grant-type:device_code")) |
253 | 252 | :access_token) |
254 | | - (gptel--gh-save)) |
| 253 | + (gptel--gh-github-token-save)) |
255 | 254 | (if (and gptel--gh-github-token |
256 | 255 | (not (string-empty-p gptel--gh-github-token))) |
257 | | - (message "Successfully logged in to GitHub Copilot") |
| 256 | + (progn |
| 257 | + (message "New GitHub token: %s" (prin1-to-string gptel--gh-github-token)) |
| 258 | + (message "Successfully logged in to GitHub Copilot")) |
258 | 259 | (user-error "Error: You might not have access to GitHub Copilot Chat!")))) |
259 | 260 |
|
260 | 261 | (defun gptel--gh-renew-token () |
@@ -358,7 +359,7 @@ for." |
358 | 359 | (declare (indent 1)) |
359 | 360 | (if (and (not gptel--gh-github-token) |
360 | 361 | github-token-init) |
361 | | - (gptel--gh-save (funcall github-token-init))) |
| 362 | + (gptel--gh-github-token-save (funcall github-token-init))) |
362 | 363 | (let ((backend (gptel--make-gh |
363 | 364 | :name name |
364 | 365 | :host host |
|
0 commit comments