GNU bug report logs - #16913
Please extend case-fold-search on-the-fly toggling

Previous Next

Package: emacs;

Reported by: Reuben Thomas <rrt <at> sc3d.org>

Date: Sat, 1 Mar 2014 11:49:02 UTC

Severity: wishlist

Tags: moreinfo

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 16913 in the body.
You can then email your comments to 16913 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#16913; Package emacs. (Sat, 01 Mar 2014 11:49:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Reuben Thomas <rrt <at> sc3d.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 01 Mar 2014 11:49:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Reuben Thomas <rrt <at> sc3d.org>
To: bug-emacs <bug-emacs <at> gnu.org>
Subject: Please extend case-fold-search on-the-fly toggling
Date: Sat, 1 Mar 2014 11:48:17 +0000
[Message part 1 (text/plain, inline)]
I have started using rgrep a lot recently, but I notice that the only way
to change its case sensitivity, other than manually editing the grep
command, is to change case-fold-search.

isearch now has the ability to toggle case-fold-search for a single search
using M-c; please could we have something like this in all (or at least
many more!) commands that use case-fold-search?

-- 
http://rrt.sc3d.org
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16913; Package emacs. (Wed, 11 May 2022 13:13:01 GMT) Full text and rfc822 format available.

Message #8 received at 16913 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Reuben Thomas <rrt <at> sc3d.org>
Cc: 16913 <at> debbugs.gnu.org
Subject: Re: bug#16913: Please extend case-fold-search on-the-fly toggling
Date: Wed, 11 May 2022 15:11:51 +0200
Reuben Thomas <rrt <at> sc3d.org> writes:

> I have started using rgrep a lot recently, but I notice that the only
> way to change its case sensitivity, other than manually editing the
> grep command, is to change case-fold-search.
>
> isearch now has the ability to toggle case-fold-search for a single
> search using M-c; please could we have something like this in all (or
> at least many more!) commands that use case-fold-search?

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

I'm not sure how the rgrep command could be extended here -- do you mean
that the user should type `M-c' at the first prompt to change
case-fold-search?  Or perhaps alter `read-regexp' to bind `M-c' to alter
case-fold-search?

Hm...  The latter seems like it could be generally useful, but I don't
see any practical way of implementing it.  I mean, we can't just set
case-fold-search here, because that would require all read-regexp
callers to bind it first.

Hm.  Anybody got any ideas?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 11 May 2022 13:13:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16913; Package emacs. (Wed, 11 May 2022 14:11:01 GMT) Full text and rfc822 format available.

Message #13 received at 16913 <at> debbugs.gnu.org (full text, mbox):

From: Reuben Thomas <rrt <at> sc3d.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 16913 <at> debbugs.gnu.org
Subject: Re: bug#16913: Please extend case-fold-search on-the-fly toggling
Date: Wed, 11 May 2022 15:10:21 +0100
[Message part 1 (text/plain, inline)]
On Wed, 11 May 2022 at 14:11, Lars Ingebrigtsen <larsi <at> gnus.org> wrote:

>
> I'm not sure how the rgrep command could be extended here -- do you mean
> that the user should type `M-c' at the first prompt to change
> case-fold-search?  Or perhaps alter `read-regexp' to bind `M-c' to alter
> case-fold-search?
>

Sorry, it's been a while since I wrote the report, and these days I mostly
use a front-end to "git grep".

It would be really cool if you could find a design that works at the level
of read-regexp.

Thanks once again for your determined work on the bugs backlog!

-- 
https://rrt.sc3d.org
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16913; Package emacs. (Wed, 11 May 2022 17:23:01 GMT) Full text and rfc822 format available.

Message #16 received at 16913 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 16913 <at> debbugs.gnu.org, Reuben Thomas <rrt <at> sc3d.org>
Subject: Re: bug#16913: Please extend case-fold-search on-the-fly toggling
Date: Wed, 11 May 2022 20:12:32 +0300
> I'm not sure how the rgrep command could be extended here -- do you mean
> that the user should type `M-c' at the first prompt to change
> case-fold-search?  Or perhaps alter `read-regexp' to bind `M-c' to alter
> case-fold-search?
>
> Hm...  The latter seems like it could be generally useful, but I don't
> see any practical way of implementing it.  I mean, we can't just set
> case-fold-search here, because that would require all read-regexp
> callers to bind it first.
>
> Hm.  Anybody got any ideas?

When sometimes necessary to toggle case sensitivity, I use 'C-u rgrep'
and edit the command line by adding/removing "-i" before running grep.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16913; Package emacs. (Wed, 11 May 2022 18:44:02 GMT) Full text and rfc822 format available.

