[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, 14 Jan 2007 20:18:59 -0500 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.92 (gnu/linux) |
> Thanks for the patch. However, it doesn't fix the problem. The following
> version of the function that you patched does seem to work. I have moved
> the `not' outside the `or' at the start of your patch.
Yes, there was some funny mixup in not/or/and.
> enough to suggest a fix. The sexpr `(match-string 0)' returns a string,
> whereas `substring' wants an integer argument.
It was supposed to be (match-beginning 0).
I thought I'd sent a newer patch (which also catches [:lower:]), but I guess
it didn't happen. Here it is.
> I think this problem really needs fixing at a lower level. When the regexp
> matcher is matching character classes such as [:upper:] and [:lower:] it
> should ignore case-fold-search.
I disagree.
Stefan
--- orig/lisp/isearch.el
+++ mod/lisp/isearch.el
@@ -2235,7 +2297,18 @@
(setq found t))
(setq quote-flag nil)))
(setq i (1+ i)))
- (not found)))
+ (not (or found
+ ;; Even if there's no uppercase char, we want to detect the use
+ ;; of [:upper:] or [:lower:] char-class, which indicates
+ ;; clearly that the user cares about case distinction.
+ (and regexp-flag (string-match "\\[:\\(upp\\|low\\)er:]" string)
+ (condition-case err
+ (progn
+ (string-match (substring string 0 (match-beginning 0))
+ "")
+ nil)
+ (invalid-regexp
+ (equal "Unmatched [ or [^" (cadr err)))))))))
;; Portability functions to support various Emacs versions.