From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kaushal Newsgroups: gmane.emacs.bugs Subject: bug#20687: 25.0.50; `perform-replace' should invoke a key that you have bound in `query-replace-map' Date: Wed, 03 Jun 2015 05:10:32 +0000 Message-ID: References: <890ac68c-1c71-49c7-9e60-45afba90d74a@default> <87zj4hsr90.fsf_-_@mail.linkov.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e0158bd92b0266705179614e5 X-Trace: ger.gmane.org 1433308285 17144 80.91.229.3 (3 Jun 2015 05:11:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 3 Jun 2015 05:11:25 +0000 (UTC) Cc: 20687@debbugs.gnu.org To: Drew Adams , Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jun 03 07:11:16 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Z00xM-0005r2-Hh for geb-bug-gnu-emacs@m.gmane.org; Wed, 03 Jun 2015 07:11:12 +0200 Original-Received: from localhost ([::1]:33485 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z00xL-00029Y-O8 for geb-bug-gnu-emacs@m.gmane.org; Wed, 03 Jun 2015 01:11:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56529) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z00xH-00029O-4O for bug-gnu-emacs@gnu.org; Wed, 03 Jun 2015 01:11:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z00xD-0002nI-Ru for bug-gnu-emacs@gnu.org; Wed, 03 Jun 2015 01:11:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:56379) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z00xD-0002n1-Nx for bug-gnu-emacs@gnu.org; Wed, 03 Jun 2015 01:11:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Z00xC-0004Ai-Am for bug-gnu-emacs@gnu.org; Wed, 03 Jun 2015 01:11:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Kaushal Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 03 Jun 2015 05:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20687 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 20687-submit@debbugs.gnu.org id=B20687.143330825516020 (code B ref 20687); Wed, 03 Jun 2015 05:11:02 +0000 Original-Received: (at 20687) by debbugs.gnu.org; 3 Jun 2015 05:10:55 +0000 Original-Received: from localhost ([127.0.0.1]:38120 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z00x2-0004AH-Rn for submit@debbugs.gnu.org; Wed, 03 Jun 2015 01:10:55 -0400 Original-Received: from mail-yh0-f50.google.com ([209.85.213.50]:34569) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z00wy-0004A2-IB for 20687@debbugs.gnu.org; Wed, 03 Jun 2015 01:10:50 -0400 Original-Received: by yhom41 with SMTP id m41so47090889yho.1 for <20687@debbugs.gnu.org>; Tue, 02 Jun 2015 22:10:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-type; bh=R3MdpKR3Q6APY6SFWdkfX8WiQBJw444z0wJ89Y3g+Ds=; b=xcEOQ6ypYe4lc0XyX1cyc5SkmSfp4JhaBz6Oszietj5sW+VFTOA8iVe83Igy++hGRx FyZwWK89Sbd4hk1YqvLXwat+QGCCNhJnsjgx4EN1CgQgpcKEY+Z3rMgfw4gB5pFG/6gx ms/SQs0QOvXYF+Qgi+q5p8ohjnPFNz/DlqUnse/qHywIsdNvDUAJiBuKnGM6QKk9f2w2 3v7X6ihKCnUfwXSVpG9Vq862Lv2m8DpELQcuzhUp/1Rfsgasmrl8jSwuwcVaiPve0s4V t8k1rHwHxFQqLVII5CM1zs/EHR6loSEVyLGiY+ZkLHFQAjThreu9vr49gZiK1P3Za7NU HPFQ== X-Received: by 10.236.43.207 with SMTP id l55mr32309970yhb.53.1433308243173; Tue, 02 Jun 2015 22:10:43 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:103531 Archived-At: --089e0158bd92b0266705179614e5 Content-Type: text/plain; charset=ISO-8859-1 > If the replacement string had uppercase chars then I always got the same message, which was very long - too long to read in the short time it was displayed. Could we shorten that message, please? Yes, I am looking for more ideas to get a better, shorter message. > And could we maybe have it logged to *Messages*, so that if someone doesn't have time to read it s?he can look it up? Only for the messages where toggling is not possible, the message can be logged to *Messages*. Sounds good? > If the replacement string had no uppercase chars then I always got the same message (about case-fold-search being nil). The toggling is not unconditional. Toggling case-replace/nocasify is very picky! So I had to put that (cond ..) statement there to handle the picky scenarios where toggling cannot happen even if the user wanted to. For the above case, nocasify will stay t regardless of the value of case-replace IF the user has set case-fold-search to nil. So the user will first need to do M-c (toggle case-fold-search to t) and then do M-r. That too will not work IF the user has used upper case letter in the search/regexp string or the replacement string. This is the ideal case for M-r to always toggle nocasify 1. case-fold-search is t 2. all lower case in search/regexp string 3. all lower case in replacement string > What is `M-r' really supposed to do? I don't see how it is a toggle, if repeating it always gives the same message, given the same replacement string. Can you describe what the toggling or cycling among states is supposed to do/mean? As described above, we cannot unconditionally toggle nocasify.. it depends on a bunch of conditions to be right. > I think Juri is right, that it should be the following, because `lookup-key' can return a number if the key is too long: ((commandp def t) ; User-defined key, invoke it. (call-interactively def)) I agree. Will make the change. > If one of you could replace the paragraphs of the doc that I mentioned by just a statement that search is controlled by `case-fold-search', that would be good. You could then add that you can toggle this using `M-c' etc. IOW, (1) those paragraphs are useless, and (2) now we have something more to say about case sensitivity. Case fold toggling is also a bit picky but the results are obvious, and M-c can force toggle case-fold-search. But default, search-upper-case is t. So if the user has a string with an upper case in the search field of query-replace, case-fold-search will be set to nil automatically (even if it is `t` by default). Then M-r will not work in the beginning. User can, though, use M-c to toggle case-fold-search first and then M-r if they wish. I found the current documentation useful while working on this patch and testing it out. But I will give it a one more read to try to improve it. On Wed, Jun 3, 2015 at 12:39 AM Drew Adams wrote: > > I tested this out and the M-c and M-r bindings work great. It now > > also gives clear info on what the user should expect after that > > binding is used. Please give it a try. I have still kept this line > > > > (def (call-interactively def)) ; User-defined key, invoke it. > > > > as it could be useful to bind any other function from outside > > that does not need internal variables. > > 1. I'm OK with whatever you guys come up with. Thanks for working > on this. > > 2. I tried it only a little. When I tried `M-r': > > * If the replacement string had uppercase chars then I always > got the same message, which was very long - too long to read > in the short time it was displayed. Could we shorten that > message, please? And could we maybe have it logged to > *Messages*, so that if someone doesn't have time to read it > s?he can look it up? > > * If the replacement string had no uppercase chars then I always > got the same message (about case-fold-search being nil). > > What is `M-r' really supposed to do? I don't see how it is a > toggle, if repeating it always gives the same message, given > the same replacement string. Can you describe what the toggling > or cycling among states is supposed to do/mean? > > 3. Wrt this: > > I have still kept this line > (def (call-interactively def)) ; User-defined key, invoke it. > as it could be useful to bind any other function from outside > that does not need internal variables. > > I think Juri is right, that it should be the following, because > `lookup-key' can return a number if the key is too long: > > ((commandp def t) ; User-defined key, invoke it. > (call-interactively def)) > > 4. If one of you could replace the paragraphs of the doc that I > mentioned by just a statement that search is controlled by > `case-fold-search', that would be good. You could then add > that you can toggle this using `M-c' etc. IOW, (1) those > paragraphs are useless, and (2) now we have something more > to say about case sensitivity. > --089e0158bd92b0266705179614e5 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
> If the replacem= ent string had uppercase chars then I always
=A0 =A0 =A0got the same mes= sage, which was very long - too long to read
=A0 =A0 =A0in the short tim= e it was displayed.=A0 Could we shorten that
=A0 =A0 =A0message, please?= =A0
Yes, I am looking for more ideas to get a bet= ter, shorter message.

