From: "Pascal J. Bourguignon" <pjb@informatimago.com>
To: help-gnu-emacs@gnu.org
Subject: Re: define keyboard macro in text file
Date: Fri, 04 Feb 2011 20:15:44 +0100 [thread overview]
Message-ID: <87aaib8vbz.fsf@kuiper.lan.informatimago.com> (raw)
In-Reply-To: a3c5cf3f-2bf7-4c1f-8a0d-7ca2d8ce199d@z3g2000prz.googlegroups.com
MelloBob <bobmellowood@gmail.com> 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__ http://www.informatimago.com/
A bad day in () is better than a good day in {}.
next prev parent reply other threads:[~2011-02-04 19:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-04 19:06 define keyboard macro in text file MelloBob
2011-02-04 19:15 ` Pascal J. Bourguignon [this message]
2011-02-04 23:56 ` MelloBob
2011-02-05 0:17 ` Pascal J. Bourguignon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87aaib8vbz.fsf@kuiper.lan.informatimago.com \
--to=pjb@informatimago.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).