From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.help Subject: Re: How to read an integer from the minibuffer Date: Tue, 16 Nov 2021 14:37:29 +0700 Message-ID: References: <87ee7nqomk.fsf@mbork.pl> <874k8jz372.fsf@yahoo.com> <87czn7qhx7.fsf@mbork.pl> <87lf1o38p3.fsf@zoho.eu> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10429"; mail-complaints-to="usenet@ciao.gmane.io" To: Emanuel Berg , help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Nov 16 08:38:39 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mmt38-0002MI-TX for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 16 Nov 2021 08:38:38 +0100 Original-Received: from localhost ([::1]:53732 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mmt37-0003az-MP for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 16 Nov 2021 02:38:37 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:54746) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mmt2F-0003ZQ-LH for help-gnu-emacs@gnu.org; Tue, 16 Nov 2021 02:37:44 -0500 Original-Received: from [2607:f8b0:4864:20::935] (port=40584 helo=mail-ua1-x935.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mmt2E-0007dM-Bs for help-gnu-emacs@gnu.org; Tue, 16 Nov 2021 02:37:43 -0500 Original-Received: by mail-ua1-x935.google.com with SMTP id y5so22551322ual.7 for ; Mon, 15 Nov 2021 23:37:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :content-transfer-encoding; bh=TSNNDp+8OGUKAOqZlxGalUtzjev9XQdjFqt8WVpGF8c=; b=Jk1yc+UtOgqXVasoLxOMCyYEN+Egp/nUEbn/wQ/gQzY/3vj8o5usDbnv0cfh0vlMi9 5sQcIInT0PgH5BW/Tqq0BAHVX+tx4/Q6P8ppBQt+bbPnGmDS3WOpjLFEQnlvIZc69foA YQdlC8Ie/eJXGKQZYpoAEwyEeE5ATs/FvjvBd5tUv9ewdTKVAz099KYN0gUcQsRWCCBt X2Zqo/npjwkYk7P5OM/Tp4e5sI92o/neUoGQi8mFxeX+wF0rvk+t5u4Y1xPzDgyHdTGc rmcqgf7k853eRs9gykSf4/EaItak2Qt6rUNldz2mmXLVURq+xDD1sjpzesD4IewuirQQ DuBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:content-transfer-encoding; bh=TSNNDp+8OGUKAOqZlxGalUtzjev9XQdjFqt8WVpGF8c=; b=TkcUG+wLQEXio4z0QnY4jJ80gthZ4A9952/MA8wJrgw1AKcysxRw+92pPibC8C/AnJ GfVbCGZTdO2ThRYhHTDEOKWcxz51uvZSehrCNspTpNL63T9Ly+xPAhjkf0FuPWL1Klnc ESkCsEJHcDe7CaCUqEcOOpEHmIacde3M4VdyhJ/KqYx/k4BVTXbccnYxtngGEgIS5Xl+ 3sJD7sGs4iv3HshQ8LLaFfDxKWoB/rx3M8GbVwuTFlp5pL9xUx0js9gkM4TYwJenu9vK fZF6Jcfv4DBJR3hNC3VM0IeAKRbaccwVtInuHBVir730sA/1Ugiu7sPf12RLruOZIxeu TygA== X-Gm-Message-State: AOAM53362z/JTlGWtHCz0WHp25gkh3Fc/ekh8jyhw1TwZ188LRWNYmQK D3xiXHGDXNAXTS+e6LG7HQg4LvY+6jPrWTwVjcQ= X-Google-Smtp-Source: ABdhPJwn3Fb7yHo/o8OOxXqBbyHln+PylGhh9cmJZVZl9Zm9r+KeiUMNwhkrmwgwD1QIrQFqJlZJtBY8UFHcSyzQ54U= X-Received: by 2002:a67:fad4:: with SMTP id g20mr53108712vsq.1.1637048261152; Mon, 15 Nov 2021 23:37:41 -0800 (PST) In-Reply-To: <87lf1o38p3.fsf@zoho.eu> X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::935 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::935; envelope-from=yurivkhan@gmail.com; helo=mail-ua1-x935.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:134624 Archived-At: On Tue, 16 Nov 2021 at 13:41, Emanuel Berg via Users list for the GNU Emacs text editor wrote: > (defun string-to-number-number (str) > (if (string=3D str "0") > 0 > (let ((num (string-to-number str))) > (unless (zerop num) > num) ))) > ;; (string-to-number-number "10") > ;; (string-to-number-number "1.5") > ;; (string-to-number-number "0") > ;; (string-to-number-number "-1.5") > ;; (string-to-number-number "-10") > ;; (string-to-number-number "not a number") ; nil =E2=80=98string-to-number=E2=80=99 has one more deficiency =E2=80=94 it ign= ores additional non-digit characters. M-: (string-to-number "123foo") =E2=87=92 123 (#o173, #x7b, ?\{) You cannot build anything strict on such a lax parser.