From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kaushal Newsgroups: gmane.emacs.bugs Subject: bug#20687: 25.0.50; `perform-replace' should invoke a key that you have bound in `query-replace-map' Date: Tue, 2 Jun 2015 09:08:51 -0400 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e016357b23778c8051788a761 X-Trace: ger.gmane.org 1433250655 1679 80.91.229.3 (2 Jun 2015 13:10:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 2 Jun 2015 13:10:55 +0000 (UTC) Cc: juri@linkov.net To: 20687@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jun 02 15:10:42 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YzlxZ-0002We-C5 for geb-bug-gnu-emacs@m.gmane.org; Tue, 02 Jun 2015 15:10:25 +0200 Original-Received: from localhost ([::1]:58376 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YzlxO-0005lC-FY for geb-bug-gnu-emacs@m.gmane.org; Tue, 02 Jun 2015 09:10:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40017) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YzlxH-0005ir-EE for bug-gnu-emacs@gnu.org; Tue, 02 Jun 2015 09:10:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YzlxE-0004P2-7h for bug-gnu-emacs@gnu.org; Tue, 02 Jun 2015 09:10:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:55232) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YzlxE-0004OV-40 for bug-gnu-emacs@gnu.org; Tue, 02 Jun 2015 09:10:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YzlxD-0007LQ-G0 for bug-gnu-emacs@gnu.org; Tue, 02 Jun 2015 09:10:03 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Kaushal Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 02 Jun 2015 13:10:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20687 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 20687-submit@debbugs.gnu.org id=B20687.143325058128198 (code B ref 20687); Tue, 02 Jun 2015 13:10:03 +0000 Original-Received: (at 20687) by debbugs.gnu.org; 2 Jun 2015 13:09:41 +0000 Original-Received: from localhost ([127.0.0.1]:36974 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Yzlwq-0007Kk-Ck for submit@debbugs.gnu.org; Tue, 02 Jun 2015 09:09:40 -0400 Original-Received: from mail-yh0-f42.google.com ([209.85.213.42]:36727) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Yzlwn-0007KV-H4 for 20687@debbugs.gnu.org; Tue, 02 Jun 2015 09:09:38 -0400 Original-Received: by yhan67 with SMTP id n67so19565882yha.3 for <20687@debbugs.gnu.org>; Tue, 02 Jun 2015 06:09:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:cc:content-type; bh=MQ0/rMXyChkH4ec8I0sUMeQWsoUzYd5berWcRH6A3YY=; b=bi/55oehiAPo1v02uEvL2Pp6oN5jOJ9zywAI8BPi4SURoUxb3GshfU0Sq4UAA6ihDl MQV5WqtD0MQ19fS4g0hL1eJYJZxguQBrVlNCxJdcal6jfnqngIpdK6ovBahOVrVZVvuS +3F8SvXbsi174EanXXRgjr33EbsUPit/36FWjepi1s8EMirZUJVhB1RESQj0GD1V0Sv0 lek9yiP6XQ8MmWTWw78ShMFfihLwnUN5UO1e34gzEOUFaQlEk+xoExBZg9whGb9Bntau aAw4bA1Qu1pLV/+g4jKy8c32vIp+f5PXxG/d6eq2kyKApGL1yiavUSpSJl+suI3plX4A LhYQ== X-Received: by 10.236.229.161 with SMTP id h31mr28901886yhq.57.1433250571973; Tue, 02 Jun 2015 06:09:31 -0700 (PDT) Original-Received: by 10.13.253.5 with HTTP; Tue, 2 Jun 2015 06:08:51 -0700 (PDT) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:103474 Archived-At: --089e016357b23778c8051788a761 Content-Type: text/plain; charset=ISO-8859-1 Hi guys, I tried the fix as Drew suggested and it works great. Patch: --- replace.el 2015-06-02 09:04:57.944380000 -0400 +++ replace-editted.el 2015-06-02 09:08:22.038682000 -0400 @@ -2099,12 +2099,11 @@ ;; Data for the next match. If a cons, it has the same format as ;; (match-data); otherwise it is t if a match is possible at point. (match-again t) - (message (if query-flag (apply 'propertize (substitute-command-keys - "Query replacing %s with %s: (\\\\[help] for help) ") + "%sQuery replacing %s with %s: (\\\\[help] for help) ") minibuffer-prompt-properties)))) ;; If region is active, in Transient Mark mode, operate on region. @@ -2275,6 +2274,8 @@ nocasify literal)) next-replacement))) (message message + ;; Show whether `case-fold-search' is `t' or `nil' + (if case-fold-search "[case] " "[CaSe] ") (query-replace-descr from-string) (query-replace-descr replacement-presentation))) (setq key (read-event)) @@ -2404,6 +2405,7 @@ (replace-dehighlight) (save-excursion (recursive-edit)) (setq replaced t)) + (def (call-interactively def)) ; User-defined key - invoke it. ;; Note: we do not need to treat `exit-prefix' ;; specially here, since we reread ;; any unrecognized character. Here is then how I add a new binding to the query-replace-map: ;; http://emacs.stackexchange.com/a/12781/115 (defun drew/toggle-case () "Toggle the value of `case-fold-search' between `nil' and non-nil." (interactive) ;; `case-fold-search' automatically becomes buffer-local when set (setq case-fold-search (not case-fold-search))) (define-key query-replace-map (kbd "C") #'drew/toggle-case) ( https://github.com/kaushalmodi/.emacs.d/blob/e690fddc7176368b3d25b0d34ec02510ee92503a/setup-files/setup-search.el#L22-L28 ) -- Kaushal Modi --089e016357b23778c8051788a761 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hi guys,

