From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Madhu Newsgroups: gmane.emacs.devel Subject: wdired replace-regexp (continue bug 14013?) Date: Tue, 03 Sep 2024 15:37:09 +0530 Message-ID: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22521"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Cancel-Lock: sha1:AhZm9jxTglomtbP52zB+p2fMa0o= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Sep 03 13:23:25 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1slRd7-0005i5-D9 for ged-emacs-devel@m.gmane-mx.org; Tue, 03 Sep 2024 13:23:25 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1slRMN-00087w-Dd; Tue, 03 Sep 2024 07:06:16 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1slQYa-0002gU-B2 for emacs-devel@gnu.org; Tue, 03 Sep 2024 06:14:40 -0400 Original-Received: from ciao.gmane.io ([116.202.254.214]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1slQY2-00087P-84 for emacs-devel@gnu.org; Tue, 03 Sep 2024 06:14:24 -0400 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1slQRR-0009IN-AM for emacs-devel@gnu.org; Tue, 03 Sep 2024 12:07:17 +0200 X-Injected-Via-Gmane: http://gmane.org/ Received-SPF: pass client-ip=116.202.254.214; envelope-from=ged-emacs-devel@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.25, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_HELO_TEMPERROR=0.01, T_SPF_TEMPERROR=0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Tue, 03 Sep 2024 07:05:53 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:323317 Archived-At: * commit 935cc42795686710f82b8928b6802f20be8f27c0 |Author: Juri Linkov |AuthorDate: Mon Mar 28 21:00:32 2022 +0300 |Commit: Juri Linkov |CommitDate: Mon Mar 28 21:00:32 2022 +0300 | Add search function to search within filenames in Dired and WDired | (bug#14013) introduces a variable `wdired-search-replace-filenames' which defaults to t. When this variable is tured on regexp-replace in wdired buffers is limited to the visible portion of the buffer. ``` mkdir /dev/shm/test-foo -pv for i in $(seq 1 40); do ln -sv /foo/$i /dev/shm/test-foo; done (dired "/dev/shm/test-foo") (wdired-change-to-wdired-mode) (replace-regexp "foo" "bar") ``` Only the first screenful of files are operated on. setting the variable to nil seems to works on the whole buffer. but can someone explain how this behaviour comes effect? The relevant code is ```wdired.el: (wdired-change-to-wdired-mode) (when wdired-search-replace-filenames (add-function :around (local 'isearch-search-fun-function) #'dired-isearch-search-filenames '((isearch-message-prefix . "filename "))) (setq-local replace-search-function (setq-local replace-re-search-function (funcall isearch-search-fun-function))) ``` and ```wdired.el:(wdired-change-to-dired-mode) (when wdired-search-replace-filenames (remove-function (local 'isearch-search-fun-function) #'dired-isearch-search-filenames) (kill-local-variable 'replace-search-function) (kill-local-variable 'replace-re-search-function) ;; Restore dired hook (add-hook 'isearch-mode-hook #'dired-isearch-filenames-setup nil t)) ``` Using add-function and remove-function (local) instead of hooks complicates the debugging, in this case makes it opaque to me. At what point does this "implicit narrowing" which results in this behaviour come into effect? I set (setq search-highlight nil search-highlight-submatches nil query-replace-highlight nil query-replace-highlight-submatches nil), Should I follow up on the the archived bug https://debbugs.gnu.org/cgi/bugreport.cgi?bug=14013 ?