GNU bug report logs -
#18017
24.4.50; Isearch case sensitivity broken/confusing
Previous Next
To reply to this bug, email your comments to 18017 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18017
; Package
emacs
.
(Mon, 14 Jul 2014 16:04:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Drew Adams <drew.adams <at> oracle.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Mon, 14 Jul 2014 16:04:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
emacs -Q
Type this in buffer *scratch*:
Add
add
ADD
M-x set-variable case-fold-search nil
C-s add C-s
C-s M-c C-s
The M-c says that search is now case-insensitive, but the second and
subsequent C-s's do not find occurrences Add and ADD.
C-s add C-s
That finds all three (case-insensitive).
IOW, what seems to happen is this:
When you repeat the last search string, that text is not interpreted
anew, per the current value of `case-fold-search'. Instead, search is
put back into the state it was in for the last search
you did (from scratch), ignoring the current value of `case-fold-search'.
If instead of C-s C-s you retype (or yank) the same text then it is
handled as you would expect (i.e., per `case-fold-search').
Similarly, if you used `M-c' during the previous search to turn off case
sensitivity, then when you start a new search by repeating the search
string, that new search acts case-insensitively, regardless of the value
of `case-fold-search'. Again, search seems to be put back into the state
it had for the previous search session, ignoring `case-fold-search'.
Similarly, if you do C-s M-c C-s then the M-c is ignored and search
takes on the case sensitivity or lack thereof that you had for the
previous search. Search ignores M-c if you repeat the previous search
string using C-s.
Is this considered a feature? Or should it be considered a bug?
It seems quit confusing, at least. Is there some advantage to having
Isearch behave this way?
Note that the doc (emacs, node Search Case) says:
The effect [of M-c] does not extend beyond the current incremental
search to the next one
which contradicts this behavior (starting with nil `case-fold-search'):
C-s add M-c C-s
C-s C-s
The M-c of the first search does affect the case-sensitivity of the
second search, because of the phenomenon described above: C-s C-s
restores not only the search string from the previous search but also
the case-sensitivity of the search state.
In GNU Emacs 24.4.50.1 (i686-pc-mingw32)
of 2014-06-28 on ODIEONE
Bzr revision: 117431 rgm <at> gnu.org-20140628015517-eku6hj8mpgcvfnso
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
`configure --prefix=/c/Devel/emacs/snapshot/trunk
--enable-checking=yes,glyphs 'CFLAGS=-O0 -g3'
LDFLAGS=-Lc:/Devel/emacs/lib 'CPPFLAGS=-DGC_MCHECK=1
-Ic:/Devel/emacs/include''
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18017
; Package
emacs
.
(Mon, 14 Jul 2014 21:19:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 18017 <at> debbugs.gnu.org (full text, mbox):
> Type this in buffer *scratch*:
>
> Add
> add
> ADD
>
> M-x set-variable case-fold-search nil
>
> C-s add C-s
>
> C-s M-c C-s
>
> The M-c says that search is now case-insensitive, but the second and
> subsequent C-s's do not find occurrences Add and ADD.
>
> C-s add C-s
>
> That finds all three (case-insensitive).
Did you mean `C-s M-c add C-s' in the last key sequence
(that finds all case-insensitive)? You have to use M-c to toggle
case-sensitivity for case-fold-search that you set to nil.
And `C-s C-s' naturally restores case-sensitivity of the
previous search string, but it's possible to configure this
using `isearch-keep-mode-variables' from bug#11378.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18017
; Package
emacs
.
(Mon, 14 Jul 2014 22:40:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 18017 <at> debbugs.gnu.org (full text, mbox):
> > Add
> > add
> > ADD
> > M-x set-variable case-fold-search nil
> > C-s add C-s
> > C-s M-c C-s
> >
> > The M-c says that search is now case-insensitive, but the second and
> > subsequent C-s's do not find occurrences Add and ADD.
> >
> > C-s add C-s
> > That finds all three (case-insensitive).
>
> Did you mean `C-s M-c add C-s' in the last key sequence
> (that finds all case-insensitive)? You have to use M-c to toggle
> case-sensitivity for case-fold-search that you set to nil.
I meant that after you use C-s add M-c C-s and then you start again
with C-s C-s, the case insensitivity of the first search continues for
the second (independent) search. IOW, M-c *does* extend beyond the
current search, if you use C-s C-s to reuse the last search string.
From what I see, reusing the last search string really means, not
just reusing its text, but reusing the last search state, including
(at least) whether searching is case-sensitive.
> And `C-s C-s' naturally restores case-sensitivity of the
> previous search string, but it's possible to configure this
> using `isearch-keep-mode-variables' from bug#11378.
Dunno about "naturally". I'm really not sure what the best behavior
to shoot for is. It does seem to me that the current behavior can be
confusing. On the other hand, perhaps someone finds it handy to not
have to repeat M-c to get back the same sensitivity as for the last search.
Perhaps you and some others could play with this and make a suggestion
wrt the best behavior. And perhaps we should define whatever is
decided on as the _default_ behavior, and add a user option that lets
users choose. I'd welcome your ideas about this. Currently I think
the behavior is confusing and could probably be improved.
For non-nil `case-fold-search' I think the current behavior is OK.
But I suspect that less thought went into the behavior wrt
case-sensitivity for the nil case.
Note that things are additionally complicated for users because of
the (handy) special handling based on the case of the chars you type
(i.e., the special handling described in (emacs) `Special Isearch').
Emacs gives users lots of possibilities here, but _discovery_ of how
things work is not straightforward. It is all too easy to stumble
into behavior that one doesn't understand, especially for a newbie.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18017
; Package
emacs
.
(Wed, 14 Jul 2021 09:15:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 18017 <at> debbugs.gnu.org (full text, mbox):
Juri Linkov <juri <at> jurta.org> writes:
> Did you mean `C-s M-c add C-s' in the last key sequence
> (that finds all case-insensitive)? You have to use M-c to toggle
> case-sensitivity for case-fold-search that you set to nil.
> And `C-s C-s' naturally restores case-sensitivity of the
> previous search string, but it's possible to configure this
> using `isearch-keep-mode-variables' from bug#11378.
The patch from bug#11378 was apparently never applied? I think it
sounds like a good idea to let the user control whether `C-s C-s' should
also restore the case sensitivity of the previous match or not.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Forcibly Merged 11378 18017.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Wed, 14 Jul 2021 09:16:01 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18017
; Package
emacs
.
(Wed, 14 Jul 2021 23:42:02 GMT)
Full text and
rfc822 format available.
Message #19 received at 18017 <at> debbugs.gnu.org (full text, mbox):
>> Did you mean `C-s M-c add C-s' in the last key sequence
>> (that finds all case-insensitive)? You have to use M-c to toggle
>> case-sensitivity for case-fold-search that you set to nil.
>> And `C-s C-s' naturally restores case-sensitivity of the
>> previous search string, but it's possible to configure this
>> using `isearch-keep-mode-variables' from bug#11378.
>
> The patch from bug#11378 was apparently never applied? I think it
> sounds like a good idea to let the user control whether `C-s C-s' should
> also restore the case sensitivity of the previous match or not.
Recently Augusto proposed fresh ideas on emacs-devel
that could also be taken into account.
This bug report was last modified 3 years and 333 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.