Function: auth-source-backends-parser-file

auth-source-backends-parser-file is a byte-compiled function defined in auth-source.el.gz.

Signature

(auth-source-backends-parser-file ENTRY)

Source Code

;; Defined in /usr/src/emacs/lisp/auth-source.el.gz
(defun auth-source-backends-parser-file (entry)
  ;; take just a file name use it as a netrc/plist file
  ;; matching any user, host, and protocol
  (when (stringp entry)
    (setq entry (list :source entry)))
  (let* ((source (plist-get entry :source))
         (source-without-gpg
          (if (and (stringp source)
                   (equal (file-name-extension source) "gpg"))
              (file-name-sans-extension source)
            (or source "")))
         (extension (or (and (stringp source-without-gpg)
                             (file-name-extension source-without-gpg))
                        "")))
    (cond
     ((or (not (stringp source))
          (and auth-source-ignore-non-existing-file
               (not (file-exists-p source))))
      (when auth-source-debug
        (auth-source-do-warn
         "auth-source-backend-parse: not existing file, ignoring spec: %S"
         entry))
      (auth-source-backend
       :source ""
       :type 'ignore))
     ((equal extension "plist")
      (auth-source-backend
       :source source
       :type 'plstore
       :search-function #'auth-source-plstore-search
       :create-function #'auth-source-plstore-create
       :data (plstore-open source)))
     ((member-ignore-case extension '("json"))
      (auth-source-backend
       :source source
       :type 'json
       :search-function #'auth-source-json-search))
     (t
      (auth-source-backend
       :source source
       :type 'netrc
       :search-function #'auth-source-netrc-search
       :create-function #'auth-source-netrc-create)))))