[gnus git] branch master updated: n0-13-92-gbb1ecd9 =5= Use `auth-source-read-char-choice' instead of `read-char'. ; Merge branch 'master' of https://git.gnus.org/gnus ; Merge branch 'master' of https://git.gnus.org/gnus ; Merge branch 'master' of https://git.gnus.org/gnus ; Merge branches 'master' and 'master' of https://git.gnus.org/gnus
Ted Zlatanov <[email protected]>
| Newsgroups | gmane.emacs.gnus.cvs |
|---|---|
| Message-ID | <[email protected]> |
via bb1ecd951a7b6bc23d73941533a6da1838f606cc (commit)
via 39fc4d785e06335f65451ba04e30b59e910379be (commit)
via 2c474a0772b01d6081354487d2d5680d830b0714 (commit)
via 0b7a05e1edc784d6ac39d16150c58195ddadf66f (commit)
via b1248a823ba3e3a0afde1844f9a468e37512bc26 (commit)
from 536ba19d04d59ea5fec95df4a15c9f0613119719 (commit)
- Log -----------------------------------------------------------------
commit bb1ecd951a7b6bc23d73941533a6da1838f606cc
Author: Ted Zlatanov <[email protected]>
Date: Wed Mar 9 05:01:17 2011 -0600
Use `auth-source-read-char-choice' instead of `read-char'.
* auth-source.el (auth-source-read-char-choice): New function to read a
character choice using `dropdown-list', `read-char-choice', or
`read-char'. It appends "[a/b/c] " to the prompt if the choices were
'(?a ?b ?c). The `dropdown-list' support is disabled for now.
(auth-source-netrc-saver): Use it.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index fe7a385..2ea13bd 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
+2011-03-09 Teodor Zlatanov <[email protected]>
+
+ * auth-source.el (auth-source-read-char-choice): New function to read a
+ character choice using `dropdown-list', `read-char-choice', or
+ `read-char'. It appends "[a/b/c] " to the prompt if the choices were
+ '(?a ?b ?c). The `dropdown-list' support is disabled for now.
+ (auth-source-netrc-saver): Use it.
+
2011-03-08 Teodor Zlatanov <[email protected]>
* nnimap.el (nnimap-credentials): Keep the :save-function as the third
diff --git a/lisp/auth-source.el b/lisp/auth-source.el
index 53a97ca..33b9ef9 100644
--- a/lisp/auth-source.el
+++ b/lisp/auth-source.el
@@ -296,6 +296,34 @@ If the value is not a list, symmetric encryption will be used."
msg))
+;;; (auth-source-read-char-choice "enter choice? " '(?a ?b ?q))
+(defun auth-source-read-char-choice (prompt choices)
+ "Read one of CHOICES by `read-char-choice', or `read-char'.
+`dropdown-list' support is disabled because it doesn't work reliably.
+Only one of CHOICES will be returned. The PROMPT is augmented
+with \"[a/b/c] \" if CHOICES is '\(?a ?b ?c\)."
+ (when choices
+ (let* ((prompt-choices
+ (apply 'concat (loop for c in choices
+ collect (format "%c/" c))))
+ (prompt-choices (concat "[" (substring prompt-choices 0 -1) "] "))
+ (full-prompt (concat prompt prompt-choices))
+ k)
+
+ (while (not (memq k choices))
+ (setq k (cond
+ ((and nil (require 'dropdown-list nil t))
+ (let* ((blank (fill (copy-sequence prompt) ?.))
+ (dlc (cons (format "%s %c" prompt (car choices))
+ (loop for c in (cdr choices)
+ collect (format "%s %c" blank c)))))
+ (nth (dropdown-list dlc) choices)))
+ ((fboundp 'read-char-choice)
+ (read-char-choice full-prompt choices))
+ (t (message "%s" full-prompt)
+ (setq k (read-char))))))
+ k)))
+
;; (auth-source-pick nil :host "any" :port 'imap :user "joe")
;; (auth-source-pick t :host "any" :port 'imap :user "joe")
;; (setq auth-sources '((:source (:secrets default) :host t :port t :user "joe")
@@ -1136,15 +1164,12 @@ Respects `auth-source-save-behavior'."
(goto-char (point-min))
;; ask AFTER we've successfully opened the file
- (let ((prompt (format "Save auth info to file %s? %s: "
- file
- "y/n/N/e/?"))
+ (let ((prompt (format "Save auth info to file %s? " file))
(done (not (eq auth-source-save-behavior 'ask)))
(bufname "*auth-source Help*")
k)
(while (not done)
- (message "%s" prompt)
- (setq k (read-char))
+ (setq k (auth-source-read-char-choice prompt '(?y ?n ?N ?e ??)))
(case k
(?y (setq done t))
(?? (save-excursion
commit 39fc4d785e06335f65451ba04e30b59e910379be
Merge: 2c474a0 536ba19
Author: Ted Zlatanov <[email protected]>
Date: Tue Mar 8 21:49:00 2011 -0600
Merge branch 'master' of https://git.gnus.org/gnus
commit 2c474a0772b01d6081354487d2d5680d830b0714
Merge: 0b7a05e 4c756ae
Author: Ted Zlatanov <[email protected]>
Date: Sun Mar 6 05:00:38 2011 -0600
Merge branch 'master' of https://git.gnus.org/gnus
commit 0b7a05e1edc784d6ac39d16150c58195ddadf66f
Merge: b1248a8 c002e64
Author: Ted Zlatanov <[email protected]>
Date: Sat Mar 5 19:00:40 2011 -0600
Merge branch 'master' of https://git.gnus.org/gnus
commit b1248a823ba3e3a0afde1844f9a468e37512bc26
Author: Ted Zlatanov <[email protected]>
Date: Sat Mar 5 18:00:32 2011 -0600
Merge branches 'master' and 'master' of https://git.gnus.org/gnus
-----------------------------------------------------------------------
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 | 8 ++++++++
lisp/auth-source.el | 35 ++++++++++++++++++++++++++++++-----
2 files changed, 38 insertions(+), 5 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