[Top][All Lists]

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

Re: [:upper:] inconsistency

From: Stefan Monnier
Subject: Re: [:upper:] inconsistency
Date: Sun, 07 Jan 2007 14:32:07 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.91 (gnu/linux)

> I would expect the regexp [[:upper:]] to behave the same as [A-Z] (in
> English text).  However, by default [[:upper:]] matches all letters,
> whereas [A-Z] matches only upper case letters, as I expect.

Hmm... I can't see to get A-Z to only match upper-case letters ...
Oh I see what you mean now.  Does the patch below fix it for you?
(I guess we could also allows the use of [:UPPER:] so you could workaround
this problem ;-)


--- orig/lisp/isearch.el
+++ mod/lisp/isearch.el
@@ -2297,7 +2297,15 @@
              (setq found t))
          (setq quote-flag nil)))
       (setq i (1+ i)))
-    (not found)))
+    (or (not found)
+        ;; Even if there's no uppercase char, we want to detect the use of
+        ;; [:upper:] char-class.
+        (and regexp-flag (string-match "\\[:upper:]" string)
+             (condition-case err
+                 (progn (string-match (substring string 0 (match-string 0)) "")
+                        nil)
+               (invalid-regexp
+                (equal "Unmatched [ or [^" (cadr err))))))))
 ;; Portability functions to support various Emacs versions.

reply via email to

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