Using $findfile in a loop this way is a bad idea, because this is what it does:
$findfile will loop through the files in the directory until it finds the %cnt'th matching file in each iteration of that loop.
So when %cnt is 1, it finds the first file.
%cnt = 1; files found = a.txt
When it's 2, it'll find the first two files, and so on:
%cnt = 2; files found = a.txt b.txt
%cnd = 3; files found = a.txt b.txt c.txt
---
Now, if we use $findfiles built-in looping functionality instead, each file will only be found once:
alias -l callback {
if ($read($1-,nw,$+(*,%search,*))) { echo -a $+($chr(3),03,$v1 $chr(3),04found in,$chr(3)03 $1-,$chr(3),04.) }
}
alias searchfiles {
set -u %search $1-
noop $findfile($scriptdir,*.org,0,callback $1-)
}