summaryrefslogtreecommitdiff
path: root/lisp/auth-source-pass.el
diff options
context:
space:
mode:
authorDamien Cassou <damien@cassou.me>2017-04-03 21:36:03 +0200
committerTed Zlatanov <tzz@lifelogs.com>2017-04-27 17:37:58 -0400
commit2a23577795f8b644a215fae68e990c07f0146d33 (patch)
tree097eb62e2e62798597754e976cc0d4f08f7def61 /lisp/auth-source-pass.el
parentb206b95ce3c598a5f3c62cfe83030da14952c81d (diff)
downloademacs-2a23577795f8b644a215fae68e990c07f0146d33.tar.gz
auth-source-pass: Add documentation; fix tests and indentation.
* doc/misc/auth.texi: Document new integration with Pass. Use @itemize instead of @enumerate. * lisp/auth-source-pass.el: Fix indentation. (auth-source-pass--remove-directory-name): Remove. * test/lisp/auth-source-pass-tests.el: Adjust test macros.
Diffstat (limited to 'lisp/auth-source-pass.el')
-rw-r--r--lisp/auth-source-pass.el17
1 files changed, 6 insertions, 11 deletions
diff --git a/lisp/auth-source-pass.el b/lisp/auth-source-pass.el
index e59cfa2d25f..a83c7de0cc5 100644
--- a/lisp/auth-source-pass.el
+++ b/lisp/auth-source-pass.el
@@ -39,8 +39,8 @@
(require 'url-parse)
(cl-defun auth-source-pass-search (&rest spec
- &key backend type host user port
- &allow-other-keys)
+ &key backend type host user port
+ &allow-other-keys)
"Given a property list SPEC, return search matches from the :backend.
See `auth-source-search' for details on SPEC."
(cl-assert (or (null type) (eq type (oref backend type)))
@@ -60,7 +60,7 @@ See `auth-source-search' for details on SPEC."
:user (or (auth-source-pass-get "user" entry) user)
:secret (lambda () (auth-source-pass-get 'secret entry)))))
(auth-source-pass--do-debug "return %s as final result (plus hidden password)"
- (seq-subseq retval 0 -2)) ;; remove password
+ (seq-subseq retval 0 -2)) ;; remove password
retval))))
;;;###autoload
@@ -159,11 +159,6 @@ CONTENTS is the contents of a password-store formatted file."
(hostname hostname)
(t host))))
-(defun auth-source-pass--remove-directory-name (name)
- "Remove directories from NAME.
-E.g., if NAME is \"foo/bar\", return \"bar\"."
- (replace-regexp-in-string ".*/" "" name))
-
(defun auth-source-pass--do-debug (&rest msg)
"Call `auth-source-do-debug` with MSG and a prefix."
(apply #'auth-source-do-debug
@@ -216,7 +211,7 @@ Only return valid entries as of `auth-source-pass--entry-valid-p'."
(member entryname (split-string entry "/"))))
(and (= (length components-host-user) 2)
(string-equal user (cadr components-host-user))))
- (string-equal entryname (auth-source-pass--remove-directory-name entry)))
+ (string-equal entryname (file-name-nondirectory entry)))
(auth-source-pass--entry-valid-p entry)))
(auth-source-pass-entries)))
@@ -225,8 +220,8 @@ Only return valid entries as of `auth-source-pass--entry-valid-p'."
If USER is non nil, give precedence to entries containing a user field
matching USER."
(auth-source-pass--do-debug "searching for '%s' in entry names (user: %s)"
- entryname
- user)
+ entryname
+ user)
(let ((matching-entries (auth-source-pass--find-all-by-entry-name entryname user)))
(pcase (length matching-entries)
(0 (auth-source-pass--do-debug "no match found")