all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dirk80 <dirk@dirkundsari.de>
To: Help-gnu-emacs@gnu.org
Subject: dired and multi-occur
Date: Fri, 4 Dec 2009 07:30:13 -0800 (PST)	[thread overview]
Message-ID: <26635922.post@talk.nabble.com> (raw)


Hi,

I would like to search a string through multiple files. I like multi-occur a
lot. It would be great if it is possible to combine dired and multi-occur. I
want that multi-occur is applied to all marked files.

Let's say the name of the interactive function to do this is
"my-dired-multi-occur". If the user invokes this function via M-x
my-dired-multi-occur the user shall be asked for a search string. All marked
files shall be searched via dired. If the file does not contain the
search-string it shall be closed again.

I tried to write a function doing this. But I'm an elisp newbie and don't
get it.

(defun my-dired-multi-occur (string)
  "Search string in files marked in dired."
  (interactive "MSearch-String:")
  (require 'dired)
  (multi-occur (mapc 'find-file (dired-get-marked-files)) string))

I get the following result, when I'm invoking this function when I have
opened dired and marked three files: M-x my-dired-multi-occur
Search-String: init

Searched 0 buffers (3 killed); no matches for `init'

---
My problem seems to be that multi-occur is not getting a list of buffers.
The other problem I have: How can I close all files which do not contain the
search-string.

Thank you very much for your help in advance.

Dirk
-- 
View this message in context: http://old.nabble.com/dired-and-multi-occur-tp26635922p26635922.html
Sent from the Emacs - Help mailing list archive at Nabble.com.





             reply	other threads:[~2009-12-04 15:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-04 15:30 Dirk80 [this message]
2009-12-04 18:21 ` dired and multi-occur Andreas Politz
2009-12-09  9:14   ` Dirk80
2009-12-05  7:59 ` Kevin Rodgers
2009-12-05 10:20   ` Thierry Volpiatto
     [not found] <mailman.12194.1259940624.2239.help-gnu-emacs@gnu.org>
2009-12-05 14:03 ` Michael Heerdegen

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

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

  git send-email \
    --in-reply-to=26635922.post@talk.nabble.com \
    --to=dirk@dirkundsari.de \
    --cc=Help-gnu-emacs@gnu.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.