jed-users mailing list

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

RE: How do I set up a template?


> > I would normally avoid that type of automatic operation and use an
> > explicit command instead.
> 
> I understand your approach, and your preference, but I'd really prefer
> the
> insertion to be automatic, based on the principle that it's much
> easier to
> have something and then delete or comment it than having to insert it
> manually. And basically ALL of my Perl (but not only!) programs begin
> in the same way.

Until you figure out how to add a hook when loading a non-existent file,
you can use this and either bind it to a keystroke or with
add_completion(...)


define add_template ()
{
    variable name;
    (name,) = what_mode();

    variable file = 
        sprintf("%s/.jed/templates/%s", getenv("HOME"), name);

    if (file_status(file) == 1)
    {
        bob();
        () = insert_file(file);
    }
    else
	vmessage("no template for mode '%s'", name);
    }
}


> Also, rather than specifying the template ad hoc with C-like strings,
> I would use an actual file: after all I'm a Perl programmer, not a
> S-Lang one...

Apart from always needing to explicitly drop any return variables,
programming in S-Lang shouldn't be very difficult for you to pick up ...
or at least enough to get things done.

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]