[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: HOW TO GIVE A DEFAULT TO A TRULY INTERACTIVE FUNCTION
From: |
gnuist006 |
Subject: |
Re: HOW TO GIVE A DEFAULT TO A TRULY INTERACTIVE FUNCTION |
Date: |
17 Oct 2002 07:35:35 -0700 |
Edi Weitz <edi@agharta.de> wrote in message
> (require 'cl)
>
> (defun* bar (&optional (default 5))
> (let* ((default-string (format "%s" default))
> (string (read-string "Number: "
> default-string
> nil
> default-string)))
> ;; needs check for wrong input
> (list (string-to-number string))))
>
> (defun foo (n)
> (interactive
> (bar 42))
> (insert (format "%s" (* 3 n))))
Pathetic solution. breaks one, fixes noone.
It just accepted "u" as the input and did not do number
validation.