Skip to content

Commit 67b5059

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

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

gptel-gh.el

Lines changed: 10 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,20 @@
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+
207+
(defun gptel--gh-restore-from-file (file)
208+
"Restore saved object from FILE."
209+
(when (file-exists-p file)
205210
;; We set the coding system to `utf-8-auto-dos' when reading so that
206211
;; files with CR EOL can still be read properly
207212
(let ((coding-system-for-read 'utf-8-auto-dos))
208213
(with-temp-buffer
209214
(set-buffer-multibyte nil)
210-
(insert-file-contents-literally gptel-gh-github-token-file)
215+
(insert-file-contents-literally file)
211216
(goto-char (point-min))
212217
(read (current-buffer))))))
213218

0 commit comments

Comments
 (0)