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


> 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");


I have something similar, but only with the date (no time) in ISO
format.  This lets you easily overwriting existing date stamps.

% remove YYYY-MM-DD and YYYY/MM/DD and replace with the current date
define today ()
{
    bskip_chars ("-/0-9");
    if (re_looking_at ("\\d+[-/]\\d+[-/]\\d+")) {
        push_mark();
        skip_chars ("-/0-9");
        del_region();
    }

    variable tm = localtime (_time ());
    vinsert ("%04d-%02d-%02d", 1900 + tm.tm_year, tm.tm_mon+1,
tm.tm_mday);
}


I don't bother saving the edit point before the bskip_chars.


/mark
This e-mail message and any attachments may contain 
legally privileged, confidential or proprietary Information, 
or information otherwise protected by law of EMCON 
Technologies, its affiliates, or third parties. This notice 
serves as marking of its "Confidential" status as defined 
in any confidentiality agreements concerning the sender 
and recipient. If you are not the intended recipient(s), 
or the employee or agent responsible for delivery of this 
message to the intended recipient(s), you are hereby 
notified that any dissemination, distribution or copying 
of this e-mail message is strictly prohibited. 
If you have received this message in error, please 
immediately notify the sender and delete this e-mail 
message from your computer.



--------------------------
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]