diff options
| author | Stefan Monnier | 2018-10-10 09:45:09 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2018-10-10 09:45:09 -0400 |
| commit | fd3a48fcd8bb212ec12b9b10a79de0ae605ee93b (patch) | |
| tree | 2239fc4b37af48e2c2537b6ff26be76dc38d6407 | |
| parent | 7212bf41a92f14401751e9891c402f67b5ce6846 (diff) | |
| download | emacs-fd3a48fcd8bb212ec12b9b10a79de0ae605ee93b.tar.gz emacs-fd3a48fcd8bb212ec12b9b10a79de0ae605ee93b.zip | |
* lisp/auth-source.el: Minor simplification
Remove redundant :group args.
(auth-source-backend-parse): Use run-hook-with-args-until-success.
| -rw-r--r-- | lisp/auth-source.el | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/lisp/auth-source.el b/lisp/auth-source.el index eb262a13df4..fd529b392ab 100644 --- a/lisp/auth-source.el +++ b/lisp/auth-source.el | |||
| @@ -83,7 +83,6 @@ | |||
| 83 | expiring. Overrides `password-cache-expiry' through a | 83 | expiring. Overrides `password-cache-expiry' through a |
| 84 | let-binding." | 84 | let-binding." |
| 85 | :version "24.1" | 85 | :version "24.1" |
| 86 | :group 'auth-source | ||
| 87 | :type '(choice (const :tag "Never" nil) | 86 | :type '(choice (const :tag "Never" nil) |
| 88 | (const :tag "All Day" 86400) | 87 | (const :tag "All Day" 86400) |
| 89 | (const :tag "2 Hours" 7200) | 88 | (const :tag "2 Hours" 7200) |
| @@ -139,7 +138,6 @@ let-binding." | |||
| 139 | (smtp "smtp" "25")) | 138 | (smtp "smtp" "25")) |
| 140 | "List of authentication protocols and their names" | 139 | "List of authentication protocols and their names" |
| 141 | 140 | ||
| 142 | :group 'auth-source | ||
| 143 | :version "23.2" ;; No Gnus | 141 | :version "23.2" ;; No Gnus |
| 144 | :type '(repeat :tag "Authentication Protocols" | 142 | :type '(repeat :tag "Authentication Protocols" |
| 145 | (cons :tag "Protocol Entry" | 143 | (cons :tag "Protocol Entry" |
| @@ -168,7 +166,6 @@ let-binding." | |||
| 168 | 166 | ||
| 169 | (defcustom auth-source-save-behavior 'ask | 167 | (defcustom auth-source-save-behavior 'ask |
| 170 | "If set, auth-source will respect it for save behavior." | 168 | "If set, auth-source will respect it for save behavior." |
| 171 | :group 'auth-source | ||
| 172 | :version "23.2" ;; No Gnus | 169 | :version "23.2" ;; No Gnus |
| 173 | :type `(choice | 170 | :type `(choice |
| 174 | :tag "auth-source new token save behavior" | 171 | :tag "auth-source new token save behavior" |
| @@ -183,7 +180,6 @@ let-binding." | |||
| 183 | "Set this to tell auth-source when to create GPG password | 180 | "Set this to tell auth-source when to create GPG password |
| 184 | tokens in netrc files. It's either an alist or `never'. | 181 | tokens in netrc files. It's either an alist or `never'. |
| 185 | Note that if EPA/EPG is not available, this should NOT be used." | 182 | Note that if EPA/EPG is not available, this should NOT be used." |
| 186 | :group 'auth-source | ||
| 187 | :version "23.2" ;; No Gnus | 183 | :version "23.2" ;; No Gnus |
| 188 | :type `(choice | 184 | :type `(choice |
| 189 | (const :tag "Always use GPG password tokens" (t gpg)) | 185 | (const :tag "Always use GPG password tokens" (t gpg)) |
| @@ -203,7 +199,6 @@ Note that if EPA/EPG is not available, this should NOT be used." | |||
| 203 | 199 | ||
| 204 | (defcustom auth-source-do-cache t | 200 | (defcustom auth-source-do-cache t |
| 205 | "Whether auth-source should cache information with `password-cache'." | 201 | "Whether auth-source should cache information with `password-cache'." |
| 206 | :group 'auth-source | ||
| 207 | :version "23.2" ;; No Gnus | 202 | :version "23.2" ;; No Gnus |
| 208 | :type `boolean) | 203 | :type `boolean) |
| 209 | 204 | ||
| @@ -218,7 +213,6 @@ for passwords). | |||
| 218 | 213 | ||
| 219 | If the value is a function, debug messages are logged by calling | 214 | If the value is a function, debug messages are logged by calling |
| 220 | that function using the same arguments as `message'." | 215 | that function using the same arguments as `message'." |
| 221 | :group 'auth-source | ||
| 222 | :version "23.2" ;; No Gnus | 216 | :version "23.2" ;; No Gnus |
| 223 | :type `(choice | 217 | :type `(choice |
| 224 | :tag "auth-source debugging mode" | 218 | :tag "auth-source debugging mode" |
| @@ -241,7 +235,6 @@ for details. | |||
| 241 | 235 | ||
| 242 | It's best to customize this with `\\[customize-variable]' because the choices | 236 | It's best to customize this with `\\[customize-variable]' because the choices |
| 243 | can get pretty complex." | 237 | can get pretty complex." |
| 244 | :group 'auth-source | ||
| 245 | :version "26.1" ; neither new nor changed default | 238 | :version "26.1" ; neither new nor changed default |
| 246 | :type `(repeat :tag "Authentication Sources" | 239 | :type `(repeat :tag "Authentication Sources" |
| 247 | (choice | 240 | (choice |
| @@ -311,7 +304,6 @@ can get pretty complex." | |||
| 311 | (defcustom auth-source-gpg-encrypt-to t | 304 | (defcustom auth-source-gpg-encrypt-to t |
| 312 | "List of recipient keys that `authinfo.gpg' encrypted to. | 305 | "List of recipient keys that `authinfo.gpg' encrypted to. |
| 313 | If the value is not a list, symmetric encryption will be used." | 306 | If the value is not a list, symmetric encryption will be used." |
| 314 | :group 'auth-source | ||
| 315 | :version "24.1" ;; No Gnus | 307 | :version "24.1" ;; No Gnus |
| 316 | :type '(choice (const :tag "Symmetric encryption" t) | 308 | :type '(choice (const :tag "Symmetric encryption" t) |
| 317 | (repeat :tag "Recipient public keys" | 309 | (repeat :tag "Recipient public keys" |
| @@ -363,10 +355,9 @@ soon as a function returns non-nil.") | |||
| 363 | (defun auth-source-backend-parse (entry) | 355 | (defun auth-source-backend-parse (entry) |
| 364 | "Create an auth-source-backend from an ENTRY in `auth-sources'." | 356 | "Create an auth-source-backend from an ENTRY in `auth-sources'." |
| 365 | 357 | ||
| 366 | (let (backend) | 358 | (let ((backend |
| 367 | (cl-dolist (f auth-source-backend-parser-functions) | 359 | (run-hook-with-args-until-success 'auth-source-backend-parser-functions |
| 368 | (when (setq backend (funcall f entry)) | 360 | entry))) |
| 369 | (cl-return))) | ||
| 370 | 361 | ||
| 371 | (unless backend | 362 | (unless backend |
| 372 | ;; none of the parsers worked | 363 | ;; none of the parsers worked |
| @@ -416,7 +407,7 @@ soon as a function returns non-nil.") | |||
| 416 | :create-function #'auth-source-netrc-create)))))) | 407 | :create-function #'auth-source-netrc-create)))))) |
| 417 | 408 | ||
| 418 | ;; Note this function should be last in the parser functions, so we add it first | 409 | ;; Note this function should be last in the parser functions, so we add it first |
| 419 | (add-hook 'auth-source-backend-parser-functions 'auth-source-backends-parser-file) | 410 | (add-hook 'auth-source-backend-parser-functions #'auth-source-backends-parser-file) |
| 420 | 411 | ||
| 421 | (defun auth-source-backends-parser-macos-keychain (entry) | 412 | (defun auth-source-backends-parser-macos-keychain (entry) |
| 422 | ;; take macos-keychain-{internet,generic}:XYZ and use it as macOS | 413 | ;; take macos-keychain-{internet,generic}:XYZ and use it as macOS |
| @@ -463,7 +454,7 @@ soon as a function returns non-nil.") | |||
| 463 | :search-function #'auth-source-macos-keychain-search | 454 | :search-function #'auth-source-macos-keychain-search |
| 464 | :create-function #'auth-source-macos-keychain-create))))) | 455 | :create-function #'auth-source-macos-keychain-create))))) |
| 465 | 456 | ||
| 466 | (add-hook 'auth-source-backend-parser-functions 'auth-source-backends-parser-macos-keychain) | 457 | (add-hook 'auth-source-backend-parser-functions #'auth-source-backends-parser-macos-keychain) |
| 467 | 458 | ||
| 468 | (defun auth-source-backends-parser-secrets (entry) | 459 | (defun auth-source-backends-parser-secrets (entry) |
| 469 | ;; take secrets:XYZ and use it as Secrets API collection "XYZ" | 460 | ;; take secrets:XYZ and use it as Secrets API collection "XYZ" |
| @@ -510,7 +501,7 @@ soon as a function returns non-nil.") | |||
| 510 | :source "" | 501 | :source "" |
| 511 | :type 'ignore)))))) | 502 | :type 'ignore)))))) |
| 512 | 503 | ||
| 513 | (add-hook 'auth-source-backend-parser-functions 'auth-source-backends-parser-secrets) | 504 | (add-hook 'auth-source-backend-parser-functions #'auth-source-backends-parser-secrets) |
| 514 | 505 | ||
| 515 | (defun auth-source-backend-parse-parameters (entry backend) | 506 | (defun auth-source-backend-parse-parameters (entry backend) |
| 516 | "Fills in the extra auth-source-backend parameters of ENTRY. | 507 | "Fills in the extra auth-source-backend parameters of ENTRY. |
| @@ -528,7 +519,7 @@ parameters." | |||
| 528 | (oset backend port val))) | 519 | (oset backend port val))) |
| 529 | backend) | 520 | backend) |
| 530 | 521 | ||
| 531 | ;; (mapcar 'auth-source-backend-parse auth-sources) | 522 | ;; (mapcar #'auth-source-backend-parse auth-sources) |
| 532 | 523 | ||
| 533 | (cl-defun auth-source-search (&rest spec | 524 | (cl-defun auth-source-search (&rest spec |
| 534 | &key max require create delete | 525 | &key max require create delete |
| @@ -2176,8 +2167,8 @@ entries for git.gnus.org: | |||
| 2176 | (plstore-save (oref backend data))))) | 2167 | (plstore-save (oref backend data))))) |
| 2177 | 2168 | ||
| 2178 | ;;; Backend specific parsing: JSON backend | 2169 | ;;; Backend specific parsing: JSON backend |
| 2179 | ;;; (auth-source-search :max 1 :machine "imap.gmail.com") | 2170 | ;; (auth-source-search :max 1 :machine "imap.gmail.com") |
| 2180 | ;;; (auth-source-search :max 1 :host '("my-gmail" "imap.gmail.com") :port '(993 "imaps" "imap" "993" "143") :user nil :require '(:user :secret)) | 2171 | ;; (auth-source-search :max 1 :host '("my-gmail" "imap.gmail.com") :port '(993 "imaps" "imap" "993" "143") :user nil :require '(:user :secret)) |
| 2181 | 2172 | ||
| 2182 | (defun auth-source-json-check (host user port require item) | 2173 | (defun auth-source-json-check (host user port require item) |
| 2183 | (and item | 2174 | (and item |