APEL 9.24 ?

Shuhei KOBAYASHI shuhei @ aqua.ocn.ne.jp
1999年 12月 23日 (木) 07:55:34 JST


>>>>> In <86ogbjyxn0.fsf @ aqua.ocn.ne.jp>,
>>>>> Shuhei KOBAYASHI <shuhei @ aqua.ocn.ne.jp> wrote:
> > おそらく、異論は出て来ないと思われるし、
> > 最悪、問題があっても元に戻せると思うので、
> > のちほどマージしてみます。
> 帰宅して mail を読んでみたらこんな事になっていたので驚きました(^^;
> ;; 様々な形で使われてみない事には問題点も発見できませんので, 別に反対
> ;; はしませんが.

うーむ, あちこちに "Emacs 20.1/XEmacs 20.3(?)" のような "(?)" つきの
comment が残っているなぁ(^^;


| ;; XXX: (defun read-passwd (prompt &optional confirm default))

これは

-------------- next part --------------
1999-12-23  Shuhei KOBAYASHI  <shuhei @ aqua.ocn.ne.jp>

	* poe.el (read-passwd): New function.

-------------- next part --------------
;;; imported from emacs-20.4/lisp/subr.el and modified a bit.
(defun read-passwd (prompt &optional confirm default)
  "Read a password, prompting with PROMPT.
Echo `.' for each character typed.
End with RET, LFD, or ESC.  DEL or C-h rubs out.  C-u kills line.
Optional argument CONFIRM, if non-nil, then read it twice to make sure.
Optional DEFAULT is a default password to use instead of empty input."
  (if confirm
      (let (success first second)
        (unwind-protect
            (progn
              (while (not success)
                (setq first  (read-passwd prompt nil default)
                      second (read-passwd "Confirm password: " nil default))
                (if (string= first second)
		    ;; make a copy of `first'.
                    (setq success (concat first))
                  (fillarray first  0)
                  (fillarray second 0)
                  (message "Password not repeated accurately; please start over")
                  (sit-for 1)))
              success)
          (if (stringp first)  (fillarray first  0))
          (if (stringp second) (fillarray second 0))))
    (static-when (fboundp 'clear-this-command-keys)
      (clear-this-command-keys))	; new in v20.
    (let ((cursor-in-echo-area t)
	  (echo-keystrokes 0)
          c pass)
      (unwind-protect
          (progn
            (while (progn
                     (message "%s%s" prompt
                              (make-string (length pass) ?.))
                     (not (memq (setq c (read-char nil t))
                                '(?\r ?\n ?\e))))
              (if (eq c ?\C-u)
                  (while pass
                    (setcar pass nil)
                    (setq pass (cdr pass)))
                (if (memq c '(?\b ?\177))
                    (if pass
                        (progn
                          (setcar pass nil)
                          (setq pass (cdr pass))))
                  (setq pass (cons c pass)))))
            (message nil)
            (or (and pass (concat (setq pass (nreverse pass))))
                default
                ""))
        (while pass
          (setcar pass nil)
          (setq pass (cdr pass)))))))
-------------- next part --------------

という定義を用意してあるのですが, poe.el で提供した方が良いでしょうか?

;; 普通に concat を使う定義の方が良い? それと, clear-this-command-keys
;; が存在して read-passwd が存在しない環境はあるのかなぁ?
-- 
Shuhei KOBAYASHI


More information about the APEL-ja mailing list