all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: bojohan+news@dd.chalmers.se (Johan Bockgård)
To: help-gnu-emacs@gnu.org
Subject: Re: Reading from minibuffer with default value when return pressed
Date: Mon, 23 Apr 2007 16:13:19 +0200	[thread overview]
Message-ID: <yoij4pn7kwlc.fsf@gamma02.me.chalmers.se> (raw)
In-Reply-To: 1177264894.293580.213410@b75g2000hsg.googlegroups.com

Nordlöw <per.nordlow@gmail.com> writes:

> I thought the following should work but it doesn't
> (read-from-minibuffer "Grep for string: " nil nil nil nil "default"
> nil)

C-h f read-from-minibuffer

    [...]
    Sixth arg DEFAULT-VALUE is the default value. If non-nil, it is
    available for history commands; but, unless READ is non-nil,
    `read-from-minibuffer' does NOT return DEFAULT-VALUE if the user
    enters empty input! It returns the empty string.

> Do I need an alternative to read-from-minibuffer() or have I missed
> something=

You can just test for "", or use read-string:

    Fourth arg DEFAULT-VALUE is the default value. If non-nil, it is
    used for history commands, and as the value to return if the user
    enters the empty string.

-- 
Johan Bockgård

  parent reply	other threads:[~2007-04-23 14:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-22 18:01 Reading from minibuffer with default value when return pressed Nordlöw
2007-04-22 18:07 ` Nordlöw
2007-04-22 18:46   ` Drew Adams
2007-04-23 14:13 ` Johan Bockgård [this message]
2007-04-23 17:05   ` Chris McMahan
2007-04-25  5:13 ` Stefan Monnier

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=yoij4pn7kwlc.fsf@gamma02.me.chalmers.se \
    --to=bojohan+news@dd.chalmers.se \
    --cc=help-gnu-emacs@gnu.org \
    /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.