I tried the fix as Drew suggest= ed and it works great.

Patch:

--- replace.el 2015-06-02 09:04:57.944380000 -= 0400
+++ replace-editted.el 2015-06-02 09:08:22.038682000 -0400
@@ -2099,12 +2099,11 @@<= /font>
=A0 =A0 =A0 =A0 =A0 ;; Data for the next match.=A0 If a cons, it has = the same format as
=A0 =A0 =A0 =A0 =A0 ;; (match-data); otherwise it = is t if a match is possible at point.
=A0 =A0 =A0 =A0 =A0 (match-agai= n t)
-
=A0 =A0 =A0 =A0 =A0 (message
=A0 =A0 =A0 =A0 =A0 = =A0(if query-flag
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(apply 'properti= ze
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (substitute-command-ke= ys
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"Query replacing= %s with %s: (\\<query-replace-map>\\[help] for help) ")<= /div>
+= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"%sQuery replacing %s with= %s: (\\<query-replace-map>\\[help] for help) ")
=A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 minibuffer-prompt-properties))))=
= =A0
=A0 =A0 =A0;; If region is active, in Transient Mark mode, operat= e on region.
@@ -2275,6 +2274,8 @@
=A0 =A0 =A0 nocasify literal))
=A0 =A0 next-replacement)))
=A0 =A0 =A0(message = message
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; = Show whether `case-fold-search' is `t' or `nil'
+ =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (if case-fold-search "= ;[case] " "[CaSe] ")
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 (query-replace-descr from-string)
<= div class=3D"gmail_default">=A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (query-replace-descr r= eplacement-presentation)))
=A0 =A0(setq key (read-event))
@@ -2404,6 +2405,7 @@=
= =A0 (replace-dehighlig= ht)
=A0 (save-ex= cursion (recursive-edit))
=A0 (setq replaced t))
<= font face=3D"trebuchet ms, sans-serif">+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0(def (call-interactively def)) ; User-defined key - invoke i= t.
=A0 ;; Note: w= e do not need to treat `exit-prefix'
=A0 ;; specially here, since we reread
=
=A0 ;; any unrecognized chara= cter.


Here is then how I add= a new binding to the query-replace-map:

(defun drew/toggle-case ()
=A0 &quo= t;Toggle the value of `case-fold-search' between `nil' and non-nil.= "
=A0 (interactive)
=A0 ;; `case-fold-search' = automatically becomes buffer-local when set
=A0 (setq case-fold-s= earch (not case-fold-search)))
(define-key query-replace-map (kbd= "C") #'drew/toggle-case)

<= br>

--
Kaushal Modi
--089e016357b23778c8051788a761--