[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:57:32 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
Gregory Heytings wrote:
>>> 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!
>
> Please show me how...
First here is another version of "read-integer" ...
We see a problem BTW that `string-to-number' returns 0
on error!
(string-to-number "Number Nighty Nine") ; 0
Anyway ...
(require 'cl-lib)
(defun read-integer ()
(let ((str)
(str-number)
(n) )
(cl-loop until (progn
(setq str (read-string "integer: "))
(if (string= str "0")
(setq n 0)
(setq str-number (string-to-number str))
(unless (= str-number 0)
(setq n str-number) ))
(integerp n)) )
n) )
;; (read-integer)
--
underground experts united
https://dataswamp.org/~incal
- Re: How to read an integer from the minibuffer, (continued)
Re: How to read an integer from the minibuffer, Gregory Heytings, 2021/11/11
- Re: How to read an integer from the minibuffer, Emanuel Berg, 2021/11/11
- Re: How to read an integer from the minibuffer, Gregory Heytings, 2021/11/11
- Re: How to read an integer from the minibuffer, Emanuel Berg, 2021/11/11
- Re: How to read an integer from the minibuffer, Gregory Heytings, 2021/11/11
- Re: How to read an integer from the minibuffer, Emanuel Berg, 2021/11/11
- Re: How to read an integer from the minibuffer, Gregory Heytings, 2021/11/11
- Re: How to read an integer from the minibuffer,
Emanuel Berg <=
- Re: How to read an integer from the minibuffer, Jean Louis, 2021/11/12
- Re: How to read an integer from the minibuffer, Emanuel Berg, 2021/11/12
- Re: How to read an integer from the minibuffer, Jean Louis, 2021/11/12
- Re: How to read an integer from the minibuffer, Emanuel Berg, 2021/11/12
- Re: How to read an integer from the minibuffer, Jean Louis, 2021/11/13
- Re: How to read an integer from the minibuffer, Emanuel Berg, 2021/11/16
Re: How to read an integer from the minibuffer, Jean Louis, 2021/11/12
Re: How to read an integer from the minibuffer, Jean Louis, 2021/11/12
Re: How to read an integer from the minibuffer, tomas, 2021/11/12
Re: How to read an integer from the minibuffer, Emanuel Berg, 2021/11/12