- Subject: Re: How do I set up a template?
- From: "John E. Davis" <davis@xxxxxxxxxxxxx>
- Date: Wed, 29 Oct 2008 15:26:22 -0400
Michele Dondi <blazar@xxxxxxxxxxxxxxxxxx> wrote:
> This is much appreciated. I hope someone will "give me a fish" re the hook
> for non-existent files. In the meantime I would certainly prefer a single
> keystroke, but unfortunately I cannot devise one which would be easy for
> me to use and not conflict with... anything else! So I renamed the
> function to insert_template and added a completion for it.
Something like this may work:
define global_mode_hook (hook)
{
variable mode;
(mode,) = what_mode ();
if (bobp() and eobp ())
{
% An empty buffer. Insert a template file
variable file = expand_filename ("~/.jed/templates/$mode.tpl"$);
() = insert_file (file);
}
}
Here, the value of the mode variable will be set to the name of the
mode. For example, it will be "C" for c-mode, "perl" for perl-mode,
etc. The corresponding template files are
~/.jed/templates/C.tpl
~/.jed/templates/perl.tpl
.
.
Note: I have tested none of the above, but I believe that the basic
idea is correct.
--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]