From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#73307: Fix ctype(3) usage Date: Wed, 18 Sep 2024 08:35:18 -0700 Organization: UCLA Computer Science Department Message-ID: References: <86r09ibiq3.fsf@gnu.org> <89deb908-92a6-489f-bab9-116556ce8ce4@cs.ucla.edu> <86r09h9odm.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------yBjh0mwWlSbMQ0eoEx0XzXAV" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6711"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: luangruo@yahoo.com, 73307@debbugs.gnu.org, wiz@gatalith.at To: Eli Zaretskii , Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Sep 18 17:36:20 2024 Return-path: Envelope-to: geb-bug-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 1sqwj5-0001bY-MJ for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 18 Sep 2024 17:36:20 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sqwig-00079R-BL; Wed, 18 Sep 2024 11:35:54 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sqwib-00078C-0G for bug-gnu-emacs@gnu.org; Wed, 18 Sep 2024 11:35:50 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sqwia-0006KJ-9R for bug-gnu-emacs@gnu.org; Wed, 18 Sep 2024 11:35:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=In-Reply-To:From:References:MIME-Version:Date:To:Subject; bh=6qfdwKDq59DY4q+sNS4/AQih2wZgWaw/MUZOsKrk7kg=; b=M8uxGDnGJPT2rCln9ZeJhoXPh91X/KN8fwNmICyfDs0xhdBTrIL7YshP8Lo0xvLDjAV0zGbh7j8yusGTSp8jSXyUENR9rv2xmzTxyEFt4cjgYuRFTTILpz7QsDyg9abnkPZu9rEcMBpoDRQkukte3IzDisQzOkFpbmN4fSXL84VM9oGr5VGFADJv9eOiQL+ihXZwfclEkPzBmKg/FL6hpkXMMkGqVK/QLb6ZI4z9ZWkTncCmMP41oVGyllqiH4WFvuJtAeuBrMZWwdqHLVbAmsDCMSs3YT6xyBqLNqhBUjU6hFMwih4VE0FufqfJhduy5GAMIKlXGIbqk2d6YP69zg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sqwip-0003Vt-Cg for bug-gnu-emacs@gnu.org; Wed, 18 Sep 2024 11:36:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 18 Sep 2024 15:36:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73307 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 73307-submit@debbugs.gnu.org id=B73307.172667374413442 (code B ref 73307); Wed, 18 Sep 2024 15:36:03 +0000 Original-Received: (at 73307) by debbugs.gnu.org; 18 Sep 2024 15:35:44 +0000 Original-Received: from localhost ([127.0.0.1]:59155 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sqwiW-0003Uj-55 for submit@debbugs.gnu.org; Wed, 18 Sep 2024 11:35:44 -0400 Original-Received: from mail.cs.ucla.edu ([131.179.128.66]:34510) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sqwiT-0003UU-8Z for 73307@debbugs.gnu.org; Wed, 18 Sep 2024 11:35:42 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 86FCD3C011BDD; Wed, 18 Sep 2024 08:35:19 -0700 (PDT) Original-Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id wWvlwdPbUZJ1; Wed, 18 Sep 2024 08:35:19 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 3C8283C011BDE; Wed, 18 Sep 2024 08:35:19 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 3C8283C011BDE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1726673719; bh=6qfdwKDq59DY4q+sNS4/AQih2wZgWaw/MUZOsKrk7kg=; h=Message-ID:Date:MIME-Version:To:From; b=Y/YdsWRfXYjTxzwTKHSpgggKl8BUDlPGtWp4+vo1FoJyyc5K62QHUF1ps/vj2LAM7 BpUjykyZREOZutSn2YIYL+0CGzbduW2zSH3NWIRhIQ3wfITim+HsL6wNI78x1QUWdc y5jP+8OJY0nih5NHZd6wIlSoG6zAsDNLfPDIjzXcz+buOdS0BYuOFcNFPOxfefvP7+ tJByhxFK7YkJ2IF2+VYZbVkvr0NaoHVKqeln8kwOk7KJoaK1kCgvZqQwRv+DbLMG2R 158TGPHWaUZY6gtjsVFX5AZM81hcQNgMS17Dbq1BxJY/txw/OFlZIkjn/7U8GzpSCa echZzFUsIVaxQ== X-Virus-Scanned: amavis at mail.cs.ucla.edu Original-Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id A9Zv03q7yEqh; Wed, 18 Sep 2024 08:35:19 -0700 (PDT) Original-Received: from [192.168.254.12] (unknown [47.150.137.250]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id 101ED3C011BDD; Wed, 18 Sep 2024 08:35:19 -0700 (PDT) Content-Language: en-US In-Reply-To: <86r09h9odm.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:292009 Archived-At: This is a multi-part message in MIME format. --------------yBjh0mwWlSbMQ0eoEx0XzXAV Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable On 2024-09-18 04:45, Eli Zaretskii wrote: > what's the > problem with using c_isspace (and what do you mean by "multibyte > space" Using c_isspace would be OK, in that it'd handle most practical=20 examples. I wrote the fancier version to handle prompts that end in=20 non-ASCII spaces, e.g., (yes-or-no-p "Delete all files?=C2=A0") where the= =20 last character is actually U+00A0 NO-BREAK_SPACE instead of U+0020=20 SPACE, so its UTF-8 encoding is multiple bytes. If it's not important to=20 handle such cases we could just use c_isspace. > You are testing characters for whitespace syntax, which is AFAIU > subject to buffer-local syntax tables. Thanks, I didn't think of that. How about the attached patch? It is an=20 alternative to just using c_isspace. --------------yBjh0mwWlSbMQ0eoEx0XzXAV Content-Type: text/x-patch; charset=UTF-8; name="fns.c.diff" Content-Disposition: attachment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