From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Trent W. Buck" Newsgroups: gmane.emacs.bugs Subject: bug#15504: 24.3; find-dired's numerous prompts are inflexible and annoying Date: Sun, 30 May 2021 21:41:25 +1000 Message-ID: References: <8761tg1m4z.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15988"; mail-complaints-to="usenet@ciao.gmane.io" To: 15504@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun May 30 13:42:21 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1lnJpk-0003u9-7O for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 30 May 2021 13:42:20 +0200 Original-Received: from localhost ([::1]:54282 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lnJpi-0002Ek-OC for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 30 May 2021 07:42:18 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37258) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lnJpV-0002EW-3f for bug-gnu-emacs@gnu.org; Sun, 30 May 2021 07:42:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46932) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lnJpR-0007go-OH for bug-gnu-emacs@gnu.org; Sun, 30 May 2021 07:42:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lnJpR-0001Q3-Kq for bug-gnu-emacs@gnu.org; Sun, 30 May 2021 07:42:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Trent W. Buck" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 30 May 2021 11:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15504 X-GNU-PR-Package: emacs Original-Received: via spool by 15504-submit@debbugs.gnu.org id=B15504.16223749035424 (code B ref 15504); Sun, 30 May 2021 11:42:01 +0000 Original-Received: (at 15504) by debbugs.gnu.org; 30 May 2021 11:41:43 +0000 Original-Received: from localhost ([127.0.0.1]:58478 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lnJp8-0001PQ-Pv for submit@debbugs.gnu.org; Sun, 30 May 2021 07:41:43 -0400 Original-Received: from mail-pj1-f53.google.com ([209.85.216.53]:46924) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lnJp5-0001PB-47 for 15504@debbugs.gnu.org; Sun, 30 May 2021 07:41:41 -0400 Original-Received: by mail-pj1-f53.google.com with SMTP id pi6-20020a17090b1e46b029015cec51d7cdso5059469pjb.5 for <15504@debbugs.gnu.org>; Sun, 30 May 2021 04:41:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Lb8EW0N/cfNtlxFByAiF0nigny0hcBlKswIek1dUEhI=; b=u7xPHmZ6rawONGQ8euZokzt9M3TQ+5g/svaPVcjOXNUm0yKWoReQT6SV85BgPXabEQ zaSakUamZAmCVokukG0DZsAtes3hnmWPQQO8wtdsr9DY6a7DdNgVIdpH9y3HL4d9t0LC S2cVecrToAjlyVyUVku1Jet1UBBTzznVmrbqjAxfPLk/e1hIUv/UuGgmASkiQ8VUbpsM khROcBhwSUq7a4cgaX0xJQmtqXMPfkCckLpSldqCTOU77PNp7zxmd/WB5vW9mL7QbvpS hwaKoq0DjwG07mhdzZXorPwVkIOjclsUgTuDiBaESsmnUIW3YUvAUn9YUfUGKrQgat16 k/0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Lb8EW0N/cfNtlxFByAiF0nigny0hcBlKswIek1dUEhI=; b=FkmBeklD7f30kKJv1UT6QrD947x348Csbp5nCPA3+cVcdAHFouyCLeVZGA88VSTVd6 ZLn53oeR3cFNAvp2XNpRVYMGFq1X/88WwgRD61YdjqiB7wjuKIr1pnIy0rye2uX6Kpfr aIfgQ5qD6G5tUFj79CPQdCA5u4RCmgYmqriKJM870uSFx3ayvk19VNPluuLBxwWGYo+O Mwa1AEL1BCl/bFIU1KmyM0qT3UWrV8cMNZPNFVBvSIy4gbebIHtbc9V01/b3GDxfisQS 6Nk0nVIiz9dy2HCsv4o44GvznSdWJiUnDM/QGEVXZHI5i0CGgpHhJG9GDwbQyUxnsbDU 6CPQ== X-Gm-Message-State: AOAM5331QlA5+oUYz+oBxqnNFV25UI0VLy1gXX+YhAYH+DOZG0Fwy1qg cwOmgfAEO6z1w1PupdP+NabXWX8BY9c= X-Google-Smtp-Source: ABdhPJyuSz6MFqMeWAhilFHNPRsRAcGOT5GbewQuQ/B+a7qGl/iY3cjq/wTCAJ0bncNqpIJr20kgIA== X-Received: by 2002:a17:90a:7a89:: with SMTP id q9mr13792506pjf.0.1622374892807; Sun, 30 May 2021 04:41:32 -0700 (PDT) Original-Received: from localhost (2403-5800-3400-bb00--add.ip6.aussiebb.net. [2403:5800:3400:bb00::add]) by smtp.gmail.com with ESMTPSA id t12sm1533460pfc.133.2021.05.30.04.41.31 for <15504@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 May 2021 04:41:32 -0700 (PDT) Content-Disposition: inline In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:207608 Archived-At: I'm fine with the "no bug here, closing". Below is some context / brainstorming / waffling, for the record. I had a look back to try to remember why I wrote this code originally. I think it was some combination of these things: 1. two prompt means two separate history lists. This annoys/annoyed me. 2. find-ls-option didn't support -ls, so was really slow on really large finds (https://debbugs.gnu.org/cgi/bugreport.cgi?bug=4403) 3. can ONLY run find, so can't do things like # find is too slow, use a cached version locate '*.gif' -i0 | xargs -0 ls -hlds or # find over NFS is too slow, run find on the NFS server # (but let Emacs use NFS, not ssh) ssh nfs-server find $PWD ... or # Read from custom metadata that requires expensive ffprobe(1) sqlite3 videos.db 'SELECT path FROM videos WHERE duration >60 AND rating >=4 AND last_seen < julianday()-365' | xargs -d\\n ls -hlds | shuf 4. because it's enclosed in \( \), can't "end" with an '-o' or ',', find -delete -o -ls # list file my user can't delete find -readable -o -ls # list files my user can't read without reordering the logic, which can be a little annoying for very queries. 5. can't add things like |sort or |tac to the end, so that the page takes time to appear, but when it does, is in a more useful state. In Emacs 27+ by default find-dired-refine-function behaves similar to adding |sort, except it kicks in when find terminates -- which is usually after I've started operating on the first few files, so I end up super confused. Actually 99% of the time what I would do is delegate this to ls (and hope I didn't have too many files to fit a single ls execution). e.g. find -ls # ugh this isn't sorted, because ZFS M-x RET , change -ls to -exec ls -hlds {} + # actually I only care about the biggest files. M-x RET , add -Sr # wow that's a lot, let's filter it down M-x RET , add -size +128M # actually I only care about files PHP can see M-x RET C-a sudo -u nginx -g www-data RET Thinking back on all this, what I want is not to run an arbitrary *find* command. I want to run an *entirely* arbitrary command, and have dired colorize and buttonize the filenames. The same way I use M-x grep RET with git-grep, not grep. The same way I add -*-compilation-*- to script(1) files, even though M-x compilation didn't generate them. I think the two-argument find-dired that's in upstream currently is "good enough" for about 80% of my usage, but there's lot of niggling edge cases where I can't go "oh I'll just tweak the command" because find-dired doesn't expose that to me. Looking at the code again today, the reason WHY is pretty obvious -- dired-mode needs to know 1) default-directory; and 2) the format ls format to parse. compilation-mode has the same issue for (1) and I solve that by just putting it in the modeline (IIRC): -*-mode:compilation; default-directory:"/rsync:build-server:/var/tmp/buildd/frobozz-1234/"-*- I haven't really solved (2), I've always just sorta ignored it :-( Kevin Rodgers wrote: > On 10/1/13 7:45 PM, Trent W. Buck wrote: > > I prefer to do M-x grep RET and then type something complicated like > > > > grep -r --include '*.c' --exclude-dir .git . -e foo -e bar > > > > ...rather than M-x rgrep which has lots of stupid prompts that then get > > stuck together in a fixed kind of way. > > > > In the same vein, I hate M-x find dired RET multiple prompts. For a few > > years I've been using a munged up replacement that just asks for a > > single command, and runs it (below). The history handling is a bit > > buggered, and it breaks the existing multi-prompt style (presumably some > > people prefer it). > > I'm afraid I don't get what you're saying, since `M-x find-dired' only prompts > for the directory to search and the long string of arguments you love to type: > > find-dired is an interactive autoloaded Lisp function in > `find-dired.el'. > > (find-dired DIR ARGS) > > Run `find' and go into Dired mode on a buffer of the output. > The command run (after changing into DIR) is > > find . \( ARGS \) -ls > > except that the variable `find-ls-option' specifies what to use > as the final argument. > And the implementation confirms the documentation: > > (defun find-dired (dir args) > ... > (interactive (list (read-file-name "Run find in directory: " nil "" t) > (read-string "Run find (with args): " find-args > '(find-args-history . 1)))) > > ... > > > PS: find -ls's output is actually crap, because the entries don't line > > up properly and files with spaces become "foo\ bar" which dired mode > > doesn't like, so I generally end up doing "find -exec ls -lidsh {} +". > > Apparently that is what `find-ls-option' is for.