GNU bug report logs - #9751
23.3; Alternative Keyboard Feature/Bug

Previous Next

Package: emacs;

Reported by: Nikos Pitsianis <nikos <at> cs.duke.edu>

Date: Fri, 14 Oct 2011 07:19:02 UTC

Severity: normal

Found in version 23.3

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


Message #95 received at 9751 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Juri Linkov <juri <at> jurta.org>
Cc: lekktu <at> gmail.com, 9751 <at> debbugs.gnu.org, Nikos Pitsianis <nikos <at> cs.duke.edu>
Subject: Re: bug#9751: 23.3; Alternative Keyboard Feature/Bug
Date: Wed, 11 Jan 2012 21:48:24 -0500
> This problem can be fixed with the following patch:

> === modified file 'lisp/subr.el'
> --- lisp/subr.el	2012-01-07 19:50:04 +0000
> +++ lisp/subr.el	2012-01-12 00:34:03 +0000
> @@ -2092,6 +2092,7 @@ (defun read-passwd (prompt &optional con
>  	    (echo-keystrokes 0)
>  	    (cursor-in-echo-area t)
>  	    (message-log-max nil)
> +	    (local-function-key-map nil)
>  	    (stop-keys (list 'return ?\r ?\n ?\e))
>  	    (rubout-keys (list 'backspace ?\b ?\177)))
>  	(add-text-properties 0 (length prompt)

I'd rather not go down that path (it might fix this problem but would
introduce others).
I wrote it too late for 24.1, but I'm using now a version of read-passwd
that uses read-string, so function-key-map (as well as all your familiar
key bindings) works just like for normal text.  I think it will fix this
problem in a more satisfactory way (but it's too late for 24.1).


        Stefan


(defun read-passwd (prompt &optional confirm default)
  "Read a password, prompting with PROMPT, and return it.
If optional CONFIRM is non-nil, read the password twice to make sure.
Optional DEFAULT is a default password to use instead of empty input.

This function echoes `.' for each character that the user types.

Once the caller uses the password, it can erase the password
by doing (clear-string STRING)."
  (if confirm
      (let (success)
        (while (not success)
          (let ((first (read-passwd prompt nil default))
                (second (read-passwd "Confirm password: " nil default)))
            (if (equal first second)
                (progn
                  (and (arrayp second) (clear-string second))
                  (setq success first))
              (and (arrayp first) (clear-string first))
              (and (arrayp second) (clear-string second))
              (message "Password not repeated accurately; please start over")
              (sit-for 1))))
        success)
    (let (minibuf)
      (minibuffer-with-setup-hook
          (lambda ()
            (setq minibuf (current-buffer))
            ;; Turn off electricity.
            (set (make-local-variable 'post-self-insert-hook) nil)
            (add-hook 'after-change-functions
                      (lambda (beg end len)
                        (clear-this-command-keys)
                        (setq beg (min end (max (minibuffer-prompt-end)
                                                beg)))
                        (dotimes (i (- end beg))
                          (put-text-property (+ i beg) (+ 1 i beg)
                                             'display (string ?.))))
                      nil t))
        (unwind-protect
            (read-string prompt nil
                         (let ((sym (make-symbol "forget-history")))
                           (set sym nil)
                           sym)
                         default)
          (when (buffer-live-p minibuf)
            (with-current-buffer minibuf (erase-buffer))))))))




This bug report was last modified 13 years and 193 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.