From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: harven Newsgroups: gmane.emacs.help Subject: Re: Making callable function of a macro Date: Thu, 25 Sep 2008 11:24:44 +0200 Organization: Guest of ProXad - France Message-ID: References: <19cc8ee3-7dbc-47ac-bee9-bf233b42a0eb@j22g2000hsf.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1222336136 15119 80.91.229.12 (25 Sep 2008 09:48:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 25 Sep 2008 09:48:56 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Sep 25 11:49:54 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 1KinTt-0000Fr-Cv for geh-help-gnu-emacs@m.gmane.org; Thu, 25 Sep 2008 11:49:53 +0200 Original-Received: from localhost ([127.0.0.1]:32798 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KinSr-0005jo-8g for geh-help-gnu-emacs@m.gmane.org; Thu, 25 Sep 2008 05:48:49 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!cleanfeed3-a.proxad.net!nnrp4-1.free.fr!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (darwin) Cancel-Lock: sha1:j0s3ELGd6IZO1e982fn7FoWDFsA= Original-Lines: 24 Original-NNTP-Posting-Date: 25 Sep 2008 11:24:44 MEST Original-NNTP-Posting-Host: 82.240.200.149 Original-X-Trace: 1222334684 news-3.free.fr 16221 82.240.200.149:49787 Original-X-Complaints-To: abuse@proxad.net Original-Xref: news.stanford.edu gnu.emacs.help:162708 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:58050 Archived-At: Decebal writes: > Now other people like the functionality that I made. ;-} > But they do not use Emacs. So I would like to change the macro to a > function. In this way the script that is used to generate the input > files, could call Emacs and process them directly. Is this possible? > If so: how would I do this? > I have worked with Emacs, but not really with the Lisp capabilities. > More as an editor. You better give a name to your macro : C-x C-k n MY-MACRO then go to your init file and type : M-x insert-kbd-macro RET MY-MACRO RET This will put under your cursor the definition of a command that executes the macro. This command can be called interactively the usual way (M-x MY-MACRO) or put in your script. I must say that it is not clear what your macro does. I would guess that you want to keep the text between the two starting = signs and add a header. But that's not what happens when I run your macro. Instead it strips everything before the second = sign and add the header. Also I think the ! insertion is meant to do the replacement until end of file, but here again that's not what I obtain when I run the macro.