Message #19 received at 16913 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: 16913 <at> debbugs.gnu.org, Reuben Thomas <rrt <at> sc3d.org>
Subject: Re: bug#16913: Please extend case-fold-search on-the-fly toggling
Date: Wed, 11 May 2022 20:42:43 +0200
Juri Linkov <juri <at> linkov.net> writes:

> When sometimes necessary to toggle case sensitivity, I use 'C-u rgrep'
> and edit the command line by adding/removing "-i" before running grep.

Yes, Reuben mentioned that in the bug report as an unsatisfactory
interface, and I agree -- the prompt is over 1K long by default.  You
can't expect users to deal with that.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16913; Package emacs. (Thu, 12 May 2022 17:09:02 GMT) Full text and rfc822 format available.

Message #22 received at 16913 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 16913 <at> debbugs.gnu.org, Reuben Thomas <rrt <at> sc3d.org>
Subject: Re: bug#16913: Please extend case-fold-search on-the-fly toggling
Date: Thu, 12 May 2022 19:46:33 +0300
>> When sometimes necessary to toggle case sensitivity, I use 'C-u rgrep'
>> and edit the command line by adding/removing "-i" before running grep.
>
> Yes, Reuben mentioned that in the bug report as an unsatisfactory
> interface, and I agree -- the prompt is over 1K long by default.  You
> can't expect users to deal with that.

It's easier to write own simple command than to learn a new key, e.g.

```
(defun irgrep ()
  (interactive)
  (let ((case-fold-search nil))
    (call-interactively 'rgrep)))
```




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16913; Package emacs. (Thu, 12 May 2022 17:44:01 GMT) Full text and rfc822 format available.

Message #25 received at 16913 <at> debbugs.gnu.org (full text, mbox):

From: Reuben Thomas <rrt <at> sc3d.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 16913 <at> debbugs.gnu.org
Subject: Re: bug#16913: Please extend case-fold-search on-the-fly toggling
Date: Thu, 12 May 2022 18:42:59 +0100
[Message part 1 (text/plain, inline)]
On Thu, 12 May 2022 at 18:07, Juri Linkov <juri <at> linkov.net> wrote:

> It's easier to write own simple command than to learn a new key, e.g.
>
> ```
> (defun irgrep ()
>   (interactive)
>   (let ((case-fold-search nil))
>     (call-interactively 'rgrep)))
> ```
>

The idea was to add the capability to do case-insensitive matching to all
commands that read regexs. The list of simple commands one would have to
write could be quite long!

-- 
https://rrt.sc3d.org
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16913; Package emacs. (Fri, 13 May 2022 12:37:02 GMT) Full text and rfc822 format available.

Message #28 received at 16913 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Reuben Thomas <rrt <at> sc3d.org>
Cc: 16913 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#16913: Please extend case-fold-search on-the-fly toggling
Date: Fri, 13 May 2022 14:36:06 +0200
Reuben Thomas <rrt <at> sc3d.org> writes:

> The idea was to add the capability to do case-insensitive matching to
> all commands that read regexs. The list of simple commands one would
> have to write could be quite long!

Yup.  I don't know what the best way for `read-regexp' to communicate
this back up to the caller, though.  Perhaps the easiest would be to
just add a new optional parameter to `read-regexp' that would make it
activate the `M-c' key binding, and then return a list that has both the
regexp we read and whether the user used a case twiddling command.

Callers like rgrep would have to be changed, but that's the case anyway.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16913; Package emacs. (Fri, 13 May 2022 17:07:01 GMT) Full text and rfc822 format available.

Message #31 received at 16913 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 16913 <at> debbugs.gnu.org, Reuben Thomas <rrt <at> sc3d.org>
Subject: Re: bug#16913: Please extend case-fold-search on-the-fly toggling
Date: Fri, 13 May 2022 20:00:55 +0300
>> The idea was to add the capability to do case-insensitive matching to
>> all commands that read regexs. The list of simple commands one would
>> have to write could be quite long!
>
> Yup.  I don't know what the best way for `read-regexp' to communicate
> this back up to the caller, though.  Perhaps the easiest would be to
> just add a new optional parameter to `read-regexp' that would make it
> activate the `M-c' key binding, and then return a list that has both the
> regexp we read and whether the user used a case twiddling command.

Maybe `read-regexp' could modify some global variable?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16913; Package emacs. (Fri, 13 May 2022 17:37:02 GMT) Full text and rfc822 format available.

Message #34 received at 16913 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: 16913 <at> debbugs.gnu.org, Reuben Thomas <rrt <at> sc3d.org>
Subject: Re: bug#16913: Please extend case-fold-search on-the-fly toggling
Date: Fri, 13 May 2022 19:35:56 +0200
Juri Linkov <juri <at> linkov.net> writes:

> Maybe `read-regexp' could modify some global variable?

