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: result of completing-read contradicting require-match Date: Sun, 3 Jul 2022 03:38:31 +0700 Message-ID: References: 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="16989"; mail-complaints-to="usenet@ciao.gmane.io" To: Yuri Khan , carlmarcos@tutanota.com, Help Gnu Emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jul 02 22:39:20 2022 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 1o7jtf-0004FD-JQ for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 02 Jul 2022 22:39:19 +0200 Original-Received: from localhost ([::1]:59512 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o7jte-0006LY-2w for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 02 Jul 2022 16:39:18 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45846) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o7jt7-0006LM-5E for help-gnu-emacs@gnu.org; Sat, 02 Jul 2022 16:38:47 -0400 Original-Received: from mail-il1-x133.google.com ([2607:f8b0:4864:20::133]:44634) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o7jt5-00038y-Kz for help-gnu-emacs@gnu.org; Sat, 02 Jul 2022 16:38:44 -0400 Original-Received: by mail-il1-x133.google.com with SMTP id v1so226913ilg.11 for ; Sat, 02 Jul 2022 13:38:43 -0700 (PDT) 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=ITKhHY4csaQ+PuSmFexXmt/ugB+8Dj2KQ70URuYotxo=; b=jEX2YiYKXB0rpwCp9QdePmwPjlybAy9pOqxCFnJcoctso/hI2F0Y2yEk1iezhAnwXe k1N+ykaN1z8FD4x8G+s60xRBgubMh7QBi6hacgO1p6K6oSgtaMPhCIiN4PGR0ZxYqoKn TI+uP2xf88E3m5Wezc6/1rX2QYX6r1w3BPfTSwwvn3bNMU0TJKrPZ5bbIW8tXUmre0qZ debSUVtq+310Oz5m3BoSmpumaVoapYP6S5SRhzB8TvIgrmms6akOsSNqrTYpCxQZ+gHx R/fe/8Gi/75UciYgw997HH/sixPKmyHPkQHgzSE89SSy5MSZZaiwQj0seDuafFqYcyA5 fTTA== 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=ITKhHY4csaQ+PuSmFexXmt/ugB+8Dj2KQ70URuYotxo=; b=LnDNzwQ7paV8GhJWRStYanitGtJpNkSv7hmT38THbSdxiaod2faSvFJT1cKM6quzGf +wcu3k+wHriHPcBLqvbL257kzqDv1CMg4IumJEI4EWZoLe/NvJTz3rrLkP1vb0/1rNvJ v5l4kVixm7VW+oo1IKEyOoACRmfmiazgiLCtc4d7FrKT6tdbz4u2hyi79RPa7zwIDwAh f4GZLpaQBXK8boST+RjL9sDu66yDZGeCwPFV4erCiwj/+UFHdBeUQOhwqsS46ANr8FL5 tpD3q5/0D0Ynvp//sN2xX167wIZjZnhyTCNlSTQ29QtHg4cOCaHaMku/pyyY7d9wQUTu S37A== X-Gm-Message-State: AJIora89FCaDcdibM1UpXJYu+Bkt9O9FegTMf7Oqq7DgnHMNtblYsD8/ A2AwnfL+mNKiN8J7vPucvi9jyzPqR/0iLVJaDb0= X-Google-Smtp-Source: AGRyM1tsO1kdjh28Ha+vhgi/O6+VOlvS6SZGTQPNC6MB0QhoV688327vQQQKipemPq2p/e4015Opmhr0Lrw6XvKO6Lg= X-Received: by 2002:a05:6e02:1201:b0:2d9:2555:15ff with SMTP id a1-20020a056e02120100b002d9255515ffmr12009795ilq.127.1656794322378; Sat, 02 Jul 2022 13:38:42 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::133; envelope-from=yurivkhan@gmail.com; helo=mail-il1-x133.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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:138266 Archived-At: On Sun, 3 Jul 2022 at 03:07, Jean Louis wrote: > > Based on the quoted part of the docstring, you could probably pass a > > function that returns t for an allowed value, and nil for disallowed > > values, including an empty string or nil. > > Do you mean from `completing-read': > > "- a function, which will be called with the input as the parameter. > If it returns a non-nil value, the minibuffer is exited with that value= ." I do. > Do you mean this: > > (let* ((cseq '("name" "name-mode")) > (csel (completing-read "Type: " cseq nil FUNCTION-HERE? nil ))) > csel) I do. > and what would be value name for function to check it? I meant a closure over the list of valid strings, something like this: (let* ((choices '("name" "name-mode")) (is-valid (lambda (s) (member s choices))) (choice (completing-read "Type: " choices nil is-valid))) choice) I took the liberty to give variables sane names. I did not test this as my currently installed Emacs does not accept functions as the REQUIRE-MATCH argument. (Or, rather, it does but treats them as the =E2=80=9Canything else=E2=80=9D case.)