[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: HOW TO GIVE A DEFAULT TO A TRULY INTERACTIVE FUNCTION
From: |
Oliver Scholz |
Subject: |
Re: HOW TO GIVE A DEFAULT TO A TRULY INTERACTIVE FUNCTION |
Date: |
18 Oct 2002 12:36:24 +0200 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 |
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é!