Like read-regexp-last-case-fold-setting or something?  I guess that's
possible, but it feels rather hacky...

We could add an extra parameter that would make read-regexp alter
`case-fold-search', and then callers (that used that parameter) would
have to bind case-fold-search around the call, but that feels like it
could be very error-prone.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16913; Package emacs. (Mon, 13 Jun 2022 13:35:02 GMT) Full text and rfc822 format available.

Message #37 received at 16913 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: 16913 <at> debbugs.gnu.org, Reuben Thomas <rrt <at> sc3d.org>
Subject: Re: bug#16913: Please extend case-fold-search on-the-fly toggling
Date: Mon, 13 Jun 2022 15:34:11 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Juri Linkov <juri <at> linkov.net> writes:
>
>> Maybe `read-regexp' could modify some global variable?
>
> Like read-regexp-last-case-fold-setting or something?  I guess that's
> possible, but it feels rather hacky...
>
> We could add an extra parameter that would make read-regexp alter
> `case-fold-search', and then callers (that used that parameter) would
> have to bind case-fold-search around the call, but that feels like it
> could be very error-prone.

I forgot the classic Emacs Lisp way of returning several values: Using
text properties.  >"?

So I've now added an `M-c' command to `read-regexp' and made `rgrep'
heed that in Emacs 29.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 29.1, send any further explanations to 16913 <at> debbugs.gnu.org and Reuben Thomas <rrt <at> sc3d.org> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 13 Jun 2022 13:35:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16913; Package emacs. (Mon, 13 Jun 2022 15:43:02 GMT) Full text and rfc822 format available.

Message #42 received at 16913 <at> debbugs.gnu.org (full text, mbox):

From: Reuben Thomas <rrt <at> sc3d.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 16913 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#16913: Please extend case-fold-search on-the-fly toggling
Date: Mon, 13 Jun 2022 16:42:03 +0100
[Message part 1 (text/plain, inline)]
On Mon, 13 Jun 2022 at 14:34, Lars Ingebrigtsen <larsi <at> gnus.org> wrote:

>
> I forgot the classic Emacs Lisp way of returning several values: Using
> text properties.  >"?
>
> So I've now added an `M-c' command to `read-regexp' and made `rgrep'
> heed that in Emacs 29.
>

Great, thanks; I look forward to it!

-- 
https://rrt.sc3d.org
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16913; Package emacs. (Mon, 13 Jun 2022 17:22:01 GMT) Full text and rfc822 format available.

Message #45 received at 16913 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 16913 <at> debbugs.gnu.org, Reuben Thomas <rrt <at> sc3d.org>
Subject: Re: bug#16913: Please extend case-fold-search on-the-fly toggling
Date: Mon, 13 Jun 2022 20:10:14 +0300
> So I've now added an `M-c' command to `read-regexp' and made `rgrep'
> heed that in Emacs 29.

Are you sure no one might want to use the global binding of M-c
to capitalize words in the minibuffer?  While redefining it
for read-regexp is fine, we need to allow disabling it,
so I suggest to add ‘(defvar-keymap read-regexp-map …’.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16913; Package emacs. (Mon, 13 Jun 2022 17:24:03 GMT) Full text and rfc822 format available.

Message #48 received at 16913 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: 16913 <at> debbugs.gnu.org, Reuben Thomas <rrt <at> sc3d.org>
Subject: Re: bug#16913: Please extend case-fold-search on-the-fly toggling
Date: Mon, 13 Jun 2022 19:23:25 +0200
Juri Linkov <juri <at> linkov.net> writes:

>> So I've now added an `M-c' command to `read-regexp' and made `rgrep'
>> heed that in Emacs 29.
>
> Are you sure no one might want to use the global binding of M-c
> to capitalize words in the minibuffer?  While redefining it
> for read-regexp is fine, we need to allow disabling it,
> so I suggest to add ‘(defvar-keymap read-regexp-map …’.

It seemed unlikely to me, and it makes the definition much simpler
(because of closures), so I didn't make a map for this.

I.e., I don't think anybody is going to bother to change this binding.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16913; Package emacs. (Mon, 13 Jun 2022 17:54:01 GMT) Full text and rfc822 format available.

Message #51 received at 16913 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Juri Linkov <juri <at> linkov.net>, Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: "16913 <at> debbugs.gnu.org" <16913 <at> debbugs.gnu.org>,
 Reuben Thomas <rrt <at> sc3d.org>
Subject: RE: [External] : bug#16913: Please extend case-fold-search on-the-fly
 toggling
Date: Mon, 13 Jun 2022 17:53:09 +0000
> > So I've now added an `M-c' command to `read-regexp' and made `rgrep'
> > heed that in Emacs 29.
> 
> Are you sure no one might want to use the global binding of M-c
> to capitalize words in the minibuffer?  While redefining it
> for read-regexp is fine, we need to allow disabling it,
> so I suggest to add ‘(defvar-keymap read-regexp-map …’.

(Sorry, I'm not following this thread.)

Please do _not_ co-opt global keys that can be used
in the minibuffer to edit input text.  The
minibuffer is above all a buffer for editing text.

If this is being done, it's shortsighted, IMO.

Too many people have too-limited an idea of what
the minibuffer is, is for, and how it can be used.
It's an extremely general, bendable, configurable
UI tool.

The more you impose key bindings in its map(s), the
more difficult you make it for users and libraries
to mold its behavior for particular uses or to
accommodate particular preferences.

If you really feel you must provide such a limited
way of interacting with a minibuffer, please do it
with a minor mode or a user option.

Please don't default-bind keys in the minibuffer
maps, especially keys for editing, searching,
query-replacing, etc. buffer text.  Force yourself,
if you must, to think of the minibuffer as an
ordinary text-editing buffer.

A minibuffer map that's particular to reading a
particular thing (e.g. a regexp) can arguably be
more open to key bindings that are specific to its
purpose.

But what Juri says here is 100% true, IMO.  Users
should be able to use normal editing keys, including
`M-C', on the minibuffer text when reading a regexp.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16913; Package emacs. (Mon, 13 Jun 2022 17:56:02 GMT) Full text and rfc822 format available.

