🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.emacs
Article #9557

Re: Need read-number function

#9557
From: Andy Norman
Date: Thu, 08 Feb 1990 16:04
24 lines
1272 bytes
>>>>> On 8 Feb 90 01:40:30 GMT, reingold@m.cs.uiuc.edu said:

ed> I need a function read-number that would behave like (interactive "n");
ed> that is, it would keep trying until a numeric value was typed.

Well, this is absolutely disgusting, but it might do what you want:

(defun read-number (&optional prompt)
  (call-interactively (list 'lambda
			    '(num)
			    (list 'interactive
				  (concat "n" prompt))
			    'num)))

If you don't want a prompt, it becomes much easier:

(defun read-number ()
  (call-interactively '(lambda (num) (interactive "n") num)))

Hope this helps...
--
					-- ange --

					ange@hplb.hpl.hp.com
Technical Details
Message-ID: <ANGE.90Feb8110419@anorman.hpl.hp.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!mcgill-vision!bloom-beacon!bu.edu!bu-cs!snorkelwacker!usc!brutus.cs.uiuc.edu!zaphod.mps.ohio-state.edu!swrinde!ucsd!ucbvax!hplabs!otter!hplb!anorman!ange
References: <4300068@m.cs.uiuc.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!mcgill-vision!bloom-beacon!bu.edu!bu-cs!snorkelwacker!usc!brutus.cs.uiuc.edu!zaphod.mps.ohio-state.edu!swrinde!ucsd!ucbvax!hplabs!otter!hplb!anorman!ange
From: ange@hplb.hpl.hp.com (Andy Norman)
Newsgroups: comp.emacs
Subject: Re: Need read-number function
Message-ID: <ANGE.90Feb8110419@anorman.hpl.hp.com>
Date: 8 Feb 90 16:04:19 GMT
References: <4300068@m.cs.uiuc.edu>
Sender: news@hplb.hpl.hp.com
Organization: Hewlett-Packard Laboratories, Bristol, UK.
Lines: 24
In-reply-to: reingold@m.cs.uiuc.edu's message of 8 Feb 90 01:40:30 GMT