From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: locate and find-dired (was: insert-directory) Date: Mon, 07 Jun 2004 12:59:23 +0300 Organization: JURTA Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <87vfi33czn.fsf_-_@mail.jurta.org> References: <200405232218.i4NMIw307789@raven.dms.auburn.edu> <200405240000.i4O00ck07917@raven.dms.auburn.edu> <200405240329.i4O3T4B08005@raven.dms.auburn.edu> <200405240416.i4O4GBX08071@raven.dms.auburn.edu> <200405250011.i4P0BtV17183@raven.dms.auburn.edu> <200405250216.i4P2GO717266@raven.dms.auburn.edu> <200405262026.i4QKQSq13079@raven.dms.auburn.edu> <86ekp6mjzo.fsf@rumba.de.uu.net> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1086602828 7334 80.91.224.253 (7 Jun 2004 10:07:08 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 7 Jun 2004 10:07:08 +0000 (UTC) Cc: Luc Teirlinck , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Mon Jun 07 12:07:00 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BXH1w-0000PT-00 for ; Mon, 07 Jun 2004 12:07:00 +0200 Original-Received: from lists.gnu.org ([199.232.76.165]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BXH1w-0001nk-00 for ; Mon, 07 Jun 2004 12:07:00 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BXH2S-0006xz-Kr for emacs-devel@quimby.gnus.org; Mon, 07 Jun 2004 06:07:32 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BXH27-0006xk-AC for emacs-devel@gnu.org; Mon, 07 Jun 2004 06:07:11 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BXH25-0006xO-22 for emacs-devel@gnu.org; Mon, 07 Jun 2004 06:07:10 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BXH24-0006xE-Tz for emacs-devel@gnu.org; Mon, 07 Jun 2004 06:07:08 -0400 Original-Received: from [66.33.219.19] (helo=spoon.dreamhost.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BXH1T-0003T2-8e for emacs-devel@gnu.org; Mon, 07 Jun 2004 06:06:31 -0400 Original-Received: from mail.jurta.org (80-235-35-47-dsl.mus.estpak.ee [80.235.35.47]) by spoon.dreamhost.com (Postfix) with ESMTP id A0BD513D909; Mon, 7 Jun 2004 03:06:28 -0700 (PDT) Original-To: Kai Grossjohann In-Reply-To: <86ekp6mjzo.fsf@rumba.de.uu.net> (Kai Grossjohann's message of "Thu, 27 May 2004 09:01:31 +0200") User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:24655 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:24655 Kai Grossjohann 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/