From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Dean Herington Newsgroups: gmane.emacs.devel Subject: Re: regexp case sensitivity bug Date: Mon, 09 Dec 2002 17:27:46 -0500 Organization: Dept. of Computer Science, UNC-CH Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <3DF518E2.6FDE0A01@cs.unc.edu> References: <3DF3B4D0.D4628D27@cs.unc.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1039476252 17739 80.91.224.249 (9 Dec 2002 23:24:12 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 9 Dec 2002 23:24:12 +0000 (UTC) Cc: emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18LXFz-0004bx-00 for ; Tue, 10 Dec 2002 00:24:11 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 18LXQG-0001LN-00 for ; Tue, 10 Dec 2002 00:34:49 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18LWNp-0000TY-01 for emacs-devel@quimby.gnus.org; Mon, 09 Dec 2002 17:28:13 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18LWNU-0000T4-00 for emacs-devel@gnu.org; Mon, 09 Dec 2002 17:27:52 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18LWNS-0000Sc-00 for emacs-devel@gnu.org; Mon, 09 Dec 2002 17:27:52 -0500 Original-Received: from wren.cs.unc.edu ([152.2.128.86]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18LWNS-0000SS-00; Mon, 09 Dec 2002 17:27:50 -0500 Original-Received: from cs.unc.edu (heringto1-cs.cs.unc.edu [152.2.132.126]) by wren.cs.unc.edu (8.12.5/8.12.5) with ESMTP id gB9MRlhi015453; Mon, 9 Dec 2002 17:27:47 -0500 (EST) X-Mailer: Mozilla 4.78 [en] (Windows NT 5.0; U) X-Accept-Language: en Original-To: rms@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:10015 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:10015 Richard Stallman wrote: > In Emacs 21.1.1, when I do isearch-forward-regexp with input "\bP", > Emacs matches 'p's case insensitively. > > Does this patch fix it? > > *** isearch.el.~1.215.~ Sun Nov 10 13:13:37 2002 > --- isearch.el Mon Dec 9 11:20:37 2002 > *************** > *** 1871,1877 **** > (if (and regexp-flag (eq char ?\\)) > (setq quote-flag (not quote-flag)) > (if (and (not quote-flag) (not (eq char (downcase char)))) > ! (setq found t)))) > (setq i (1+ i))) > (not found))) > > --- 1871,1878 ---- > (if (and regexp-flag (eq char ?\\)) > (setq quote-flag (not quote-flag)) > (if (and (not quote-flag) (not (eq char (downcase char)))) > ! (setq found t)) > ! (setq quote-flag nil))) > (setq i (1+ i))) > (not found))) That patch fixes the bug I saw. How about the following, which I find simpler? (defun isearch-no-upper-case-p (string regexp-flag) "Return t if there are no upper case chars in STRING. If REGEXP-FLAG is non-nil, disregard letters quoted by `\\' since they have special meaning in a regexp." (let ((i 0) (len (length string)) found) (while (and (not found) (< i len)) (let ((char (aref string i))) (if (and regexp-flag (eq char ?\\)) (setq i (1+ i)) (if (not (eq char (downcase char))) (setq found t)))) (setq i (1+ i))) (not found)))