* define keyboard macro in text file
@ 2011-02-04 19:06 MelloBob
2011-02-04 19:15 ` Pascal J. Bourguignon
0 siblings, 1 reply; 4+ messages in thread
From: MelloBob @ 2011-02-04 19:06 UTC (permalink / raw)
To: help-gnu-emacs
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.
Suggestions welcome ... even one that says I'm looking at the problem
all wrong :)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: define keyboard macro in text file
2011-02-04 19:06 define keyboard macro in text file MelloBob
@ 2011-02-04 19:15 ` Pascal J. Bourguignon
2011-02-04 23:56 ` MelloBob
0 siblings, 1 reply; 4+ messages in thread
From: Pascal J. Bourguignon @ 2011-02-04 19:15 UTC (permalink / raw)
To: help-gnu-emacs
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 {}.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: define keyboard macro in text file
2011-02-04 19:15 ` Pascal J. Bourguignon
@ 2011-02-04 23:56 ` MelloBob
2011-02-05 0:17 ` Pascal J. Bourguignon
0 siblings, 1 reply; 4+ messages in thread
From: MelloBob @ 2011-02-04 23:56 UTC (permalink / raw)
To: help-gnu-emacs
> > 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.
And, if I want to live dangerously ... what is the magical
incantation?
> 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.
Yes, that might be the easiest in the long run.
Thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: define keyboard macro in text file
2011-02-04 23:56 ` MelloBob
@ 2011-02-05 0:17 ` Pascal J. Bourguignon
0 siblings, 0 replies; 4+ messages in thread
From: Pascal J. Bourguignon @ 2011-02-05 0:17 UTC (permalink / raw)
To: help-gnu-emacs
MelloBob <bobmellowood@gmail.com> writes:
>> > 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.
>
> And, if I want to live dangerously ... what is the magical
> incantation?
I gave the indication. Putting a File Local Variable named eval.
>> 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.
>
> Yes, that might be the easiest in the long run.
--
__Pascal Bourguignon__ http://www.informatimago.com/
A bad day in () is better than a good day in {}.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-02-05 0:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-04 19:06 define keyboard macro in text file MelloBob
2011-02-04 19:15 ` Pascal J. Bourguignon
2011-02-04 23:56 ` MelloBob
2011-02-05 0:17 ` Pascal J. Bourguignon
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).