]> git.eshelyaron.com Git - emacs.git/commitdiff
(top-level): Don't require cl when compiling.
authorGlenn Morris <rgm@gnu.org>
Tue, 4 Dec 2007 04:11:13 +0000 (04:11 +0000)
committerGlenn Morris <rgm@gnu.org>
Tue, 4 Dec 2007 04:11:13 +0000 (04:11 +0000)
(password-read-and-add): Doc fix.  Make obsolete.

lisp/ChangeLog
lisp/password-cache.el

index 429c08f72c369709c83efd4d34346e66770710e8..e96ca3b2b541756edc25797c9524efb28243a6cd 100644 (file)
@@ -1,5 +1,9 @@
 2007-12-04  Glenn Morris  <rgm@gnu.org>
 
+       * password-cache.el: Move here from gnus/password.el.
+       (top-level): Don't require cl when compiling.
+       (password-read-and-add): Doc fix.  Make obsolete.
+
        * emulation/cua-base.el (top-level): Move (provide 'cua-base) to end.
        No longer provide 'cua.  Don't require cua-rect, cua-gmrk when
        compiling.
index f82de18d94e071fc35ecf7c59ae3128ee4252105..eeaa31b9a3105cdd3e69e6ee3f98f9a0b29ab51d 100644 (file)
 ;; (password-cache-add "test" "foo")
 ;;  => nil
 
-;; Note the previous two can be replaced with:
-;; (password-read-and-add "Password? " "test")
-;; ;; Minibuffer prompt for password.
-;; => "foo"
-;; ;; "foo" is now cached with key "test"
-
-
 ;; (password-read "Password? " "test")
 ;; ;; No minibuffer prompt
 ;;  => "foo"
@@ -60,9 +53,6 @@
 
 ;;; Code:
 
-(eval-when-compile
-  (require 'cl))
-
 (defcustom password-cache t
   "Whether to cache passwords."
   :group 'password
@@ -97,14 +87,20 @@ The variable `password-cache' control whether the cache is used."
 (defun password-read-and-add (prompt &optional key)
   "Read password, for use with KEY, from user, or from cache if wanted.
 Then store the password in the cache.  Uses `password-read' and
-`password-cache-add'.
-Custom variables `password-cache' and `password-cache-expiry'
-regulate cache behavior."
+`password-cache-add'.  Custom variables `password-cache' and
+`password-cache-expiry' regulate cache behavior.
+
+Warning: the password is cached without checking that it is
+correct.  It is better to check the password before caching.  If
+you must use this function, take care to check passwords and
+remove incorrect ones from the cache."
   (let ((password (password-read prompt key)))
     (when (and password key)
       (password-cache-add key password))
     password))
 
+(make-obsolete 'password-read-and-add 'password-read "23.1")
+
 (defun password-cache-remove (key)
   "Remove password indexed by KEY from password cache.
 This is typically run be a timer setup from `password-cache-add',
@@ -121,8 +117,7 @@ user again."
 
 (defun password-cache-add (key password)
   "Add password to cache.
-The password is removed by a timer after `password-cache-expiry'
-seconds."
+The password is removed by a timer after `password-cache-expiry' seconds."
   (when (and password-cache-expiry (null (intern-soft key password-data)))
     (run-at-time password-cache-expiry nil
                 #'password-cache-remove