|
200 | 200 | (setq hex (nconc hex (list (aref hex-chars (random 16)))))) |
201 | 201 | (apply #'string hex))) |
202 | 202 |
|
203 | | -(defun gptel--gh-save (obj) |
204 | | - "Save OBJ to FILE." |
205 | | - (message "New GitHub token: %s" (prin1-to-string obj)) |
206 | | - (setq gptel--gh-github-token obj)) |
| 203 | +(defun gptel--gh-github-token-save (token) |
| 204 | + "Saves the new github token for use." |
| 205 | + (setq gptel--gh-github-token token)) |
207 | 206 |
|
208 | 207 | (defun gptel-gh-login () |
209 | 208 | "Login to GitHub Copilot API. |
@@ -235,10 +234,12 @@ If your browser does not open automatically, browse to %s." |
235 | 234 | :device_code ,device_code |
236 | 235 | :grant_type "urn:ietf:params:oauth:grant-type:device_code")) |
237 | 236 | :access_token) |
238 | | - (gptel--gh-save)) |
| 237 | + (gptel--gh-github-token-save)) |
239 | 238 | (if (and gptel--gh-github-token |
240 | 239 | (not (string-empty-p gptel--gh-github-token))) |
241 | | - (message "Successfully logged in to GitHub Copilot") |
| 240 | + (progn |
| 241 | + (message "New GitHub token: %s" (prin1-to-string gptel--gh-github-token)) |
| 242 | + (message "Successfully logged in to GitHub Copilot")) |
242 | 243 | (user-error "Error: You might not have access to GitHub Copilot Chat!")))) |
243 | 244 |
|
244 | 245 | (defun gptel--gh-renew-token () |
@@ -342,7 +343,7 @@ for." |
342 | 343 | (declare (indent 1)) |
343 | 344 | (if (and (not gptel--gh-github-token) |
344 | 345 | github-token-init) |
345 | | - (gptel--gh-save (funcall github-token-init))) |
| 346 | + (gptel--gh-github-token-save (funcall github-token-init))) |
346 | 347 | (let ((backend (gptel--make-gh |
347 | 348 | :name name |
348 | 349 | :host host |
|
0 commit comments