From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.help Subject: RE: How to handle default value in read-string? Date: Mon, 3 Aug 2015 16:51:43 -0700 (PDT) Message-ID: <93600d92-2698-483a-8c1b-f1333363f541@default> References: <87k2tc9jeu.fsf@mbork.pl> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1438645939 29851 80.91.229.3 (3 Aug 2015 23:52:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 3 Aug 2015 23:52:19 +0000 (UTC) To: Marcin Borkowski , Help Gnu Emacs mailing list Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Aug 04 01:52:07 2015 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 1ZMPWX-0002eP-1n for geh-help-gnu-emacs@m.gmane.org; Tue, 04 Aug 2015 01:52:05 +0200 Original-Received: from localhost ([::1]:60781 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZMPWV-0003qo-RA for geh-help-gnu-emacs@m.gmane.org; Mon, 03 Aug 2015 19:52:03 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58830) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZMPWL-0003qi-HS for help-gnu-emacs@gnu.org; Mon, 03 Aug 2015 19:51:54 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZMPWH-0006rm-E4 for help-gnu-emacs@gnu.org; Mon, 03 Aug 2015 19:51:53 -0400 Original-Received: from userp1040.oracle.com ([156.151.31.81]:47666) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZMPWH-0006rh-6j for help-gnu-emacs@gnu.org; Mon, 03 Aug 2015 19:51:49 -0400 Original-Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t73Npjw9004338 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 3 Aug 2015 23:51:46 GMT Original-Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.13.8/8.13.8) with ESMTP id t73NpjL3003233 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Mon, 3 Aug 2015 23:51:45 GMT Original-Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by userv0122.oracle.com (8.13.8/8.13.8) with ESMTP id t73Npjxn028824; Mon, 3 Aug 2015 23:51:45 GMT In-Reply-To: <87k2tc9jeu.fsf@mbork.pl> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9 (901082) [OL 12.0.6691.5000 (x86)] X-Source-IP: aserv0021.oracle.com [141.146.126.233] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 156.151.31.81 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:106225 Archived-At: > I'd like read-string to somehow indicate the default value. A natural > idea is to include it in the prompt, for example having a prompt like >=20 > (format "Foo (%s): " default) >=20 > However, Icicles' version of read-string already does exactly that, so > for Icicles users this would be superfluous. >=20 > So here's the question: is there a better way than just have a prompt of >=20 > (if icicle-mode (don't-include-default) (do-include-default))? That's OK. Or wrap the `read-string' call in: (let ((icicle-default-value nil)) ...) A nil value of `icicle-default-value' tells Icicles not to put the default value in the prompt. Then you can add it to the prompt explicitly, so it will be there with and without Icicle mode: (defun foo (strg) (interactive (let ((icicle-default-value nil)) (list (read-string "String (default my-default): " nil nil "my-default")))))