From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Rupert Swarbrick Newsgroups: gmane.emacs.help Subject: Re: Opening files from a command Date: Sat, 01 Nov 2008 20:57:41 +0000 Organization: albasani.net Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Trace: ger.gmane.org 1225575742 12381 80.91.229.12 (1 Nov 2008 21:42:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 1 Nov 2008 21:42:22 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Nov 01 22:43:24 2008 connect(): Connection refused Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KwOFa-0007X4-T9 for geh-help-gnu-emacs@m.gmane.org; Sat, 01 Nov 2008 22:43:19 +0100 Original-Received: from localhost ([127.0.0.1]:51840 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KwOET-00065B-BC for geh-help-gnu-emacs@m.gmane.org; Sat, 01 Nov 2008 17:42:09 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!news.glorb.com!news2!proxad.net!feeder1-2.proxad.net!newsfeed.straub-nv.de!news.albasani.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 61 Original-X-Trace: news.albasani.net jqzMzokk+6OdTNMCJGkmsxLM6SWWJyJa7N/ouhUpgcRm8pRP+OpUp8e9b6R00aqao6eqYwJr5SAC3/+0ChPK9S5HQvjTKG+mti1QBz2nO18r1c6PKdKRN+U/CACBy/Ns Original-X-Complaints-To: abuse@albasani.net Original-NNTP-Posting-Date: Sat, 1 Nov 2008 20:57:43 +0000 (UTC) X-User-ID: M+s01hMZISgz+2WCkSQ1ut9DBxzGJaUFHdAh61G/5FM= Cancel-Lock: sha1:D5C69nyDKx43zmP37u8bBwVf8+4= User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.60 (gnu/linux) X-NNTP-Posting-Host: SzcNPb+0evRr+l7Kdw0VYYLZsLzj4vnt28QBuRsx9rE= Original-Xref: news.stanford.edu gnu.emacs.help:164006 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:59350 Archived-At: --=-=-= Decebal writes: > Sometimes I like to edit files based on a certain criterium. I use for > example a grep command. I use this from a shell in Emacs. (I have to > work with kshell, which does not have tab-expansion. This is why I am > working from a shell in Emacs.) At this moment I am putting those > filenames one by one in the kill-ring and open them. But is there a > better way? > > Offcourse I could do: > emacs `grep ...` & > but this opens an new Emacs session. I would prefer not to open a new > session. One solution might be to (in your M-x shell buffer) use an invocation like grep -Ril This will give you a list of files (which presumably you were doing inside the backticks above), which will be listed one per line in your buffer. There's no doubt clever elisp hackery you can do next, but I'd be inclined to use a keyboard macro: C-x ( ;; Start macro C-SPC C-e M-w C-a C-n ;; Put line on kill-ring C-x 4 f C-y ;; Open that file in a different window C-x o ;; Go back to the shell buffer C-x ) ;; End macro (note that I tried this, then used view-lossage). Anyhoo, you should then be able to do C-x e and repeat. You may wish to either write some elisp or save that macro if you need to do this more often. It occurs to me that the other option, rather than pulling up a separate window, is find-file-noselect. But that really does make more sense from elisp. The other thing I'd point out is that M-x rgrep and friends give you output in a cleverly modified Compile buffer, with internal "hyperlinks" to the matching files. Rupert --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iJwEAQECAAYFAkkMwsUACgkQRtd/pJbYVoZZ+AP9F2Jo4O26zBWamtMh7lOTwgoa 2HVA+TOLCaLxRuNX73zSqWj7qWN6qDsjKhgp5upvwTDDUCEPFP1LuQzmgfWyfpLg spL/xh4qHeJXbf9vVS5dmL+8NfFT9ycXbdPgX4gCNM3cEIzq9ss3Ia95QncwQ1wV I6Q3DLon3xIGf0byWAs= =jOq+ -----END PGP SIGNATURE----- --=-=-=--