> =A0And could we maybe have it logged to
=A0 =A0 =A0*Messages*, = so that if someone doesn't have time to read it
=A0 =A0 =A0s?he can = look it up?
Only for the messages where toggling is not possible, the me= ssage can be logged to *Messages*. Sounds good?

> If the replacem= ent string had no uppercase chars then I always
=A0 =A0 =A0got the same = message (about case-fold-search being nil).
The toggling is not uncondit= ional. Toggling case-replace/nocasify is very picky!
So I had to put that (cond ..) statement there to handle the picky scen= arios where toggling cannot happen even if the user wanted to.

For the above case, nocasify w= ill stay t regardless of the value of case-replace IF the user has set case= -fold-search to nil.
So the user will first need = to do M-c (toggle case-fold-search to t) and then do M-r. That too will not= work IF the user has used upper case letter in the search/regexp string or= the replacement string.

This is the ideal case for M-r to always toggle nocasify
1. case-fold-search is t
2. all lo= wer case in search/regexp string
3. all lower cas= e in replacement string

> =A0 What is `M-r= ' really supposed to do?=A0 I don't see how it is a
=A0 =A0toggl= e, if repeating it always gives the same message, given
=A0 =A0the same = replacement string.=A0 Can you describe what the toggling
=A0 =A0or cycl= ing among states is supposed to do/mean?

As described above, we cann= ot unconditionally toggle nocasify.. it depends on a bunch of conditions to= be right.

> =A0 I think Juri is right, t= hat it should be the following, because
=A0 =A0`lookup-key' can return a number if the= key is too long:

