At 10:06 AM 8/17/2001 +0200, you wrote:
>
>"Paul Kinnucan" <[EMAIL PROTECTED]> wrote in message
>[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>> At 06:52 PM 8/16/2001 +0200, Max Rydahl Andersen wrote:
>> >Sounds great - but is there not a method for adding such templates
>> >programattically as an extension to the current buffer-templates ?
>> >The custom-set-variables should only be used in .emacs, should it not ?
>> >
>>
>> Yes, there is. Customize jde-gen-buffer-templates to add a template to the
>> JDE New->Other list.
>
>Yes - but that is something that I only know to do manually through the
>custimization interface.
>My questions is - how do you do that programmatically ?
>

Use customize. Customize generates code in your .emacs file.

I don't understand why you see a difference between using customize to
generate your initialization code and writing the code yourself. The end
result is the same programmatic initialization. The only difference is how
the code is created. But what a difference customization makes. By
automating the process, it eliminates many of the coding errors that used
to plague JDE users.

>I would think there should be a programmatic interface like this:
>
>(add-to-list 'jde-gen-buffer-templates my-own-buffer-template)

Customize generates the equivalent of this in your .emacs file if
you choose the "Save for future sessions" option. Moreover, 
customize generates the correct equivalent (the value of the variable
is an association list), saving you from creating a bug in your .emacs
file.

>
>But the above line does not work :( (probably because it ignores the :set
>function on the defcustom of jde-gen-buffer-templates)
>If it worked it would make it possible to add such buffer-templates without
>modifying jde-gen.el or require the user to manually copy-paste the template
>into the customization work.
>

I don't understand your point. There is no need to modifiy jde-gen.el or to
"copy paste" anything into any "customization work."

Here is the way I intended this to work:

1. You develop your own templates and store them in your .emacs file
   or in a separate file required by your .emacs file. 

   Note that you don't have to use defcustom to create
   your templates  as I have done. I used defcustom so that 
   users can modify the  templates in jde-gen.el without 
   having to modify jde-gen.el itself.

   In fact, you don't even have to use tempo to create your templates.
   Tempo is simply a facility for generating code generation functions
   from declarative specifications. The JDE doesn't care how the
   template functions are created. It will accept any function that
   inserts code into the buffer at point.

2. Register your templates with the JDE. You do this by
   customizing jde-gen-buffer-templates to add the names of your 
   templates with associated descriptive text.

Note that each of your projects can have its own set of templates if you
save the customization  of jde-gen-buffer-templates in your project files.

All of this is described in excruciating detail in the JDE User's Guide,
but of course the user's guide the last place consulted by users looking
for information about the JDE.

- Paul

Reply via email to