Message #54 received at 16913 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>, Juri Linkov <juri <at> linkov.net>
Cc: "16913 <at> debbugs.gnu.org" <16913 <at> debbugs.gnu.org>,
 Reuben Thomas <rrt <at> sc3d.org>
Subject: RE: [External] : bug#16913: Please extend case-fold-search on-the-fly
 toggling
Date: Mon, 13 Jun 2022 17:55:31 +0000
> > Are you sure no one might want to use the global binding of M-c
> > to capitalize words in the minibuffer?  While redefining it
> > for read-regexp is fine, we need to allow disabling it,
> > so I suggest to add ‘(defvar-keymap read-regexp-map …’.
> 
> It seemed unlikely to me, and it makes the definition much simpler
> (because of closures), so I didn't make a map for this.
> 
> I.e., I don't think anybody is going to bother to change this binding.

Too bad.  Short-sighted.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16913; Package emacs. (Mon, 13 Jun 2022 18:14:02 GMT) Full text and rfc822 format available.

Message #57 received at 16913 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 16913 <at> debbugs.gnu.org, Reuben Thomas <rrt <at> sc3d.org>
Subject: Re: bug#16913: Please extend case-fold-search on-the-fly toggling
Date: Mon, 13 Jun 2022 21:11:05 +0300
>> Are you sure no one might want to use the global binding of M-c
>> to capitalize words in the minibuffer?  While redefining it
>> for read-regexp is fine, we need to allow disabling it,
>> so I suggest to add ‘(defvar-keymap read-regexp-map …’.
>
> It seemed unlikely to me, and it makes the definition much simpler
> (because of closures), so I didn't make a map for this.

It's easy to toggle a (mini)buffer-local variable like toggling in isearch does.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16913; Package emacs. (Tue, 14 Jun 2022 12:04:01 GMT) Full text and rfc822 format available.

Message #60 received at 16913 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: 16913 <at> debbugs.gnu.org, Reuben Thomas <rrt <at> sc3d.org>
Subject: Re: bug#16913: Please extend case-fold-search on-the-fly toggling
Date: Tue, 14 Jun 2022 14:03:18 +0200
Juri Linkov <juri <at> linkov.net> writes:

>>> Are you sure no one might want to use the global binding of M-c
>>> to capitalize words in the minibuffer?  While redefining it
>>> for read-regexp is fine, we need to allow disabling it,
>>> so I suggest to add ‘(defvar-keymap read-regexp-map …’.
>>
>> It seemed unlikely to me, and it makes the definition much simpler
>> (because of closures), so I didn't make a map for this.
>
> It's easy to toggle a (mini)buffer-local variable like toggling in
> isearch does.

Sure, so if somebody wants to be able to change the binding here,
rewriting shouldn't be all that much work.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 13 Jul 2022 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 281 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.