emacs-devel
[Top][All Lists]
Advanced

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

Q: read-file-name: Descend into subdirs while using a predicate?


From: T.V Raman
Subject: Q: read-file-name: Descend into subdirs while using a predicate?
Date: Mon, 26 Sep 2022 07:45:08 -0700

This feels like a puzzle that should have an easy answer, but I've not
found it:-)

You want to:

1. Use read-file-name with completion.
2. You want to only return filenames with a given extension -- and
   that extension is a regex 
3. You also want to descend into  subdirs of the current directory if
   the user's input matches a subdir that exists 

So you provide 'must-match  and a predicate -- and in that predicate I
tested for the regexp --- but then the descend into subdirs fails, and
if you check for either the   pattern or file-directory-p, then the
read call just returns the directory.

one heavy-weight solution might be to call directory-files with a
pattern,  and pass that as a list to completing-read but that feels
heaviy-weight in that you could end up descending deeper into the
directory tree than you need to ...

-- 

Thanks,

--Raman(I Search, I Find, I Misplace, I Research)
♉ Id: kg:/m/0285kf1  🦮

-- 

Thanks,

--Raman(I Search, I Find, I Misplace, I Research)
♉ Id: kg:/m/0285kf1  🦮



reply via email to

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