/[emacs]/emacs/lisp/subr.el
ViewVC logotype

Diff of /emacs/lisp/subr.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.360.2.14 by miles, Wed Oct 27 05:41:58 2004 UTC revision 1.360.2.15 by miles, Thu Nov 4 08:55:35 2004 UTC
# Line 817  is converted into a string by expressing Line 817  is converted into a string by expressing
817  (make-obsolete-variable 'post-command-idle-delay  (make-obsolete-variable 'post-command-idle-delay
818    "use timers instead, with `run-with-idle-timer'." "before 19.34")    "use timers instead, with `run-with-idle-timer'." "before 19.34")
819    
820    (defvaralias 'x-lost-selection-hooks 'x-lost-selection-functions)
821    (make-obsolete-variable 'x-lost-selection-hooks 'x-lost-selection-functions "21.4")
822    (defvaralias 'x-sent-selection-hooks 'x-sent-selection-functions)
823    (make-obsolete-variable 'x-sent-selection-hooks 'x-sent-selection-functions "21.4")
824    
825  ;;;; Alternate names for functions - these are not being phased out.  ;;;; Alternate names for functions - these are not being phased out.
826    
# Line 1211  any other non-digit terminates the chara Line 1215  any other non-digit terminates the chara
1215        (setq first nil))        (setq first nil))
1216      code))      code))
1217    
1218    (defun read-passwd (prompt &optional confirm default)
1219      "Read a password, prompting with PROMPT, and return it.
1220    If optional CONFIRM is non-nil, read the password twice to make sure.
1221    Optional DEFAULT is a default password to use instead of empty input.
1222    
1223    This function echoes `.' for each character that the user types.
1224    The user ends with RET, LFD, or ESC.  DEL or C-h rubs out.  C-u kills line.
1225    C-g quits; if `inhibit-quit' was non-nil around this function,
1226    then it returns nil if the user types C-g.
1227    
1228    Once the caller uses the password, it can erase the password
1229    by doing (clear-string STRING)."
1230      (with-local-quit
1231        (if confirm
1232            (let (success)
1233              (while (not success)
1234                (let ((first (read-passwd prompt nil default))
1235                      (second (read-passwd "Confirm password: " nil default)))
1236                  (if (equal first second)
1237                      (progn
1238                        (and (arrayp second) (clear-string second))
1239                        (setq success first))
1240                    (and (arrayp first) (clear-string first))
1241                    (and (arrayp second) (clear-string second))
1242                    (message "Password not repeated accurately; please start over")
1243                    (sit-for 1))))
1244              success)
1245          (let ((pass nil)
1246                (c 0)
1247                (echo-keystrokes 0)
1248                (cursor-in-echo-area t))
1249            (while (progn (message "%s%s"
1250                                   prompt
1251                                   (make-string (length pass) ?.))
1252                          (setq c (read-char-exclusive nil t))
1253                          (and (/= c ?\r) (/= c ?\n) (/= c ?\e)))
1254              (clear-this-command-keys)
1255              (if (= c ?\C-u)
1256                  (progn
1257                    (and (arrayp pass) (clear-string pass))
1258                    (setq pass ""))
1259                (if (and (/= c ?\b) (/= c ?\177))
1260                    (let* ((new-char (char-to-string c))
1261                           (new-pass (concat pass new-char)))
1262                      (and (arrayp pass) (clear-string pass))
1263                      (clear-string new-char)
1264                      (setq c ?\0)
1265                      (setq pass new-pass))
1266                  (if (> (length pass) 0)
1267                      (let ((new-pass (substring pass 0 -1)))
1268                        (and (arrayp pass) (clear-string pass))
1269                        (setq pass new-pass))))))
1270            (message nil)
1271            (or pass default "")))))
1272    
1273  ;; This should be used by `call-interactively' for `n' specs.  ;; This should be used by `call-interactively' for `n' specs.
1274  (defun read-number (prompt &optional default)  (defun read-number (prompt &optional default)
1275    (let ((n nil))    (let ((n nil))

Legend:
Removed from v.1.360.2.14  
changed lines
  Added in v.1.360.2.15

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26