[Top][All Lists]

[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: Fri, 12 Nov 2021 01:41:44 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Gregory Heytings wrote:

>> Rather, I meant show how to use the second solution to
>> solve the OPs example, i.e. to read an integer and only
>> an integer.
> Just use
> (restricted-read-from-minibuffer "Integer? " "^[0-9][0-9]*$")


  if: Wrong number of arguments: string-match, 4

> The fourth argument is new in Emacs 29, indeed.

GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, cairo version
1.16.0) of 2021-10-04

>>> (BTW, it seems that there's no way in Elisp to "expand"
>>> a regexp charset, e.g. "[0-9]" into "0123456789".
>>> That would make the ALLOWED-CHARS argument easier to
>>> type in.)
>> There is such a package, xr - the reverse of rx, LOL :)
> Apparently it doesn't do what I want here, namely converting
> "[0-9]" into "0123456789", "[0-9a-f]" into
> "0123456789abcdef", and so forth.

I think it can!

underground experts united

reply via email to

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