1020Re: [jasspa] Few macro questions
- Feb 17, 2004Jeremy Cowgar wrote:
> Greetings.There is no need to split the window or
> 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
> define-macro uuidgen-mac
> set-variable #l0 $buffer-bname
> 1 pipe-shell-command "uuidgen"
> 3 forward-line
> 0 delete-buffer "*command*"
> 0 find-buffer #l0
> insert-string "/* arch-tag: "
> 1 yank
> insert-string " */\n\n"
> (it probably does not look very pretty, but it's the first macro I
> really wrote)
> 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.
run with the *command* buffer. If you do your
own buffer management then it is easier. i.e.
Remember the name of the current buffer.
set-variable #l0 $buffer-bname
Create a new buffer for the results
and delte any old one.
!force 0 delete-buffer "*mybuffer*"
Control the pipe and buffer
2 pipe-shell-command "command" "*mybuffer*"
Return to the previous buffer
> 2. This macro outputs C comments only, therefore I have to edit theUse "$buffer-fhook" value.
> 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?
The comment is defined by:-
See the help page for buffer-init(2) for details
of the comment structure and how you get the
>Put it in the "my-fhook-xxx" of myxxx.emf. I suggest that
> 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?
your macro determines if the arch information is not filled
in, if it is not then run the pipe stuff.
> This is an unmoderated list. JASSPA is not responsible for the content of
> any material posted to this list.
> To unsubscribe, send a mail message to
> or visit http://groups.yahoo.com/group/jasspa and
> modify your account settings manually.
> Yahoo! Groups Links
- << Previous post in topic