diff options
| author | Mark Oteiza | 2016-10-17 14:31:31 -0400 |
|---|---|---|
| committer | Mark Oteiza | 2016-10-17 14:31:31 -0400 |
| commit | e697ccab77b1668a0781397b55b676fc4e9bc1b6 (patch) | |
| tree | 963c26f4f1b72af0e8788da97488ee2df0dc285f | |
| parent | 421c0512f76683e0b85ea5e1362291c2da4149ba (diff) | |
| download | emacs-e697ccab77b1668a0781397b55b676fc4e9bc1b6.tar.gz emacs-e697ccab77b1668a0781397b55b676fc4e9bc1b6.zip | |
Turn on lexical-binding in auth-source
* lisp/auth-source.el: Turn on lexical-binding.
(auth-source-netrc-parse, auth-source-netrc-normalize):
(auth-source-token-passphrase-callback-function):
(auth-source-netrc-create, auth-source-secrets-search):
(auth-source-macos-keychain-search-items):
(auth-source-plstore-search): Use let instead of lexical-let.
| -rw-r--r-- | lisp/auth-source.el | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/lisp/auth-source.el b/lisp/auth-source.el index 97059fa5bd9..9e1f46877bd 100644 --- a/lisp/auth-source.el +++ b/lisp/auth-source.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; auth-source.el --- authentication sources for Gnus and Emacs | 1 | ;;; auth-source.el --- authentication sources for Gnus and Emacs -*- lexical-binding: t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2008-2016 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2008-2016 Free Software Foundation, Inc. |
| 4 | 4 | ||
| @@ -1002,7 +1002,7 @@ Note that the MAX parameter is used so we can exit the parse early." | |||
| 1002 | (auth-source--aput | 1002 | (auth-source--aput |
| 1003 | auth-source-netrc-cache file | 1003 | auth-source-netrc-cache file |
| 1004 | (list :mtime (nth 5 (file-attributes file)) | 1004 | (list :mtime (nth 5 (file-attributes file)) |
| 1005 | :secret (lexical-let ((v (mapcar #'1+ (buffer-string)))) | 1005 | :secret (let ((v (mapcar #'1+ (buffer-string)))) |
| 1006 | (lambda () (apply #'string (mapcar #'1- v))))))) | 1006 | (lambda () (apply #'string (mapcar #'1- v))))))) |
| 1007 | (goto-char (point-min)) | 1007 | (goto-char (point-min)) |
| 1008 | (let ((entries (auth-source-netrc-parse-entries check max)) | 1008 | (let ((entries (auth-source-netrc-parse-entries check max)) |
| @@ -1118,7 +1118,7 @@ Note that the MAX parameter is used so we can exit the parse early." | |||
| 1118 | (read-passwd | 1118 | (read-passwd |
| 1119 | (format "Passphrase for %s tokens: " file) | 1119 | (format "Passphrase for %s tokens: " file) |
| 1120 | t)) | 1120 | t)) |
| 1121 | (setcdr entry (lexical-let ((p (copy-sequence passphrase))) | 1121 | (setcdr entry (let ((p (copy-sequence passphrase))) |
| 1122 | (lambda () p))) | 1122 | (lambda () p))) |
| 1123 | passphrase)))) | 1123 | passphrase)))) |
| 1124 | 1124 | ||
| @@ -1174,8 +1174,8 @@ FILE is the file from which we obtained this token." | |||
| 1174 | 1174 | ||
| 1175 | ;; send back the secret in a function (lexical binding) | 1175 | ;; send back the secret in a function (lexical binding) |
| 1176 | (when (equal k "secret") | 1176 | (when (equal k "secret") |
| 1177 | (setq v (lexical-let ((lexv v) | 1177 | (setq v (let ((lexv v) |
| 1178 | (token-decoder nil)) | 1178 | (token-decoder nil)) |
| 1179 | (when (string-match "^gpg:" lexv) | 1179 | (when (string-match "^gpg:" lexv) |
| 1180 | ;; it's a GPG token: create a token decoder | 1180 | ;; it's a GPG token: create a token decoder |
| 1181 | ;; which unsets itself once | 1181 | ;; which unsets itself once |
| @@ -1384,7 +1384,7 @@ See `auth-source-search' for details on SPEC." | |||
| 1384 | (setq artificial (plist-put artificial | 1384 | (setq artificial (plist-put artificial |
| 1385 | (auth-source--symbol-keyword r) | 1385 | (auth-source--symbol-keyword r) |
| 1386 | (if (eq r 'secret) | 1386 | (if (eq r 'secret) |
| 1387 | (lexical-let ((data data)) | 1387 | (let ((data data)) |
| 1388 | (lambda () data)) | 1388 | (lambda () data)) |
| 1389 | data)))) | 1389 | data)))) |
| 1390 | 1390 | ||
| @@ -1414,8 +1414,8 @@ See `auth-source-search' for details on SPEC." | |||
| 1414 | (plist-put | 1414 | (plist-put |
| 1415 | artificial | 1415 | artificial |
| 1416 | :save-function | 1416 | :save-function |
| 1417 | (lexical-let ((file file) | 1417 | (let ((file file) |
| 1418 | (add add)) | 1418 | (add add)) |
| 1419 | (lambda () (auth-source-netrc-saver file add)))) | 1419 | (lambda () (auth-source-netrc-saver file add)))) |
| 1420 | 1420 | ||
| 1421 | (list artificial))) | 1421 | (list artificial))) |
| @@ -1611,7 +1611,7 @@ authentication tokens: | |||
| 1611 | ;; make an entry for the secret (password) element | 1611 | ;; make an entry for the secret (password) element |
| 1612 | (list | 1612 | (list |
| 1613 | :secret | 1613 | :secret |
| 1614 | (lexical-let ((v (secrets-get-secret coll item))) | 1614 | (let ((v (secrets-get-secret coll item))) |
| 1615 | (lambda () v))) | 1615 | (lambda () v))) |
| 1616 | ;; rewrite the entry from ((k1 v1) (k2 v2)) to plist | 1616 | ;; rewrite the entry from ((k1 v1) (k2 v2)) to plist |
| 1617 | (apply #'append | 1617 | (apply #'append |
| @@ -1813,8 +1813,8 @@ entries for git.gnus.org: | |||
| 1813 | ret | 1813 | ret |
| 1814 | keychain-generic | 1814 | keychain-generic |
| 1815 | "secret" | 1815 | "secret" |
| 1816 | (lexical-let ((v (auth-source--decode-octal-string | 1816 | (let ((v (auth-source--decode-octal-string |
| 1817 | (match-string 1)))) | 1817 | (match-string 1)))) |
| 1818 | (lambda () v))))) | 1818 | (lambda () v))))) |
| 1819 | ;; TODO: check if this is really the label | 1819 | ;; TODO: check if this is really the label |
| 1820 | ;; match 0x00000007 <blob>="AppleID" | 1820 | ;; match 0x00000007 <blob>="AppleID" |
| @@ -1896,7 +1896,7 @@ entries for git.gnus.org: | |||
| 1896 | (if secret | 1896 | (if secret |
| 1897 | (setcar | 1897 | (setcar |
| 1898 | (cdr secret) | 1898 | (cdr secret) |
| 1899 | (lexical-let ((v (car (cdr secret)))) | 1899 | (let ((v (car (cdr secret)))) |
| 1900 | (lambda () v)))) | 1900 | (lambda () v)))) |
| 1901 | plist)) | 1901 | plist)) |
| 1902 | items)) | 1902 | items)) |