Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!cbatt!ihnp4!homxb!genesis!hotlg!nz From: nz@hotlg.UUCP Newsgroups: comp.emacs Subject: Re: reading without echo... Message-ID: <94@hotlg.ATT> Date: Wed, 13-May-87 13:51:45 EDT Article-I.D.: hotlg.94 Posted: Wed May 13 13:51:45 1987 Date-Received: Sat, 16-May-87 04:46:13 EDT References: <188@scampi.UUCP> Reply-To: nz@hotlg.UUCP (Neal Ziring) Followup-To: ihnp4!hotlg!nz Distribution: na Organization: AT&T-BL Dept. 54315 Lines: 57 Keywords: Gnu Emacs In article <188@scampi.UUCP> ramin@scampi.UUCP (Fubar Void) writes: > Maybe I'm missing something... but is there a way to read in the > minibuffer with echo turned off? That is, to prompt the user for, say, > a password, and read it in without echo... > > ramin... > -- > {ihnp4,lll-lcc,hoptoad}!scampi!ramin > systems control inc. (415) 494-1165 x-1777 Ramin, I wrote a small package that used such a thing a while ago, but RMS declined to include it in the 18.4x distribution. I could not find a way to accomplish the read purely in Elisp, so I did it in C. Here is a useful routine that was part of the terminal-lock package: DEFUN ("read-string-silent", Fread_string_silent, Sread_string_silent, 1, 1, 0, "Read a string from the terminal, no echo, return result on seeing CHAR.\ Maximum length of the string is same as maximum width of screen.") (rc) Lisp_Object rc; { int ic, icret; char is[MScreenWidth]; int ndex; Lisp_Object ret, justread; icret = XINT (rc); for(ndex = 0, ic = icret + 1; ic != icret; ) { justread = Fread_char (); ic = XINT (justread); if (ndex < (MScreenWidth - 1)) { is[ndex] = (char) ic; ndex++; } } is[ndex] = '\0'; ret = build_string (is); return ret; } Of course, this doesn't do the prompting, but I just use (message x y z) for that. If anybody out there in net land is interested in the lock-terminal command and termlock package, just drop me a letter and I'll send it off to you. -- ...nz (Neal Ziring @ ATT-BL Holmdel, x2354, 3H-437) "You can fit an infinite number of wires into this junction box, but we usually don't go that far in practice." London Electric Co. Worker, 1880s