From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xah Lee Newsgroups: gmane.emacs.help Subject: Re: Macros in dired - Is it possible? Date: Sat, 18 Jul 2009 02:14:47 -0700 (PDT) Organization: http://groups.google.com Message-ID: <7b577771-72b5-4d61-ad90-430bb2e81d49@m3g2000pri.googlegroups.com> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1247911329 2094 80.91.229.12 (18 Jul 2009 10:02:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 18 Jul 2009 10:02:09 +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 Jul 18 12:02:01 2009 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 1MS6jx-00015G-79 for geh-help-gnu-emacs@m.gmane.org; Sat, 18 Jul 2009 12:02:01 +0200 Original-Received: from localhost ([127.0.0.1]:52076 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MS6jw-0004dN-N1 for geh-help-gnu-emacs@m.gmane.org; Sat, 18 Jul 2009 06:02:00 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!m3g2000pri.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 67 Original-NNTP-Posting-Host: 76.102.12.87 Original-X-Trace: posting.google.com 1247908488 3418 127.0.0.1 (18 Jul 2009 09:14:48 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Sat, 18 Jul 2009 09:14:48 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: m3g2000pri.googlegroups.com; posting-host=76.102.12.87; posting-account=bRPKjQoAAACxZsR8_VPXCX27T2YcsyMA User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/530.5 (KHTML, like Gecko) Chrome/2.0.172.37 Safari/530.5, gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:171011 X-Mailman-Approved-At: Sat, 18 Jul 2009 06:00:09 -0400 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:66199 Archived-At: On Jul 17, 11:41 am, zeek peters wrote: > [ *Question* ] > Is it possible to mark files in dired and then run a macro on all > the selected files? > > [ *Background* ] > The macro finds and deletes certain portions/paragraphs from text > files to cut them down in size so that I can read them easier and quicker= . > > But I am getting tired of loading one file at a time into Emacs to > run the macro ( via ^u 0 MX macro1 ). I do this about 100x/day. So is the= re > a > quicker/better way to run a macro en mass? > > [ *What I Have Tried, but Hasn't Worked* ] > As an example > 1. I load 10 text files into emacs, thus creating 10 separate > buffers. > 2. Then tried creating another macro that calls the first macro, > and also saves the edited and much smaller file, and then kills the buffe= r > 3. So, for 10 files, I would call macro2 via [ ^u 10 Mx macro2 ] > 4. The problem, I am having is that the 2nd macro doesn't record > the save or the kill. So, I tried to edit the saved macro2 via [ > Mx edit-named-k TAB RET macro2 ]. I add the commands [ ^x ^s ] > and [ ^x k RET ], and do a [ c ^c ]. The changes are saved, but > when I try again, the 2nd macro calls macro1 to do its magic, but > the modifications aren't saved, nor is the buffer killed. So, > only one of the 10 files files has been modified. > > [ *What I have learned* ] > A lot, since I am a completely new to this. Learned a little bit about Gi= t, > compiling, Org-mode. Currently, reading the both manuals ( emacs > and Lisp how2 ). > > I'm looking forward to learning more, but starting to get a bit > frustated. Hope you could offer some insight/assistance. Thanks > > [ *Info* ] > emacs-snapshot ( GNU Emacs 23.0.95.1 (i486-pc-linux-gnu, GTK+ > Version 2.16.4) of 2009-07-03 seems what you wanted certainly can be done. But it is very unclear to me exactly what you want to be done. can you give description in terms of what you watn to do exactly? e.g. which files you want to process? are they all html files? files with certain line? etc? what do you want to do to each file? delete certain lines, then save? what text pattern does the line needs to match? etc. kbd macros are typically one session use only. they are not meant to be edited, and they are pretty unreadable. They simply are record of keystrokes. In your case, of calling kbd macros on kbd macros, is probably much simpler having a elisp function. Xah =E2=88=91 http://xahlee.org/ =E2=98=84