bug#26580: 25.1; inappropriate case folding while isearch-forward-regexp

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

bug#26580: 25.1; inappropriate case folding while isearch-forward-regexp

ynyaaa

'M-C-s \A' matches both lower letter a and upper letter A.
'M-C-s [\A]' matches \ and lower letter a and upper letter A.
'M-C-s \cCa' matches 一a, but does not match 一A.




In GNU Emacs 25.1.1 (i686-w64-mingw32)
 of 2016-09-18 built on LAPHROAIG
Windowing system distributor 'Microsoft Corp.', version 6.0.6002
Configured using:
 'configure --host=i686-w64-mingw32 --without-dbus
 --without-compress-install CFLAGS=-static'

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY ACL GNUTLS LIBXML2 ZLIB
TOOLKIT_SCROLL_BARS

Important settings:
  value of $LANG: JPN
  locale-coding-system: cp932

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message dired format-spec rfc822 mml
mml-sec password-cache epg epg-config gnus-util mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util help-fns mail-prsvr mail-utils
misearch multi-isearch help-mode easymenu cl-loaddefs pcase cl-lib
time-date mule-util japan-util tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel dos-w32 ls-lisp disp-table
w32-win w32-vars term/common-win tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register
page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese charscript case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote w32notify w32 multi-tty
make-network-process emacs)

Memory information:
((conses 8 92081 7564)
 (symbols 32 19681 0)
 (miscs 32 54 161)
 (strings 16 15921 3924)
 (string-bytes 1 430154)
 (vectors 8 13169)
 (vector-slots 4 519590 4478)
 (floats 8 165 28)
 (intervals 28 217 13)
 (buffers 520 19))



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

bug#26580: 25.1; inappropriate case folding while isearch-forward-regexp

Tino Calancha-2
[hidden email] writes:

> 'M-C-s \A' matches both lower letter a and upper letter A.
> 'M-C-s [\A]' matches \ and lower letter a and upper letter A.
> 'M-C-s \cCa' matches 一a, but does not match 一A.

