From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "T.V Raman" Newsgroups: gmane.emacs.devel Subject: Q: read-file-name: Descend into subdirs while using a predicate? Date: Mon, 26 Sep 2022 07:45:08 -0700 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13711"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Sep 26 16:53:20 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ocpTz-0003O0-Om for ged-emacs-devel@m.gmane-mx.org; Mon, 26 Sep 2022 16:53:19 +0200 Original-Received: from localhost ([::1]:34134 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ocpTy-0004Lu-ML for ged-emacs-devel@m.gmane-mx.org; Mon, 26 Sep 2022 10:53:18 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59076) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ocpME-0004g1-71 for emacs-devel@gnu.org; Mon, 26 Sep 2022 10:45:19 -0400 Original-Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]:41883) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ocpMB-0007LS-CP for emacs-devel@gnu.org; Mon, 26 Sep 2022 10:45:17 -0400 Original-Received: by mail-pg1-x52b.google.com with SMTP id q9so6741622pgq.8 for ; Mon, 26 Sep 2022 07:45:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=content-transfer-encoding:mime-version:subject:cc:to:from :message-id:date:from:to:cc:subject:date; bh=G5b4CSkNMdX+2sQLvrEYgM1gpxU48CrhXMLnmHTLEvk=; b=ssPEFY2H21uuDF+i5CntAGkwK+tEx24N5LnCyXtTjqfOt9JmShYtJZ2GuI1jTQso9j LGfpIa26BspSxPf3Jr577krlJzY46VchKWqqTOYzNwbo2rRH1nUPjDSL90O9KsEUnLlw dNqxVPJ7WlyId2jrb5hkWdYz/rSR2f+vQkqzTEcrS47eyHCA1Wt2o9VDfOqb/P56FV7K zFFPYp0vPya+k+YX8va9hsr/5vaSl3VXIjt5lrhUzeQ7u4yqSNg28elZ2bGQHaMVfXP0 yWMq1l8+7jUPQhMraf8AhRwJ9suF5b041PUBUpRgdhyoWn6p/p1JTjVMER90Uoz5X+d8 esNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:subject:cc:to:from :message-id:date:x-gm-message-state:from:to:cc:subject:date; bh=G5b4CSkNMdX+2sQLvrEYgM1gpxU48CrhXMLnmHTLEvk=; b=1e1FjvNGZ8yhdyILR/xUaO3nYTpW5LSZOeZ7gPrkttG3KwcgettAzNsDUamesQS7aW zoqYrLmEA/uXcYdRSzZb8KjhiElEaF79+kzt7wzzQxCwaILQ8vNoq4/Jk0YSeRqBu6lE EytB/8fP62mPso5tq4ykKlGb9etSzltEBkoKA7keiB76mBPm9rlONnN+xn09PEF4ehH5 35ufl1yYVGo1tA+ge8OwMmJDNTvYom7mUWivnpurR/VEcjPKEGzhxhAOLH5txBjbjEwp HhiHwDcFmowBmsZ4qH97DKFYFoyMfnM6Nd6SaEeTpUdEvIfdBveVEisIurf6/XmWTGH5 VPUA== X-Gm-Message-State: ACrzQf0ZjBgwjPb3TTDR97cqPw/jq41Qnc5OmmpFYwNBoMMwaWvMbZgW GQAjhfIm6xEU0K8Dooi2xtJX78LAdf+xQg== X-Google-Smtp-Source: AMsMyM5GtGXafoIGnXiFc07yqMx5ZSEVyjJ4k+lhZh6PKLse2vfIo9xdHTKTUGtkrapo5vwGu+x2Hw== X-Received: by 2002:a63:6c08:0:b0:43c:7d2a:606 with SMTP id h8-20020a636c08000000b0043c7d2a0606mr10986203pgc.318.1664203511338; Mon, 26 Sep 2022 07:45:11 -0700 (PDT) Original-Received: from raman9 (c-24-4-174-65.hsd1.ca.comcast.net. [24.4.174.65]) by smtp.gmail.com with ESMTPSA id o8-20020a170902d4c800b0017693bb573bsm11343868plg.219.2022.09.26.07.45.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Sep 2022 07:45:10 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::52b; envelope-from=raman@google.com; helo=mail-pg1-x52b.google.com X-Spam_score_int: -175 X-Spam_score: -17.6 X-Spam_bar: ----------------- X-Spam_report: (-17.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, USER_IN_DEF_DKIM_WL=-7.5, USER_IN_DEF_SPF_WL=-7.5 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:296286 Archived-At: 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 🦮