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: Sun, 19 Jul 2009 09:04:04 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <87tz19aecl.wl%anselm.helbig+news2009@googlemail.com> <75b2b979-ef00-4ec9-9d3b-76625aa3ffbc@i4g2000prm.googlegroups.com> 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 1248096518 11545 80.91.229.12 (20 Jul 2009 13:28:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 20 Jul 2009 13:28:38 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jul 20 15:28:31 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 1MSsus-0003q7-NP for geh-help-gnu-emacs@m.gmane.org; Mon, 20 Jul 2009 15:28:31 +0200 Original-Received: from localhost ([127.0.0.1]:42075 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MSsur-0007fu-SB for geh-help-gnu-emacs@m.gmane.org; Mon, 20 Jul 2009 09:28:29 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!x6g2000prc.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 43 Original-NNTP-Posting-Host: 76.102.12.87 Original-X-Trace: posting.google.com 1248019444 14250 127.0.0.1 (19 Jul 2009 16:04:04 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Sun, 19 Jul 2009 16:04:04 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: x6g2000prc.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:171035 X-Mailman-Approved-At: Mon, 20 Jul 2009 09:28:08 -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:66240 Archived-At: On Jul 18, 7:29=C2=A0pm, zeek wrote: > Thank you Anselm Helbig and Muede for the functions > > Looking forward to trying them out. Already learning more Lisp. There > is no way I could have come up with them. > > Now I understand why I couldn't get the macros to save & kill the > buffer - makes sense. Well written. > > Thank you again for responding so quickly with your solutions. > > Cheers To apply a function to marked files in dired, use =E2=80=9Cdired-get-marked= - files=E2=80=9D, like this: ;; idiom for processing a list of files in dired's marked files ;; suppose myProcessFile is your function that takes a file path ;; and do some processing on the file (defun dired-myProcessFile () "apply myProcessFile function to marked files in dired." (interactive) (require 'dired) (mapc 'myProcessFile (dired-get-marked-files)) ) See: =E2=80=A2 Emacs Lisp Idioms http://xahlee.org/emacs/elisp_idioms.html you just need to write the myProcessFile function ... it's pretty easy to do what you want. The function should open the file, use search- forward to move cursor to the place of the word, then delete that paragraph, repeat, then save the file. I'd say this code would be less than 20 or 30 lines, and will take (me) about 20 min. Xah =E2=88=91 http://xahlee.org/ =E2=98=84