unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#16913: Please extend case-fold-search on-the-fly toggling
@ 2014-03-01 11:48 Reuben Thomas
  2022-05-11 13:11 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 18+ messages in thread
From: Reuben Thomas @ 2014-03-01 11:48 UTC (permalink / raw)
  To: 16913

[-- Attachment #1: Type: text/plain, Size: 404 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 502 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#16913: Please extend case-fold-search on-the-fly toggling
  2014-03-01 11:48 bug#16913: Please extend case-fold-search on-the-fly toggling Reuben Thomas
@ 2022-05-11 13:11 ` Lars Ingebrigtsen
  2022-05-11 14:10   ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-05-11 17:12   ` Juri Linkov
  0 siblings, 2 replies; 18+ messages in thread
From: Lars Ingebrigtsen @ 2022-05-11 13:11 UTC (permalink / raw)
  To: Reuben Thomas; +Cc: 16913

Reuben Thomas <rrt@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





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#16913: Please extend case-fold-search on-the-fly toggling
  2022-05-11 13:11 ` Lars Ingebrigtsen
@ 2022-05-11 14:10   ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-05-11 17:12   ` Juri Linkov
  1 sibling, 0 replies; 18+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-05-11 14:10 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 16913

[-- Attachment #1: Type: text/plain, Size: 601 bytes --]

On Wed, 11 May 2022 at 14:11, Lars Ingebrigtsen <larsi@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

[-- Attachment #2: Type: text/html, Size: 1659 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#16913: Please extend case-fold-search on-the-fly toggling
  2022-05-11 13:11 ` Lars Ingebrigtsen
  2022-05-11 14:10   ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-05-11 17:12   ` Juri Linkov
  2022-05-11 18:42     ` Lars Ingebrigtsen
  1 sibling, 1 reply; 18+ messages in thread
From: Juri Linkov @ 2022-05-11 17:12 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 16913, Reuben Thomas

> 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.





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#16913: Please extend case-fold-search on-the-fly toggling
  2022-05-11 17:12   ` Juri Linkov
@ 2022-05-11 18:42     ` Lars Ingebrigtsen
  2022-05-12 16:46       ` Juri Linkov
  0 siblings, 1 reply; 18+ messages in thread
From: Lars Ingebrigtsen @ 2022-05-11 18:42 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 16913, Reuben Thomas

Juri Linkov <juri@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





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#16913: Please extend case-fold-search on-the-fly toggling
  2022-05-11 18:42     ` Lars Ingebrigtsen
@ 2022-05-12 16:46       ` Juri Linkov
  2022-05-12 17:42         ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 18+ messages in thread
From: Juri Linkov @ 2022-05-12 16:46 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 16913, Reuben Thomas

>> 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)))
```





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#16913: Please extend case-fold-search on-the-fly toggling
  2022-05-12 16:46       ` Juri Linkov
@ 2022-05-12 17:42         ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-05-13 12:36           ` Lars Ingebrigtsen
  0 siblings, 1 reply; 18+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-05-12 17:42 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Lars Ingebrigtsen, 16913

[-- Attachment #1: Type: text/plain, Size: 464 bytes --]

On Thu, 12 May 2022 at 18:07, Juri Linkov <juri@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

[-- Attachment #2: Type: text/html, Size: 1062 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#16913: Please extend case-fold-search on-the-fly toggling
  2022-05-12 17:42         ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-05-13 12:36           ` Lars Ingebrigtsen
  2022-05-13 17:00             ` Juri Linkov
  0 siblings, 1 reply; 18+ messages in thread
From: Lars Ingebrigtsen @ 2022-05-13 12:36 UTC (permalink / raw)
  To: Reuben Thomas; +Cc: 16913, Juri Linkov

Reuben Thomas <rrt@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





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#16913: Please extend case-fold-search on-the-fly toggling
  2022-05-13 12:36           ` Lars Ingebrigtsen
@ 2022-05-13 17:00             ` Juri Linkov
  2022-05-13 17:35               ` Lars Ingebrigtsen
  0 siblings, 1 reply; 18+ messages in thread
From: Juri Linkov @ 2022-05-13 17:00 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 16913, Reuben Thomas

>> 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?





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#16913: Please extend case-fold-search on-the-fly toggling
  2022-05-13 17:00             ` Juri Linkov
@ 2022-05-13 17:35               ` Lars Ingebrigtsen
  2022-06-13 13:34                 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 18+ messages in thread
From: Lars Ingebrigtsen @ 2022-05-13 17:35 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 16913, Reuben Thomas

