From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Whitfield Diffie Newsgroups: gmane.emacs.help Subject: Re: how to customize `read-passwd' [was: Setting mark in minibuffer prompt] Date: Tue, 10 Jul 2012 21:44:41 -0700 Message-ID: References: <7A0C0DE9B626433FB3A172ACCC2E10E9@us.oracle.com> <56703336BFC44E70AEFE1A16FB0DD7F0@us.oracle.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=f46d04462f665d9dc404c486813c X-Trace: dough.gmane.org 1341981894 8747 80.91.229.3 (11 Jul 2012 04:44:54 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 11 Jul 2012 04:44:54 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Drew Adams Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jul 11 06:44:54 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SoonE-0002Fp-HT for geh-help-gnu-emacs@m.gmane.org; Wed, 11 Jul 2012 06:44:52 +0200 Original-Received: from localhost ([::1]:58360 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SoonD-0004N1-FQ for geh-help-gnu-emacs@m.gmane.org; Wed, 11 Jul 2012 00:44:51 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:40695) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Soon8-0004Mu-Ge for help-gnu-emacs@gnu.org; Wed, 11 Jul 2012 00:44:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Soon6-0008VT-Tb for help-gnu-emacs@gnu.org; Wed, 11 Jul 2012 00:44:46 -0400 Original-Received: from mail-ob0-f169.google.com ([209.85.214.169]:48638) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Soon6-0008VB-Kr for help-gnu-emacs@gnu.org; Wed, 11 Jul 2012 00:44:44 -0400 Original-Received: by obhx4 with SMTP id x4so1153777obh.0 for ; Tue, 10 Jul 2012 21:44:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=qW2rgo2E7LH+vRO5aN4s0EsB3+zDUA6lPQIZjDcWIxo=; b=XheU10s3TAtNcOr6GGWHk5PNLyhglUpTaX5DZj0hg/Kr9e+rUMFZ2V0fItoONYBQgG BQ5STQBqrI50gKrO0fkvy5FjKSeJEzjchf6ohDp/y1MrFiziDvEDOcBbJGw+5mgElsYP LqsrUt5Ay/TnwY9GtkhLa7fJmUEhI++aEyDCf0mm58CEhy76fMKj3RBr7OuHM3oRcyzI Ku9UMEzEU8SeLAmSDF/0U/x1GbPkPTpD0YLuH+5oB1zVZ5pmI0qnLJdjl7DIwyh8psfB Vu0XMqkIqGnU8SRUnrHpQvLcyW0thmt+eju3TzmnFBPR8PSnVnQzUEauSke7IVTe0RxT esoQ== Original-Received: by 10.182.16.3 with SMTP id b3mr43410159obd.72.1341981881900; Tue, 10 Jul 2012 21:44:41 -0700 (PDT) Original-Received: by 10.182.150.104 with HTTP; Tue, 10 Jul 2012 21:44:41 -0700 (PDT) In-Reply-To: <56703336BFC44E70AEFE1A16FB0DD7F0@us.oracle.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.214.169 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:85778 Archived-At: --f46d04462f665d9dc404c486813c Content-Type: text/plain; charset=ISO-8859-1 > Please, in general, start a new thread for a new question. Will do. For now, I have accepted yours. >> Does anyone know how to get the cursor to come out in the >> right place as I back up down the row of dots that >> read-passwd echoes? > What I advise is to look at the code defining `read-passwd', and define your > function similarly. That is of course exactly what I did. A simplified version that merely accepts C-f and C-b and moves forward and backward through the echoed dots is attached. I have had, however, to insert my own cursor by hand. The problem is that the echo of the password is produced by message and message doesn't seem to call the minibuffer-setup-hook you taught me about. (If you enable cursor-in-echo-area, the cursor appears but sits at the end of the line.) > What you see there is that `read-key' is called and each key that is read is > handled with a case analysis. What you want is to add another case (or cases). This is what I did, along with changing the nested ifs to a cond for readability. > See how that code currently handles special lists of keys: `stop-keys' and > `rubout-keys'. More pertinent perhaps is the treatment of `C-y'. Read password doesn't do anything with C-y; it just goes in as an element of the password. Whit --f46d04462f665d9dc404c486813c Content-Type: application/octet-stream; name="line-edit-passwd.el" Content-Disposition: attachment; filename="line-edit-passwd.el" Content-Transfer-Encoding: base64 X-Attachment-Id: f_h4hwu41k0 KGRlZnVuIGxpbmUtZWRpdC1wYXNzd2QgKHByb21wdCkKCiAgIiAgIFNpbXBsZS1yZWFkLWtleXBo cmFzZSBSZWFkcyBhIGtleSBwaHJhc2UsIHByb21wdGluZyB3aXRoIFBST01QVC4gIEVjaG8gYC4n IGZvcgogICBlYWNoIGNoYXJhY3RlciB0eXBlZC4gIEVuZCB3aXRoIFJFVCwgTEZELCBvciBFU0Mu ICBERUwgcnVicyBvdXQ7IEMtaCBydWJzIG91dAogICBhbmQgc2hvd3MgdGhlIGxhc3QgZmV3IGNo YXJhY3RlcnMgdHlwZWQuICBDLXUga2lsbHMgbGluZS4gIE9wdGlvbmFsIGFyZ3VtZW50CiAgIENP TkZJUk0sIGlmIG5vbi1uaWwsIHRoZW4gcmVhZCBpdCB0d2ljZSB0byBtYWtlIHN1cmUuIgoKICAo bGV0ICgoZWNoby1jaGFyID8uKS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