From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 25 20:30:10 2012 Received: (at submit) by debbugs.gnu.org; 26 Feb 2012 01:30:10 +0000 Received: from localhost ([127.0.0.1]:56560 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1SwD-0007Zc-Rs for submit@debbugs.gnu.org; Sat, 25 Feb 2012 20:30:10 -0500 Received: from eggs.gnu.org ([208.118.235.92]:35829) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1SYb-0006rc-GV for submit@debbugs.gnu.org; Sat, 25 Feb 2012 20:05:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S1SVs-0000Pz-Tl for submit@debbugs.gnu.org; Sat, 25 Feb 2012 20:03:02 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([140.186.70.17]:52214) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S1SVs-0000Pu-QJ for submit@debbugs.gnu.org; Sat, 25 Feb 2012 20:02:56 -0500 Received: from eggs.gnu.org ([208.118.235.92]:42640) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S1SVn-0007Fh-Md for Bug-gnu-emacs@gnu.org; Sat, 25 Feb 2012 20:02:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S1SVi-0000PS-Fj for Bug-gnu-emacs@gnu.org; Sat, 25 Feb 2012 20:02:51 -0500 Received: from sam.nabble.com ([216.139.236.26]:34728) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S1SVi-0000PO-Ax for Bug-gnu-emacs@gnu.org; Sat, 25 Feb 2012 20:02:46 -0500 Received: from isper.nabble.com ([192.168.236.156]) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1S1SVh-0006bU-7K for Bug-gnu-emacs@gnu.org; Sat, 25 Feb 2012 17:02:45 -0800 Message-ID: <33392837.post@talk.nabble.com> Date: Sat, 25 Feb 2012 17:02:45 -0800 (PST) From: linuxfever To: Bug-gnu-emacs@gnu.org Subject: Replace expressions: enhance functionality when searching in filled paragraphs MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: linuxfever@yahoo.gr X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -1.1 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sat, 25 Feb 2012 20:30:08 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.1 (-) Hello, This is more of a suggestion/wish, rather than an actual bug, which could enhance significantly replacement functionality in a filled text (region, paragraph, buffer, etc). Currently it seems that when trying to replace an expression comprising two words, say for example 'replace this', then the functions 'replace-string' or 'replace-regexp' fail to locate the expression when that is split along two lines in the text, i.e., in the above example when the word 'replace' is at the end of one line, and the word 'this' is at the beginning of the next one. I learned today (http://old.nabble.com/Search-in-filled-text-does-not-work-correctly-td33390451.html#a33392628) that there are ways around this by specifying a newline between words, for example, searching for 'replace C-q C-j this' would actually do the work but there are two problems with this. First, it is inefficient as it takes longer to type, and second it would replace only the expressions that are actually split in two lines and leave out the ones separated by a normal SPC. In a nutshell, I believe enhancing the functionality of the replacement functions to accommodate for expressions split in two lines, would make their usability so much easier. Thanks for your time and for such a great and versatile editor! -- View this message in context: http://old.nabble.com/Replace-expressions%3A-enhance-functionality-when-searching-in-filled-paragraphs-tp33392837p33392837.html Sent from the Emacs - Bugs mailing list archive at Nabble.com. From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 25 20:59:51 2012 Received: (at 10885) by debbugs.gnu.org; 26 Feb 2012 01:59:51 +0000 Received: from localhost ([127.0.0.1]:56569 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1TOw-0008IZ-P6 for submit@debbugs.gnu.org; Sat, 25 Feb 2012 20:59:51 -0500 Received: from fencepost.gnu.org ([140.186.70.10]:40233) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1TOu-0008IR-Bq for 10885@debbugs.gnu.org; Sat, 25 Feb 2012 20:59:49 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1S1TMH-0000bX-5a; Sat, 25 Feb 2012 20:57:05 -0500 From: Glenn Morris To: linuxfever Subject: Re: bug#10885: Replace expressions: enhance functionality when searching in filled paragraphs References: <33392837.post@talk.nabble.com> X-Spook: halcon ASO Agfa SCUD missile Albanian Freeh Noriega X-Ran: 6X#)sC?vF|1` X-Hue: yellow X-Debbugs-No-Ack: yes X-Attribution: GM Date: Sat, 25 Feb 2012 20:57:05 -0500 In-Reply-To: <33392837.post@talk.nabble.com> (linuxfever@yahoo.gr's message of "Sat, 25 Feb 2012 17:02:45 -0800 (PST)") Message-ID: <1oipiuxspa.fsf@fencepost.gnu.org> User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: 10885 Cc: 10885@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) linuxfever wrote: > Currently it seems that when trying to replace an expression comprising two > words, say for example 'replace this', then the functions 'replace-string' > or 'replace-regexp' fail to locate the expression when that is split along > two lines in the text, i.e., in the above example when the word 'replace' is > at the end of one line, and the word 'this' is at the beginning of the next > one. You can use query-replace-regexp for this. Sample input: This is text. This is text. This is text. This is text. Replace this. This is text. This is text. This is text. This is text. This is text. Replace this. Replace this. M-x query-replace-regexp RET \(replace\)\([ ^I^J]*\)\(this\) RET Done\2that RET Output: This is text. This is text. This is text. This is text. Done that. This is text. This is text. This is text. This is text. This is text. Done that. Done that. From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 26 02:18:31 2012 Received: (at submit) by debbugs.gnu.org; 26 Feb 2012 07:18:31 +0000 Received: from localhost ([127.0.0.1]:56648 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1YNL-0007BM-8j for submit@debbugs.gnu.org; Sun, 26 Feb 2012 02:18:31 -0500 Received: from eggs.gnu.org ([208.118.235.92]:60439) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1YNJ-0007BE-Jr for submit@debbugs.gnu.org; Sun, 26 Feb 2012 02:18:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S1YKY-0001cf-1m for submit@debbugs.gnu.org; Sun, 26 Feb 2012 02:15:45 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_PSBL autolearn=no version=3.3.2 Received: from lists.gnu.org ([140.186.70.17]:38882) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S1YKX-0001cQ-U9 for submit@debbugs.gnu.org; Sun, 26 Feb 2012 02:15:37 -0500 Received: from eggs.gnu.org ([208.118.235.92]:60789) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S1YKQ-0004ll-VE for bug-gnu-emacs@gnu.org; Sun, 26 Feb 2012 02:15:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S1YKH-0001ai-Ry for bug-gnu-emacs@gnu.org; Sun, 26 Feb 2012 02:15:30 -0500 Received: from plane.gmane.org ([80.91.229.3]:33331) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S1YKH-0001aV-Ld for bug-gnu-emacs@gnu.org; Sun, 26 Feb 2012 02:15:21 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1S1YKF-00084C-DA for bug-gnu-emacs@gnu.org; Sun, 26 Feb 2012 08:15:19 +0100 Received: from c-71-237-25-24.hsd1.co.comcast.net ([71.237.25.24]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 26 Feb 2012 08:15:19 +0100 Received: from kevin.d.rodgers by c-71-237-25-24.hsd1.co.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 26 Feb 2012 08:15:19 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: bug-gnu-emacs@gnu.org From: Kevin Rodgers Subject: Re: bug#10885: Replace expressions: enhance functionality when searching in filled paragraphs Date: Sun, 26 Feb 2012 00:16:36 -0700 Lines: 35 Message-ID: References: <33392837.post@talk.nabble.com> <1oipiuxspa.fsf@fencepost.gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: c-71-237-25-24.hsd1.co.comcast.net User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9.2.27) Gecko/20120216 Thunderbird/3.1.19 In-Reply-To: <1oipiuxspa.fsf@fencepost.gnu.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: 0.8 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 0.8 (/) On 2/25/12 6:57 PM, Glenn Morris wrote: > linuxfever wrote: > >> Currently it seems that when trying to replace an expression comprising two >> words, say for example 'replace this', then the functions 'replace-string' >> or 'replace-regexp' fail to locate the expression when that is split along >> two lines in the text, i.e., in the above example when the word 'replace' is >> at the end of one line, and the word 'this' is at the beginning of the next >> one. > > You can use query-replace-regexp for this. > > Sample input: > > This is text. This is text. This is text. This is text. Replace this. > This is text. This is text. This is text. This is text. This is text. Replace > this. > Replace this. > > M-x query-replace-regexp RET \(replace\)\([ ^I^J]*\)\(this\) RET Done\2that RET > > Output: > > This is text. This is text. This is text. This is text. Done that. > This is text. This is text. This is text. This is text. This is text. Done > that. > Done that. Would it make sense for replace-regexp/query-replace-regexp (and other commands that read regexps from the user) to respect search-whitespace-regexp, just like isearch? -- Kevin Rodgers Denver, Colorado, USA From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 26 05:13:45 2012 Received: (at submit) by debbugs.gnu.org; 26 Feb 2012 10:13:45 +0000 Received: from localhost ([127.0.0.1]:56816 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1b6v-0005Dp-Fh for submit@debbugs.gnu.org; Sun, 26 Feb 2012 05:13:45 -0500 Received: from eggs.gnu.org ([208.118.235.92]:36934) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1b6s-0005Di-VX for submit@debbugs.gnu.org; Sun, 26 Feb 2012 05:13:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S1b48-0005RR-4K for submit@debbugs.gnu.org; Sun, 26 Feb 2012 05:10:57 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_PSBL autolearn=no version=3.3.2 Received: from lists.gnu.org ([140.186.70.17]:47299) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S1b48-0005RI-0X for submit@debbugs.gnu.org; Sun, 26 Feb 2012 05:10:52 -0500 Received: from eggs.gnu.org ([208.118.235.92]:43519) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S1b41-0005S8-Nx for Bug-gnu-emacs@gnu.org; Sun, 26 Feb 2012 05:10:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S1b3w-0005Qv-NB for Bug-gnu-emacs@gnu.org; Sun, 26 Feb 2012 05:10:45 -0500 Received: from sam.nabble.com ([216.139.236.26]:53752) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S1b3w-0005Qr-JX for Bug-gnu-emacs@gnu.org; Sun, 26 Feb 2012 05:10:40 -0500 Received: from isper.nabble.com ([192.168.236.156]) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1S1b3v-0003NC-5E for Bug-gnu-emacs@gnu.org; Sun, 26 Feb 2012 02:10:39 -0800 Message-ID: <33393821.post@talk.nabble.com> Date: Sun, 26 Feb 2012 02:10:39 -0800 (PST) From: linuxfever To: Bug-gnu-emacs@gnu.org Subject: Re: bug#10885: Replace expressions: enhance functionality when searching in filled paragraphs In-Reply-To: <1oipiuxspa.fsf@fencepost.gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: linuxfever@yahoo.gr References: <33392837.post@talk.nabble.com> <1oipiuxspa.fsf@fencepost.gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: 1.6 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Glenn Morris-3 wrote: > > > You can use query-replace-regexp for this. > > M-x query-replace-regexp RET \(replace\)\([ ^I^J]*\)\(this\) RET > Done\2that RET > > Thanks, but this command does not seem to work for me. Moreover, it is still quite involved with all the extra characters between the two words, and the idea is to avoid this complication. -- View this message in context: http://old.nabble.com/Replace-expressions%3A-enhance-functionality-when-searching-in-filled-paragraphs-tp33392837p33393821.html Sent from the Emacs - Bugs mailing list archive at Nabble.com. [...] Content analysis details: (1.6 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 2.7 RCVD_IN_PSBL RBL: Received via a relay in PSBL [208.118.235.92 listed in psbl.surriel.com] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (linuxfever[at]yahoo.gr) 0.8 SPF_NEUTRAL SPF: sender does not match SPF record (neutral) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 1.6 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Glenn Morris-3 wrote: > > > You can use query-replace-regexp for this. > > M-x query-replace-regexp RET \(replace\)\([ ^I^J]*\)\(this\) RET > Done\2that RET > > Thanks, but this command does not seem to work for me. Moreover, it is still quite involved with all the extra characters between the two words, and the idea is to avoid this complication. -- View this message in context: http://old.nabble.com/Replace-expressions%3A-enhance-functionality-when-searching-in-filled-paragraphs-tp33392837p33393821.html Sent from the Emacs - Bugs mailing list archive at Nabble.com. [...] Content analysis details: (1.6 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (linuxfever[at]yahoo.gr) 2.7 RCVD_IN_PSBL RBL: Received via a relay in PSBL [208.118.235.92 listed in psbl.surriel.com] 0.8 SPF_NEUTRAL SPF: sender does not match SPF record (neutral) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Glenn Morris-3 wrote: > > > You can use query-replace-regexp for this. > > M-x query-replace-regexp RET \(replace\)\([ ^I^J]*\)\(this\) RET > Done\2that RET > > Thanks, but this command does not seem to work for me. Moreover, it is still quite involved with all the extra characters between the two words, and the idea is to avoid this complication. -- View this message in context: http://old.nabble.com/Replace-expressions%3A-enhance-functionality-when-searching-in-filled-paragraphs-tp33392837p33393821.html Sent from the Emacs - Bugs mailing list archive at Nabble.com. From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 26 05:27:57 2012 Received: (at 10885) by debbugs.gnu.org; 26 Feb 2012 10:27:58 +0000 Received: from localhost ([127.0.0.1]:57505 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1bKf-0005kO-O6 for submit@debbugs.gnu.org; Sun, 26 Feb 2012 05:27:57 -0500 Received: from mail-tul01m020-f172.google.com ([209.85.214.172]:44931) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1bKd-0005kG-8h for 10885@debbugs.gnu.org; Sun, 26 Feb 2012 05:27:56 -0500 Received: by obbeh20 with SMTP id eh20so279557obb.3 for <10885@debbugs.gnu.org>; Sun, 26 Feb 2012 02:25:10 -0800 (PST) Received-SPF: pass (google.com: domain of dmoncayo@gmail.com designates 10.182.192.36 as permitted sender) client-ip=10.182.192.36; Authentication-Results: mr.google.com; spf=pass (google.com: domain of dmoncayo@gmail.com designates 10.182.192.36 as permitted sender) smtp.mail=dmoncayo@gmail.com; dkim=pass header.i=dmoncayo@gmail.com Received: from mr.google.com ([10.182.192.36]) by 10.182.192.36 with SMTP id hd4mr3345352obc.60.1330251910100 (num_hops = 1); Sun, 26 Feb 2012 02:25:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=1YavMSkqSy6GTYB1j1Zji00zNwOpQgXPnQt/HkO1ZpM=; b=b2IGhKvMsNgzJe1ISFezd5nFbZYBgB39EMQva2vIMvdNcNRR/Ys6dSWWdLjthSb0T0 GYc4d9mzIYEXV/RsiKG8KCTy4ESUMQHqFJKOIciC/hnn4UK1r53Ju+MDDg0T2vEaewNk Tkp4Zs7UDu2Ad+4+Mx6sLVJkE2ntZ9CZM3zmU= MIME-Version: 1.0 Received: by 10.182.192.36 with SMTP id hd4mr2993851obc.60.1330251429101; Sun, 26 Feb 2012 02:17:09 -0800 (PST) Received: by 10.60.42.193 with HTTP; Sun, 26 Feb 2012 02:17:09 -0800 (PST) In-Reply-To: <33392837.post@talk.nabble.com> References: <33392837.post@talk.nabble.com> Date: Sun, 26 Feb 2012 11:17:09 +0100 Message-ID: Subject: Re: bug#10885: Replace expressions: enhance functionality when searching in filled paragraphs From: Dani Moncayo To: linuxfever Content-Type: text/plain; charset=ISO-8859-1 X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10885 Cc: 10885@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) > In a nutshell, I believe enhancing the functionality of the replacement > functions to accommodate for expressions split in two lines, would make > their usability so much easier. Adding a "word-type mode" to query-replace (analogous of the word-type mode of Isearch) would do what you want, and would be a good feature, IMO. That is: add an option to query-replace whereby the matches are found using a word-type search, instead of the (default) normal search. -- Dani Moncayo From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 26 20:32:55 2012 Received: (at 10885) by debbugs.gnu.org; 27 Feb 2012 01:32:55 +0000 Received: from localhost ([127.0.0.1]:58667 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1pSQ-0002nf-Fx for submit@debbugs.gnu.org; Sun, 26 Feb 2012 20:32:55 -0500 Received: from pruche.dit.umontreal.ca ([132.204.246.22]:38478) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1pSN-0002nV-1S for 10885@debbugs.gnu.org; Sun, 26 Feb 2012 20:32:52 -0500 Received: from ceviche.home (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id q1R1U0m0003812; Sun, 26 Feb 2012 20:30:00 -0500 Received: by ceviche.home (Postfix, from userid 20848) id 39102660DC; Sun, 26 Feb 2012 16:22:12 -0500 (EST) From: Stefan Monnier To: linuxfever Subject: Re: bug#10885: Replace expressions: enhance functionality when searching in filled paragraphs Message-ID: References: <33392837.post@talk.nabble.com> <1oipiuxspa.fsf@fencepost.gnu.org> <33393821.post@talk.nabble.com> Date: Sun, 26 Feb 2012 16:22:10 -0500 In-Reply-To: <33393821.post@talk.nabble.com> (linuxfever@yahoo.gr's message of "Sun, 26 Feb 2012 02:10:39 -0800 (PST)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Level: X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0.2 X-NAI-Spam-Rules: 2 Rules triggered GEN_SPAM_FEATRE=0.2, RV4144=0 X-NAI-Spam-Version: 2.2.0.9309 : core <4144> : streams <732529> : uri <1072717> X-Spam-Score: -3.5 (---) X-Debbugs-Envelope-To: 10885 Cc: 10885@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.5 (---) >> M-x query-replace-regexp RET \(replace\)\([ ^I^J]*\)\(this\) RET >> Done\2that RET I think the "\2" should be replaced by just a space (it's probably fine in the above example, but for a general solution the user would want some re-filling afterwards). Stefan From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 06:48:09 2012 Received: (at 10885) by debbugs.gnu.org; 27 Feb 2012 11:48:10 +0000 Received: from localhost ([127.0.0.1]:59136 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1z3n-0001kh-5d for submit@debbugs.gnu.org; Mon, 27 Feb 2012 06:48:09 -0500 Received: from ps18281.dreamhost.com ([69.163.218.105]:53386 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1z3j-0001kT-7b for 10885@debbugs.gnu.org; Mon, 27 Feb 2012 06:48:04 -0500 Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 5A1FC451C0B9; Mon, 27 Feb 2012 03:43:31 -0800 (PST) From: Juri Linkov To: Dani Moncayo Subject: Re: bug#10885: Replace expressions: enhance functionality when searching in filled paragraphs Organization: JURTA References: <33392837.post@talk.nabble.com> Date: Mon, 27 Feb 2012 12:58:22 +0200 In-Reply-To: (Dani Moncayo's message of "Sun, 26 Feb 2012 11:17:09 +0100") Message-ID: <87ehtg4ic1.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10885 Cc: 10885@debbugs.gnu.org, linuxfever X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) >> In a nutshell, I believe enhancing the functionality of the replacement >> functions to accommodate for expressions split in two lines, would make >> their usability so much easier. > > Adding a "word-type mode" to query-replace (analogous of the word-type > mode of Isearch) would do what you want, and would be a good feature, > IMO. > > That is: add an option to query-replace whereby the matches are found > using a word-type search, instead of the (default) normal search. There exists already a "word query-replace mode" with `C-u M-%', but currently it is very limited. To bring it in sync with the "word search" is possible with this patch (for 24.2): === modified file 'lisp/replace.el' --- lisp/replace.el 2012-02-24 22:46:57 +0000 +++ lisp/replace.el 2012-02-27 10:55:04 +0000 @@ -1813,10 +1813,7 @@ (defun perform-replace (from-string repl (if delimited-flag (setq search-function 're-search-forward - search-string (concat "\\b" - (if regexp-flag from-string - (regexp-quote from-string)) - "\\b"))) + search-string (word-search-regexp from-string))) (when query-replace-lazy-highlight (setq isearch-lazy-highlight-last-string nil)) From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 08:30:32 2012 Received: (at 10885) by debbugs.gnu.org; 27 Feb 2012 13:30:33 +0000 Received: from localhost ([127.0.0.1]:59240 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S20eu-0005d4-IS for submit@debbugs.gnu.org; Mon, 27 Feb 2012 08:30:32 -0500 Received: from mail-tul01m020-f172.google.com ([209.85.214.172]:60294) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S20es-0005bH-Pz for 10885@debbugs.gnu.org; Mon, 27 Feb 2012 08:30:31 -0500 Received: by obbeh20 with SMTP id eh20so1189555obb.3 for <10885@debbugs.gnu.org>; Mon, 27 Feb 2012 05:27:39 -0800 (PST) Received-SPF: pass (google.com: domain of dmoncayo@gmail.com designates 10.182.141.9 as permitted sender) client-ip=10.182.141.9; Authentication-Results: mr.google.com; spf=pass (google.com: domain of dmoncayo@gmail.com designates 10.182.141.9 as permitted sender) smtp.mail=dmoncayo@gmail.com; dkim=pass header.i=dmoncayo@gmail.com Received: from mr.google.com ([10.182.141.9]) by 10.182.141.9 with SMTP id rk9mr4861992obb.50.1330349259426 (num_hops = 1); Mon, 27 Feb 2012 05:27:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=ytPO1VDDrB3UJeMTsUophf5jhzrJ2qkxHA1Rbrd6RFk=; b=s3F7vTZ+qUgkSQwJSUo64PaFEn9vPFePmVRF2rkBRZ23zxMHsfsUDuBUjxau98EBTZ 73ckhOqTPJ++udPMcb7AVjB6WlKDcFiNT09n1mE+9xijwDo8mIhQzZ3U1758zRL44SPO oQ+4dffL1YCw8jWEwy9uZHWW8pGZbyOuhJk4c= MIME-Version: 1.0 Received: by 10.182.141.9 with SMTP id rk9mr4375104obb.50.1330349259350; Mon, 27 Feb 2012 05:27:39 -0800 (PST) Received: by 10.60.42.193 with HTTP; Mon, 27 Feb 2012 05:27:39 -0800 (PST) In-Reply-To: <87ehtg4ic1.fsf@mail.jurta.org> References: <33392837.post@talk.nabble.com> <87ehtg4ic1.fsf@mail.jurta.org> Date: Mon, 27 Feb 2012 14:27:39 +0100 Message-ID: Subject: Re: bug#10885: Replace expressions: enhance functionality when searching in filled paragraphs From: Dani Moncayo To: Juri Linkov Content-Type: text/plain; charset=ISO-8859-1 X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10885 Cc: 10885@debbugs.gnu.org, linuxfever X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) >> Adding a "word-type mode" to query-replace (analogous of the word-type >> mode of Isearch) would do what you want, and would be a good feature, >> IMO. >> >> That is: add an option to query-replace whereby the matches are found >> using a word-type search, instead of the (default) normal search. > > There exists already a "word query-replace mode" with `C-u M-%', > but currently it is very limited. > > To bring it in sync with the "word search" is possible > with this patch (for 24.2): This patch seems to work too. Thank you! -- Dani Moncayo From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 28 05:08:29 2012 Received: (at 10885) by debbugs.gnu.org; 28 Feb 2012 10:08:29 +0000 Received: from localhost ([127.0.0.1]:60780 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S2Jyp-0002Zg-R2 for submit@debbugs.gnu.org; Tue, 28 Feb 2012 05:08:29 -0500 Received: from mail-tul01m020-f172.google.com ([209.85.214.172]:51349) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S2JyY-0002Yv-Ua for 10885@debbugs.gnu.org; Tue, 28 Feb 2012 05:08:12 -0500 Received: by obbeh20 with SMTP id eh20so2253167obb.3 for <10885@debbugs.gnu.org>; Tue, 28 Feb 2012 02:04:55 -0800 (PST) Received-SPF: pass (google.com: domain of dmoncayo@gmail.com designates 10.182.149.71 as permitted sender) client-ip=10.182.149.71; Authentication-Results: mr.google.com; spf=pass (google.com: domain of dmoncayo@gmail.com designates 10.182.149.71 as permitted sender) smtp.mail=dmoncayo@gmail.com; dkim=pass header.i=dmoncayo@gmail.com Received: from mr.google.com ([10.182.149.71]) by 10.182.149.71 with SMTP id ty7mr6450138obb.70.1330423495421 (num_hops = 1); Tue, 28 Feb 2012 02:04:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=8JPN6cK0jFAi43XFfCoeop4ta2HYhrpAIHjf2jp5hqs=; b=J62OBoyGhlvw5sxFGU4yVpzBMGQPybV5Sjwqvh4WeuCwfceyNXt+X7PqLuef4eatON JdhpDHMJHgnXF9NHwp+3DOCOYtBFySi5dHeXOGc9+58P+UG7Y+nevtF/2klW0HQY/CCd J2LVGX+KzlY1tWjZUlJ0NAhMI4paIFnDa+ymw= MIME-Version: 1.0 Received: by 10.182.149.71 with SMTP id ty7mr5741498obb.70.1330423495338; Tue, 28 Feb 2012 02:04:55 -0800 (PST) Received: by 10.60.42.193 with HTTP; Tue, 28 Feb 2012 02:04:55 -0800 (PST) In-Reply-To: References: <33392837.post@talk.nabble.com> <1oipiuxspa.fsf@fencepost.gnu.org> Date: Tue, 28 Feb 2012 11:04:55 +0100 Message-ID: Subject: Re: bug#10885: Replace expressions: enhance functionality when searching in filled paragraphs From: Dani Moncayo To: Kevin Rodgers Content-Type: text/plain; charset=ISO-8859-1 X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10885 Cc: 10885@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) > Would it make sense for replace-regexp/query-replace-regexp (and other > commands > that read regexps from the user) to respect search-whitespace-regexp, just > like > isearch? Good question. Quote from the docstring of `isearch-forward-regexp': In regexp incremental searches, a space or spaces normally matches any whitespace (the variable `search-whitespace-regexp' controls precisely what that means). If you want to search for a literal space and nothing else, enter C-q SPC. Does anyone knows why `query-replace-regexp' don't behave that way too? I think it should, i.e., `query-replace-regexp' should find the same matches that `isearch-forward-regexp' would find with the same search regexp. -- Dani Moncayo From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 28 05:13:14 2012 Received: (at 10885) by debbugs.gnu.org; 28 Feb 2012 10:13:14 +0000 Received: from localhost ([127.0.0.1]:60785 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S2K3Q-0002fz-L3 for submit@debbugs.gnu.org; Tue, 28 Feb 2012 05:13:14 -0500 Received: from mail-tul01m020-f172.google.com ([209.85.214.172]:41740) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S2K2z-0002fM-Lg for 10885@debbugs.gnu.org; Tue, 28 Feb 2012 05:12:56 -0500 Received: by obbeh20 with SMTP id eh20so2256963obb.3 for <10885@debbugs.gnu.org>; Tue, 28 Feb 2012 02:09:30 -0800 (PST) Received-SPF: pass (google.com: domain of dmoncayo@gmail.com designates 10.182.192.36 as permitted sender) client-ip=10.182.192.36; Authentication-Results: mr.google.com; spf=pass (google.com: domain of dmoncayo@gmail.com designates 10.182.192.36 as permitted sender) smtp.mail=dmoncayo@gmail.com; dkim=pass header.i=dmoncayo@gmail.com Received: from mr.google.com ([10.182.192.36]) by 10.182.192.36 with SMTP id hd4mr6449137obc.60.1330423770347 (num_hops = 1); Tue, 28 Feb 2012 02:09:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=OdTTa9VEmuZqt25YMXQDgmZMjMQUp5rhs+uqFZcviyY=; b=i+GKmofkOpuWnauDXqf5fMzoo1ewToiLuWAL/g6/ltCE597spUSg8jd2uEL0UGyfsv ZyhUaYZqo4B4hVyFVOKOyLFomE63SUypLx/ha/1VLn9R2mRE76waWyG43VQMIbv/n/lp VX9GJC7MIUHiFKt114qBNUlzI5yk0mRpPoJvg= MIME-Version: 1.0 Received: by 10.182.192.36 with SMTP id hd4mr5737910obc.60.1330423770254; Tue, 28 Feb 2012 02:09:30 -0800 (PST) Received: by 10.60.42.193 with HTTP; Tue, 28 Feb 2012 02:09:30 -0800 (PST) In-Reply-To: References: <33392837.post@talk.nabble.com> <1oipiuxspa.fsf@fencepost.gnu.org> Date: Tue, 28 Feb 2012 11:09:30 +0100 Message-ID: Subject: Re: bug#10885: Replace expressions: enhance functionality when searching in filled paragraphs From: Dani Moncayo To: Kevin Rodgers Content-Type: text/plain; charset=ISO-8859-1 X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10885 Cc: 10885@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) > Does anyone knows why `query-replace-regexp' don't behave that way too? Arrggg. Forgive my bad English. I meant: Does anyone know why `query-replace-regexp' doesn't behave that way too? -- "Dani Moncayo, who, some day, will learn to revise his mails before sending them." From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 28 05:49:56 2012 Received: (at 10885) by debbugs.gnu.org; 28 Feb 2012 10:49:56 +0000 Received: from localhost ([127.0.0.1]:60802 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S2Kd1-0003VV-Nz for submit@debbugs.gnu.org; Tue, 28 Feb 2012 05:49:56 -0500 Received: from ps18281.dreamhost.com ([69.163.218.105]:44762 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S2KcX-0003Un-Ih for 10885@debbugs.gnu.org; Tue, 28 Feb 2012 05:49:35 -0500 Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 41694451C1D0; Tue, 28 Feb 2012 02:44:33 -0800 (PST) From: Juri Linkov To: Dani Moncayo Subject: Re: bug#10885: Replace expressions: enhance functionality when searching in filled paragraphs Organization: JURTA References: <33392837.post@talk.nabble.com> <1oipiuxspa.fsf@fencepost.gnu.org> Date: Tue, 28 Feb 2012 12:42:16 +0200 In-Reply-To: (Dani Moncayo's message of "Tue, 28 Feb 2012 11:04:55 +0100") Message-ID: <87d38z1bp3.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10885 Cc: 10885@debbugs.gnu.org, Kevin Rodgers X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) >> Would it make sense for replace-regexp/query-replace-regexp (and >> other commands that read regexps from the user) to respect >> search-whitespace-regexp, just like isearch? > > Good question. > > Quote from the docstring of `isearch-forward-regexp': > > In regexp incremental searches, a space or spaces normally matches > any whitespace (the variable `search-whitespace-regexp' controls > precisely what that means). If you want to search for a literal space > and nothing else, enter C-q SPC. > > Does anyone know why `query-replace-regexp' doesn't behave that way too? > > I think it should, i.e., `query-replace-regexp' should find the same > matches that `isearch-forward-regexp' would find with the same search > regexp. Full agreement. This patch for 24.2 brings query-replace closer to isearch: === modified file 'lisp/replace.el' --- lisp/replace.el 2012-02-24 22:46:57 +0000 +++ lisp/replace.el 2012-02-28 10:38:58 +0000 @@ -1752,6 +1752,7 @@ (defun perform-replace (from-string repl (if (and case-fold-search search-upper-case) (isearch-no-upper-case-p from-string regexp-flag) case-fold-search)) + (search-spaces-regexp (if regexp-flag search-whitespace-regexp)) (nocasify (not (and case-replace case-fold-search))) (literal (or (not regexp-flag) (eq regexp-flag 'literal))) (search-function @@ -2117,9 +2115,8 @@ (defun replace-highlight (match-beg matc (if query-replace-lazy-highlight (let ((isearch-string string) (isearch-regexp regexp) - (search-whitespace-regexp nil) (isearch-case-fold-search case-fold) (isearch-forward t) (isearch-error nil)) From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 28 19:12:44 2012 Received: (at 10885) by debbugs.gnu.org; 29 Feb 2012 00:12:44 +0000 Received: from localhost ([127.0.0.1]:54889 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S2X9w-0003f4-6d for submit@debbugs.gnu.org; Tue, 28 Feb 2012 19:12:44 -0500 Received: from fencepost.gnu.org ([208.118.235.10]:58387) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S2X9b-0003eM-3e for 10885@debbugs.gnu.org; Tue, 28 Feb 2012 19:12:32 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1S2X9G-0006qi-FR; Tue, 28 Feb 2012 19:12:02 -0500 From: Glenn Morris To: Juri Linkov Subject: Re: bug#10885: Replace expressions: enhance functionality when searching in filled paragraphs References: <33392837.post@talk.nabble.com> <1oipiuxspa.fsf@fencepost.gnu.org> <87d38z1bp3.fsf@mail.jurta.org> X-Spook: LLNL Clinton ANZUS colonel FIPS140 Tony Blair X-Ran: n['VevfD/R(:aPy-i?^D^jiy*DO+SA<78vM;WQ7:wQ=Y8>JY,XkdzcaR["`hVK\bUB0c== X-Hue: red X-Debbugs-No-Ack: yes X-Attribution: GM Date: Tue, 28 Feb 2012 19:12:02 -0500 Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: 0.8 (/) X-Debbugs-Envelope-To: 10885 Cc: 10885@debbugs.gnu.org, Kevin Rodgers , Dani Moncayo X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 0.8 (/) Juri Linkov wrote: > Full agreement. This patch for 24.2 brings query-replace closer to isearch: The doc and manual would need updating; since at present search-whitespace-regexp is only documented to affect incremental searches. From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 28 19:42:25 2012 Received: (at 10885) by debbugs.gnu.org; 29 Feb 2012 00:42:26 +0000 Received: from localhost ([127.0.0.1]:54909 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S2Xcf-0004L7-F8 for submit@debbugs.gnu.org; Tue, 28 Feb 2012 19:42:25 -0500 Received: from ps18281.dreamhost.com ([69.163.218.105]:57871 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S2XcT-0004KS-FK for 10885@debbugs.gnu.org; Tue, 28 Feb 2012 19:42:13 -0500 Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 966D1451C1B1; Tue, 28 Feb 2012 16:40:15 -0800 (PST) From: Juri Linkov To: Glenn Morris Subject: Re: bug#10885: Replace expressions: enhance functionality when searching in filled paragraphs Organization: JURTA References: <33392837.post@talk.nabble.com> <1oipiuxspa.fsf@fencepost.gnu.org> <87d38z1bp3.fsf@mail.jurta.org> Date: Wed, 29 Feb 2012 02:41:03 +0200 In-Reply-To: (Glenn Morris's message of "Tue, 28 Feb 2012 19:12:02 -0500") Message-ID: <87linm79pc.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10885 Cc: 10885@debbugs.gnu.org, Kevin Rodgers , Dani Moncayo X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > The doc and manual would need updating; since at present > search-whitespace-regexp is only documented to affect incremental > searches. There is one problem of using `search-whitespace-regexp' in `query-replace-regexp'. When the user doesn't want `SPC' to match any sequence of whitespace characters in regexp isearch `C-M-s', it it possible to type `C-q SPC'. But how to do the same in `query-replace-regexp'? `C-M-% replace C-q SPC this' doesn't quote SPC as a literal character. From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 11 05:28:54 2012 Received: (at 10885) by debbugs.gnu.org; 11 Mar 2012 09:28:54 +0000 Received: from localhost ([127.0.0.1]:44463 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S6f5B-0005Ru-Bp for submit@debbugs.gnu.org; Sun, 11 Mar 2012 05:28:54 -0400 Received: from mail-iy0-f172.google.com ([209.85.210.172]:50235) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S6f59-0005Ro-Ov for 10885@debbugs.gnu.org; Sun, 11 Mar 2012 05:28:52 -0400 Received: by iazz13 with SMTP id z13so4458382iaz.3 for <10885@debbugs.gnu.org>; Sun, 11 Mar 2012 00:59:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=TXb+OPOsEjgtk5Vh3/Uqsv0f4GkEjy53Q+u/xnJWAnI=; b=sQf1K4GYe38Cfxu1L+L4W5FFevcRp43MPo/XC1bIYGSvHi1U+ylU5jFyTcKvzZhP1X u825yu9QgW/qe0C6Mdwg6d0F/VRi1fInBfDIKb03McO6ahmD9c1yUFEq1Inq8ZsAKRbM 6zydKy/OmCKBy7wpHWprLa1tjW/V8jVx6S60F7Z1wFkYcNKMWzDOuFb6Yuv/snc6Ymnb KrLKc1GM3fUuNVB9vbUrbS9PTQdM6wFzlWADp50kehRgTv7/3I75X+pYRAvvONNsEdnr kLR/JUu1BzP7mMvcX0p6FK9AHOtSP0r2d43025zBdh/S+qvIDyfwc8HXcFry/EHeFtXG eWRw== MIME-Version: 1.0 Received: by 10.60.25.41 with SMTP id z9mr4082987oef.70.1331456347312; Sun, 11 Mar 2012 00:59:07 -0800 (PST) Received: by 10.60.42.193 with HTTP; Sun, 11 Mar 2012 00:59:07 -0800 (PST) In-Reply-To: <87linm79pc.fsf@mail.jurta.org> References: <33392837.post@talk.nabble.com> <1oipiuxspa.fsf@fencepost.gnu.org> <87d38z1bp3.fsf@mail.jurta.org> <87linm79pc.fsf@mail.jurta.org> Date: Sun, 11 Mar 2012 09:59:07 +0100 Message-ID: Subject: Re: bug#10885: Replace expressions: enhance functionality when searching in filled paragraphs From: Dani Moncayo To: Juri Linkov Content-Type: text/plain; charset=ISO-8859-1 X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10885 Cc: 10885@debbugs.gnu.org, Glenn Morris , Kevin Rodgers X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) On Wed, Feb 29, 2012 at 01:41, Juri Linkov wrote: >> The doc and manual would need updating; since at present >> search-whitespace-regexp is only documented to affect incremental >> searches. > > There is one problem of using `search-whitespace-regexp' > in `query-replace-regexp'. > > When the user doesn't want `SPC' to match any sequence of whitespace > characters in regexp isearch `C-M-s', it it possible to type `C-q SPC'. > > But how to do the same in `query-replace-regexp'? > > `C-M-% replace C-q SPC this' doesn't quote SPC as a literal character. FWIW: the isearch commands have this problem too, when editing the search string from the minibuffer. For example: C-M-s replace this M-e M-b DEL C-q SPC RET --> The new search string doesn't have the intended quoted space. -- Dani Moncayo From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 11 07:20:48 2012 Received: (at 10885) by debbugs.gnu.org; 11 Mar 2012 11:20:49 +0000 Received: from localhost ([127.0.0.1]:44573 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S6gpU-0001Ie-Al for submit@debbugs.gnu.org; Sun, 11 Mar 2012 07:20:48 -0400 Received: from ps18281.dreamhost.com ([69.163.218.105]:41432 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S6gpR-0001IV-So for 10885@debbugs.gnu.org; Sun, 11 Mar 2012 07:20:47 -0400 Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id B01D9451C842; Sun, 11 Mar 2012 03:49:06 -0700 (PDT) From: Juri Linkov To: Dani Moncayo Subject: Re: bug#10885: Replace expressions: enhance functionality when searching in filled paragraphs Organization: JURTA References: <33392837.post@talk.nabble.com> <1oipiuxspa.fsf@fencepost.gnu.org> <87d38z1bp3.fsf@mail.jurta.org> <87linm79pc.fsf@mail.jurta.org> Date: Sun, 11 Mar 2012 12:48:08 +0200 In-Reply-To: (Dani Moncayo's message of "Sun, 11 Mar 2012 09:59:07 +0100") Message-ID: <8762ebbehj.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10885 Cc: 10885@debbugs.gnu.org, Glenn Morris , Kevin Rodgers X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) >> There is one problem of using `search-whitespace-regexp' >> in `query-replace-regexp'. >> >> When the user doesn't want `SPC' to match any sequence of whitespace >> characters in regexp isearch `C-M-s', it it possible to type `C-q SPC'. >> >> But how to do the same in `query-replace-regexp'? >> >> `C-M-% replace C-q SPC this' doesn't quote SPC as a literal character. > > FWIW: the isearch commands have this problem too, when editing the > search string from the minibuffer. > > For example: C-M-s replace this M-e M-b DEL C-q SPC RET > --> The new search string doesn't have the intended quoted space. Actually this `search-spaces-regexp' thing is rather a feature of word search intermixed with the pure regexp search into the hybrid half-word/regexp search. What `C-q SPC' does is adding the invisible regexp `[ ]' to the search string. In the minibuffer `C-q SPC' could do the same, not necessarily invisibly because you still see `[ ]' when typing e.g. `C-M-s replace C-q SPC this M-e' From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 02 05:54:21 2012 Received: (at 10885) by debbugs.gnu.org; 2 Sep 2012 09:54:21 +0000 Received: from localhost ([127.0.0.1]:33885 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T86sn-0004w9-Jo for submit@debbugs.gnu.org; Sun, 02 Sep 2012 05:54:21 -0400 Received: from ps18281.dreamhost.com ([69.163.218.105]:55748 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T86sl-0004w2-Qk for 10885@debbugs.gnu.org; Sun, 02 Sep 2012 05:54:20 -0400 Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 72EA3451CC65 for <10885@debbugs.gnu.org>; Sun, 2 Sep 2012 02:52:52 -0700 (PDT) From: Juri Linkov To: 10885@debbugs.gnu.org Subject: Re: bug#10885: Replace expressions: enhance functionality when searching in filled paragraphs Organization: JURTA References: <33392837.post@talk.nabble.com> <1oipiuxspa.fsf@fencepost.gnu.org> <87d38z1bp3.fsf@mail.jurta.org> <87linm79pc.fsf@mail.jurta.org> <8762ebbehj.fsf@mail.jurta.org> Date: Sun, 02 Sep 2012 12:45:33 +0300 In-Reply-To: <8762ebbehj.fsf@mail.jurta.org> (Juri Linkov's message of "Sun, 11 Mar 2012 12:48:08 +0200") Message-ID: <87oblo21xe.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10885 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) After installing http://lists.gnu.org/archive/html/emacs-devel/2012-09/msg00008.html this functionality is available to query-replace, but currently only when it's started from isearch. To use it in query-replace independently from isearch, I see two ways to toggle whitespace matching in query-replace: 1. Add a new defcustom like `case-replace' with a name e.g. `replace-lax-whitespace' and use it in `perform-replace'. When non-nil, spaces will match any whitespace in replacement. 2. Add a new command like `query-replace-regexp' with a name e.g. `query-replace-lax-whitespace', where to let-bind `replace-lax-whitespace' to t and call `perform-replace'. From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 02 07:39:05 2012 Received: (at 10885) by debbugs.gnu.org; 2 Sep 2012 11:39:05 +0000 Received: from localhost ([127.0.0.1]:33951 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T88W8-0008BR-Eh for submit@debbugs.gnu.org; Sun, 02 Sep 2012 07:39:05 -0400 Received: from ps18281.dreamhost.com ([69.163.218.105]:39441 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T88W4-0008B0-MJ for 10885@debbugs.gnu.org; Sun, 02 Sep 2012 07:39:02 -0400 Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 5C723451CC76 for <10885@debbugs.gnu.org>; Sun, 2 Sep 2012 04:37:32 -0700 (PDT) From: Juri Linkov To: 10885@debbugs.gnu.org Subject: Re: bug#10885: Replace expressions: enhance functionality when searching in filled paragraphs Organization: JURTA References: <33392837.post@talk.nabble.com> <1oipiuxspa.fsf@fencepost.gnu.org> <87d38z1bp3.fsf@mail.jurta.org> <87linm79pc.fsf@mail.jurta.org> <8762ebbehj.fsf@mail.jurta.org> <87oblo21xe.fsf@mail.jurta.org> Date: Sun, 02 Sep 2012 14:32:33 +0300 In-Reply-To: <87oblo21xe.fsf@mail.jurta.org> (Juri Linkov's message of "Sun, 02 Sep 2012 12:45:33 +0300") Message-ID: <87boho1wyz.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10885 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > 1. Add a new defcustom like `case-replace' with a name e.g. > `replace-lax-whitespace' and use it in `perform-replace'. > When non-nil, spaces will match any whitespace in replacement. This is implemented in the following patch: === modified file 'lisp/replace.el' --- lisp/replace.el 2012-08-06 05:33:39 +0000 +++ lisp/replace.el 2012-09-02 11:27:15 +0000 @@ -33,6 +33,13 @@ (defcustom case-replace t :type 'boolean :group 'matching) +(defcustom replace-lax-whitespace nil + "Non-nil means `query-replace' matches a sequence of whitespace chars. +When you enter a space or spaces in the strings or regexps to be replaced, +it will match any sequence matched by the regexp `search-whitespace-regexp'." + :type 'boolean + :group 'matching) + (defvar query-replace-history nil "Default history list for query-replace commands. See `query-replace-from-history-variable' and @@ -226,6 +233,10 @@ (defun query-replace (from-string to-str matched is all caps, or capitalized, then its replacement is upcased or capitalized.) +If `replace-lax-whitespace' is non-nil, a space or spaces in the string +to be replaced will match a sequence of whitespace chars defined by the +regexp in `search-whitespace-regexp'. + Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace only matches surrounded by word boundaries. Fourth and fifth arg START and END specify the region to operate on. @@ -270,6 +281,10 @@ (defun query-replace-regexp (regexp to-s all caps, or capitalized, then its replacement is upcased or capitalized.) +If `replace-lax-whitespace' is non-nil, a space or spaces in the regexp +to be replaced will match a sequence of whitespace chars defined by the +regexp in `search-whitespace-regexp'. + Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace only matches surrounded by word boundaries. Fourth and fifth arg START and END specify the region to operate on. @@ -346,6 +361,10 @@ (defun query-replace-regexp-eval (regexp Preserves case in each replacement if `case-replace' and `case-fold-search' are non-nil and REGEXP has no uppercase letters. +If `replace-lax-whitespace' is non-nil, a space or spaces in the regexp +to be replaced will match a sequence of whitespace chars defined by the +regexp in `search-whitespace-regexp'. + Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace only matches that are surrounded by word boundaries. Fourth and fifth arg START and END specify the region to operate on." @@ -437,6 +456,10 @@ (defun replace-string (from-string to-st \(Preserving case means that if the string matched is all caps, or capitalized, then its replacement is upcased or capitalized.) +If `replace-lax-whitespace' is non-nil, a space or spaces in the string +to be replaced will match a sequence of whitespace chars defined by the +regexp in `search-whitespace-regexp'. + In Transient Mark mode, if the mark is active, operate on the contents of the region. Otherwise, operate from point to the end of the buffer. @@ -475,6 +498,10 @@ (defun replace-regexp (regexp to-string Preserve case in each match if `case-replace' and `case-fold-search' are non-nil and REGEXP has no uppercase letters. +If `replace-lax-whitespace' is non-nil, a space or spaces in the regexp +to be replaced will match a sequence of whitespace chars defined by the +regexp in `search-whitespace-regexp'. + In Transient Mark mode, if the mark is active, operate on the contents of the region. Otherwise, operate from point to the end of the buffer. @@ -1717,12 +1745,12 @@ (defun replace-match-maybe-edit (newtext (replace-match newtext fixedcase literal) noedit) -(defvar replace-search-function 'search-forward +(defvar replace-search-function nil "Function to use when searching for strings to replace. It is used by `query-replace' and `replace-string', and is called with three arguments, as if it were `search-forward'.") -(defvar replace-re-search-function 're-search-forward +(defvar replace-re-search-function nil "Function to use when searching for regexps to replace. It is used by `query-replace-regexp', `replace-regexp', `query-replace-regexp-eval', and `map-query-replace-regexp'. @@ -1755,9 +1783,16 @@ (defun perform-replace (from-string repl (nocasify (not (and case-replace case-fold-search))) (literal (or (not regexp-flag) (eq regexp-flag 'literal))) (search-function - (if regexp-flag - replace-re-search-function - replace-search-function)) + (or (if regexp-flag + replace-re-search-function + replace-search-function) + (if replace-lax-whitespace + (if regexp-flag + #'re-search-forward-lax-whitespace + #'search-forward-lax-whitespace) + (if regexp-flag + #'re-search-forward + #'search-forward)))) (search-string from-string) (real-match-data nil) ; The match data for the current match. (next-replacement nil) @@ -2120,7 +2156,10 @@ (defun replace-highlight (match-beg matc ;; Set isearch-word to nil because word-replace is regexp-based, ;; so `isearch-search-fun' should not use `word-search-forward'. (isearch-word nil) - (search-whitespace-regexp nil) + (isearch-lax-whitespace + (and replace-lax-whitespace (not regexp))) + (isearch-regexp-lax-whitespace + (and replace-lax-whitespace regexp)) (isearch-case-fold-search case-fold) (isearch-forward t) (isearch-error nil)) === modified file 'lisp/isearch.el' --- lisp/isearch.el 2012-09-02 09:31:45 +0000 +++ lisp/isearch.el 2012-09-02 11:27:15 +0000 @@ -1579,14 +1612,11 @@ (defun isearch-query-replace (&optional ;; set `search-upper-case' to nil to not call ;; `isearch-no-upper-case-p' in `perform-replace' (search-upper-case nil) - (replace-search-function - (if (and isearch-lax-whitespace (not regexp-flag)) - #'search-forward-lax-whitespace - replace-search-function)) - (replace-re-search-function - (if (and isearch-regexp-lax-whitespace regexp-flag) - #'re-search-forward-lax-whitespace - replace-re-search-function)) + (replace-lax-whitespace + (and search-whitespace-regexp + (if isearch-regexp + isearch-regexp-lax-whitespace + isearch-lax-whitespace))) ;; Set `isearch-recursive-edit' to nil to prevent calling ;; `exit-recursive-edit' in `isearch-done' that terminates ;; the execution of this command when it is non-nil. @@ -2956,6 +3045,10 @@ (defun isearch-lazy-highlight-search () (isearch-regexp isearch-lazy-highlight-regexp) (isearch-word isearch-lazy-highlight-word) (search-invisible nil) ; don't match invisible text + (isearch-lax-whitespace + isearch-lazy-highlight-lax-whitespace) + (isearch-regexp-lax-whitespace + isearch-lazy-highlight-regexp-lax-whitespace) (retry t) (success nil) (isearch-forward isearch-lazy-highlight-forward) From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 05 04:44:46 2012 Received: (at 10885) by debbugs.gnu.org; 5 Sep 2012 08:44:46 +0000 Received: from localhost ([127.0.0.1]:39484 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9BE6-0008FR-5Y for submit@debbugs.gnu.org; Wed, 05 Sep 2012 04:44:46 -0400 Received: from ps18281.dreamhost.com ([69.163.218.105]:33162 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9BE2-0008FJ-NE for 10885@debbugs.gnu.org; Wed, 05 Sep 2012 04:44:44 -0400 Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id C0FAA451CB7E for <10885@debbugs.gnu.org>; Wed, 5 Sep 2012 01:44:35 -0700 (PDT) From: Juri Linkov To: 10885@debbugs.gnu.org Subject: Re: bug#10885: Replace expressions: enhance functionality when searching in filled paragraphs Organization: JURTA References: <33392837.post@talk.nabble.com> <1oipiuxspa.fsf@fencepost.gnu.org> <87d38z1bp3.fsf@mail.jurta.org> <87linm79pc.fsf@mail.jurta.org> <8762ebbehj.fsf@mail.jurta.org> <87oblo21xe.fsf@mail.jurta.org> <87boho1wyz.fsf@mail.jurta.org> Date: Wed, 05 Sep 2012 11:38:50 +0300 In-Reply-To: <87boho1wyz.fsf@mail.jurta.org> (Juri Linkov's message of "Sun, 02 Sep 2012 14:32:33 +0300") Message-ID: <87ligozwx1.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10885 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > This is implemented in the following patch: > + (if replace-lax-whitespace > + (if regexp-flag > + #'re-search-forward-lax-whitespace > + #'search-forward-lax-whitespace) > + (if regexp-flag > + #'re-search-forward > + #'search-forward)))) Since query-replace is going in the direction of closer integration with isearch, the right thing would be to get its search function from isearch. Before calling `isearch-search-fun', `perform-replace' should bind the same isearch related variables as in `replace-highlight'. This will guarantee that highlighted matches are the same that it's going to replace. With this change query-replace will also correctly handle replacements of symbols started from isearch-symbol mode with no additional code in replace.el to implement this. This patch is based on the previously sent patch and could be installed in separate commits: === modified file 'lisp/replace.el' --- lisp/replace.el 2012-09-02 11:27:15 +0000 +++ lisp/replace.el 2012-09-05 08:33:27 +0000 @@ -1786,13 +1791,15 @@ (defun perform-replace (from-string repl (or (if regexp-flag replace-re-search-function replace-search-function) - (if replace-lax-whitespace - (if regexp-flag - #'re-search-forward-lax-whitespace - #'search-forward-lax-whitespace) - (if regexp-flag - #'re-search-forward - #'search-forward)))) + (let ((isearch-regexp regexp-flag) + (isearch-word delimited-flag) + (isearch-lax-whitespace + (and replace-lax-whitespace (not regexp-flag))) + (isearch-regexp-lax-whitespace + (and replace-lax-whitespace regexp-flag)) + (isearch-case-fold-search case-fold-search) + (isearch-forward t)) + (isearch-search-fun)))) (search-string from-string) (real-match-data nil) ; The match data for the current match. (next-replacement nil) @@ -1846,9 +1853,6 @@ (defun perform-replace (from-string repl (vector repeat-count repeat-count replacements replacements))))) - (if delimited-flag - (setq search-function 're-search-forward - search-string (word-search-regexp from-string))) (when query-replace-lazy-highlight (setq isearch-lazy-highlight-last-string nil)) @@ -1934,7 +1938,7 @@ (defun perform-replace (from-string repl (replace-highlight (nth 0 real-match-data) (nth 1 real-match-data) start end search-string - (or delimited-flag regexp-flag) case-fold-search)) + regexp-flag delimited-flag case-fold-search)) (setq noedit (replace-match-maybe-edit next-replacement nocasify literal @@ -1953,7 +1957,7 @@ (defun perform-replace (from-string repl (replace-highlight (match-beginning 0) (match-end 0) start end search-string - (or delimited-flag regexp-flag) case-fold-search) + regexp-flag delimited-flag case-fold-search) ;; Bind message-log-max so we don't fill up the message log ;; with a bunch of identical messages. (let ((message-log-max nil) @@ -2135,15 +2139,10 @@ (defun perform-replace (from-string repl (defvar replace-overlay nil) (defun replace-highlight (match-beg match-end range-beg range-end - string regexp case-fold) + string regexp word case-fold) (if query-replace-highlight (if replace-overlay (move-overlay replace-overlay match-beg match-end (current-buffer)) @@ -2153,9 +2152,7 @@ (defun replace-highlight (match-beg matc (if query-replace-lazy-highlight (let ((isearch-string string) (isearch-regexp regexp) - ;; Set isearch-word to nil because word-replace is regexp-based, - ;; so `isearch-search-fun' should not use `word-search-forward'. - (isearch-word nil) + (isearch-word word) (isearch-lax-whitespace (and replace-lax-whitespace (not regexp))) (isearch-regexp-lax-whitespace From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 05 10:39:14 2012 Received: (at 10885) by debbugs.gnu.org; 5 Sep 2012 14:39:15 +0000 Received: from localhost ([127.0.0.1]:40461 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9Gl6-0001ML-HB for submit@debbugs.gnu.org; Wed, 05 Sep 2012 10:39:13 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:18755) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9Gl1-0001M8-Vb for 10885@debbugs.gnu.org; Wed, 05 Sep 2012 10:39:10 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAG6Zu09FxINJ/2dsb2JhbABEtBGBCIIVAQEEAVYjBQsLNBIUGA0kiBwFugmQRAOjM4FYgwU X-IronPort-AV: E=Sophos;i="4.75,637,1330923600"; d="scan'208";a="197564868" Received: from 69-196-131-73.dsl.teksavvy.com (HELO pastel.home) ([69.196.131.73]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 05 Sep 2012 10:39:00 -0400 Received: by pastel.home (Postfix, from userid 20848) id EAD915923B; Wed, 5 Sep 2012 10:38:59 -0400 (EDT) From: Stefan Monnier To: Juri Linkov Subject: Re: bug#10885: Replace expressions: enhance functionality when searching in filled paragraphs Message-ID: References: <33392837.post@talk.nabble.com> <1oipiuxspa.fsf@fencepost.gnu.org> <87d38z1bp3.fsf@mail.jurta.org> <87linm79pc.fsf@mail.jurta.org> <8762ebbehj.fsf@mail.jurta.org> <87oblo21xe.fsf@mail.jurta.org> <87boho1wyz.fsf@mail.jurta.org> <87ligozwx1.fsf@mail.jurta.org> Date: Wed, 05 Sep 2012 10:38:59 -0400 In-Reply-To: <87ligozwx1.fsf@mail.jurta.org> (Juri Linkov's message of "Wed, 05 Sep 2012 11:38:50 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10885 Cc: 10885@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > Since query-replace is going in the direction of closer integration with > isearch, the right thing would be to get its search function from isearch. Agreed. > This patch is based on the previously sent patch and could be installed > in separate commits: I haven't had much time to devote to this thread, but it generally looks like it's moving in the right direction and I don't see any obvious problem in your patch. Stefan From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 05 10:40:08 2012 Received: (at 10885) by debbugs.gnu.org; 5 Sep 2012 14:40:08 +0000 Received: from localhost ([127.0.0.1]:40466 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9Glz-0001Ny-SP for submit@debbugs.gnu.org; Wed, 05 Sep 2012 10:40:08 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:36194) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9Gly-0001Ns-9A for 10885@debbugs.gnu.org; Wed, 05 Sep 2012 10:40:06 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAG6Zu09FxINJ/2dsb2JhbABEtBGBCIIWAQVWIxALNBIUGA0kiCG6CZBEA6MzgViDBQ X-IronPort-AV: E=Sophos;i="4.75,637,1330923600"; d="scan'208";a="197564971" Received: from 69-196-131-73.dsl.teksavvy.com (HELO pastel.home) ([69.196.131.73]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 05 Sep 2012 10:39:59 -0400 Received: by pastel.home (Postfix, from userid 20848) id C5E4E5923B; Wed, 5 Sep 2012 10:39:58 -0400 (EDT) From: Stefan Monnier To: Juri Linkov Subject: Re: bug#10885: Replace expressions: enhance functionality when searching in filled paragraphs Message-ID: References: <33392837.post@talk.nabble.com> <1oipiuxspa.fsf@fencepost.gnu.org> <87d38z1bp3.fsf@mail.jurta.org> <87linm79pc.fsf@mail.jurta.org> <8762ebbehj.fsf@mail.jurta.org> <87oblo21xe.fsf@mail.jurta.org> <87boho1wyz.fsf@mail.jurta.org> <87ligozwx1.fsf@mail.jurta.org> Date: Wed, 05 Sep 2012 10:39:58 -0400 In-Reply-To: <87ligozwx1.fsf@mail.jurta.org> (Juri Linkov's message of "Wed, 05 Sep 2012 11:38:50 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10885 Cc: 10885@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > (defun replace-highlight (match-beg match-end range-beg range-end > - string regexp case-fold) > + string regexp word case-fold) Maybe we should use an isearch-state argument? Stefan From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 06 04:57:16 2012 Received: (at 10885-done) by debbugs.gnu.org; 6 Sep 2012 08:57:17 +0000 Received: from localhost ([127.0.0.1]:42149 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9Xti-0004vW-S0 for submit@debbugs.gnu.org; Thu, 06 Sep 2012 04:57:16 -0400 Received: from ps18281.dreamhost.com ([69.163.218.105]:51304 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9Xtb-0004vA-UJ for 10885-done@debbugs.gnu.org; Thu, 06 Sep 2012 04:57:11 -0400 Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id C8DA0451CB38; Thu, 6 Sep 2012 01:56:54 -0700 (PDT) From: Juri Linkov To: Stefan Monnier Subject: Re: bug#10885: Replace expressions: enhance functionality when searching in filled paragraphs Organization: JURTA References: <33392837.post@talk.nabble.com> <1oipiuxspa.fsf@fencepost.gnu.org> <87d38z1bp3.fsf@mail.jurta.org> <87linm79pc.fsf@mail.jurta.org> <8762ebbehj.fsf@mail.jurta.org> <87oblo21xe.fsf@mail.jurta.org> <87boho1wyz.fsf@mail.jurta.org> <87ligozwx1.fsf@mail.jurta.org> Date: Thu, 06 Sep 2012 11:54:12 +0300 In-Reply-To: (Stefan Monnier's message of "Wed, 05 Sep 2012 10:38:59 -0400") Message-ID: <87y5knpm4r.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10885-done Cc: 10885-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) >> Since query-replace is going in the direction of closer integration with >> isearch, the right thing would be to get its search function from isearch. > > Agreed. Installed. Since this enhancement request is completely implemented, and all mentioned problems are fixed, I'm closing it. >> (defun replace-highlight (match-beg match-end range-beg range-end >> - string regexp case-fold) >> + string regexp word case-fold) > > Maybe we should use an isearch-state argument? Actually these arguments correspond to the variables of `perform-replace', not isearch state. So I renamed them to the names used in `perform-replace', causing isearch-related let-bindings in `replace-highlight' to be the exact copy of let-bindings in `perform-replace'. From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 06 11:54:47 2012 Received: (at 10885) by debbugs.gnu.org; 6 Sep 2012 15:54:47 +0000 Received: from localhost ([127.0.0.1]:44357 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9ePm-0008Ey-M9 for submit@debbugs.gnu.org; Thu, 06 Sep 2012 11:54:46 -0400 Received: from mail-ob0-f172.google.com ([209.85.214.172]:56809) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9ePk-0008Eq-FL for 10885@debbugs.gnu.org; Thu, 06 Sep 2012 11:54:45 -0400 Received: by obbwc20 with SMTP id wc20so2574168obb.3 for <10885@debbugs.gnu.org>; Thu, 06 Sep 2012 08:54:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=2p5e5jEwz54/8aLaL0skWaDkeoC9uNX/plBNoU8B02Q=; b=sjaaZosPVaLiACnLjm6iDzCp6mQTLazsmZL03rShC21gqIV3v7SddMNSwsmodZNSrq PmCXuEW7fBNq9Kr2J0gsRfPDDgjCR5gTjTFX34wiw6c+4CEegkNfliQRKdIp0hjcpG0m +kAhsVuglhFAldJRwR1yh9dur97mI0eMdL802v/6iteuHWXDXkiGfJNHPdC6yz4HG6NA 1eCT0AGj33h91GxJnQ2V2udsmeMEGFoUEDQVPkXsBVka741iWu8o6G+HdcWk12afih7l HpScuNbHamzbvhKgDVJ5DqYk/Q+L9MgzQNJ09JO4pPQI6Omq0zOIlv5UtmFhOWP0uOQq odMg== MIME-Version: 1.0 Received: by 10.60.13.37 with SMTP id e5mr2621974oec.98.1346946870869; Thu, 06 Sep 2012 08:54:30 -0700 (PDT) Received: by 10.60.50.130 with HTTP; Thu, 6 Sep 2012 08:54:30 -0700 (PDT) In-Reply-To: <87y5knpm4r.fsf@mail.jurta.org> References: <33392837.post@talk.nabble.com> <1oipiuxspa.fsf@fencepost.gnu.org> <87d38z1bp3.fsf@mail.jurta.org> <87linm79pc.fsf@mail.jurta.org> <8762ebbehj.fsf@mail.jurta.org> <87oblo21xe.fsf@mail.jurta.org> <87boho1wyz.fsf@mail.jurta.org> <87ligozwx1.fsf@mail.jurta.org> <87y5knpm4r.fsf@mail.jurta.org> Date: Thu, 6 Sep 2012 17:54:30 +0200 Message-ID: Subject: Re: bug#10885: Replace expressions: enhance functionality when searching in filled paragraphs From: Dani Moncayo To: juri@jurta.org Content-Type: text/plain; charset=ISO-8859-1 X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10885 Cc: 10885@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) On Thu, Sep 6, 2012 at 10:54 AM, Juri Linkov wrote: >>> Since query-replace is going in the direction of closer integration with >>> isearch, the right thing would be to get its search function from isearch. >> >> Agreed. > > Installed. [...] Thank you so much Juri. I have some comments: 1. You've defined two separate variables (`isearch-lax-whitespace' and `isearch-regexp-lax-whitespace') to enable/disable the lax whitespace matching in search commands: one for basic search commands and the other for regexp search commands. But there is only one similar variable (replace-lax-whitespace) which controls both basic and regexp replace commands. Why this inconsistency? I.e. why not define also a `replace-regexp-lax-whitespace' variable? 2. While in an incremental search commands, it is possible to toggle the value of the corresponding variable with `M-s SPC'. Why not having the same possibility in incremental replace commands? 3. Many users will want a consistent behavior wrt whitespace-matching between (regexp) search and (regexp) replace commands. So, why not allowing to "connect" the corresponding variables? I.e. why not defining some special value for `replace-lax-whitespace' and `replace-regexp-lax-whitespace' which means "get the value from the corresponding search variable" ? TIA. -- Dani Moncayo From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 06 13:17:23 2012 Received: (at 10885) by debbugs.gnu.org; 6 Sep 2012 17:17:23 +0000 Received: from localhost ([127.0.0.1]:44547 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9fhi-0001lE-AG for submit@debbugs.gnu.org; Thu, 06 Sep 2012 13:17:23 -0400 Received: from ps18281.dreamhost.com ([69.163.218.105]:41335 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9fhf-0001l5-MJ for 10885@debbugs.gnu.org; Thu, 06 Sep 2012 13:17:21 -0400 Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id E5140451CC02; Thu, 6 Sep 2012 10:17:04 -0700 (PDT) From: Juri Linkov To: Dani Moncayo Subject: Re: bug#10885: Replace expressions: enhance functionality when searching in filled paragraphs Organization: JURTA References: <33392837.post@talk.nabble.com> <1oipiuxspa.fsf@fencepost.gnu.org> <87d38z1bp3.fsf@mail.jurta.org> <87linm79pc.fsf@mail.jurta.org> <8762ebbehj.fsf@mail.jurta.org> <87oblo21xe.fsf@mail.jurta.org> <87boho1wyz.fsf@mail.jurta.org> <87ligozwx1.fsf@mail.jurta.org> <87y5knpm4r.fsf@mail.jurta.org> Date: Thu, 06 Sep 2012 19:50:58 +0300 In-Reply-To: (Dani Moncayo's message of "Thu, 6 Sep 2012 17:54:30 +0200") Message-ID: <871uif3xjh.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10885 Cc: 10885@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > 1. You've defined two separate variables (`isearch-lax-whitespace' > and `isearch-regexp-lax-whitespace') to enable/disable the lax > whitespace matching in search commands: one for basic search commands > and the other for regexp search commands. But there is only one > similar variable (replace-lax-whitespace) which controls both basic > and regexp replace commands. Why this inconsistency? I.e. why not > define also a `replace-regexp-lax-whitespace' variable? `isearch-regexp-lax-whitespace' was necessary to provide backward-compatibility for old functionality. Very likely it will be declared obsolete. But of course, it would be better to have `replace-regexp-lax-whitespace' for consistency until they both will be declared obsolete simultaneously. > 2. While in an incremental search commands, it is possible to toggle > the value of the corresponding variable with `M-s SPC'. Why not > having the same possibility in incremental replace commands? Isearch has different implementation than query-replace. query-replace uses the normal minibuffer to read a string to replace. Implementing `M-s SPC' for it means more trouble: `query-replace-read-from' should set the arg `keymap' of `read-from-minibuffer' to a new keymap with the `M-s SPC' keybinding bound to a function to toggle the value of the defcustom option. > 3. Many users will want a consistent behavior wrt whitespace-matching > between (regexp) search and (regexp) replace commands. So, why not > allowing to "connect" the corresponding variables? I.e. why not > defining some special value for `replace-lax-whitespace' and > `replace-regexp-lax-whitespace' which means "get the value from the > corresponding search variable" ? When it will be decided that isearch and query-replace should have the same default values, then `replace-lax-whitespace' could inherit its default value from `isearch-lax-whitespace'. From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 06 13:39:31 2012 Received: (at 10885) by debbugs.gnu.org; 6 Sep 2012 17:39:31 +0000 Received: from localhost ([127.0.0.1]:44597 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9g38-0002fh-CF for submit@debbugs.gnu.org; Thu, 06 Sep 2012 13:39:30 -0400 Received: from mail-ob0-f172.google.com ([209.85.214.172]:50918) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9g34-0002fW-Iu for 10885@debbugs.gnu.org; Thu, 06 Sep 2012 13:39:27 -0400 Received: by obbwc20 with SMTP id wc20so2787995obb.3 for <10885@debbugs.gnu.org>; Thu, 06 Sep 2012 10:39:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=xfOPQkoaX17MPRxwdG34VXbLRrssNbtQsuCElUvswMI=; b=bvECNUQZUFfnSF3KOt0chcef2GS3896+GlbxcLBhueFLmCmVPGXKTiNBR+u5UZhpRm lg+eDuLb8kdcclu58nyH9LFbWrxwUwD71P3ToqtXkAxWBZcj8XJOeEyFmWCxo5sq22CM ennFwjqVv1z9YtFjS1634iPUD5cAq2IzYSO67GJ40ywRdxru+HUonJ/geAUsYoSFuN0E FxK/cRpAyOyQt/BtiIAfMhrZ+bhUMDrZvf2RECUcun0oZmw1iFA6x/471cgYSfX1OHVU wxhh2R1IgZjJT82TydBBZVyb7qYEAbNizhzab4EJY+Eo6Mi1szWKC+IuY9mIouIQd1Uf EAXA== MIME-Version: 1.0 Received: by 10.182.89.102 with SMTP id bn6mr3255536obb.7.1346953152770; Thu, 06 Sep 2012 10:39:12 -0700 (PDT) Received: by 10.60.50.130 with HTTP; Thu, 6 Sep 2012 10:39:12 -0700 (PDT) In-Reply-To: <871uif3xjh.fsf@mail.jurta.org> References: <33392837.post@talk.nabble.com> <1oipiuxspa.fsf@fencepost.gnu.org> <87d38z1bp3.fsf@mail.jurta.org> <87linm79pc.fsf@mail.jurta.org> <8762ebbehj.fsf@mail.jurta.org> <87oblo21xe.fsf@mail.jurta.org> <87boho1wyz.fsf@mail.jurta.org> <87ligozwx1.fsf@mail.jurta.org> <87y5knpm4r.fsf@mail.jurta.org> <871uif3xjh.fsf@mail.jurta.org> Date: Thu, 6 Sep 2012 19:39:12 +0200 Message-ID: Subject: Re: bug#10885: Replace expressions: enhance functionality when searching in filled paragraphs From: Dani Moncayo To: Juri Linkov Content-Type: text/plain; charset=ISO-8859-1 X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10885 Cc: 10885@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) On Thu, Sep 6, 2012 at 6:50 PM, Juri Linkov wrote: >> 1. You've defined two separate variables (`isearch-lax-whitespace' >> and `isearch-regexp-lax-whitespace') to enable/disable the lax >> whitespace matching in search commands: one for basic search commands >> and the other for regexp search commands. But there is only one >> similar variable (replace-lax-whitespace) which controls both basic >> and regexp replace commands. Why this inconsistency? I.e. why not >> define also a `replace-regexp-lax-whitespace' variable? > > `isearch-regexp-lax-whitespace' was necessary to provide > backward-compatibility for old functionality. Very likely > it will be declared obsolete. Ah Good. I think we all agree that this feature is confusing/unnecessary in regexp search & replace. > But of course, it would be better > to have `replace-regexp-lax-whitespace' for consistency until > they both will be declared obsolete simultaneously. > >> 2. While in an incremental search commands, it is possible to toggle >> the value of the corresponding variable with `M-s SPC'. Why not >> having the same possibility in incremental replace commands? > > Isearch has different implementation than query-replace. > query-replace uses the normal minibuffer to read a string to replace. > Implementing `M-s SPC' for it means more trouble: > `query-replace-read-from' should set the arg `keymap' of > `read-from-minibuffer' to a new keymap with the `M-s SPC' keybinding > bound to a function to toggle the value of the defcustom option. But I meant to bind `M-s SPC' not while reading the arguments, but right after that, i.e. during the interactive replacing. >> 3. Many users will want a consistent behavior wrt whitespace-matching >> between (regexp) search and (regexp) replace commands. So, why not >> allowing to "connect" the corresponding variables? I.e. why not >> defining some special value for `replace-lax-whitespace' and >> `replace-regexp-lax-whitespace' which means "get the value from the >> corresponding search variable" ? > > When it will be decided that isearch and query-replace should have > the same default values, then `replace-lax-whitespace' could inherit > its default value from `isearch-lax-whitespace'. But I don't meant that. What I want is the possibility to have these two variables "synchronized" or "connected" at every moment, even after toggling its value with `M-s SPC'. IOW: make Isearch and query-replace _share_ the same setting (at every moment). -- Dani Moncayo From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 06 15:13:10 2012 Received: (at 10885) by debbugs.gnu.org; 6 Sep 2012 19:13:10 +0000 Received: from localhost ([127.0.0.1]:44746 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9hVm-0004q9-It for submit@debbugs.gnu.org; Thu, 06 Sep 2012 15:13:10 -0400 Received: from ps18281.dreamhost.com ([69.163.218.105]:34154 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9hVj-0004q1-RI for 10885@debbugs.gnu.org; Thu, 06 Sep 2012 15:13:08 -0400 Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id A25AC451CC74; Thu, 6 Sep 2012 12:12:52 -0700 (PDT) From: Juri Linkov To: Dani Moncayo Subject: Re: bug#10885: Replace expressions: enhance functionality when searching in filled paragraphs Organization: JURTA References: <33392837.post@talk.nabble.com> <1oipiuxspa.fsf@fencepost.gnu.org> <87d38z1bp3.fsf@mail.jurta.org> <87linm79pc.fsf@mail.jurta.org> <8762ebbehj.fsf@mail.jurta.org> <87oblo21xe.fsf@mail.jurta.org> <87boho1wyz.fsf@mail.jurta.org> <87ligozwx1.fsf@mail.jurta.org> <87y5knpm4r.fsf@mail.jurta.org> <871uif3xjh.fsf@mail.jurta.org> Date: Thu, 06 Sep 2012 22:11:33 +0300 In-Reply-To: (Dani Moncayo's message of "Thu, 6 Sep 2012 19:39:12 +0200") Message-ID: <87ehmfx8yi.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10885 Cc: 10885@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > But I meant to bind `M-s SPC' not while reading the arguments, but > right after that, i.e. during the interactive replacing. If you meant `query-replace-map' then it lacks other isearch keybindings too, e.g. toggling case-fold, regexp and word mode. It has a similar feature to edit the replacement string but it's bound to the `E' key unlike `M-e' to edit the search string in isearch. > But I don't meant that. What I want is the possibility to have these > two variables "synchronized" or "connected" at every moment, even > after toggling its value with `M-s SPC'. IOW: make Isearch and > query-replace _share_ the same setting (at every moment). They are already shared and synchronized when you run query-replace from isearch like e.g. `C-s replace this M-w SPC M-%'. From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 06 15:17:38 2012 Received: (at 10885) by debbugs.gnu.org; 6 Sep 2012 19:17:38 +0000 Received: from localhost ([127.0.0.1]:44750 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9ha6-0004wV-3T for submit@debbugs.gnu.org; Thu, 06 Sep 2012 15:17:38 -0400 Received: from ps18281.dreamhost.com ([69.163.218.105]:35953 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9ha4-0004wO-7h for 10885@debbugs.gnu.org; Thu, 06 Sep 2012 15:17:37 -0400 Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id A4C4E451CC74; Thu, 6 Sep 2012 12:17:21 -0700 (PDT) From: Juri Linkov To: Dani Moncayo Subject: Re: bug#10885: Replace expressions: enhance functionality when searching in filled paragraphs Organization: JURTA References: <33392837.post@talk.nabble.com> <1oipiuxspa.fsf@fencepost.gnu.org> <87d38z1bp3.fsf@mail.jurta.org> <87linm79pc.fsf@mail.jurta.org> <8762ebbehj.fsf@mail.jurta.org> <87oblo21xe.fsf@mail.jurta.org> <87boho1wyz.fsf@mail.jurta.org> <87ligozwx1.fsf@mail.jurta.org> <87y5knpm4r.fsf@mail.jurta.org> <871uif3xjh.fsf@mail.jurta.org> <87ehmfx8yi.fsf@mail.jurta.org> Date: Thu, 06 Sep 2012 22:15:33 +0300 In-Reply-To: <87ehmfx8yi.fsf@mail.jurta.org> (Juri Linkov's message of "Thu, 06 Sep 2012 22:11:33 +0300") Message-ID: <87627rx8q6.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10885 Cc: 10885@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > from isearch like e.g. `C-s replace this M-w SPC M-%'. === M-s From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 06 15:45:45 2012 Received: (at 10885) by debbugs.gnu.org; 6 Sep 2012 19:45:45 +0000 Received: from localhost ([127.0.0.1]:44788 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9i1H-0005ZV-Hq for submit@debbugs.gnu.org; Thu, 06 Sep 2012 15:45:45 -0400 Received: from mail-ob0-f172.google.com ([209.85.214.172]:63729) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9i1F-0005ZN-3F for 10885@debbugs.gnu.org; Thu, 06 Sep 2012 15:45:41 -0400 Received: by obbwc20 with SMTP id wc20so3026536obb.3 for <10885@debbugs.gnu.org>; Thu, 06 Sep 2012 12:45:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=6Q1+daiN9xea6MAudtFr8TOvXxaTqaT3KAAQecDyyjc=; b=JGksKPwXkecErVhlx4Dv8c+A6D0HRlDzf1ccpAqbi98Dk1nY4t+rNrrDBsRg5/1nLd gNcpqUw0Wqeam1An4y/RE4GxaVFIkeNdW61e5eUGMoQsXlWIMUsXDy7U58J1VVQNkCcY vx69jg25zGQjFFNbCMt8L9Xm8mgXUhYAcrigixuM9vGQ3d8ZJsX3RZbHcAGN5fRKFkLa n8B4FfcPSUMACL+PTpE+MqsYtSuQDHK8Hybg+EFB19iIftD1btC/ZCqCKJIuCAOVquO5 yDYOLAVTmJcrCs6w/k9/yhoDFwL1szhDu2iMkGwr4v/jg7g/EbZ9jHQK+4156nu7zwMA NqyQ== MIME-Version: 1.0 Received: by 10.60.30.168 with SMTP id t8mr3634997oeh.89.1346960725861; Thu, 06 Sep 2012 12:45:25 -0700 (PDT) Received: by 10.60.50.130 with HTTP; Thu, 6 Sep 2012 12:45:25 -0700 (PDT) In-Reply-To: <87ehmfx8yi.fsf@mail.jurta.org> References: <33392837.post@talk.nabble.com> <1oipiuxspa.fsf@fencepost.gnu.org> <87d38z1bp3.fsf@mail.jurta.org> <87linm79pc.fsf@mail.jurta.org> <8762ebbehj.fsf@mail.jurta.org> <87oblo21xe.fsf@mail.jurta.org> <87boho1wyz.fsf@mail.jurta.org> <87ligozwx1.fsf@mail.jurta.org> <87y5knpm4r.fsf@mail.jurta.org> <871uif3xjh.fsf@mail.jurta.org> <87ehmfx8yi.fsf@mail.jurta.org> Date: Thu, 6 Sep 2012 21:45:25 +0200 Message-ID: Subject: Re: bug#10885: Replace expressions: enhance functionality when searching in filled paragraphs From: Dani Moncayo To: Juri Linkov Content-Type: text/plain; charset=ISO-8859-1 X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10885 Cc: 10885@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) On Thu, Sep 6, 2012 at 9:11 PM, Juri Linkov wrote: >> But I meant to bind `M-s SPC' not while reading the arguments, but >> right after that, i.e. during the interactive replacing. > > If you meant `query-replace-map' then it lacks other isearch > keybindings too, e.g. toggling case-fold, regexp and word mode. Well, I think all these commands would make sense during a query-replace, for adjusting the search (that is taking place as part of the replace operation) in the same way that they would adjust an Isearch. So, why not binding them in `query-replace-map'? That would make Isearch and query-replace more coherent. > It has a similar feature to edit the replacement string but it's bound > to the `E' key unlike `M-e' to edit the search string in isearch. IMO, here `M-e' would be better, for consistency with Isearch. >> But I don't meant that. What I want is the possibility to have these >> two variables "synchronized" or "connected" at every moment, even >> after toggling its value with `M-s SPC'. IOW: make Isearch and >> query-replace _share_ the same setting (at every moment). > > They are already shared and synchronized when you run query-replace > from isearch like e.g. `C-s replace this M-s SPC M-%'. That's fine, but it's not the case I'm talking about. It seems that my English is worse than I thought :) I'll try to explain it in yet another way: I'd like to configure my Emacs so that, at any moment, an Isearch would find exactly the same matches than a query-replace (with the same search string, of course), and without the need to start the query-replace from an Isearch. One way to achieve that goal would be to define a special value for `replace-lax-whitespace' whose meaning be "use the current value of `isearch-lax-whitespace'". -- Dani Moncayo From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 06 16:21:39 2012 Received: (at 10885) by debbugs.gnu.org; 6 Sep 2012 20:21:39 +0000 Received: from localhost ([127.0.0.1]:44808 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9ia2-0006OH-82 for submit@debbugs.gnu.org; Thu, 06 Sep 2012 16:21:38 -0400 Received: from mail-ob0-f172.google.com ([209.85.214.172]:39201) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9ia0-0006OA-NB for 10885@debbugs.gnu.org; Thu, 06 Sep 2012 16:21:37 -0400 Received: by obbwc20 with SMTP id wc20so3089703obb.3 for <10885@debbugs.gnu.org>; Thu, 06 Sep 2012 13:21:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=iAowppQWH7Se77sm5AAAkxV4+21kz80dYmg0pylg2JU=; b=JWNzgT47T0IRPnHNCkek9Gfj61ahNOdb33/1vJi+0sENgMZ89d8RvoXtsx+Inx0rY1 BHsVrXADCa4LIEqzEg9JCLRJhL/9OLVea/Eyy0jP2U3E2sQG7mduEfnqBpMKhrbwzwWc YB+2cLbLrgqgPDFvK6at1FZtxb2bwbaQn6JmYfFHkz6Lfl5YLk7KrrbOhQWs2F96pxIt 46zHTDX2HTYOK00z+Rv9+uwjY+RVk7gzHRDGjA/YfIbWaTh0WDif2Rm+Mc7nAo1HnaYc 3eSgvvQoXy/jfx8Ug41qo6Uog3m23H26OqyPB/xsLBbjzy2ae6vATv0lSvGrNdlJuvuO 5bIA== MIME-Version: 1.0 Received: by 10.182.188.41 with SMTP id fx9mr3541661obc.92.1346962881300; Thu, 06 Sep 2012 13:21:21 -0700 (PDT) Received: by 10.60.50.130 with HTTP; Thu, 6 Sep 2012 13:21:21 -0700 (PDT) In-Reply-To: References: <33392837.post@talk.nabble.com> <1oipiuxspa.fsf@fencepost.gnu.org> <87d38z1bp3.fsf@mail.jurta.org> <87linm79pc.fsf@mail.jurta.org> <8762ebbehj.fsf@mail.jurta.org> <87oblo21xe.fsf@mail.jurta.org> <87boho1wyz.fsf@mail.jurta.org> <87ligozwx1.fsf@mail.jurta.org> <87y5knpm4r.fsf@mail.jurta.org> <871uif3xjh.fsf@mail.jurta.org> <87ehmfx8yi.fsf@mail.jurta.org> Date: Thu, 6 Sep 2012 22:21:21 +0200 Message-ID: Subject: Re: bug#10885: Replace expressions: enhance functionality when searching in filled paragraphs From: Dani Moncayo To: Juri Linkov Content-Type: text/plain; charset=ISO-8859-1 X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10885 Cc: 10885@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) >> It has a similar feature to edit the replacement string but it's bound >> to the `E' key unlike `M-e' to edit the search string in isearch. > > IMO, here `M-e' would be better, for consistency with Isearch. Well, not really. Obviously `M-e' should be used for editing the _search_ string (i.e. the string to replace), not the replacement string. -- Dani Moncayo From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 06 17:25:22 2012 Received: (at 10885) by debbugs.gnu.org; 6 Sep 2012 21:25:22 +0000 Received: from localhost ([127.0.0.1]:44902 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9jZh-0007tx-2s for submit@debbugs.gnu.org; Thu, 06 Sep 2012 17:25:22 -0400 Received: from chene.dit.umontreal.ca ([132.204.246.20]:46201) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9jZf-0007tq-D2 for 10885@debbugs.gnu.org; Thu, 06 Sep 2012 17:25:20 -0400 Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id q86LP4PI000971; Thu, 6 Sep 2012 17:25:04 -0400 Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 5E079B4085; Thu, 6 Sep 2012 17:25:04 -0400 (EDT) From: Stefan Monnier To: Juri Linkov Subject: Re: bug#10885: Replace expressions: enhance functionality when searching in filled paragraphs Message-ID: References: <33392837.post@talk.nabble.com> <1oipiuxspa.fsf@fencepost.gnu.org> <87d38z1bp3.fsf@mail.jurta.org> <87linm79pc.fsf@mail.jurta.org> <8762ebbehj.fsf@mail.jurta.org> <87oblo21xe.fsf@mail.jurta.org> <87boho1wyz.fsf@mail.jurta.org> <87ligozwx1.fsf@mail.jurta.org> <87y5knpm4r.fsf@mail.jurta.org> <871uif3xjh.fsf@mail.jurta.org> Date: Thu, 06 Sep 2012 17:25:04 -0400 In-Reply-To: <871uif3xjh.fsf@mail.jurta.org> (Juri Linkov's message of "Thu, 06 Sep 2012 19:50:58 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -3.5 (---) X-Debbugs-Envelope-To: 10885 Cc: 10885@debbugs.gnu.org, Dani Moncayo X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.5 (---) > `isearch-regexp-lax-whitespace' was necessary to provide > backward-compatibility for old functionality. Very likely > it will be declared obsolete. But of course, it would be better > to have `replace-regexp-lax-whitespace' for consistency until > they both will be declared obsolete simultaneously. I don't think it makes sense to add something only for "consistency" reasons, knowing it'll be obsoleted soon. Stefan From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 07 04:33:40 2012 Received: (at 10885) by debbugs.gnu.org; 7 Sep 2012 08:33:40 +0000 Received: from localhost ([127.0.0.1]:45381 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9u0S-0000Gm-Dv for submit@debbugs.gnu.org; Fri, 07 Sep 2012 04:33:40 -0400 Received: from mail-ob0-f172.google.com ([209.85.214.172]:53522) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9u0Q-0000Ge-GP for 10885@debbugs.gnu.org; Fri, 07 Sep 2012 04:33:39 -0400 Received: by obbwc20 with SMTP id wc20so3889567obb.3 for <10885@debbugs.gnu.org>; Fri, 07 Sep 2012 01:33:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=7K5W3z0k0eL65pFd2I4JJSFQwzktbSPTsWXMPB7iSds=; b=DJ6RpQAG4VHbhBYidGFj65TgNBPAEblGt3cNSwwbZRldpog8KXj8+WpTnn+ZoIYSS9 gHzui2PhSJ8A745XxpFRqnFewQ4ycuwCsFb1yt6kfdSXdAPgGSnsCUnALIV+hjC2YxU4 8cINV4JzZkiw6QAH0f2rIKZ2HnOp9D6xjGFFAG6uLBYeSBA9fnKzCZs+6gwoR5cO9xdy w/gPOebDlJ5KaRNi+8G/+K4L6qGs1pgQsZdQUdPPmT+ijA318aAmGilVigzNeXprv9q+ /1ufKCjPpzgoNMVeILqzMctozBfonDgKiLQVQzEXGsj4Smf5NsOq7uJ/9i5mp7/6+JsY HOQA== MIME-Version: 1.0 Received: by 10.182.47.9 with SMTP id z9mr4894124obm.58.1347006799896; Fri, 07 Sep 2012 01:33:19 -0700 (PDT) Received: by 10.60.50.130 with HTTP; Fri, 7 Sep 2012 01:33:19 -0700 (PDT) In-Reply-To: References: <33392837.post@talk.nabble.com> <1oipiuxspa.fsf@fencepost.gnu.org> <87d38z1bp3.fsf@mail.jurta.org> <87linm79pc.fsf@mail.jurta.org> <8762ebbehj.fsf@mail.jurta.org> <87oblo21xe.fsf@mail.jurta.org> <87boho1wyz.fsf@mail.jurta.org> <87ligozwx1.fsf@mail.jurta.org> <87y5knpm4r.fsf@mail.jurta.org> <871uif3xjh.fsf@mail.jurta.org> Date: Fri, 7 Sep 2012 10:33:19 +0200 Message-ID: Subject: Re: bug#10885: Replace expressions: enhance functionality when searching in filled paragraphs From: Dani Moncayo To: Stefan Monnier Content-Type: text/plain; charset=ISO-8859-1 X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10885 Cc: Juri Linkov , 10885@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) On Thu, Sep 6, 2012 at 11:25 PM, Stefan Monnier wrote: >> `isearch-regexp-lax-whitespace' was necessary to provide >> backward-compatibility for old functionality. Very likely >> it will be declared obsolete. But of course, it would be better >> to have `replace-regexp-lax-whitespace' for consistency until >> they both will be declared obsolete simultaneously. > > I don't think it makes sense to add something only for "consistency" > reasons, knowing it'll be obsoleted soon. I think replace-regexp-lax-whitespace is needed while the Isearch counterpart (isearch-regexp-lax-whitespace) exists, if you want to support the option I was asking for, whereby the lax-whitespace settings in query-replace[-regexp] are "connected" (or "redirected") to the Isearch counterparts. And IMO this option is important, for a consistent user-experience. But FWIW, as I said, I consider this lax-whitespace feature confusing and unnecesary in regexp search/replace. Thus, I'll rather remove both isearch-regexp-lax-whitespace and replace-regexp-lax-whitespace. -- Dani Moncayo From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 07 05:41:25 2012 Received: (at 10885) by debbugs.gnu.org; 7 Sep 2012 09:41:25 +0000 Received: from localhost ([127.0.0.1]:45463 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9v40-0003ZV-LN for submit@debbugs.gnu.org; Fri, 07 Sep 2012 05:41:25 -0400 Received: from ps18281.dreamhost.com ([69.163.218.105]:58450 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9v3x-0003ZI-IJ for 10885@debbugs.gnu.org; Fri, 07 Sep 2012 05:41:23 -0400 Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id F3C87451CC5E; Fri, 7 Sep 2012 02:41:02 -0700 (PDT) From: Juri Linkov To: Dani Moncayo Subject: Re: bug#10885: Replace expressions: enhance functionality when searching in filled paragraphs Organization: JURTA References: <33392837.post@talk.nabble.com> <1oipiuxspa.fsf@fencepost.gnu.org> <87d38z1bp3.fsf@mail.jurta.org> <87linm79pc.fsf@mail.jurta.org> <8762ebbehj.fsf@mail.jurta.org> <87oblo21xe.fsf@mail.jurta.org> <87boho1wyz.fsf@mail.jurta.org> <87ligozwx1.fsf@mail.jurta.org> <87y5knpm4r.fsf@mail.jurta.org> <871uif3xjh.fsf@mail.jurta.org> Date: Fri, 07 Sep 2012 12:28:59 +0300 In-Reply-To: (Dani Moncayo's message of "Fri, 7 Sep 2012 10:33:19 +0200") Message-ID: <87a9x25gh0.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10885 Cc: 10885@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > I think replace-regexp-lax-whitespace is needed while the Isearch > counterpart (isearch-regexp-lax-whitespace) exists, if you want to > support the option I was asking for, whereby the lax-whitespace > settings in query-replace[-regexp] are "connected" (or "redirected") > to the Isearch counterparts. > > And IMO this option is important, for a consistent user-experience. The reason why replace-regexp-lax-whitespace is important to have is not just for consistency but because replace-lax-whitespace should not affect regexp replacements. But currently its value applies to regexp replacements because it depends on calls from isearch that has a separate variable for regexp that starts a lax-whitespace regexp replacement to replace the same regexp matches as in isearch. So actually a lax-whitespace regexp replacement feature exists in replace.el implicitly. A clean way to fix this problem is to add a new option replace-regexp-lax-whitespace: === modified file 'lisp/replace.el' --- lisp/replace.el 2012-09-06 09:12:16 +0000 +++ lisp/replace.el 2012-09-07 09:27:35 +0000 @@ -35,7 +35,15 @@ (defcustom case-replace t (defcustom replace-lax-whitespace nil "Non-nil means `query-replace' matches a sequence of whitespace chars. -When you enter a space or spaces in the strings or regexps to be replaced, +When you enter a space or spaces in the strings to be replaced, +it will match any sequence matched by the regexp `search-whitespace-regexp'." + :type 'boolean + :group 'matching + :version "24.3") + +(defcustom replace-regexp-lax-whitespace nil + "Non-nil means `query-replace-regexp' matches a sequence of whitespace chars. +When you enter a space or spaces in the regexps to be replaced, it will match any sequence matched by the regexp `search-whitespace-regexp'." :type 'boolean :group 'matching @@ -282,7 +290,7 @@ (defun query-replace-regexp (regexp to-s all caps, or capitalized, then its replacement is upcased or capitalized.) -If `replace-lax-whitespace' is non-nil, a space or spaces in the regexp +If `replace-regexp-lax-whitespace' is non-nil, a space or spaces in the regexp to be replaced will match a sequence of whitespace chars defined by the regexp in `search-whitespace-regexp'. @@ -362,7 +370,7 @@ (defun query-replace-regexp-eval (regexp Preserves case in each replacement if `case-replace' and `case-fold-search' are non-nil and REGEXP has no uppercase letters. -If `replace-lax-whitespace' is non-nil, a space or spaces in the regexp +If `replace-regexp-lax-whitespace' is non-nil, a space or spaces in the regexp to be replaced will match a sequence of whitespace chars defined by the regexp in `search-whitespace-regexp'. @@ -499,7 +507,7 @@ (defun replace-regexp (regexp to-string Preserve case in each match if `case-replace' and `case-fold-search' are non-nil and REGEXP has no uppercase letters. -If `replace-lax-whitespace' is non-nil, a space or spaces in the regexp +If `replace-regexp-lax-whitespace' is non-nil, a space or spaces in the regexp to be replaced will match a sequence of whitespace chars defined by the regexp in `search-whitespace-regexp'. @@ -1790,9 +1798,9 @@ (defun perform-replace (from-string repl (let ((isearch-regexp regexp-flag) (isearch-word delimited-flag) (isearch-lax-whitespace - (and replace-lax-whitespace (not regexp-flag))) + replace-lax-whitespace) (isearch-regexp-lax-whitespace - (and replace-lax-whitespace regexp-flag)) + replace-regexp-lax-whitespace) (isearch-case-fold-search case-fold-search) (isearch-forward t)) (isearch-search-fun)))) @@ -2151,9 +2159,9 @@ (defun replace-highlight (match-beg matc (isearch-regexp regexp-flag) (isearch-word delimited-flag) (isearch-lax-whitespace - (and replace-lax-whitespace (not regexp-flag))) + replace-lax-whitespace) (isearch-regexp-lax-whitespace - (and replace-lax-whitespace regexp-flag)) + replace-regexp-lax-whitespace) (isearch-case-fold-search case-fold-search) (isearch-forward t) (isearch-error nil)) === modified file 'lisp/isearch.el' --- lisp/isearch.el 2012-09-06 09:12:16 +0000 +++ lisp/isearch.el 2012-09-07 09:27:42 +0000 @@ -1613,10 +1613,9 @@ (defun isearch-query-replace (&optional ;; `isearch-no-upper-case-p' in `perform-replace' (search-upper-case nil) (replace-lax-whitespace - (and search-whitespace-regexp - (if isearch-regexp - isearch-regexp-lax-whitespace - isearch-lax-whitespace))) + isearch-lax-whitespace) + (replace-regexp-lax-whitespace + isearch-regexp-lax-whitespace) ;; Set `isearch-recursive-edit' to nil to prevent calling ;; `exit-recursive-edit' in `isearch-done' that terminates ;; the execution of this command when it is non-nil. From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 09 18:16:44 2012 Received: (at 10885) by debbugs.gnu.org; 9 Sep 2012 22:16:44 +0000 Received: from localhost ([127.0.0.1]:50754 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TApo4-0000BH-AG for submit@debbugs.gnu.org; Sun, 09 Sep 2012 18:16:44 -0400 Received: from ps18281.dreamhost.com ([69.163.218.105]:33104 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TApo2-0000BB-PX for 10885@debbugs.gnu.org; Sun, 09 Sep 2012 18:16:43 -0400 Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id DC696451CCA5 for <10885@debbugs.gnu.org>; Sun, 9 Sep 2012 15:16:08 -0700 (PDT) From: Juri Linkov To: 10885@debbugs.gnu.org Subject: Re: bug#10885: Replace expressions: enhance functionality when searching in filled paragraphs Organization: JURTA References: <33392837.post@talk.nabble.com> <1oipiuxspa.fsf@fencepost.gnu.org> <87d38z1bp3.fsf@mail.jurta.org> <87linm79pc.fsf@mail.jurta.org> <8762ebbehj.fsf@mail.jurta.org> <87oblo21xe.fsf@mail.jurta.org> <87boho1wyz.fsf@mail.jurta.org> <87ligozwx1.fsf@mail.jurta.org> <87y5knpm4r.fsf@mail.jurta.org> <871uif3xjh.fsf@mail.jurta.org> <87a9x25gh0.fsf@mail.jurta.org> Date: Mon, 10 Sep 2012 01:15:48 +0300 In-Reply-To: <87a9x25gh0.fsf@mail.jurta.org> (Juri Linkov's message of "Fri, 07 Sep 2012 12:28:59 +0300") Message-ID: <87pq5udeqz.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10885 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > The reason why replace-regexp-lax-whitespace is important to have > is not just for consistency but because replace-lax-whitespace > should not affect regexp replacements. But currently its value applies > to regexp replacements because it depends on calls from isearch that has > a separate variable for regexp that starts a lax-whitespace regexp replacement > to replace the same regexp matches as in isearch. So actually a lax-whitespace > regexp replacement feature exists in replace.el implicitly. A clean way to > fix this problem is to add a new option replace-regexp-lax-whitespace: I see no way to avoid adding replace-regexp-lax-whitespace as counterpart of isearch-regexp-lax-whitespace, so I installed it. Other features proposed by Dani (adding isearch-like keybindings to `query-replace-map' and connecting isearch and query-replace default values) don't belong to bug#10885 and could be discussed on emacs-devel because there are many problems with them like a problem that `query-replace-map' is used by `y-or-n-p' and other packages, and some of bindings (e.g. `scroll-down') are implemented only in `y-or-n-p' but not in `perform-replace'. Perhaps, a new common keymap should be separated from `query-replace-map', so `query-replace-map' could inherit from it and add own keybindings including isearch-like keybindings. From unknown Fri Aug 15 21:27:27 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 08 Oct 2012 11:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator