[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: define keyboard macro in text file

From: Pascal J. Bourguignon
Subject: Re: define keyboard macro in text file
Date: Fri, 04 Feb 2011 20:15:44 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

MelloBob <address@hidden> writes:

> I auto-create some files, templates really, which I then edit with
> emacs. I find that I need to create a macro which I use on the first
> pass clean up just about every time I do this. So ...
> Is it possible to include some text in the created file which defines
> the macro? After using it the one time I'd just delete the line from
> the file. If it means copying, pasting, evaluating in the lisp
> buffer ... it's probably just as easy to do it from the keyboard ...
> yup, the macro is very simple.

This is possible, but it's dangerous (think virus).  Emacs warns when
you do that, which is molesting.

> Suggestions welcome ... even one that says I'm looking at the problem
> all wrong :)

What you could do, is to define a mode specific to edit your template
files, along with a specific file extension.  Then you can do any
processing you want when the mode is activated.

Have a look at the macro: define-minor-mode
the variable: auto-mode-alist
and the manual section about: File Local Variables

__Pascal Bourguignon__           
A bad day in () is better than a good day in {}.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]