emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Moving files from lisp/gnus/ to lisp/net/?


From: Daiki Ueno
Subject: Re: Moving files from lisp/gnus/ to lisp/net/?
Date: Sat, 10 Nov 2007 13:53:23 +0900
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1 (gnu/linux)

>>>>> In <address@hidden> 
>>>>>   Richard Stallman <address@hidden> wrote:
> So you're saying he would turn on caching without realizing it?

Yes.

>     That says "give shorter names to frequently used functions, longer
>     names to rarely used functions".  My suggestion is based on the fact
>     that I hope that password caching in elisp will not be used frequently

> Ok, you have convinced me.  Let's make it a separate function.

> With that decision made, is the code ready to install?

password.el itself is in lisp/gnus/.  But we need a new function which
does password caching, whose arglist is similar to read-passwd's, and
whose name is longer than `read-passwd'.

What about this patch?

Index: lisp/gnus/password.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/gnus/password.el,v
retrieving revision 1.1
diff -c -r1.1 password.el
*** lisp/gnus/password.el       28 Oct 2007 09:18:25 -0000      1.1
--- lisp/gnus/password.el       10 Nov 2007 04:47:16 -0000
***************
*** 134,139 ****
--- 134,152 ----
    (interactive)
    (fillarray password-data 0))
  
+ ;;;###autoload
+ (defun read-passwd-through-cache (prompt key &optional confirm default)
+   "Read password associated with KEY in password cache.
+ This first looks up the cache by KEY.  If it doesn't hit, this asks
+ user to input, and then adds it to the cache.  The rest of arguments
+ PROMPT, CONFIRM, and DEFAULT are passed to `read-passwd'.
+ 
+ The variable `password-cache' control whether the cache is used."
+   (or (password-read-from-cache key)
+       (let ((password (read-passwd prompt confirm default)))
+       (password-cache-add key password)
+       password)))
+ 
  (provide 'password)
  
  ;;; arch-tag: ab160494-16c8-4c68-a4a1-73eebf6686e5

Regards,
-- 
Daiki Ueno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]