Thanks for the report.  I guess this is a feature.
A capital letter triggers a case sensitive search.  In your last example,
upper letter C turned on the case sensitive search.  It might be argue
if that should happen in this case.  I think the current way is handy.
Maybe we should mention about this in the `isearch-forward' docstring.

In the former examples the slash somehow prevents this to happen.  For instance,
if you don't escape 'A' in the first example, then the search will match just 'A'.

Try the following:
'M-C-s A' matches upper letter A.
'M-C-s [a\]' matches \ and lower letter a and upper letter A.
'M-C-s [A\]' matches \ and upper letter A.

'M-C-s \cca' matches 一a, and 一A.
'M-C-s \ccA' just matches 一A.
'M-C-s \cCA' just matches 一A.
'M-C-s \cCa' just matches 一a.

Of couse, you always can toggle the case sensitivity during
those searches with M-c:
'M-C-s A M-c' matches both lower letter a and upper letter A.
'M-C-s \cCa M-c' matches 一a, and 一A.


Regards,
Tino



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

bug#26580: 25.1; inappropriate case folding while isearch-forward-regexp

Andreas Schwab-2
On Apr 21 2017, Tino Calancha <[hidden email]> wrote:

> A capital letter triggers a case sensitive search.  In your last example,
> upper letter C turned on the case sensitive search.  It might be argue
> if that should happen in this case.  I think the current way is handy.

IMHO that is a bug.  Just like \W doesn't trigger it, \cC should not do
it either.

Andreas.

--
Andreas Schwab, [hidden email]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

bug#26580: 25.1; inappropriate case folding while isearch-forward-regexp

Tino Calancha-2


On Fri, 21 Apr 2017, Andreas Schwab wrote:

> On Apr 21 2017, Tino Calancha <[hidden email]> wrote:
>
>> A capital letter triggers a case sensitive search.  In your last example,
>> upper letter C turned on the case sensitive search.  It might be argue
>> if that should happen in this case.  I think the current way is handy.
>
> IMHO that is a bug.  Just like \W doesn't trigger it, \cC should not do
> it either.
Yeah, it looks strange.  I would say, if \W doesn't trigger, then c\C
would not either (\cC might do, because the upper case is not escaped).

I'm also wondering if \W should do what is doing.  Is it documented
somewhere that the slash does not trigger case sensitivity?



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

bug#26580: 25.1; inappropriate case folding while isearch-forward-regexp

Andreas Schwab-2
On Apr 21 2017, Tino Calancha <[hidden email]> wrote:

> I'm also wondering if \W should do what is doing.  Is it documented
> somewhere that the slash does not trigger case sensitivity?

\W has nothing to do with case, it's just a non-word character.  Same
for \cC.

Andreas.

--
Andreas Schwab, [hidden email]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

bug#26580: 25.1; inappropriate case folding while isearch-forward-regexp

Tino Calancha-2


On Fri, 21 Apr 2017, Andreas Schwab wrote:

> On Apr 21 2017, Tino Calancha <[hidden email]> wrote:
>
>> I'm also wondering if \W should do what is doing.  Is it documented
>> somewhere that the slash does not trigger case sensitivity?
>
> \W has nothing to do with case, it's just a non-word character.  Same
> for \cC.
OK, i just picked up \W from you.  Let's changed to \T:
emacs -Q:
C-M-s \T ; matches lower and upper T
C-M-s T ; just matches upper T

I don't see in the manual this effect on an escaped upper letter.




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

bug#26580: 25.1; inappropriate case folding while isearch-forward-regexp

Eli Zaretskii
> From: Tino Calancha <[hidden email]>
> Date: Fri, 21 Apr 2017 21:16:27 +0900 (JST)
> Cc: [hidden email], Tino Calancha <[hidden email]>,
> [hidden email], Juri Linkov <[hidden email]>
>
> C-M-s \T ; matches lower and upper T
> C-M-s T ; just matches upper T
>
> I don't see in the manual this effect on an escaped upper letter.

  (defcustom search-upper-case 'not-yanks
    "If non-nil, upper case chars disable case fold searching.
  That is, upper and lower case chars must match exactly.
  This applies no matter where the chars come from, but does not
  apply to chars in regexps that are prefixed with `\\'.
  If this value is `not-yanks', text yanked into the search string
  in Isearch mode is always downcased."
    :type '(choice (const :tag "off" nil)
                   (const not-yanks)
                   (other :tag "on" t)))



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

bug#26580: 25.1; inappropriate case folding while isearch-forward-regexp

Andreas Schwab-2
In reply to this post by Tino Calancha-2
On Apr 21 2017, Tino Calancha <[hidden email]> wrote:

> OK, i just picked up \W from you.  Let's changed to \T:

Since \T has no meaning nobody would use it anyway.

Andreas.

--
Andreas Schwab, [hidden email]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

bug#26580: 25.1; inappropriate case folding while isearch-forward-regexp

Tino Calancha-2
In reply to this post by Eli Zaretskii


On Fri, 21 Apr 2017, Eli Zaretskii wrote:

>> From: Tino Calancha <[hidden email]>
>> Date: Fri, 21 Apr 2017 21:16:27 +0900 (JST)
>> Cc: [hidden email], Tino Calancha <[hidden email]>,
>> [hidden email], Juri Linkov <[hidden email]>
>>
>> C-M-s \T ; matches lower and upper T
>> C-M-s T ; just matches upper T
>>
>> I don't see in the manual this effect on an escaped upper letter.
>
>  (defcustom search-upper-case 'not-yanks
>    "If non-nil, upper case chars disable case fold searching.
>  That is, upper and lower case chars must match exactly.
>  This applies no matter where the chars come from, but does not
>  apply to chars in regexps that are prefixed with `\\'.
>  If this value is `not-yanks', text yanked into the search string
>  in Isearch mode is always downcased."
>    :type '(choice (const :tag "off" nil)
>   (const not-yanks)
>   (other :tag "on" t)))
>
Great, thanks!
Now it's clear why \A matches both 'a' and 'A'.



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

bug#26580: 25.1; inappropriate case folding while isearch-forward-regexp

Tino Calancha-2
In reply to this post by Andreas Schwab-2


On Fri, 21 Apr 2017, Andreas Schwab wrote:

> On Apr 21 2017, Tino Calancha <[hidden email]> wrote:
>
>> OK, i just picked up \W from you.  Let's changed to \T:
>
> Since \T has no meaning nobody would use it anyway.
Someone might want to use it to disable the case sensitivity search.

After Eli e-mail, i agree with the OP and you that would be more
consistent if '\cCa' disables case sensitive searches as '\cc\A' does.

In case that is difficult to implement, we might want to document
that the  slash trick just works for single characters.  Then, the user
would just use '\cca' which loks even simpler.



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

bug#26580: 25.1; inappropriate case folding while isearch-forward-regexp

Andreas Schwab-2
On Apr 22 2017, Tino Calancha <[hidden email]> wrote:

> would just use '\cca' which loks even simpler.

\cc means something quite different than \cC.

Andreas.

--
Andreas Schwab, [hidden email]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

bug#26580: 25.1; inappropriate case folding while isearch-forward-regexp

Juri Linkov-2
In reply to this post by Tino Calancha-2
> In case that is difficult to implement, we might want to document
> that the  slash trick just works for single characters.  Then, the user
> would just use '\cca' which loks even simpler.

The implementation that takes care of ‘\’ is in ‘isearch-no-upper-case-p’.
I guess we need a special casing for ‘\cC’ here as well.



Loading...