help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to read an integer from the minibuffer


From: Emanuel Berg
Subject: Re: How to read an integer from the minibuffer
Date: Thu, 11 Nov 2021 07:27:33 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Marcin Borkowski wrote:

> I'd like to read an integer (or something else e.g.
> matching a regex) from a minibuffer. Basically, I'm after
> a version of `read-string', but either allowing only some
> characters, or accepting only input matching some regex
> (possibly both).

Hm ... interesting

(require 'cl-lib)

(let ((n))
  (cl-loop until (progn
                   (setq n (read-number "integer: " 1))
                   (integerp n) ))
  n)

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

[Prev in Thread] Current Thread [Next in Thread]