When using a gpg encrypted authinfo file, due to this code:
(defun aichat-openai-api-key ()
"Get openai api key from `auth-sources'."
(auth-source-pick-first-password :host "platform.openai.com" :user "aichat-openai"))
The user will be prompted for their gpg passphrase, which is fine when starting Emacs in the foreground.
However, if Emacs is started in the background, for example using Emacs Daemon, it will just keep it from fully loading, as the user will never have access to the gpg prompt.
I'm suggesting wrapping auth-source-pick-first-password in a lambda like this:
(defun aichat-openai-api-key ()
"Get openai api key from `auth-sources'."
(lambda () (auth-source-pick-first-password :host "platform.openai.com" :user "aichat-openai")))
This will return a closure and defer the auth-source-pick-first-password call, allowing proper load of Emacs in the background.
When using a gpg encrypted authinfo file, due to this code:
The user will be prompted for their gpg passphrase, which is fine when starting Emacs in the foreground.
However, if Emacs is started in the background, for example using Emacs Daemon, it will just keep it from fully loading, as the user will never have access to the gpg prompt.
I'm suggesting wrapping
auth-source-pick-first-password
in a lambda like this:This will return a closure and defer the
auth-source-pick-first-password
call, allowing proper load of Emacs in the background.