jed-users mailing list

[2008 Date Index] [2008 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: Using a "saved" macro


Duke Normandin <dukeofperl@xxxxxxx> wrote:
> I needed a macro/function to insert the current date & time at the
> cursor position. I did the following:
>
> ()=evalfile("macro")
>
> ^X(
> ^X ESC insert ( time())
> ^X)
>
> The macro worked fine!
>
> I then did a:
>
> ^X ESC macro_save_macro
>
> I followed the prompts, and everything is cool. However, I need to
> know how to inhale the macro back into Jed when I need it again?  I
> also realize that I could have "saved" the macro to a function or 
> assigned it to a key. I was thinking that perhaps once the macro was
> saved to a file, it could be made to show up in the menus. TIA...

I think that the best thing to do would be to put the function into
your .jedrc file:

    define insert_time ()
    {
       insert (time ());
    }
    add_completion ("insert_time");

If you also want to add this to a menu, for example the Edit menu,
then try putting the following in your .jedrc file:

    private define load_popups_hook (menubar)
    {
       menu_append_item ("Global.&Edit", "Insert Time", "insert_time");
    }
    add_to_hook ("load_popup_hooks", &load_popups_hook);

--John

--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2008 date index] [2008 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]