From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#11746: feature request: `isearch-query-replace' should open invisible text Date: Wed, 29 May 2013 01:28:52 +0300 Organization: JURTA Message-ID: <87txlmyc0r.fsf@mail.jurta.org> References: <87mx3z9od7.fsf@web.de> <87pq02btxv.fsf@mail.jurta.org> <87y5eq4pm1.fsf@web.de> <8761y410tk.fsf@mail.jurta.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1369780436 30730 80.91.229.3 (28 May 2013 22:33:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 28 May 2013 22:33:56 +0000 (UTC) Cc: michael_heerdegen@web.de To: 11746@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed May 29 00:33:55 2013 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 1UhSSp-0004wi-0z for geb-bug-gnu-emacs@m.gmane.org; Wed, 29 May 2013 00:33:55 +0200 Original-Received: from localhost ([::1]:47639 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UhSSo-0000nn-Id for geb-bug-gnu-emacs@m.gmane.org; Tue, 28 May 2013 18:33:54 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:37907) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UhSSg-0000nN-S2 for bug-gnu-emacs@gnu.org; Tue, 28 May 2013 18:33:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UhSSc-0005zy-3G for bug-gnu-emacs@gnu.org; Tue, 28 May 2013 18:33:46 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:49809) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UhSSb-0005zu-WE for bug-gnu-emacs@gnu.org; Tue, 28 May 2013 18:33:42 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UhSTu-00017U-1D for bug-gnu-emacs@gnu.org; Tue, 28 May 2013 18:35:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 28 May 2013 22:35:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11746 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 11746-submit@debbugs.gnu.org id=B11746.13697804724263 (code B ref 11746); Tue, 28 May 2013 22:35:01 +0000 Original-Received: (at 11746) by debbugs.gnu.org; 28 May 2013 22:34:32 +0000 Original-Received: from localhost ([127.0.0.1]:38167 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UhSTQ-00016i-2D for submit@debbugs.gnu.org; Tue, 28 May 2013 18:34:32 -0400 Original-Received: from ps18281.dreamhost.com ([69.163.218.105]:39336 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UhSTN-00016Z-I3 for 11746@debbugs.gnu.org; Tue, 28 May 2013 18:34:31 -0400 Original-Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 8B11B258B9E91C; Tue, 28 May 2013 15:33:07 -0700 (PDT) In-Reply-To: <8761y410tk.fsf@mail.jurta.org> (Juri Linkov's message of "Tue, 28 May 2013 02:04:50 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.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:74626 Archived-At: It would be nice to inform the users who customized `search-invisible' to nil that now `query-replace' ignores hidden matches, i.e. currently at the end `query-replace' reports in the echo area: Replaced 2 occurrences Instead of keeping silence about skipped occurrences a better message would be: Replaced 2 occurrences (skipped 3 read-only, 4 invisible, 5 filtered out) === modified file 'lisp/replace.el' --- lisp/replace.el 2013-05-27 23:38:56 +0000 +++ lisp/replace.el 2013-05-28 22:28:01 +0000 @@ -1934,6 +1965,9 @@ (defun perform-replace (from-string repl (keep-going t) (stack nil) (replace-count 0) + (skip-read-only-count 0) + (skip-filtered-count 0) + (skip-invisible-count 0) (nonempty-match nil) (multi-buffer nil) (recenter-last-op nil) ; Start cycling order with initial position. @@ -2042,20 +2076,24 @@ (defun perform-replace (from-string repl (and (/= (nth 0 match) (nth 1 match)) match)))))) - ;; Optionally ignore matches that have a read-only property. - (when (and (or (not query-replace-skip-read-only) - (not (text-property-not-all - (nth 0 real-match-data) (nth 1 real-match-data) - 'read-only nil))) - ;; Optionally filter out matches. - (run-hook-with-args-until-failure - 'isearch-filter-predicates - (nth 0 real-match-data) (nth 1 real-match-data)) - ;; Optionally ignore invisible matches. - (or (eq search-invisible t) - (not (isearch-range-invisible - (nth 0 real-match-data) (nth 1 real-match-data))))) - + (cond + ;; Optionally ignore matches that have a read-only property. + ((not (or (not query-replace-skip-read-only) + (not (text-property-not-all + (nth 0 real-match-data) (nth 1 real-match-data) + 'read-only nil)))) + (setq skip-read-only-count (1+ skip-read-only-count))) + ;; Optionally filter out matches. + ((not (run-hook-with-args-until-failure + 'isearch-filter-predicates + (nth 0 real-match-data) (nth 1 real-match-data))) + (setq skip-filtered-count (1+ skip-filtered-count))) + ;; Optionally ignore invisible matches. + ((not (or (eq search-invisible t) + (not (isearch-range-invisible + (nth 0 real-match-data) (nth 1 real-match-data))))) + (setq skip-invisible-count (1+ skip-invisible-count))) + (t ;; Calculate the replacement string, if necessary. (when replacements (set-match-data real-match-data) @@ -2260,13 +2298,31 @@ (defun perform-replace (from-string repl (match-end 0) (current-buffer)) (match-data t))) - stack))))) + stack)))))) (replace-dehighlight)) (or unread-command-events - (message "Replaced %d occurrence%s" + (message "Replaced %d occurrence%s%s" replace-count - (if (= replace-count 1) "" "s"))) + (if (= replace-count 1) "" "s") + (if (> (+ skip-read-only-count + skip-filtered-count + skip-invisible-count) 0) + (format " (skipped %s)" + (mapconcat + 'identity + (delq nil (list + (if (> skip-read-only-count 0) + (format "%s read-only" + skip-read-only-count)) + (if (> skip-invisible-count 0) + (format "%s invisible" + skip-invisible-count)) + (if (> skip-filtered-count 0) + (format "%s filtered out" + skip-filtered-count)))) + ", ")) + ""))) (or (and keep-going stack) multi-buffer))) ;;; replace.el ends here