From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.devel Subject: Re: emacs-28 a866674b2a: Fix inaccuracies in "lax search" documentation Date: Wed, 31 Aug 2022 19:26:48 +0200 Message-ID: <8735dcjpd3.fsf@gmail.com> References: <165875050243.3275.8867100069985547389@vcs2.savannah.gnu.org> <20220725120142.D1283C0F203@vcs2.savannah.gnu.org> <87r1298hxp.fsf@gmail.com> <864jz513nb.fsf@mail.linkov.net> <83h735dpno.fsf@gnu.org> <86tu75doeq.fsf@mail.linkov.net> <867d41dlc8.fsf@mail.linkov.net> <87ilnk8fuc.fsf@gmail.com> <86o7w2196j.fsf@mail.linkov.net> <87mtbkkdb5.fsf@gmail.com> <867d2ol9yl.fsf@mail.linkov.net> <87edwwjrp4.fsf@gmail.com> <83ilm8s6xh.fsf@gnu.org> <87a67kjqqw.fsf@gmail.com> <86a67kjpyu.fsf@mail.linkov.net> <83h71ss4yx.fsf@gnu.org> 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="17297"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Juri Linkov , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Aug 31 19:27:41 2022 Return-path: Envelope-to: ged-emacs-devel@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 1oTRV6-0004Mu-6v for ged-emacs-devel@m.gmane-mx.org; Wed, 31 Aug 2022 19:27:40 +0200 Original-Received: from localhost ([::1]:60562 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oTRV5-00077T-3z for ged-emacs-devel@m.gmane-mx.org; Wed, 31 Aug 2022 13:27:39 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36132) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTRUL-0006PH-EL for emacs-devel@gnu.org; Wed, 31 Aug 2022 13:26:53 -0400 Original-Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]:40831) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oTRUJ-0003Z2-QH; Wed, 31 Aug 2022 13:26:53 -0400 Original-Received: by mail-wm1-x333.google.com with SMTP id h204-20020a1c21d5000000b003a5b467c3abso12075371wmh.5; Wed, 31 Aug 2022 10:26:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date; bh=aZ4Q1CCSJNAx1bYNB1F0wlSMqfC5coLEpcUnU5e/04I=; b=nKog0qDHoEtSMCoKAlylLSgu7QZqKGTjiZ1+qpLP4jgrRJGwUUlBvdWWnybiafQAvM zEPGwpA+o4/8UUhoQVMDJMmzdkpLKgg7fuHOml+tLPokk+2EaZN26nOYIcyle9tn7e5G aXJSzHrnxsNL6UfMfY+roulutcW48284U5iCivIdaJ/h41+9DKaYLrQpzNoR85eFxrby bBI+fnThij7lNxjzOQHFjJXijAbrHqmLdWjf+4SnoxQoU0l5ofJc8LMHQTWXEaTvLJHS /JXEHPgrF7Jvlt3U1bVfDcug+9rhviZ9PvXChM9v1RupkIbJxIz6GpxVuOWyj28E+/6o izuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=aZ4Q1CCSJNAx1bYNB1F0wlSMqfC5coLEpcUnU5e/04I=; b=KkfwNadYrNF/Sqfz+vf1ucC9o7nANmV+qAj/ICzH8ZpTfhJm613Al5VExH7LReANKL bNIgyq2KhXGsr4+20WpZx2mFo4KIfktdfv7Q1HqCW0qs0fPHxBCUXNOUkKQAyvxOZttH EvGkOQWC6LStkBLLS1BDjkMw6qd8aXXDdov1kFURka7FixNis8IWYqIvbLwFZ5OdDE+M z6y+AnoD1YNsqxKmiUBvBupYQxkpSr01XSM1g2Stfa8oMWiliPCqpYWZ7dgYKxyfLy5g XODWzEnyP2MEAL4jqIYgK+8cTqKrG3SGGsStiqYWWV9f5Ew7O/xPcB7u5M1iBW0x+sdN /gpw== X-Gm-Message-State: ACgBeo3I/ZEJ83Kiu6wPb27fb9aHqFjkjwgMmlZFdZw+ys+JCpBfgLa2 kZ7IAKBQ0pgRUYUzsROQmHa0jTZ47S0= X-Google-Smtp-Source: AA6agR7sYFbmZc0UotuUkLZDqCHrL8PjUH1AuUMxKtYk5XEa0HZOhM5K6g+7ZobJHoS9ElgP0F+ryQ== X-Received: by 2002:a7b:cd14:0:b0:3a5:c5b3:508 with SMTP id f20-20020a7bcd14000000b003a5c5b30508mr2585521wmj.179.1661966809159; Wed, 31 Aug 2022 10:26:49 -0700 (PDT) Original-Received: from rltb ([2a01:e0a:3f3:fb50:34fb:6aed:1aac:5cee]) by smtp.gmail.com with ESMTPSA id j2-20020a056000124200b0022537d826f3sm12563219wrx.23.2022.08.31.10.26.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Aug 2022 10:26:48 -0700 (PDT) In-Reply-To: <83h71ss4yx.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 31 Aug 2022 20:22:30 +0300") Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=rpluim@gmail.com; helo=mail-wm1-x333.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: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:294450 Archived-At: >>>>> On Wed, 31 Aug 2022 20:22:30 +0300, Eli Zaretskii said: >> From: Juri Linkov >> Cc: Eli Zaretskii , emacs-devel@gnu.org >> Date: Wed, 31 Aug 2022 20:13:45 +0300 >>=20 >> I see it the other way around - that pleads for fixing >> `read-char-from-minibuffer': Eli> You do? Eli> If read-char-from-minibuffer is supposed to return a single charac= ter, Eli> it cannot return nil (or anything else that indicates empty input). Eli> If you make such a change, expect it to break many use cases Eli> elsewhere. Eli> To me, the above says that read-char-from-minibuffer is not the ri= ght Eli> tool for this job. Here=CA=BCs the kind of thing I had in mind: diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds= .el index 12896cc4b0..4137642528 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el @@ -3195,7 +3195,7 @@ read-char-by-name-sort :group 'mule :version "28.1") =20 -(defun read-char-by-name (prompt) +(defun read-char-by-name (prompt &optional allow-single) "Read a character by its Unicode name or hex number string. Display PROMPT and read a string that represents a character by its Unicode property `name' or `old-name'. @@ -3216,7 +3216,10 @@ read-char-by-name number like \"2A10\", or a number in hash notation (e.g., \"#x2a10\" for hex, \"10r10768\" for decimal, or \"#o25020\" for octal). Treat otherwise-ambiguous strings like \"BED\" (U+1F6CF) -as names, not numbers." +as names, not numbers. + +Optional arg ALLOW-SINGLE non-nil means to additionally allow +single characters to be treated as standing for themselves." (let* ((enable-recursive-minibuffers t) (completion-ignore-case t) (completion-tab-width 4) @@ -3239,6 +3242,9 @@ read-char-by-name (char (cond ((char-from-name input t)) + ((and allow-single + (string-match-p "\\`.\\'" input) + (ignore-errors (string-to-char input)))) ((string-match-p "\\`[[:xdigit:]]+\\'" input) (ignore-errors (string-to-number input 16))) ((string-match-p "\\`#\\([bBoOxX]\\|[0-9]+[rR]\\)[0-9a-zA-Z]+\\= '" Robert --=20