[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Secondary filtering with occur

From: Stephen Berman
Subject: Re: Secondary filtering with occur
Date: Fri, 15 Jul 2022 00:32:30 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

On Wed, 13 Jul 2022 12:51:31 -0500 Archmux <> wrote:

> Dear Emacs Help,
> I need to filter the results of `find-name-dired' programmatically.
> I am attempting it with this command-prototype:
> """""
> (with-current-buffer (find-name-dired "~/Musica/" "*.flac")
>   (occur "Hunter")
> )
> """""
> It returns:
> """""
> (wrong-type-argument stringp (":%s"))
> set-buffer((":%s"))
> ...
> """""
> 1. How do I troubleshoot/discover the issue causing, `set-buffer((":%s"))' ?

One way is to look at the source of `find-name-dired' and you'll see it
contains no "(:%s)" but it calls `find-dired', which also contains no
"(:%s)" but it calls `find-dired-with-command', which indeed ends with
`(setq mode-line-process '(":%s"))', which means `(":%s")' is the return
value, and that's causing the error.

> 2.  What function do I need to use instead of `with-current-buffer'?

Using `with-current-buffer' is not the problem, rather, you need to
specify the buffer containing the output of `find-name-dired', which is
*Find*.  But there also seems to be some race condition in calling
`occur' immediately after `find-name-dired'; the following works for me:

  (find-name-dired "~/Musica/" "*.flac")
  (sit-for 0.05)
  (with-current-buffer "*Find*"
    (occur "Hunter")))

But e.g. (sit-for 0.01) shows incomplete results and with (sit-for 0)
or without `sit-for' the *Occur* buffer is empty.

Steve Berman

reply via email to

[Prev in Thread] Current Thread [Next in Thread]