unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
Cc: Luc Teirlinck <teirllm@dms.auburn.edu>, emacs-devel@gnu.org
Subject: locate and find-dired (was: insert-directory)
Date: Mon, 07 Jun 2004 12:59:23 +0300	[thread overview]
Message-ID: <87vfi33czn.fsf_-_@mail.jurta.org> (raw)
In-Reply-To: <86ekp6mjzo.fsf@rumba.de.uu.net> (Kai Grossjohann's message of "Thu, 27 May 2004 09:01:31 +0200")

Kai Grossjohann <kai@emptydomain.de> writes:
> I wonder if it makes sense to have the locate output look more like
> the find-dired output?  Then the buffer could be in dired mode
> normally.  (One could call file-attributes on each filename returned
> by locate and construct "ls -l" like output from that.)

This would be very useful, because often there is a need to look at
file attributes of files returned by locate, and also it will allow
dired operations on files.

There are at least two solutions.  One doesn't require any
modification and can be simply invoked as:

C-u M-x locate RET locate filename | xargs ls -alG RET

This produces interesting results with recent Luc's changes: it
automatically inserts found subdirectories into *Locate* buffer.

Another solution is to extend find-dired.el to allow arbitrary
command lines.  For example, a new variable `find-dired-program'
could be set to "locate %s | xargs ls ", so results of `locate'
are put into dired mode.  [Note that the code below is NOT a finished
patch for installing into CVS, this is simply an example of possible
extension of find-dired.el]

--- lisp/find-dired.el	6 Jun 2004 02:30:21 -0000	1.48
+++ lisp/find-dired.el	7 Jun 2004 09:48:43 -0000
@@ -40,6 +40,11 @@
   :group 'dired
   :type 'file)
 
+(defcustom find-dired-program nil
+  "Command line used to find files."
+  :group 'dired
+  :type 'string)
+
 ;; find's -ls corresponds to these switches.
 ;; Note -b, at least GNU find quotes spaces etc. in filenames
 ;;;###autoload
@@ -125,11 +130,14 @@
     (erase-buffer)
     (setq default-directory dir
 	  find-args args	      ; save for next interactive call
-	  args (concat find-dired-find-program " . "
+	  args (if find-dired-program
+                   (concat (format find-dired-program args)
+                           (cdr find-ls-option))
+                 (concat find-dired-find-program " . "
 		       (if (string= args "")
 			   ""
 			 (concat "\\( " args " \\) "))
-		       (car find-ls-option)))
+		       (car find-ls-option))))
     ;; Start the find process.
     (shell-command (concat args "&") (current-buffer))
     ;; The next statement will bomb in classic dired (no optional arg allowed)

-- 
Juri Linkov
http://www.jurta.org/emacs/

  parent reply	other threads:[~2004-06-07  9:59 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-23 22:18 insert-directory Luc Teirlinck
2004-05-24  0:00 ` insert-directory Luc Teirlinck
2004-05-24  3:29   ` insert-directory Luc Teirlinck
2004-05-24  3:55     ` insert-directory Luc Teirlinck
2004-05-24  3:55     ` insert-directory Luc Teirlinck
2004-05-24  4:16     ` insert-directory Luc Teirlinck
2004-05-25  0:11       ` insert-directory Luc Teirlinck
2004-05-25  2:16         ` insert-directory Luc Teirlinck
2004-05-26 20:26           ` insert-directory Luc Teirlinck
2004-05-26 20:35             ` insert-directory David Kastrup
2004-05-26 20:42               ` insert-directory Luc Teirlinck
2004-05-27  7:01             ` insert-directory Kai Grossjohann
2004-05-27 15:51               ` insert-directory Luc Teirlinck
2004-06-07  9:59               ` Juri Linkov [this message]
2004-06-07 11:17                 ` locate and find-dired Kai Grossjohann
2004-06-07 11:59                   ` Juri Linkov
2004-05-25 16:06   ` insert-directory Richard Stallman

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=87vfi33czn.fsf_-_@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=emacs-devel@gnu.org \
    --cc=teirllm@dms.auburn.edu \
    /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).