emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: regexp case sensitivity bug


From: Dean Herington
Subject: Re: regexp case sensitivity bug
Date: Mon, 09 Dec 2002 17:27:46 -0500

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)))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]