[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
wdired replace-regexp (continue bug 14013?)
From: |
Madhu |
Subject: |
wdired replace-regexp (continue bug 14013?) |
Date: |
Tue, 03 Sep 2024 15:37:09 +0530 |
* commit 935cc42795686710f82b8928b6802f20be8f27c0
|Author: Juri Linkov <juri@linkov.net>
|AuthorDate: Mon Mar 28 21:00:32 2022 +0300
|Commit: Juri Linkov <juri@linkov.net>
|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
?
- wdired replace-regexp (continue bug 14013?),
Madhu <=