diff options
| author | Stefan Monnier | 2011-03-14 22:44:17 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2011-03-14 22:44:17 -0400 |
| commit | aa2ebce9fc5b7c393d57be41db70d2b3cc087fb8 (patch) | |
| tree | fef509c71e02106bf742c258efa4b576f8a586a6 /lisp/gnus/auth-source.el | |
| parent | 49c5410a593ad8b162e5c4608e2210f839539f7f (diff) | |
| download | emacs-aa2ebce9fc5b7c393d57be41db70d2b3cc087fb8.tar.gz emacs-aa2ebce9fc5b7c393d57be41db70d2b3cc087fb8.zip | |
* lisp/gnus/auth-source.el (auth-source-netrc-create): Use usual format for the
default in prompts.
Diffstat (limited to 'lisp/gnus/auth-source.el')
| -rw-r--r-- | lisp/gnus/auth-source.el | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/lisp/gnus/auth-source.el b/lisp/gnus/auth-source.el index 52f2b92e933..f703fbbd200 100644 --- a/lisp/gnus/auth-source.el +++ b/lisp/gnus/auth-source.el | |||
| @@ -1093,17 +1093,19 @@ See `auth-source-search' for details on SPEC." | |||
| 1093 | (?h ,(aget printable-defaults 'host)) | 1093 | (?h ,(aget printable-defaults 'host)) |
| 1094 | (?p ,(aget printable-defaults 'port)))))) | 1094 | (?p ,(aget printable-defaults 'port)))))) |
| 1095 | 1095 | ||
| 1096 | ;; store the data, prompting for the password if needed | 1096 | ;; Store the data, prompting for the password if needed. |
| 1097 | (setq data | 1097 | (setq data |
| 1098 | (cond | 1098 | (cond |
| 1099 | ((and (null data) (eq r 'secret)) | 1099 | ((and (null data) (eq r 'secret)) |
| 1100 | ;; special case prompt for passwords | 1100 | ;; Special case prompt for passwords. |
| 1101 | (read-passwd prompt)) | 1101 | (read-passwd prompt)) |
| 1102 | ((null data) | 1102 | ((null data) |
| 1103 | (when default | 1103 | (when default |
| 1104 | (setq | 1104 | (setq prompt |
| 1105 | prompt | 1105 | (if (string-match ": *\\'" prompt) |
| 1106 | (concat prompt (format "(default %s) " default)))) | 1106 | (concat (substring prompt 0 (match-beginning 0)) |
| 1107 | " (default " default "): ") | ||
| 1108 | (concat prompt "(default " default ") ")))) | ||
| 1107 | (read-string prompt nil nil default)) | 1109 | (read-string prompt nil nil default)) |
| 1108 | (t (or data default)))) | 1110 | (t (or data default)))) |
| 1109 | 1111 | ||
| @@ -1115,7 +1117,7 @@ See `auth-source-search' for details on SPEC." | |||
| 1115 | (lambda () data)) | 1117 | (lambda () data)) |
| 1116 | data)))) | 1118 | data)))) |
| 1117 | 1119 | ||
| 1118 | ;; when r is not an empty string... | 1120 | ;; When r is not an empty string... |
| 1119 | (when (and (stringp data) | 1121 | (when (and (stringp data) |
| 1120 | (< 0 (length data))) | 1122 | (< 0 (length data))) |
| 1121 | ;; this function is not strictly necessary but I think it | 1123 | ;; this function is not strictly necessary but I think it |
| @@ -1173,7 +1175,7 @@ Respects `auth-source-save-behavior'. Uses | |||
| 1173 | ;; we want the new data to be found first, so insert at beginning | 1175 | ;; we want the new data to be found first, so insert at beginning |
| 1174 | (goto-char (point-min)) | 1176 | (goto-char (point-min)) |
| 1175 | 1177 | ||
| 1176 | ;; ask AFTER we've successfully opened the file | 1178 | ;; Ask AFTER we've successfully opened the file. |
| 1177 | (let ((prompt (format "Save auth info to file %s? " file)) | 1179 | (let ((prompt (format "Save auth info to file %s? " file)) |
| 1178 | (done (not (eq auth-source-save-behavior 'ask))) | 1180 | (done (not (eq auth-source-save-behavior 'ask))) |
| 1179 | (bufname "*auth-source Help*") | 1181 | (bufname "*auth-source Help*") |
| @@ -1190,6 +1192,8 @@ Respects `auth-source-save-behavior'. Uses | |||
| 1190 | "(N)o and don't ask to save again\n" | 1192 | "(N)o and don't ask to save again\n" |
| 1191 | "(e)dit the line\n" | 1193 | "(e)dit the line\n" |
| 1192 | "(?) for help as you can see.\n")) | 1194 | "(?) for help as you can see.\n")) |
| 1195 | ;; Why? Doesn't with-output-to-temp-buffer already do | ||
| 1196 | ;; the exact same thing anyway? --Stef | ||
| 1193 | (set-buffer standard-output) | 1197 | (set-buffer standard-output) |
| 1194 | (help-mode)))) | 1198 | (help-mode)))) |
| 1195 | (?n (setq add "" | 1199 | (?n (setq add "" |
| @@ -1203,7 +1207,7 @@ Respects `auth-source-save-behavior'. Uses | |||
| 1203 | (when (get-buffer-window bufname) | 1207 | (when (get-buffer-window bufname) |
| 1204 | (delete-window (get-buffer-window bufname))) | 1208 | (delete-window (get-buffer-window bufname))) |
| 1205 | 1209 | ||
| 1206 | ;; make sure the info is not saved | 1210 | ;; Make sure the info is not saved. |
| 1207 | (when (null auth-source-save-behavior) | 1211 | (when (null auth-source-save-behavior) |
| 1208 | (setq add "")) | 1212 | (setq add "")) |
| 1209 | 1213 | ||