Skip to content

Commit 198ec46

Browse files
gptel-gh: Restore signature for gptel--gh-restore-from-file
1 parent 5cbf148 commit 198ec46

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

gptel-gh.el

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@
151151
:type 'string
152152
:group 'gptel)
153153

154-
(defcustom gptel-gh-github-token-load-function 'gptel--gh-restore-from-file
154+
(defcustom gptel-gh-github-token-load-function 'gptel--gh-restore-github-token-from-file
155155
"Function to load the current github token. Default behavior is file-based based on `gptel-gh-github-token-file'."
156156
:type 'function
157157
:group 'gptel)
@@ -199,15 +199,19 @@
199199
(setq hex (nconc hex (list (aref hex-chars (random 16))))))
200200
(apply #'string hex)))
201201

202-
(defun gptel--gh-restore-from-file ()
203-
"Restore saved object from gptel-gh-github-token-file."
204-
(when (file-exists-p gptel-gh-github-token-file)
202+
(defun gptel--gh-restore-github-token-from-file ()
203+
"Restore GitHub token from the file gptel-gh-github-token-file."
204+
(gptel--gh-restore-from-file gptel-gh-github-token-file))
205+
206+
(defun gptel--gh-restore-from-file (file)
207+
"Restore saved object from FILE."
208+
(when (file-exists-p file)
205209
;; We set the coding system to `utf-8-auto-dos' when reading so that
206210
;; files with CR EOL can still be read properly
207211
(let ((coding-system-for-read 'utf-8-auto-dos))
208212
(with-temp-buffer
209213
(set-buffer-multibyte nil)
210-
(insert-file-contents-literally gptel-gh-github-token-file)
214+
(insert-file-contents-literally file)
211215
(goto-char (point-min))
212216
(read (current-buffer))))))
213217

0 commit comments

Comments
 (0)