Juri Linkov <juri@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





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#16913: Please extend case-fold-search on-the-fly toggling
  2022-05-13 17:35               ` Lars Ingebrigtsen
@ 2022-06-13 13:34                 ` Lars Ingebrigtsen
  2022-06-13 15:42                   ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-06-13 17:10                   ` Juri Linkov
  0 siblings, 2 replies; 18+ messages in thread
From: Lars Ingebrigtsen @ 2022-06-13 13:34 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 16913, Reuben Thomas

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Juri Linkov <juri@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





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#16913: Please extend case-fold-search on-the-fly toggling
  2022-06-13 13:34                 ` Lars Ingebrigtsen
@ 2022-06-13 15:42                   ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-06-13 17:10                   ` Juri Linkov
  1 sibling, 0 replies; 18+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-06-13 15:42 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 16913, Juri Linkov

[-- Attachment #1: Type: text/plain, Size: 336 bytes --]

On Mon, 13 Jun 2022 at 14:34, Lars Ingebrigtsen <larsi@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

[-- Attachment #2: Type: text/html, Size: 933 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#16913: Please extend case-fold-search on-the-fly toggling
  2022-06-13 13:34                 ` Lars Ingebrigtsen
  2022-06-13 15:42                   ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-06-13 17:10                   ` Juri Linkov
  2022-06-13 17:23                     ` Lars Ingebrigtsen
  2022-06-13 17:53                     ` Drew Adams
  1 sibling, 2 replies; 18+ messages in thread
From: Juri Linkov @ 2022-06-13 17:10 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 16913, Reuben Thomas

> 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 …’.





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#16913: Please extend case-fold-search on-the-fly toggling
  2022-06-13 17:10                   ` Juri Linkov
@ 2022-06-13 17:23                     ` Lars Ingebrigtsen
  2022-06-13 17:55                       ` Drew Adams
  2022-06-13 18:11                       ` Juri Linkov
  2022-06-13 17:53                     ` Drew Adams
  1 sibling, 2 replies; 18+ messages in thread
From: Lars Ingebrigtsen @ 2022-06-13 17:23 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 16913, Reuben Thomas

Juri Linkov <juri@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





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#16913: Please extend case-fold-search on-the-fly toggling
  2022-06-13 17:10                   ` Juri Linkov
  2022-06-13 17:23                     ` Lars Ingebrigtsen
@ 2022-06-13 17:53                     ` Drew Adams
  1 sibling, 0 replies; 18+ messages in thread
From: Drew Adams @ 2022-06-13 17:53 UTC (permalink / raw)
  To: Juri Linkov, Lars Ingebrigtsen; +Cc: 16913@debbugs.gnu.org, Reuben Thomas

> > 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.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#16913: Please extend case-fold-search on-the-fly toggling
  2022-06-13 17:23                     ` Lars Ingebrigtsen
@ 2022-06-13 17:55                       ` Drew Adams
  2022-06-13 18:11                       ` Juri Linkov
  1 sibling, 0 replies; 18+ messages in thread
From: Drew Adams @ 2022-06-13 17:55 UTC (permalink / raw)
  To: Lars Ingebrigtsen, Juri Linkov; +Cc: 16913@debbugs.gnu.org, Reuben Thomas

> > 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.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#16913: Please extend case-fold-search on-the-fly toggling
  2022-06-13 17:23                     ` Lars Ingebrigtsen
  2022-06-13 17:55                       ` Drew Adams
@ 2022-06-13 18:11                       ` Juri Linkov
  2022-06-14 12:03                         ` Lars Ingebrigtsen
  1 sibling, 1 reply; 18+ messages in thread
From: Juri Linkov @ 2022-06-13 18:11 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 16913, Reuben Thomas

>> 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.





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#16913: Please extend case-fold-search on-the-fly toggling
  2022-06-13 18:11                       ` Juri Linkov
@ 2022-06-14 12:03                         ` Lars Ingebrigtsen
  0 siblings, 0 replies; 18+ messages in thread
From: Lars Ingebrigtsen @ 2022-06-14 12:03 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 16913, Reuben Thomas

Juri Linkov <juri@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





^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2022-06-14 12:03 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-01 11:48 bug#16913: Please extend case-fold-search on-the-fly toggling Reuben Thomas
2022-05-11 13:11 ` Lars Ingebrigtsen
2022-05-11 14:10   ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-11 17:12   ` Juri Linkov
2022-05-11 18:42     ` Lars Ingebrigtsen
2022-05-12 16:46       ` Juri Linkov
2022-05-12 17:42         ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-13 12:36           ` Lars Ingebrigtsen
2022-05-13 17:00             ` Juri Linkov
2022-05-13 17:35               ` Lars Ingebrigtsen
2022-06-13 13:34                 ` Lars Ingebrigtsen
2022-06-13 15:42                   ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-13 17:10                   ` Juri Linkov
2022-06-13 17:23                     ` Lars Ingebrigtsen
2022-06-13 17:55                       ` Drew Adams
2022-06-13 18:11                       ` Juri Linkov
2022-06-14 12:03                         ` Lars Ingebrigtsen
2022-06-13 17:53                     ` Drew Adams

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).