unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Stephen Berman <stephen.berman@gmx.net>
To: Archmux <archmux@stemux.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Secondary filtering with occur
Date: Fri, 15 Jul 2022 00:32:30 +0200	[thread overview]
Message-ID: <875yjzjpfl.fsf@gmx.net> (raw)
In-Reply-To: <ccb9b8d1-e035-c6ea-28d8-7654a24db608@stemux.com> (archmux@stemux.com's message of "Wed, 13 Jul 2022 12:51:31 -0500")

On Wed, 13 Jul 2022 12:51:31 -0500 Archmux <archmux@stemux.com> 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:

(progn
  (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



  parent reply	other threads:[~2022-07-14 22:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-13 17:51 Secondary filtering with occur Archmux
2022-07-13 20:22 ` Fwd: " Archmux
2022-07-14 22:32 ` Stephen Berman [this message]
2022-07-15  4:54   ` tomas
2022-07-19 15:23 ` Michael Heerdegen
2022-07-23 13:32   ` Arch Mux

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=875yjzjpfl.fsf@gmx.net \
    --to=stephen.berman@gmx.net \
    --cc=archmux@stemux.com \
    --cc=help-gnu-emacs@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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).