unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Oliver Scholz <alkibiades@gmx.de>
Subject: Re: HOW TO GIVE A DEFAULT TO A TRULY INTERACTIVE FUNCTION
Date: 18 Oct 2002 12:36:24 +0200	[thread overview]
Message-ID: <uy98wghjr.fsf@ID-87814.user.dfncis.de> (raw)
In-Reply-To: b00bb831.0210170627.2fe31d74@posting.google.com

gnuist006@hotmail.com (gnuist006) writes:
[...]
> They say emacs is customizable. OK it is if you only want to do what
> it
> can do, and never try to do what you want to do.

I don't understand this.

[...]
> I prefer it display the default 5 in the message and there is
> SINGLE instance of 5 in the function. ie using defaultval.

AFAIK you can not get this with the spec-string to `interactive', but
there is nothing wrong with an explicit call to `read-from-minibuffer'
in this case. 

(read-from-minibuffer "Hello: " (number-to-string 5))
 
The return value is a string. I only glanced quickly over this thread
(sorry for this!), but I seem to recall that someone already told how
to check if a string contains the decimal representation of a number.

To repeat this until the input is a valid number, use `while'.

[untested:]

(while (not (string-match 
              "^[-0-9]+\\(?:\\\\.[0-9]\\)*$"
              (setq my-number
                (read-from-minibuffer "Hello: "
                                      (number-to-string 5))))))

... or something less cluttered ...

> If this cannot do this and you were all lying to yourself that
> emacs is customizable, infinitely extensible, then I atleast want
> quick fix for this.

I can not parse this.

    -- Oliver

-- 
27 Vendémiaire an 211 de la Révolution
Liberté, Egalité, Fraternité!

  parent reply	other threads:[~2002-10-18 10:36 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-14 16:02 HOW TO GIVE A DEFAULT TO A TRULY INTERACTIVE FUNCTION gnuist006
2002-10-14 17:22 ` Joe Casadonte
2002-10-14 20:07 ` Edi Weitz
2002-10-17 14:27   ` gnuist006
2002-10-17 17:35     ` Barry Margolin
2002-10-18 10:36     ` Oliver Scholz [this message]
2002-10-17 14:35   ` gnuist006
2002-10-17 15:03     ` Edi Weitz
2002-10-18  5:51       ` huntingdon
2002-10-18  7:13     ` Friedrich Dominicus
2002-10-18  7:07 ` Friedrich Dominicus
2002-10-18  8:05   ` Friedrich Dominicus
2002-10-18 17:05   ` Kevin Rodgers
  -- strict thread matches above, loose matches on Subject: below --
2002-10-14 18:27 Bingham, Jay
     [not found] <mailman.1034620095.15632.help-gnu-emacs@gnu.org>
2002-10-17 14:22 ` gnuist006
2002-10-18  7:14   ` Friedrich Dominicus

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=uy98wghjr.fsf@ID-87814.user.dfncis.de \
    --to=alkibiades@gmx.de \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).