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: Setting mark in minibuffer prompt Date: Sun, 8 Jul 2012 10:54:14 -0700 Message-ID: References: <7A0C0DE9B626433FB3A172ACCC2E10E9@us.oracle.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=e89a8f839d337cc4e504c4552fcd X-Trace: dough.gmane.org 1341770067 25571 80.91.229.3 (8 Jul 2012 17:54:27 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 8 Jul 2012 17:54:27 +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 Sun Jul 08 19:54:27 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 1Snvgg-0007fU-Fm for geh-help-gnu-emacs@m.gmane.org; Sun, 08 Jul 2012 19:54:26 +0200 Original-Received: from localhost ([::1]:57531 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Snvgf-0007YK-KB for geh-help-gnu-emacs@m.gmane.org; Sun, 08 Jul 2012 13:54:25 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:39964) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SnvgY-0007Y9-Ks for help-gnu-emacs@gnu.org; Sun, 08 Jul 2012 13:54:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SnvgX-0000At-19 for help-gnu-emacs@gnu.org; Sun, 08 Jul 2012 13:54:18 -0400 Original-Received: from mail-ob0-f169.google.com ([209.85.214.169]:46781) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SnvgW-0000Ae-NC for help-gnu-emacs@gnu.org; Sun, 08 Jul 2012 13:54:16 -0400 Original-Received: by obhx4 with SMTP id x4so16724525obh.0 for ; Sun, 08 Jul 2012 10:54:14 -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=pKX9aRZjtp2IzokjOsAIbtXUnaWvz/1vMiAH0qZvODc=; b=IspXDIzAKCDgJ7c/aRyhtA8RrkIFbgyYg5kSFIbbBUy3+1NxKUqRX6gahDHHJA9aHR Oo3sFjY5fClsxXWz/qe8cEMePMTJchk8ct/NmRdoVLsSKt10KadP5uZAi8x2tepFgOZr qkUODyfKtzw4rwqT5Ql3S/i49qpvK/Tn4Iwr3ZKCJVjm72pkEc7HAHCzBgWBaInZIPgj JCZtumf/oX0wz5RDrndqKjAi730krWrP8djcelQ7LN0QKD8TXn3tR7VCKVIdrQ01QzDg D3gTKz4RCd+sWLQvyTpE6zVHkrFCGBlPsoqBQVWG0KboejPP1bctDAGzUxGCGi9eFtQ9 +WxQ== Original-Received: by 10.182.162.101 with SMTP id xz5mr13373392obb.47.1341770054812; Sun, 08 Jul 2012 10:54:14 -0700 (PDT) Original-Received: by 10.182.43.40 with HTTP; Sun, 8 Jul 2012 10:54:14 -0700 (PDT) In-Reply-To: <7A0C0DE9B626433FB3A172ACCC2E10E9@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:85731 Archived-At: --e89a8f839d337cc4e504c4552fcd Content-Type: text/plain; charset=ISO-8859-1 > IIUC, you want point to remain after the inserted `default-directory', and you > want mark at some position to the left of that. ... You did understand correctly and the code you sent seems to solve the problem. The essential point I didn't understand was the need to use the minibuffer-setup-hook. Many thanks. Virtue being its own punishment, I am enclosing a related question I asked almost exactly two years ago in case the answer is equally simple If I type (read-string "Prompt: ") I can line edit the typein with , , , etc. If I type (read-passwd "Prompt: ") the only characters that are not merely absorbed into the string are and either of the delete-backwards characters. 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? I realize it is not obvious what use this would be. Don't trust me; I have something up my sleeve. Many thanks, Whit I have attached the code I wrote to do this but I am not happy with the technique because I had to insert the cursor ``by hand.'' Unfortunately what is attached is rather long because it is not an example; it implements a line editor. Very gratefully, Whit --e89a8f839d337cc4e504c4552fcd Content-Type: application/octet-stream; name="read-keyphrase.el" Content-Disposition: attachment; filename="read-keyphrase.el" Content-Transfer-Encoding: base64 X-Attachment-Id: f_h4ef086p0 KGRlZnVuIHJlYWQta2V5cGhyYXNlIChwcm9tcHQgJm9wdGlvbmFsIGNvbmZpcm0gZGVmYXVsdCBl Y2hvLWNoYXIgY3Vyc29yLWNoYXIKCQkJCQltaW5pbXVtLWxlbmd0aCBzaG93LWtleW5hbWUtYWZ0 ZXIKCQkJCQlzaG93LWNoYXJzLWJlZm9yZSBzaG93LWNoYXJzLWFmdGVyCgkJCQkJZWNoby1vbi1l ZGl0aW5nLW9ubHkpCgogICIgICBSZWFkIGEga2V5IHBocmFzZSwgcHJvbXB0aW5nIHdpdGggUFJP TVBULiAgRWNobyBgKicgZm9yIGVhY2ggY2hhcmFjdGVyCiAgIHR5cGVkLiAgRW5kIHdpdGggUkVU LCBMRkQsIG9yIEVTQy4gIERFTCBydWJzIG91dDsgQy1oIHJ1YnMgb3V0IGFuZCBzaG93cwogICB0 aGUgbGFzdCBmZXcgY2hhcmFjdGVycyB0eXBlZC4gIEMtdSBraWxscyBsaW5lLiAgT3B0aW9uYWwg YXJndW1lbnQgQ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