Merge branch 'main' of git.sr.ht:~marcuskammer/emacs.d

This commit is contained in:
Marcus Kammer 2024-04-13 15:31:57 +02:00
commit 66123b5fdf
Signed by: marcuskammer
GPG key ID: C374817BE285268F

View file

@ -208,3 +208,19 @@
(interactive "sEnter the URL to mirror: ")
(let ((cmd (format "wget --mirror --convert-links --adjust-extension --page-requisites --no-parent %s" url)))
(async-shell-command cmd)))
(defun mk/get-auth-source-key (host key)
"Retrieve the API key using 'auth-source'."
(require 'auth-source)
(let* ((auth-source-creation-prompts
'((secret . (format "API key for %s@%s: " key host))))
(found (nth 0 (auth-source-search
:max 1
:host host
:user key
:require '(:secret)
:create t)))
(secret (plist-get found :secret)))
(if (functionp secret)
(funcall secret)
secret)))