[Top][All Lists]

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

[PATCH] perform-replace is too case-sensitive

From: Christopher J. Madsen
Subject: [PATCH] perform-replace is too case-sensitive
Date: Sat, 14 Jul 2007 12:22:04 -0500
User-agent: Thunderbird (Windows/20070604)

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

perform-replace examines the search string for upper-case characters,
and forces a case-sensitive search if it finds any.  But it doesn't
consider that a regexp may contain upper-case characters without being
case-sensitive (e.g., a\S-).

Isearch has a function (isearch-no-upper-case-p) that was designed to
address this issue.  I've attached a patch to make perform-replace use
isearch-no-upper-case-p instead of its naive comparison.

In GNU Emacs 22.1.1 (i686-pc-linux-gnu, GTK+ Version 2.10.11)
 of 2007-06-07 on bit
Windowing system distributor `The X.Org Foundation', version 11.0.70101000
configured using `configure  '--prefix=/usr' '--host=i686-pc-linux-gnu'
'--mandir=/usr/share/man' '--infodir=/usr/share/info'
'--datadir=/usr/share' '--sysconfdir=/etc' '--localstatedir=/var/lib'
'--program-suffix=-emacs-22' '--infodir=/usr/share/info/emacs-22'
'--without-carbon' '--with-sound' '--with-x' '--with-xpm'
'--with-toolkit-scroll-bars' '--with-jpeg' '--with-tiff' '--with-gif'
'--with-png' '--with-x-toolkit=gtk' '--build=i686-pc-linux-gnu'
'build_alias=i686-pc-linux-gnu' 'host_alias=i686-pc-linux-gnu'
'CFLAGS=-march=athlon-xp -pipe -O2''

Important settings:
  value of $LC_ALL: en_US
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  locale-coding-system: iso-8859-1
  default-enable-multibyte-characters: t

--- ./lisp/replace.el   2007-06-07 18:59:12.298007424 -0500
+++ ./lisp/replace.el   2007-07-14 11:57:46.046830123 -0500
@@ -1409,11 +1409,10 @@ (defun perform-replace (from-string repl
   (and query-flag minibuffer-auto-raise
        (raise-frame (window-frame (minibuffer-window))))
   (let ((nocasify (not (and case-fold-search case-replace
-                           (string-equal from-string
-                                         (downcase from-string)))))
+                            (isearch-no-upper-case-p from-string 
        (case-fold-search (and case-fold-search
-                              (string-equal from-string
-                                            (downcase from-string))))
+                               (isearch-no-upper-case-p from-string
+                                                        regexp-flag)))
        (literal (or (not regexp-flag) (eq regexp-flag 'literal)))
        (search-function (if regexp-flag 're-search-forward 'search-forward))
        (search-string from-string)

reply via email to

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