1019Few macro questions
- Feb 17, 2004Greetings.
I have made a macro which inserts a line of text:
arch-tag: <output of uuidgen program>
into my source code files. I do have a few problems with this and
was wondering if anyone could help me out with it.
Here is the macro for reference
set-variable #l0 $buffer-bname
1 pipe-shell-command "uuidgen"
0 delete-buffer "*command*"
0 find-buffer #l0
insert-string "/* arch-tag: "
insert-string " */\n\n"
(it probably does not look very pretty, but it's the first macro I
1. When I use pipe-shell-command, a new command window is opened and
the output of the pipe-shell-command is put there. You see that I
delete the buffer "*command* which works just fine, however, it splits
the window. Problem: I do not know if the window was split prior to
running this macro, so I cannot automatically make it 1 window again.
Question: How can I return the window configuration back to the setup
they had before? For instance, what if the top window was hi.c and the
bottom bye.c ... at the end of this macro, both would be hi.c. Another
example would be, what if they only had 1 window open. At the end of
this macro, they now have 2 windows, both hi.c.
2. This macro outputs C comments only, therefore I have to edit the
resulting text when I am editing other files such as Lua or Makefile.
How can I retrieve the current mode's comment scheme and utilize it?
3. This only needs to be done upon the creation of a new file, therefore
I would like to allow the placement of arch-tag: in the template files
and then do a search. If it's found, then fill it in with the uuidgen
output. I know how to do the search, filling in, etc... but how can I
trigger my macro to be run upon creating a new file of any type?
- Next post in topic >>