I'm using auth-source-search to retrieve passwords from ~/.authinfo.gpg. According to the documentation I may have to unwrap the secret property because it's in a function.

(let ((secret (plist-get found :secret)))
            (if (functionp secret)
                (funcall secret)

But in my case the password is somehow wrapped in two functions, so I would have to retrieve it with:

(funcall (funcall secret))

This would result in very ugly code.

(let ((secret (plist-get info :secret))
    (if (functionp secret)
        (if (functionp (funcall secret))
            (funcall (funcall secret))
        (funcall secret))

Is there a more elegant way to solve this problem?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.