all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Juri Linkov <juri@jurta.org>
Cc: lekktu@gmail.com, 9751@debbugs.gnu.org,
	Nikos Pitsianis <nikos@cs.duke.edu>
Subject: bug#9751: 23.3; Alternative Keyboard Feature/Bug
Date: Wed, 11 Jan 2012 21:48:24 -0500	[thread overview]
Message-ID: <jwvvcohabgi.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87ty41ahal.fsf@mail.jurta.org> (Juri Linkov's message of "Thu, 12 Jan 2012 02:35:54 +0200")

> 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))))))))





  reply	other threads:[~2012-01-12  2:48 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-14  7:05 bug#9751: 23.3; Alternative Keyboard Feature/Bug Nikos Pitsianis
2011-10-14 11:48 ` Juanma Barranquero
2011-10-14 17:06   ` Nikos Pitsianis
2011-10-14 17:21     ` Eli Zaretskii
2011-10-14 17:47       ` Nikos Pitsianis
2011-10-14 18:49         ` Stefan Monnier
2011-10-20  0:12           ` Juri Linkov
2011-10-20  2:10             ` Stefan Monnier
2011-10-20  6:29               ` Juri Linkov
2011-10-20 13:19                 ` Stefan Monnier
2011-10-21 14:01                   ` Juri Linkov
2011-10-21 17:37                     ` Stefan Monnier
2011-10-22 15:36                       ` Juri Linkov
2011-10-23 20:08                         ` Stefan Monnier
2011-10-23 20:24                           ` Andreas Schwab
2011-10-24  3:05                             ` Stefan Monnier
2011-10-24  5:17                               ` Juri Linkov
2011-10-24 13:01                                 ` Stefan Monnier
2011-10-24 15:35                                   ` Juri Linkov
2011-10-24 16:05                                     ` Stefan Monnier
2011-10-24 16:20                                       ` Juri Linkov
2011-10-24 20:18                                         ` Stefan Monnier
2011-10-25  4:33                                           ` Juri Linkov
2011-10-25 12:21                                             ` Stefan Monnier
2011-10-25 12:54                                           ` Stefan Monnier
2011-10-25 15:45                                             ` Juri Linkov
2012-01-12  0:35               ` Juri Linkov
2012-01-12  2:48                 ` Stefan Monnier [this message]
2012-01-12 10:33                   ` Juri Linkov
2011-10-14 19:19     ` Juanma Barranquero

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvvcohabgi.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=9751@debbugs.gnu.org \
    --cc=juri@jurta.org \
    --cc=lekktu@gmail.com \
    --cc=nikos@cs.duke.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.