[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[h-e-w] Template creation

From: Wojciech Komornicki
Subject: [h-e-w] Template creation
Date: Fri, 15 Feb 2002 08:37:25 -0600

Take a look at the tempo package.  It allows you to create templates
with prompts for variable inputs.  As an example, load tempo.elc and
then evaluate the code

             (tempo-define-template "cif"
                       '(> "if (" (P "if-clause: " clause) ") {"  n>
                          > r n
                         "}" > n>
                       "Insert a C if statement"

Finally run the function

I use templates like this bound to various keys to insert code template,
especially in teaching beginning level programming classes.

Wojciech Komornicki                                      Dept of Mathematics
address@hidden                                     Hamline University                               St Paul, MN 55104

The skill of writing is to create a context in which other people can think.
                                                           Edwin Schlossberg

>>>>> "Rajesh" == Rajesh J Advani <address@hidden> writes:

  Rajesh> Hi,
  Rajesh> I'm using Emacs 21.1 (precompiled version), on Win2k, and I know no
  Rajesh> Lisp/Elisp.

  Rajesh> I regularly have this need to insert certain code (say comments)
  Rajesh> following a given template, repeatedly in to my sourcecode, where 
only a
  Rajesh> couple of words in  that template change.

  Rajesh> eg -

  Rajesh> Template -

  Rajesh> -----------------------------------------------------------------
  Rajesh> <SETVALUE BEAN="B2RResourceLoader.Property" VALUE="<The variable text
  Rajesh> goes here>">
  Rajesh> <VALUEOF BEAN="B2RResourceLoader.PropertyValue"/>
  Rajesh> -----------------------------------------------------------------

  Rajesh> So this would be repeated as

  Rajesh> <SETVALUE BEAN="B2RResourceLoader.Property" VALUE="Value1">
  Rajesh> <VALUEOF BEAN="B2RResourceLoader.PropertyValue"/>

  Rajesh> <SETVALUE BEAN="B2RResourceLoader.Property" VALUE="Value2">
  Rajesh> <VALUEOF BEAN="B2RResourceLoader.PropertyValue"/>

  Rajesh> <SETVALUE BEAN="B2RResourceLoader.Property" VALUE="Value3">
  Rajesh> <VALUEOF BEAN="B2RResourceLoader.PropertyValue"/>

  Rajesh> etc, in my code.

  Rajesh> Is there some lisp available to automate this? I want it so that all I
  Rajesh> need is a key-stroke or two to insert the template into my buffer, and
  Rajesh> then it prompts me for the text for the different variable fields.
  Rajesh> I've seen functionality like this in JDE, and XAE modes.

  Rajesh> I'm not averse to writing a bit of lisp if required. But I'd prefer
  Rajesh> simple code reuse ;)

  Rajesh> --
  Rajesh> Rajesh J Advani
  Rajesh> -----------------------------------
  Rajesh> The fact that no one understands
  Rajesh> you doesn't mean you're an artist.

  Rajesh> Information contained in this E-MAIL being proprietary to Wipro 
  Rajesh> is 'privileged' and 'confidential' and intended for use only by the
  Rajesh> individual or entity to which it is addressed. You are notified that 
  Rajesh> use, copying or dissemination of the information contained in the 
  Rajesh> in any manner whatsoever is strictly prohibited.

  Rajesh>  ********************************************************************

reply via email to

[Prev in Thread] Current Thread [Next in Thread]