all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Madhu <enometh@meer.net>
To: emacs-devel@gnu.org
Subject: wdired replace-regexp (continue bug 14013?)
Date: Tue, 03 Sep 2024 15:37:09 +0530	[thread overview]
Message-ID: <m3seuh3vaq.fsf@leonis4.robolove.meer.net> (raw)


* 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
?




             reply	other threads:[~2024-09-03 10:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-03 10:07 Madhu [this message]
2024-09-03 12:24 ` wdired replace-regexp (continue bug 14013?) Michael Heerdegen via Emacs development discussions.
2024-09-03 12:30   ` Michael Heerdegen via Emacs development discussions.
2024-09-04  1:50     ` Madhu
2024-09-04  3:14       ` Michael Heerdegen via Emacs development discussions.

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3seuh3vaq.fsf@leonis4.robolove.meer.net \
    --to=enometh@meer.net \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.