unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Phil Sainty <psainty@orcon.net.nz>,
	Michael Heerdegen <michael_heerdegen@web.de>
Cc: 27456@debbugs.gnu.org, 32668@debbugs.gnu.org, darkfeline@felesatra.moe
Subject: bug#32668: bug#27456: 25.2; Not possible to use -prune with find-dired
Date: Sun, 9 Sep 2018 07:04:26 -0700 (PDT)	[thread overview]
Message-ID: <0b2d5d16-846e-4711-b1c4-0030a6871b7e@default> (raw)
In-Reply-To: <e19aeea2-4705-d887-f3b4-e4708555a361@orcon.net.nz>

> For now I have raised this as bug#32668: 26.1; Give find-dired prefix
> argument behaviour equivalent to that of rgrep

FWIW, in my library `find-dired+.el', which adds to `find-dired.el',
`find-dired' acts as follows (`C-h f find-dired'):

------8<---------------
find-dired is an interactive Lisp function in ‘find-dired+.el’. 

(find-dired DIR ARGS &optional DEPTH-LIMITS EXCLUDED-PATHS)

Run ‘find’ and put its output in a buffer in Dired Mode.
Then run ‘find-dired-hook’ and ‘dired-after-readin-hook’.
The ‘find’ command run (after changing into DIR) is essentially this,
where LS-SWITCHES is ‘(car find-ls-option)’:

  find . \( ARGS \) LS-SWITCHES

Optional args:

* DEPTH-LIMITS:   Minimum and maximum depths: (MIN-DEPTH MAX-DEPTH).
* EXCLUDED-PATHS: Strings matching paths to be excluded.
                  Uses ‘find’ switch ‘-path’.

When both optional args are non-nil, the ‘find’ command run is this:

  find . -mindepth MIN-DEPTH -maxdepth MAX-DEPTH
         \( -path EXCLUDE1 -o -path EXCLUDE2 ... \)
         -prune -o \( ARGS \) LS-SWITCHES

where EXCLUDE1, EXCLUDE2... are the EXCLUDED-PATHS, but shell-quoted.
------8<---------------

The same is true for `find-name-dired' and `find-grep-dired' - they make the same use of `-prune', as does the new command `find-time-dired' (`C-h f'):

------8<---------------
find-time-dired is an interactive Lisp function in ‘find-dired+.el’.
 
(find-time-dired DIR MIN-TIME MAX-TIME &optional DEPTH-LIMITS
EXCLUDED-PATHS)

Find files in directory DIR newer or older than a timestamp.
The output is shown in a Dired buffer.

MIN-TIME is a format-time string parsable by ‘parse-time-string’, such
 as "2014-12-25 23:59:00".  Only files newer than this are shown.
 If MIN-TIME is nil or a string matching regexp "^\s-*$", there is
 no lower time limit.

MAX-TIME is also a format-time string parsable by ‘parse-time-string’.
 Only files older than this time are shown.
 If MAX-TIME is nil or a string matching regexp "^\s-*$", the upper
 time limit is the current system time.

Optional arg DEPTH-LIMITS is a list (MIN-DEPTH MAX-DEPTH) of the
 minimum and maximum depths.  If nil, search directory tree under DIR.

Optional arg EXCLUDED-PATHS is a list of strings that match paths to
 exclude from the search.  If nil, search all directories.

If args DEPTH-LIMITS and EXCLUDED-PATHS are both non-nil then the
command run is essentially the following:

    find . -mindepth MIN-DEPTH -maxdepth MAX-DEPTH
           \( -path EXCLUDE1 -o -path EXCLUDE2 ... \)
           -prune -o \( -TIME-SWITCH -SINCE-MIN -TIME-SWITCH +SINCE-MAX \)
           LS-SWITCHES

where:

* EXCLUDE1, EXCLUDE2... are the EXCLUDED-PATHS, but shell-quoted.
* TIME-SWITCH is ‘find-diredp-time-prefix’ concatenated with "min".
* SINCE-MIN is the elapsed time since MIN-TIME in minutes.
* SINCE-MAX is the elapsed time since MAX-TIME in minutes.
* LS-SWITCHES is ‘(car find-ls-option)’.
------8<---------------

This code was improved by Tino Calancha. Without having studied
the bug threads of #27456 or #32668, this sounds relevant. If it
helps I can offer this code, as a patch or as is. The code is here:

https://www.emacswiki.org/emacs/download/find-dired%2b.el





      parent reply	other threads:[~2018-09-09 14:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-23  6:00 bug#27456: 25.2; Not possible to use -prune with find-dired Allen Li
2017-07-12 19:40 ` Michael Heerdegen
2017-07-13  6:56   ` Allen Li
2017-07-19  0:21     ` Michael Heerdegen
2017-07-13  7:32 ` Andreas Schwab
2018-09-09  0:35 ` Allen Li
2018-09-09  2:39   ` Michael Heerdegen
2018-09-09  5:22     ` Phil Sainty
2018-09-09  5:32       ` Michael Heerdegen
2018-09-09  9:38         ` Phil Sainty
2018-09-09 11:49           ` Phil Sainty
2018-09-09 14:04           ` Drew Adams [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0b2d5d16-846e-4711-b1c4-0030a6871b7e@default \
    --to=drew.adams@oracle.com \
    --cc=27456@debbugs.gnu.org \
    --cc=32668@debbugs.gnu.org \
    --cc=darkfeline@felesatra.moe \
    --cc=michael_heerdegen@web.de \
    --cc=psainty@orcon.net.nz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).