all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Secondary filtering with occur
@ 2022-07-13 17:51 Archmux
  2022-07-13 20:22 ` Fwd: " Archmux
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Archmux @ 2022-07-13 17:51 UTC (permalink / raw)
  To: help-gnu-emacs

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"))' ?


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


Thank you,

Arch Mux




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Fwd: Secondary filtering with occur
  2022-07-13 17:51 Secondary filtering with occur Archmux
@ 2022-07-13 20:22 ` Archmux
  2022-07-14 22:32 ` Stephen Berman
  2022-07-19 15:23 ` Michael Heerdegen
  2 siblings, 0 replies; 6+ messages in thread
From: Archmux @ 2022-07-13 20:22 UTC (permalink / raw)
  To: help-gnu-emacs

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"))' ?


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


Thank you,

Arch Mux




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Secondary filtering with occur
  2022-07-13 17:51 Secondary filtering with occur Archmux
  2022-07-13 20:22 ` Fwd: " Archmux
@ 2022-07-14 22:32 ` Stephen Berman
  2022-07-15  4:54   ` tomas
  2022-07-19 15:23 ` Michael Heerdegen
  2 siblings, 1 reply; 6+ messages in thread
From: Stephen Berman @ 2022-07-14 22:32 UTC (permalink / raw)
  To: Archmux; +Cc: help-gnu-emacs

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



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Secondary filtering with occur
  2022-07-14 22:32 ` Stephen Berman
@ 2022-07-15  4:54   ` tomas
  0 siblings, 0 replies; 6+ messages in thread
From: tomas @ 2022-07-15  4:54 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1215 bytes --]

On Fri, Jul 15, 2022 at 12:32:30AM +0200, Stephen Berman wrote:
> 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.

Another useful tool for such things is setting up debug on error, by
doing "M-x toggle-debug-on-error". This will lead you to the spot in
the source where the error was caught.

Cheers
-- 
t

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Secondary filtering with occur
  2022-07-13 17:51 Secondary filtering with occur Archmux
  2022-07-13 20:22 ` Fwd: " Archmux
  2022-07-14 22:32 ` Stephen Berman
@ 2022-07-19 15:23 ` Michael Heerdegen
  2022-07-23 13:32   ` Arch Mux
  2 siblings, 1 reply; 6+ messages in thread
From: Michael Heerdegen @ 2022-07-19 15:23 UTC (permalink / raw)
  To: Archmux; +Cc: help-gnu-emacs

Archmux <archmux@stemux.com> writes:

> Dear Emacs Help,
>
> I need to filter the results of `find-name-dired' programmatically.

May I ask how your use case looks like?  Can you maybe just use
`find-dired' instead of `find-name-dired'?

Michael.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Secondary filtering with occur
  2022-07-19 15:23 ` Michael Heerdegen
@ 2022-07-23 13:32   ` Arch Mux
  0 siblings, 0 replies; 6+ messages in thread
From: Arch Mux @ 2022-07-23 13:32 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs

Michael Heerdegen <michael_heerdegen@web.de> writes:

> Archmux <archmux@stemux.com> writes:
>
>> Dear Emacs Help,
>>
>> I need to filter the results of `find-name-dired' programmatically.
>
> May I ask how your use case looks like?  Can you maybe just use
> `find-dired' instead of `find-name-dired'?
>
> Michael.

My apologies for the belated response. I have been intensively configuring GNU
Emacs incorrectly.

Thanks to your statement about `find-dired', I realized my usage of
`find-name-dired' is unnecessary because it redundantly filters by name using `occur'.

I need to locate a package file, for Exherbo Linux, with the extension
of '.exheres-0' or '.exlib' within the directory
'~/Internet/Git/Exherbo/Remote/'.

The current implementation with `find-dired':

""""""
(defun archmux/exherbo-cd ()
  "Find exheres."
  (interactive
   (let* (
	  (exherbo_directory	"~/Internet/Git/Exherbo/Remote/")
	  (exheres_user_input	(read-from-minibuffer "Exheres to locate: "))
	  (find-pattern		(concat "-name " exheres_user_input "*"))
	  (find-ls-option       '("-type f -ls" . ""))
	  )
     (find-dired exherbo_directory find-pattern)
     )
   )
  )
""""""

Thank you,
Archmux



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-07-23 13:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-13 17:51 Secondary filtering with occur Archmux
2022-07-13 20:22 ` Fwd: " Archmux
2022-07-14 22:32 ` Stephen Berman
2022-07-15  4:54   ` tomas
2022-07-19 15:23 ` Michael Heerdegen
2022-07-23 13:32   ` Arch Mux

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.