=A0 =A0((commandp def t)=A0 =A0 =A0 =A0 =A0 ; User= -defined key, invoke it.
=A0 =A0 (call-interactively def))

I agre= e. Will make the change.

> If one of you c= ould replace the paragraphs of the doc that I
=A0 =A0mentioned by just a= statement that search is controlled by
=A0 =A0`case-fold-search', t= hat would be good. You could then add
=A0 =A0that you can toggle this us= ing `M-c' etc. IOW, (1) those
=A0 =A0paragraphs are useless, and (2)= now we have something more
=A0 =A0to say about case sensitivity.
<= div class=3D"F3hlO">
Case fold toggling is al= so a bit picky but the results are obvious, and M-c can force toggle case-f= old-search.

But de= fault, search-upper-case is t. So if the user has a string with an upper ca= se in the search field of query-replace, case-fold-search will be set to ni= l automatically (even if it is `t` by default). Then M-r will not work in t= he beginning. User can, though, use M-c to toggle case-fold-search first an= d then M-r if they wish.

I found the current documentation useful while working on this patch= and testing it out. But I will give it a one more read to try to improve i= t.

On Wed,= Jun 3, 2015 at 12:39 AM Drew Adams <drew.adams@oracle.com> wrote:
> I tested this out and the M-c and M-r bindings work great. It = now
> also gives clear info on what the user should expect after that
> binding is used. Please give it a try. I have still kept this line
>
> =A0(def (call-interactively def)) ; User-defined key, invoke it.
>
> as it could be useful to bind any other function from outside
> that does not need internal variables.

1. I'm OK with whatever you guys come up with.=A0 Thanks for working =A0 =A0on this.

2. I tried it only a little.=A0 When I tried `M-r':

=A0 =A0* If the replacement string had uppercase chars then I always
=A0 =A0 =A0got the same message, which was very long - too long to read
=A0 =A0 =A0in the short time it was displayed.=A0 Could we shorten that
=A0 =A0 =A0message, please?=A0 And could we maybe have it logged to
=A0 =A0 =A0*Messages*, so that if someone doesn't have time to read it<= br> =A0 =A0 =A0s?he can look it up?

=A0 =A0* If the replacement string had no uppercase chars then I always
=A0 =A0 =A0got the same message (about case-fold-search being nil).

=A0 =A0What is `M-r' really supposed to do?=A0 I don't see how it i= s a
=A0 =A0toggle, if repeating it always gives the same message, given
=A0 =A0the same replacement string.=A0 Can you describe what the toggling =A0 =A0or cycling among states is supposed to do/mean?

3. Wrt this:

=A0 =A0 =A0 I have still kept this line
=A0 =A0 =A0 (def (call-interactively def)) ; User-defined key, invoke it. =A0 =A0 =A0 as it could be useful to bind any other function from outside =A0 =A0 =A0 that does not need internal variables.

=A0 =A0I think Juri is right, that it should be the following, because
=A0 =A0`lookup-key' can return a number if the key is too long:

=A0 =A0((commandp def t)=A0 =A0 =A0 =A0 =A0 ; User-defined key, invoke it.<= br> =A0 =A0 (call-interactively def))

4. If one of you could replace the paragraphs of the doc that I
=A0 =A0mentioned by just a statement that search is controlled by
=A0 =A0`case-fold-search', that would be good. You could then add
=A0 =A0that you can toggle this using `M-c' etc. IOW, (1) those
=A0 =A0paragraphs are useless, and (2) now we have something more
=A0 =A0to say about case sensitivity.
--089e0158bd92b0266705179614e5--