[gnus git] branch master updated: n0-13-37-gdcb7395
Ted Zlatanov <[email protected]>
| Newsgroups | gmane.emacs.gnus.cvs |
|---|---|
| Message-ID | <[email protected]> |
via dcb73950e208a620704faf2a3d2fcb7c952e4288 (commit)
via 35aa1a37b547e3cd2a7f2544d1c7754f7e1e952d (commit)
from 4c0611be7b8cf4b34d42531534d14b88ba60c9ca (commit)
- Log -----------------------------------------------------------------
commit dcb73950e208a620704faf2a3d2fcb7c952e4288
Merge: 35aa1a3 4c0611b
Author: Ted Zlatanov <[email protected]>
Date: Thu Feb 24 07:05:36 2011 -0600
Resolved ChangeLog merge.
diff --cc lisp/ChangeLog
index b1c5fb2,278295c..851c1c5
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@@ -1,14 -1,15 +1,26 @@@
+2011-02-24 Teodor Zlatanov <[email protected]>
+
+ * auth-source.el (auth-source-creation-prompts): New variable to manage
+ creation-time prompts.
+ (auth-source-search): Document it.
+ (auth-source-format-prompt): Add utility function.
+ (auth-source-netrc-create): Don't default the user name to
+ user-login-name. Use `auth-source-creation-prompts' and some default
+ prompts for user, host, port, and password (the default generic prompt
+ remains ugly).
+
+ 2011-02-24 Katsumi Yamaoka <[email protected]>
+
+ * auth-source.el (auth-source-netrc-create): Use `read-char' with no
+ argument that XEmacs doesn't support.
+
+ * dgnushack.el (dgnushack-compile): Exclude color.el from being
+ compiled for Emacsen having no `libxml-parse-html-region' support.
+
+ * gnus-xmas.el (gnus-xmas-define): Remove gnus-x-color-values.
+
+ * lpath.el: Bind buffer-save-without-query for XEmacs.
+
2011-02-23 Julien Danjou <[email protected]>
* gnus-art.el (article-make-date-line): Ignore errors if time is
commit 35aa1a37b547e3cd2a7f2544d1c7754f7e1e952d
Author: Ted Zlatanov <[email protected]>
Date: Thu Feb 24 07:01:53 2011 -0600
Fixes to improve auth-source prompting and don't default user name to anything.
* auth-source.el (auth-source-creation-prompts): New variable to manage
creation-time prompts.
(auth-source-search): Document it.
(auth-source-format-prompt): Add utility function.
(auth-source-netrc-create): Don't default the user name to
user-login-name. Use `auth-source-creation-prompts' and some default
prompts for user, host, port, and password (the default generic prompt
remains ugly).
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c7ea239..b1c5fb2 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,14 @@
+2011-02-24 Teodor Zlatanov <[email protected]>
+
+ * auth-source.el (auth-source-creation-prompts): New variable to manage
+ creation-time prompts.
+ (auth-source-search): Document it.
+ (auth-source-format-prompt): Add utility function.
+ (auth-source-netrc-create): Don't default the user name to
+ user-login-name. Use `auth-source-creation-prompts' and some default
+ prompts for user, host, port, and password (the default generic prompt
+ remains ugly).
+
2011-02-23 Julien Danjou <[email protected]>
* gnus-art.el (article-make-date-line): Ignore errors if time is
diff --git a/lisp/auth-source.el b/lisp/auth-source.el
index 1db6b56..a40b4d2 100644
--- a/lisp/auth-source.el
+++ b/lisp/auth-source.el
@@ -147,6 +147,9 @@ let-binding."
(defvar auth-source-creation-defaults nil
"Defaults for creating token values. Usually let-bound.")
+(defvar auth-source-creation-prompts nil
+ "Default prompts for token values. Usually let-bound.")
+
(make-obsolete 'auth-source-hide-passwords nil "Emacs 24.1")
(defvar auth-source-magic "auth-source-magic ")
@@ -445,12 +448,18 @@ parameter, that parameter will be required in the resulting
token. The value for that parameter will be obtained from the
search parameters or from user input. If any queries are needed,
the alist `auth-source-creation-defaults' will be checked for the
-default prompt.
+default value. If the user, host, or port are missing, the alist
+`auth-source-creation-prompts' will be used to look up the
+prompts IN THAT ORDER (so the 'user prompt will be queried first,
+then 'host, then 'port, and finally 'secret). Each prompt string
+can use %u, %h, and %p to show the user, host, and port.
Here's an example:
\(let ((auth-source-creation-defaults '((user . \"defaultUser\")
- (A . \"default A\"))))
+ (A . \"default A\")))
+ (auth-source-creation-prompts
+ '((password . \"Enter IMAP password for %h:%p: \"))))
(auth-source-search :host '(\"nonesuch\" \"twosuch\") :type 'netrc :max 1
:P \"pppp\" :Q \"qqqq\"
:create '(A B Q)))
@@ -462,12 +471,11 @@ which says:
Create a new entry if you found none. The netrc backend will
automatically require host, user, and port. The host will be
- 'nonesuch' and Q will be 'qqqq'. We prompt for A with default
- 'default A', for B and port with default nil, and for the
- user with default 'defaultUser'. We will not prompt for Q. The
- resulting token will have keys user, host, port, A, B, and Q.
- It will not have P with any value, even though P is used in the
- search to find only entries that have P set to 'pppp'.\"
+ 'nonesuch' and Q will be 'qqqq'. We prompt for the password
+ with the shown prompt. We will not prompt for Q. The resulting
+ token will have keys user, host, port, A, B, and Q. It will not
+ have P with any value, even though P is used in the search to
+ find only entries that have P set to 'pppp'.\"
When multiple values are specified in the search parameter, the
user is prompted for which one. So :host (X Y Z) would ask the
@@ -913,6 +921,17 @@ See `auth-source-search' for details on SPEC."
(nth 0 v)
v))
+;; (auth-source-format-prompt "test %u %h %p" '((?u "user") (?h "host")))
+
+(defun auth-source-format-prompt (prompt alist)
+ "Format PROMPT using %x (for any character x) specifiers in ALIST."
+ (dolist (cell alist)
+ (let ((c (nth 0 cell))
+ (v (nth 1 cell)))
+ (when (and c v)
+ (setq prompt (replace-regexp-in-string (format "%%%c" c) v prompt)))))
+ prompt)
+
;;; (auth-source-search :host "nonesuch" :type 'netrc :max 1 :create t)
;;; (auth-source-search :host "nonesuch" :type 'netrc :max 1 :create t :create-extra-keys '((A "default A") (B)))
@@ -964,31 +983,50 @@ See `auth-source-search' for details on SPEC."
;; the default supplementals are simple: for the user,
;; try (user-login-name), otherwise take given-default
(default (cond
- ((and (not given-default) (eq r 'user))
- (user-login-name))
- (t given-default))))
-
- ;; store the data, prompting for the password if needed
- (setq data
- (cond
- ((and (null data) (eq r 'secret))
- ;; special case prompt for passwords
- (read-passwd (format "Password for %s@%s:%s: "
+ ;; don't default the user name
+ ;; ((and (not given-default) (eq r 'user))
+ ;; (user-login-name))
+ (t given-default)))
+ (printable-defaults (list
+ (cons 'user
(or
(auth-source-netrc-element-or-first
(aget valist 'user))
(plist-get artificial :user)
- "[any user]")
+ "[any user]"))
+ (cons 'host
(or
(auth-source-netrc-element-or-first
(aget valist 'host))
(plist-get artificial :host)
- "[any host]")
+ "[any host]"))
+ (cons 'port
(or
(auth-source-netrc-element-or-first
(aget valist 'port))
(plist-get artificial :port)
"[any port]"))))
+ (prompt (or (aget auth-source-creation-prompts r)
+ (case r
+ ('secret "%p password for user %u, host %h: ")
+ ('user "%p user name: ")
+ ('host "%p host name for user %u: ")
+ ('port "%p port for user %u and host %h: "))
+ (format "Enter %s (%%u@%%h:%%p): " r)))
+ (prompt (auth-source-format-prompt
+ prompt
+ `((?u ,(aget printable-defaults 'user))
+ (?h ,(aget printable-defaults 'host))
+ (?p ,(aget printable-defaults 'port))))))
+
+ ;; store the data, prompting for the password if needed
+ (setq data
+ (cond
+ ((and (null data) (eq r 'secret))
+ ;; special case prompt for passwords
+ (read-passwd prompt))
+ ((null data)
+ (read-string prompt default))
(t (or data default))))
(when data
-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.
Summary of changes:
lisp/ChangeLog | 11 ++++++
lisp/auth-source.el | 92 ++++++++++++++++++++++++++++++++++++---------------
2 files changed, 76 insertions(+), 27 deletions(-)
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".
The branch, master has been updated
hooks/post-receive
--
Gnus Project